Skip to content
Open
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
16 changes: 4 additions & 12 deletions sycl/include/sycl/interop_handle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,19 +205,13 @@ class interop_handle {
friend class detail::DispatchHostTask;
using ReqToMem = std::pair<detail::AccessorImplHost *, ur_mem_handle_t>;

#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
// Clean this up (no shared pointers). Not doing it right now because I expect
// there will be several iterations of simplifications possible and it would
// be hard to track which of them made their way into a minor public release
// and which didn't. Let's just clean it up once during ABI breaking window.
#endif
interop_handle(std::vector<ReqToMem> MemObjs,
const std::shared_ptr<detail::queue_impl> &Queue,
detail::device_impl &Device,
const std::shared_ptr<detail::context_impl> &Context,
ur_exp_command_buffer_handle_t Graph = nullptr)
: MQueue(Queue), MDevice(Device), MContext(Context), MGraph(Graph),
MMemObjs(std::move(MemObjs)) {}
: MQueue(Queue), MGraph(Graph), MMemObjs(std::move(MemObjs)) {
assert(MQueue != nullptr &&
"interop_handle must be associated with a valid queue");
}

template <backend Backend, typename DataT, int Dims>
backend_return_t<Backend, buffer<DataT, Dims>>
Expand All @@ -243,8 +237,6 @@ class interop_handle {
__SYCL_EXPORT ur_native_handle_t getNativeGraph() const;

std::shared_ptr<detail::queue_impl> MQueue;
detail::device_impl &MDevice;
std::shared_ptr<detail::context_impl> MContext;
ur_exp_command_buffer_handle_t MGraph;

std::vector<ReqToMem> MMemObjs;
Expand Down
11 changes: 3 additions & 8 deletions sycl/source/detail/scheduler/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,7 @@ class DispatchHostTask {
if (HostTask.MHostTask->isInteropTask()) {
assert(HostTask.MQueue &&
"Host task submissions should have an associated queue");
interop_handle IH{MReqToMem, HostTask.MQueue,
HostTask.MQueue->getDeviceImpl(),
HostTask.MQueue->getContextImpl().shared_from_this()};
interop_handle IH{MReqToMem, HostTask.MQueue};
// TODO: should all the backends that support this entry point use this
// for host task?
auto &Queue = HostTask.MQueue;
Expand Down Expand Up @@ -3113,8 +3111,7 @@ ur_result_t ExecCGCommand::enqueueImpCommandBuffer() {

ur_exp_command_buffer_handle_t InteropCommandBuffer =
ChildCommandBuffer ? ChildCommandBuffer : MCommandBuffer;
interop_handle IH{std::move(ReqToMem), MQueue, DeviceImpl,
ContextImpl.shared_from_this(), InteropCommandBuffer};
interop_handle IH{std::move(ReqToMem), MQueue, InteropCommandBuffer};
CommandBufferNativeCommandData CustomOpData{
std::move(IH), HostTask->MHostTask->MInteropTask};

Expand Down Expand Up @@ -3487,9 +3484,7 @@ ur_result_t ExecCGCommand::enqueueImpQueue() {
}

EnqueueNativeCommandData CustomOpData{
interop_handle{std::move(ReqToMem), HostTask->MQueue,
HostTask->MQueue->getDeviceImpl(),
HostTask->MQueue->getContextImpl().shared_from_this()},
interop_handle{std::move(ReqToMem), HostTask->MQueue},
HostTask->MHostTask->MInteropTask};

ur_bool_t NativeCommandSupport = false;
Expand Down
11 changes: 5 additions & 6 deletions sycl/source/interop_handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,24 @@ interop_handle::getNativeMem(detail::Requirement *Req) const {
}

detail::adapter_impl &Adapter = MQueue->getAdapter();
detail::device_impl &Device = MQueue->getDeviceImpl();
ur_native_handle_t Handle;
Adapter.call<detail::UrApiKind::urMemGetNativeHandle>(
Iter->second, MDevice.getHandleRef(), &Handle);
Iter->second, Device.getHandleRef(), &Handle);
return Handle;
}

ur_native_handle_t interop_handle::getNativeDevice() const {
return MDevice.getNative();
return MQueue->getDeviceImpl().getNative();
}

ur_native_handle_t interop_handle::getNativeContext() const {
return MContext->getNative();
return MQueue->getContextImpl().getNative();
}

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

ur_native_handle_t interop_handle::getNativeGraph() const {
Expand Down