Skip to content

Commit 3a61a20

Browse files
[NFC][SYCL] Pass context_impl by raw ptr in CGHostTask ctor (#19147)
Continuation of the refactoring in #18795 #18877 #18966 #18979 #18980 #18981 #19007 #19030 #19123 #19126
1 parent c22d5b3 commit 3a61a20

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

sycl/source/detail/cg.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -726,9 +726,9 @@ class CGHostTask : public CG {
726726
std::vector<ArgDesc> MArgs;
727727

728728
CGHostTask(std::shared_ptr<HostTask> HostTask, detail::queue_impl *Queue,
729-
std::shared_ptr<detail::context_impl> Context,
730-
std::vector<ArgDesc> Args, CG::StorageInitHelper CGData,
731-
CGType Type, detail::code_location loc = {});
729+
detail::context_impl *Context, std::vector<ArgDesc> Args,
730+
CG::StorageInitHelper CGData, CGType Type,
731+
detail::code_location loc = {});
732732
};
733733

734734
} // namespace detail

sycl/source/detail/graph/graph_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ EventImplPtr exec_graph_impl::enqueueHostTaskPartition(
10431043
// dependencies for the current execution.
10441044
std::unique_ptr<sycl::detail::CG> CommandGroup =
10451045
std::make_unique<sycl::detail::CGHostTask>(sycl::detail::CGHostTask(
1046-
NodeCommandGroup->MHostTask, &Queue, NodeCommandGroup->MContext,
1046+
NodeCommandGroup->MHostTask, &Queue, NodeCommandGroup->MContext.get(),
10471047
NodeCommandGroup->MArgs, std::move(CGData),
10481048
NodeCommandGroup->getType()));
10491049

sycl/source/detail/graph/node_impl.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,8 @@ class node_impl : public std::enable_shared_from_this<node_impl> {
287287
return std::make_unique<sycl::detail::CGHostTask>(
288288
sycl::detail::CGHostTask(
289289
std::move(HostTaskSPtr), CommandGroupPtr->MQueue.get(),
290-
CommandGroupPtr->MContext, std::move(NewArgs), std::move(Data),
291-
CommandGroupPtr->getType(), Loc));
290+
CommandGroupPtr->MContext.get(), std::move(NewArgs),
291+
std::move(Data), CommandGroupPtr->getType(), Loc));
292292
}
293293
case sycl::detail::CGType::Barrier:
294294
case sycl::detail::CGType::BarrierWaitlist:

sycl/source/detail/scheduler/commands.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3874,13 +3874,13 @@ void UpdateCommandBufferCommand::emitInstrumentationData() {}
38743874
bool UpdateCommandBufferCommand::producesPiEvent() const { return false; }
38753875

38763876
CGHostTask::CGHostTask(std::shared_ptr<HostTask> HostTask,
3877-
detail::queue_impl *Queue,
3878-
std::shared_ptr<detail::context_impl> Context,
3877+
detail::queue_impl *Queue, detail::context_impl *Context,
38793878
std::vector<ArgDesc> Args, CG::StorageInitHelper CGData,
38803879
CGType Type, detail::code_location loc)
38813880
: CG(Type, std::move(CGData), std::move(loc)),
38823881
MHostTask(std::move(HostTask)),
3883-
MQueue(Queue ? Queue->shared_from_this() : nullptr), MContext(Context),
3882+
MQueue(Queue ? Queue->shared_from_this() : nullptr),
3883+
MContext(Context ? Context->shared_from_this() : nullptr),
38843884
MArgs(std::move(Args)) {}
38853885
} // namespace detail
38863886
} // namespace _V1

sycl/source/handler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,8 +733,8 @@ event handler::finalize() {
733733
detail::context_impl &Context = impl->get_context();
734734
detail::queue_impl *Queue = impl->get_queue_or_null();
735735
CommandGroup.reset(new detail::CGHostTask(
736-
std::move(impl->MHostTask), Queue, Context.shared_from_this(),
737-
std::move(impl->MArgs), std::move(impl->CGData), getType(), MCodeLoc));
736+
std::move(impl->MHostTask), Queue, &Context, std::move(impl->MArgs),
737+
std::move(impl->CGData), getType(), MCodeLoc));
738738
break;
739739
}
740740
case detail::CGType::Barrier:

sycl/unittests/scheduler/SchedulerTestUtils.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ class MockHandlerCustomFinalize : public MockHandler {
310310
}
311311
case sycl::detail::CGType::CodeplayHostTask: {
312312
CommandGroup.reset(new sycl::detail::CGHostTask(
313-
std::move(getHostTask()), getQueue(), getQueue()->getContextImplPtr(),
313+
std::move(getHostTask()), getQueue(), &getQueue()->getContextImpl(),
314314
getArgs(), std::move(CGData), getType(), getCodeLoc()));
315315
break;
316316
}

0 commit comments

Comments
 (0)