Skip to content

Commit a4fa35a

Browse files
Eliminate excessive copying.
1 parent 368b5da commit a4fa35a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

sycl/source/detail/queue_impl.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ event queue_impl::submitMemOpHelper(const std::shared_ptr<queue_impl> &Self,
481481
}
482482

483483
event ResEvent = prepareSYCLEventAssociatedWithQueue(Self);
484-
auto EventImpl = detail::getSyclObjImpl(ResEvent);
484+
const auto &EventImpl = detail::getSyclObjImpl(ResEvent);
485485
{
486486
NestedCallsTracker tracker;
487487
ur_event_handle_t UREvent = nullptr;
@@ -505,7 +505,7 @@ event queue_impl::submitMemOpHelper(const std::shared_ptr<queue_impl> &Self,
505505
if (isInOrder()) {
506506
auto &EventToStoreIn = MGraph.expired() ? MDefaultGraphDeps.LastEventPtr
507507
: MExtGraphDeps.LastEventPtr;
508-
EventToStoreIn = std::move(EventImpl);
508+
EventToStoreIn = EventImpl;
509509
}
510510
// Track only if we won't be able to handle it with urQueueFinish.
511511
if (MEmulateOOO)

sycl/source/detail/scheduler/scheduler.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ bool CheckEventReadiness(const ContextImplPtr &Context,
662662
}
663663

664664
bool Scheduler::areEventsSafeForSchedulerBypass(
665-
const std::vector<sycl::event> &DepEvents, ContextImplPtr Context) {
665+
const std::vector<sycl::event> &DepEvents, const ContextImplPtr &Context) {
666666

667667
return std::all_of(
668668
DepEvents.begin(), DepEvents.end(), [&Context](const sycl::event &Event) {
@@ -672,7 +672,7 @@ bool Scheduler::areEventsSafeForSchedulerBypass(
672672
}
673673

674674
bool Scheduler::areEventsSafeForSchedulerBypass(
675-
const std::vector<EventImplPtr> &DepEvents, ContextImplPtr Context) {
675+
const std::vector<EventImplPtr> &DepEvents, const ContextImplPtr &Context) {
676676

677677
return std::all_of(DepEvents.begin(), DepEvents.end(),
678678
[&Context](const EventImplPtr &SyclEventImplPtr) {

sycl/source/detail/scheduler/scheduler.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -479,10 +479,10 @@ class Scheduler {
479479

480480
static bool
481481
areEventsSafeForSchedulerBypass(const std::vector<sycl::event> &DepEvents,
482-
ContextImplPtr Context);
482+
const ContextImplPtr &Context);
483483
static bool
484484
areEventsSafeForSchedulerBypass(const std::vector<EventImplPtr> &DepEvents,
485-
ContextImplPtr Context);
485+
const ContextImplPtr &Context);
486486

487487
protected:
488488
using RWLockT = std::shared_timed_mutex;

0 commit comments

Comments
 (0)