Skip to content

[NFC][SYCL] Pass context_impl by raw ptr in CGHostTask ctor #19147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sycl/source/detail/cg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -726,9 +726,9 @@ class CGHostTask : public CG {
std::vector<ArgDesc> MArgs;

CGHostTask(std::shared_ptr<HostTask> HostTask, detail::queue_impl *Queue,
std::shared_ptr<detail::context_impl> Context,
std::vector<ArgDesc> Args, CG::StorageInitHelper CGData,
CGType Type, detail::code_location loc = {});
detail::context_impl *Context, std::vector<ArgDesc> Args,
CG::StorageInitHelper CGData, CGType Type,
detail::code_location loc = {});
};

} // namespace detail
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/graph/graph_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ EventImplPtr exec_graph_impl::enqueueHostTaskPartition(
// dependencies for the current execution.
std::unique_ptr<sycl::detail::CG> CommandGroup =
std::make_unique<sycl::detail::CGHostTask>(sycl::detail::CGHostTask(
NodeCommandGroup->MHostTask, &Queue, NodeCommandGroup->MContext,
NodeCommandGroup->MHostTask, &Queue, NodeCommandGroup->MContext.get(),
NodeCommandGroup->MArgs, std::move(CGData),
NodeCommandGroup->getType()));

Expand Down
4 changes: 2 additions & 2 deletions sycl/source/detail/graph/node_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ class node_impl : public std::enable_shared_from_this<node_impl> {
return std::make_unique<sycl::detail::CGHostTask>(
sycl::detail::CGHostTask(
std::move(HostTaskSPtr), CommandGroupPtr->MQueue.get(),
CommandGroupPtr->MContext, std::move(NewArgs), std::move(Data),
CommandGroupPtr->getType(), Loc));
CommandGroupPtr->MContext.get(), std::move(NewArgs),
std::move(Data), CommandGroupPtr->getType(), Loc));
}
case sycl::detail::CGType::Barrier:
case sycl::detail::CGType::BarrierWaitlist:
Expand Down
6 changes: 3 additions & 3 deletions sycl/source/detail/scheduler/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3875,13 +3875,13 @@ void UpdateCommandBufferCommand::emitInstrumentationData() {}
bool UpdateCommandBufferCommand::producesPiEvent() const { return false; }

CGHostTask::CGHostTask(std::shared_ptr<HostTask> HostTask,
detail::queue_impl *Queue,
std::shared_ptr<detail::context_impl> Context,
detail::queue_impl *Queue, detail::context_impl *Context,
std::vector<ArgDesc> Args, CG::StorageInitHelper CGData,
CGType Type, detail::code_location loc)
: CG(Type, std::move(CGData), std::move(loc)),
MHostTask(std::move(HostTask)),
MQueue(Queue ? Queue->shared_from_this() : nullptr), MContext(Context),
MQueue(Queue ? Queue->shared_from_this() : nullptr),
MContext(Context ? Context->shared_from_this() : nullptr),
MArgs(std::move(Args)) {}
} // namespace detail
} // namespace _V1
Expand Down
4 changes: 2 additions & 2 deletions sycl/source/handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -733,8 +733,8 @@ event handler::finalize() {
detail::context_impl &Context = impl->get_context();
detail::queue_impl *Queue = impl->get_queue_or_null();
CommandGroup.reset(new detail::CGHostTask(
std::move(impl->MHostTask), Queue, Context.shared_from_this(),
std::move(impl->MArgs), std::move(impl->CGData), getType(), MCodeLoc));
std::move(impl->MHostTask), Queue, &Context, std::move(impl->MArgs),
std::move(impl->CGData), getType(), MCodeLoc));
break;
}
case detail::CGType::Barrier:
Expand Down
2 changes: 1 addition & 1 deletion sycl/unittests/scheduler/SchedulerTestUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ class MockHandlerCustomFinalize : public MockHandler {
}
case sycl::detail::CGType::CodeplayHostTask: {
CommandGroup.reset(new sycl::detail::CGHostTask(
std::move(getHostTask()), getQueue(), getQueue()->getContextImplPtr(),
std::move(getHostTask()), getQueue(), &getQueue()->getContextImpl(),
getArgs(), std::move(CGData), getType(), getCodeLoc()));
break;
}
Expand Down