Skip to content

[SYCL] Fixes circular reference between events and queues #1226

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
5 changes: 3 additions & 2 deletions sycl/source/detail/event_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ void event_impl::wait_and_throw(
if (Cmd)
Cmd->getQueue()->throw_asynchronous();
}
if (MQueue)
MQueue->throw_asynchronous();
QueueImplPtr Queue = MQueue.lock();
if (Queue)
Queue->throw_asynchronous();
}

template <>
Expand Down
3 changes: 2 additions & 1 deletion sycl/source/detail/event_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class context_impl;
using ContextImplPtr = std::shared_ptr<cl::sycl::detail::context_impl>;
class queue_impl;
using QueueImplPtr = std::shared_ptr<cl::sycl::detail::queue_impl>;
using QueueImplWPtr = std::weak_ptr<cl::sycl::detail::queue_impl>;

class event_impl {
public:
Expand Down Expand Up @@ -147,7 +148,7 @@ class event_impl {
private:
RT::PiEvent MEvent = nullptr;
ContextImplPtr MContext;
QueueImplPtr MQueue;
QueueImplWPtr MQueue;
bool MOpenCLInterop = false;
bool MHostEvent = true;
std::unique_ptr<HostProfilingInfo> MHostProfilingInfo;
Expand Down