Skip to content
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
20 changes: 16 additions & 4 deletions sycl/source/detail/graph/graph_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,13 @@ graph_impl::add(std::shared_ptr<dynamic_command_group_impl> &DynCGImpl,
return NodeImpl;
}

std::shared_ptr<sycl::detail::queue_impl> graph_impl::getQueue() const {
std::shared_ptr<sycl::detail::queue_impl> Return{};
if (!MRecordingQueues.empty())
Return = MRecordingQueues.begin()->lock();
return Return;
}

void graph_impl::addQueue(sycl::detail::queue_impl &RecordingQueue) {
MRecordingQueues.insert(RecordingQueue.weak_from_this());
}
Expand Down Expand Up @@ -870,10 +877,6 @@ exec_graph_impl::exec_graph_impl(sycl::context Context,
const std::shared_ptr<graph_impl> &GraphImpl,
const property_list &PropList)
: MSchedule(), MGraphImpl(GraphImpl), MSyncPoints(),
MQueueImpl(sycl::detail::queue_impl::create(
*sycl::detail::getSyclObjImpl(GraphImpl->getDevice()),
*sycl::detail::getSyclObjImpl(Context), sycl::async_handler{},
sycl::property_list{})),
MDevice(GraphImpl->getDevice()), MContext(Context), MRequirements(),
MSchedulerDependencies(),
MIsUpdatable(PropList.has_property<property::graph::updatable>()),
Expand All @@ -893,6 +896,15 @@ exec_graph_impl::exec_graph_impl(sycl::context Context,
}
// Copy nodes from GraphImpl and merge any subgraph nodes into this graph.
duplicateNodes();

if (auto PlaceholderQueuePtr = GraphImpl->getQueue()) {
MQueueImpl = PlaceholderQueuePtr;
} else {
MQueueImpl = sycl::detail::queue_impl::create(
*sycl::detail::getSyclObjImpl(GraphImpl->getDevice()),
*sycl::detail::getSyclObjImpl(Context), sycl::async_handler{},
sycl::property_list{});
}
}

exec_graph_impl::~exec_graph_impl() {
Expand Down
2 changes: 2 additions & 0 deletions sycl/source/detail/graph/graph_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ class graph_impl : public std::enable_shared_from_this<graph_impl> {
node_impl &add(std::shared_ptr<dynamic_command_group_impl> &DynCGImpl,
nodes_range Deps);

std::shared_ptr<sycl::detail::queue_impl> getQueue() const;

/// Add a queue to the set of queues which are currently recording to this
/// graph.
/// @param RecordingQueue Queue to add to set.
Expand Down
4 changes: 3 additions & 1 deletion sycl/source/interop_handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ ur_native_handle_t interop_handle::getNativeContext() const {

ur_native_handle_t
interop_handle::getNativeQueue(int32_t &NativeHandleDesc) const {
return MQueue->getNative(NativeHandleDesc);
if (MQueue != nullptr)
return MQueue->getNative(NativeHandleDesc);
return 0;
}

ur_native_handle_t interop_handle::getNativeGraph() const {
Expand Down
Loading