From d57fa09f4f5d7cdc3c4b88485b6ccb5cc0addf4b Mon Sep 17 00:00:00 2001 From: Alexander Batashev Date: Fri, 12 Mar 2021 14:03:39 +0300 Subject: [PATCH 1/7] [SYCL] SYCL 2020 backend interoperability part 1 --- sycl/include/CL/sycl/backend.hpp | 84 +++++++++++++++ sycl/include/CL/sycl/backend/level_zero.hpp | 12 +++ sycl/include/CL/sycl/backend/opencl.hpp | 13 +++ .../include/CL/sycl/detail/backend_traits.hpp | 25 +++++ sycl/include/CL/sycl/platform.hpp | 1 + sycl/source/CMakeLists.txt | 1 + sycl/source/backend.cpp | 100 ++++++++++++++++++ sycl/source/backend/level_zero.cpp | 21 +--- sycl/source/backend/opencl.cpp | 39 ++----- 9 files changed, 247 insertions(+), 49 deletions(-) create mode 100644 sycl/include/CL/sycl/detail/backend_traits.hpp create mode 100644 sycl/source/backend.cpp diff --git a/sycl/include/CL/sycl/backend.hpp b/sycl/include/CL/sycl/backend.hpp index 921cba381de38..57db49977f93d 100644 --- a/sycl/include/CL/sycl/backend.hpp +++ b/sycl/include/CL/sycl/backend.hpp @@ -8,9 +8,17 @@ #pragma once +#include "CL/sycl/exception_list.hpp" #include #include +#include +#include +#include #include +#include +#include + +#include __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { @@ -34,5 +42,81 @@ auto get_native(const accessor>::type = delete; +namespace detail { +__SYCL_EXPORT platform make_platform(pi_native_handle NativeHandle, + backend Backend); +__SYCL_EXPORT device make_device(pi_native_handle NativeHandle, + backend Backend); +__SYCL_EXPORT context make_context(pi_native_handle NativeHandle, + const async_handler Handler, + backend Backend); +__SYCL_EXPORT queue make_queue(pi_native_handle NativeHandle, + const context &TargetContext, + const async_handler Handler, backend Backend); +__SYCL_EXPORT event make_event(pi_native_handle NativeHandle, + const context &TargetContext, backend Backend); +} // namespace detail + +template +typename std::enable_if< + detail::InteropFeatureSupportMap::MakePlatform == true, + platform>::type +make_platform(const typename interop::type &BackendObject) { + return detail::make_platform( + detail::pi::cast(BackendObject), Backend); +} + +template +typename std::enable_if< + detail::InteropFeatureSupportMap::MakeDevice == true, device>::type +make_device(const typename interop::type &BackendObject) { + return detail::make_device(detail::pi::cast(BackendObject), + Backend); +} + +template +typename std::enable_if< + detail::InteropFeatureSupportMap::MakeContext == true, + context>::type +make_context(const typename interop::type &BackendObject, + const async_handler &Handler = {}) { + return detail::make_context(detail::pi::cast(BackendObject), + Handler, Backend); +} + +template +typename std::enable_if< + detail::InteropFeatureSupportMap::MakeQueue == true, queue>::type +make_queue(const typename interop::type &BackendObject, + const context &TargetContext, const async_handler Handler = {}) { + return detail::make_queue(detail::pi::cast(BackendObject), + TargetContext, Handler, Backend); +} + +template +typename std::enable_if< + detail::InteropFeatureSupportMap::MakeEvent == true, event>::type +make_event(const typename interop::type &BackendObject, + const context &TargetContext) { + return detail::make_event(detail::pi::cast(BackendObject), + TargetContext, Backend); +} + +template +typename std::enable_if::MakeBuffer == + true, + buffer>::type +make_buffer( + const interop> &BackendObject, + const context &TargetContext, event AvailableEvent = {}) { + if (Backend != backend::opencl) + throw invalid_object_error{ + "Buffer interop is only supported for OpenCL backend", + PI_INVALID_MEM_OBJECT}; + + return buffer( + reinterpret_cast(BackendObject), TargetContext, AvailableEvent); +} } // namespace sycl } // __SYCL_INLINE_NAMESPACE(cl) diff --git a/sycl/include/CL/sycl/backend/level_zero.hpp b/sycl/include/CL/sycl/backend/level_zero.hpp index e7b8be77bba93..260025b077208 100644 --- a/sycl/include/CL/sycl/backend/level_zero.hpp +++ b/sycl/include/CL/sycl/backend/level_zero.hpp @@ -49,6 +49,18 @@ struct interop class InteropFeatureSupportMap { + static constexpr bool MakePlatform = true; + static constexpr bool MakeDevice = false; + static constexpr bool MakeContext = false; + static constexpr bool MakeQueue = false; + static constexpr bool MakeEvent = true; + static constexpr bool MakeBuffer = false; + static constexpr bool MakeKernel = false; +}; +} // namespace detail + namespace level_zero { // Since Level-Zero is not doing any reference counting itself, we have to diff --git a/sycl/include/CL/sycl/backend/opencl.hpp b/sycl/include/CL/sycl/backend/opencl.hpp index 81e6a2de4b62e..96eab738adacc 100644 --- a/sycl/include/CL/sycl/backend/opencl.hpp +++ b/sycl/include/CL/sycl/backend/opencl.hpp @@ -11,6 +11,7 @@ #include #include +#include #include __SYCL_INLINE_NAMESPACE(cl) { @@ -52,6 +53,18 @@ struct interop class InteropFeatureSupportMap { + static constexpr bool MakePlatform = true; + static constexpr bool MakeDevice = true; + static constexpr bool MakeContext = true; + static constexpr bool MakeQueue = true; + static constexpr bool MakeEvent = true; + static constexpr bool MakeBuffer = true; + static constexpr bool MakeKernel = true; +}; +} // namespace detail + namespace opencl { // Implementation of various "make" functions resides in SYCL RT because diff --git a/sycl/include/CL/sycl/detail/backend_traits.hpp b/sycl/include/CL/sycl/detail/backend_traits.hpp new file mode 100644 index 0000000000000..861d1ec757436 --- /dev/null +++ b/sycl/include/CL/sycl/detail/backend_traits.hpp @@ -0,0 +1,25 @@ +//==-------------- backend_traits.hpp - SYCL backend traits ----------------==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#pragma once + +__SYCL_INLINE_NAMESPACE(cl) { +namespace sycl { +namespace detail { +template class InteropFeatureSupportMap { + static constexpr bool MakePlatform = false; + static constexpr bool MakeDevice = false; + static constexpr bool MakeContext = false; + static constexpr bool MakeQueue = false; + static constexpr bool MakeEvent = false; + static constexpr bool MakeBuffer = false; + static constexpr bool MakeKernel = false; +}; +} // namespace detail +} // namespace sycl +} // __SYCL_INLINE_NAMESPACE(cl) diff --git a/sycl/include/CL/sycl/platform.hpp b/sycl/include/CL/sycl/platform.hpp index 6d2c36ef2cf27..86a9ba39c2a70 100644 --- a/sycl/include/CL/sycl/platform.hpp +++ b/sycl/include/CL/sycl/platform.hpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #pragma once +#include #include #include #include diff --git a/sycl/source/CMakeLists.txt b/sycl/source/CMakeLists.txt index d8832cb0d6a57..e7586f38bde2b 100644 --- a/sycl/source/CMakeLists.txt +++ b/sycl/source/CMakeLists.txt @@ -102,6 +102,7 @@ set(SYCL_SOURCES "${sycl_inc_dir}/CL/sycl.hpp" "backend/opencl.cpp" "backend/level_zero.cpp" + "backend.cpp" "detail/accessor_impl.cpp" "detail/buffer_impl.cpp" "detail/builtins_common.cpp" diff --git a/sycl/source/backend.cpp b/sycl/source/backend.cpp new file mode 100644 index 0000000000000..520f168d9a4b0 --- /dev/null +++ b/sycl/source/backend.cpp @@ -0,0 +1,100 @@ +//==------------------- backend.cpp ----------------------------------------==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "CL/sycl/detail/export.hpp" +#include "CL/sycl/detail/pi.h" +#include "CL/sycl/exception_list.hpp" +#include "detail/context_impl.hpp" +#include "detail/event_impl.hpp" +#include "detail/platform_impl.hpp" +#include "detail/plugin.hpp" +#include "detail/queue_impl.hpp" +#include "sycl/CL/sycl/detail/pi.h" +#include + +__SYCL_INLINE_NAMESPACE(cl) { +namespace sycl { +namespace detail { + +static const plugin &getPlugin(backend Backend) { + switch (Backend) { + case backend::opencl: + return pi::getPlugin(); + case backend::level_zero: + return pi::getPlugin(); + default: + assert(false && "Unsupported backend type"); + } +} + +__SYCL_EXPORT platform make_platform(pi_native_handle NativeHandle, + backend Backend) { + const auto &Plugin = getPlugin(Backend); + + pi::PiPlatform PiPlatform; + Plugin.call(NativeHandle, + &PiPlatform); + + return detail::createSyclObjFromImpl( + platform_impl::getOrMakePlatformImpl(PiPlatform, Plugin)); +} + +__SYCL_EXPORT device make_device(pi_native_handle NativeHandle, + backend Backend) { + const auto &Plugin = getPlugin(Backend); + + pi::PiDevice PiDevice; + Plugin.call(NativeHandle, + nullptr, &PiDevice); + // Construct the SYCL device from PI device. + return detail::createSyclObjFromImpl( + std::make_shared(PiDevice, Plugin)); +} + +__SYCL_EXPORT context make_context(pi_native_handle NativeHandle, + const async_handler &Handler, + backend Backend) { + const auto &Plugin = getPlugin(Backend); + + pi::PiContext PiContext; + Plugin.call( + NativeHandle, 0, nullptr, false, &PiContext); + // Construct the SYCL context from PI context. + return detail::createSyclObjFromImpl( + std::make_shared(PiContext, Handler, Plugin)); +} + +__SYCL_EXPORT queue make_queue(pi_native_handle NativeHandle, + const context &Context, + const async_handler Handler, backend Backend) { + const auto &Plugin = getPlugin(Backend); + const auto &ContextImpl = getSyclObjImpl(Context); + // Create PI queue first. + pi::PiQueue PiQueue; + Plugin.call( + NativeHandle, ContextImpl->getHandleRef(), &PiQueue); + // Construct the SYCL queue from PI queue. + return detail::createSyclObjFromImpl( + std::make_shared(PiQueue, ContextImpl, Handler)); +} + +__SYCL_EXPORT event make_event(pi_native_handle NativeHandle, + const context &Context, backend Backend) { + const auto &Plugin = getPlugin(Backend); + + pi::PiEvent PiEvent; + Plugin.call(NativeHandle, + &PiEvent); + + return detail::createSyclObjFromImpl( + std::make_shared(PiEvent, Context)); +} + +} // namespace detail +} // namespace sycl +} // __SYCL_INLINE_NAMESPACE(cl) diff --git a/sycl/source/backend/level_zero.cpp b/sycl/source/backend/level_zero.cpp index 22ceec88b799f..94dac2f4d19b8 100644 --- a/sycl/source/backend/level_zero.cpp +++ b/sycl/source/backend/level_zero.cpp @@ -6,6 +6,7 @@ // //===----------------------------------------------------------------------===// +#include "CL/sycl/backend.hpp" #include #include #include @@ -20,14 +21,7 @@ using namespace detail; //---------------------------------------------------------------------------- // Implementation of level_zero::make __SYCL_EXPORT platform make_platform(pi_native_handle NativeHandle) { - const auto &Plugin = pi::getPlugin(); - // Create PI platform first. - pi::PiPlatform PiPlatform; - Plugin.call(NativeHandle, - &PiPlatform); - - return detail::createSyclObjFromImpl( - platform_impl::getOrMakePlatformImpl(PiPlatform, Plugin)); + return detail::make_platform(NativeHandle, backend::level_zero); } //---------------------------------------------------------------------------- @@ -86,15 +80,10 @@ __SYCL_EXPORT program make_program(const context &Context, // Implementation of level_zero::make __SYCL_EXPORT queue make_queue(const context &Context, pi_native_handle NativeHandle) { - const auto &Plugin = pi::getPlugin(); const auto &ContextImpl = getSyclObjImpl(Context); - // Create PI queue first. - pi::PiQueue PiQueue; - Plugin.call( - NativeHandle, ContextImpl->getHandleRef(), &PiQueue); - // Construct the SYCL queue from PI queue. - return detail::createSyclObjFromImpl(std::make_shared( - PiQueue, ContextImpl, ContextImpl->get_async_handler())); + return detail::make_queue(NativeHandle, Context, + ContextImpl->get_async_handler(), + backend::level_zero); } } // namespace level_zero diff --git a/sycl/source/backend/opencl.cpp b/sycl/source/backend/opencl.cpp index d5dae4b1805e1..b8d7e7a46480d 100644 --- a/sycl/source/backend/opencl.cpp +++ b/sycl/source/backend/opencl.cpp @@ -6,6 +6,7 @@ // //===----------------------------------------------------------------------===// +#include "CL/sycl/backend.hpp" #include #include #include @@ -20,41 +21,19 @@ using namespace detail; //---------------------------------------------------------------------------- // Implementation of opencl::make __SYCL_EXPORT platform make_platform(pi_native_handle NativeHandle) { - const auto &Plugin = pi::getPlugin(); - // Create PI platform first. - pi::PiPlatform PiPlatform; - Plugin.call(NativeHandle, - &PiPlatform); - - // Construct the SYCL platform from PI platfrom. - return detail::createSyclObjFromImpl( - std::make_shared(PiPlatform, Plugin)); + return detail::make_platform(NativeHandle, backend::opencl); } //---------------------------------------------------------------------------- // Implementation of opencl::make __SYCL_EXPORT device make_device(pi_native_handle NativeHandle) { - const auto &Plugin = pi::getPlugin(); - // Create PI device first. - pi::PiDevice PiDevice; - Plugin.call(NativeHandle, - nullptr, &PiDevice); - // Construct the SYCL device from PI device. - return detail::createSyclObjFromImpl( - std::make_shared(PiDevice, Plugin)); + return detail::make_device(NativeHandle, backend::opencl); } //---------------------------------------------------------------------------- // Implementation of opencl::make __SYCL_EXPORT context make_context(pi_native_handle NativeHandle) { - const auto &Plugin = pi::getPlugin(); - // Create PI context first. - pi::PiContext PiContext; - Plugin.call( - NativeHandle, 0, nullptr, false, &PiContext); - // Construct the SYCL context from PI context. - return detail::createSyclObjFromImpl( - std::make_shared(PiContext, async_handler{}, Plugin)); + return detail::make_context(NativeHandle, async_handler{}, backend::opencl); } //---------------------------------------------------------------------------- @@ -72,15 +51,9 @@ __SYCL_EXPORT program make_program(const context &Context, // Implementation of opencl::make __SYCL_EXPORT queue make_queue(const context &Context, pi_native_handle NativeHandle) { - const auto &Plugin = pi::getPlugin(); const auto &ContextImpl = getSyclObjImpl(Context); - // Create PI queue first. - pi::PiQueue PiQueue; - Plugin.call( - NativeHandle, ContextImpl->getHandleRef(), &PiQueue); - // Construct the SYCL queue from PI queue. - return detail::createSyclObjFromImpl(std::make_shared( - PiQueue, ContextImpl, ContextImpl->get_async_handler())); + return detail::make_queue(NativeHandle, Context, + ContextImpl->get_async_handler(), backend::opencl); } } // namespace opencl From 9ff5d64df58d4e93758055d2b187c5c37ea2fbf0 Mon Sep 17 00:00:00 2001 From: Alexander Batashev Date: Fri, 12 Mar 2021 14:30:19 +0300 Subject: [PATCH 2/7] minor fixes --- sycl/include/CL/sycl/backend.hpp | 6 ------ sycl/source/backend.cpp | 7 +++---- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/sycl/include/CL/sycl/backend.hpp b/sycl/include/CL/sycl/backend.hpp index 57db49977f93d..1752db1a5db1c 100644 --- a/sycl/include/CL/sycl/backend.hpp +++ b/sycl/include/CL/sycl/backend.hpp @@ -8,7 +8,6 @@ #pragma once -#include "CL/sycl/exception_list.hpp" #include #include #include @@ -110,11 +109,6 @@ typename std::enable_if::MakeBuffer == make_buffer( const interop> &BackendObject, const context &TargetContext, event AvailableEvent = {}) { - if (Backend != backend::opencl) - throw invalid_object_error{ - "Buffer interop is only supported for OpenCL backend", - PI_INVALID_MEM_OBJECT}; - return buffer( reinterpret_cast(BackendObject), TargetContext, AvailableEvent); } diff --git a/sycl/source/backend.cpp b/sycl/source/backend.cpp index 520f168d9a4b0..7d30f7b121d2b 100644 --- a/sycl/source/backend.cpp +++ b/sycl/source/backend.cpp @@ -6,16 +6,15 @@ // //===----------------------------------------------------------------------===// -#include "CL/sycl/detail/export.hpp" -#include "CL/sycl/detail/pi.h" -#include "CL/sycl/exception_list.hpp" #include "detail/context_impl.hpp" #include "detail/event_impl.hpp" #include "detail/platform_impl.hpp" #include "detail/plugin.hpp" #include "detail/queue_impl.hpp" -#include "sycl/CL/sycl/detail/pi.h" #include +#include +#include +#include __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { From 7829e2f420fce25bd37d4cb8e1117bbf348d09f5 Mon Sep 17 00:00:00 2001 From: Alexander Batashev Date: Mon, 15 Mar 2021 10:58:30 +0300 Subject: [PATCH 3/7] Add tests --- .../basic_tests/interop/construction_ocl.cpp | 47 +++++++++++++++++++ .../basic_tests/interop/construction_ze.cpp | 30 ++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 sycl/test/on-device/basic_tests/interop/construction_ocl.cpp create mode 100644 sycl/test/on-device/basic_tests/interop/construction_ze.cpp diff --git a/sycl/test/on-device/basic_tests/interop/construction_ocl.cpp b/sycl/test/on-device/basic_tests/interop/construction_ocl.cpp new file mode 100644 index 0000000000000..568919b7534c6 --- /dev/null +++ b/sycl/test/on-device/basic_tests/interop/construction_ocl.cpp @@ -0,0 +1,47 @@ +// REQUIRES: opencl +// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -lOpenCL %s -o %t.ocl.out +// RUN: %t.ocl.out + +#include +#include + +constexpr auto BE = sycl::backend::opencl; + +int main() { + sycl::device Dev{sycl::default_selector{}}; + auto NativeDev = Dev.get_native(); + + sycl::device NewDev = sycl::make_device(NativeDev); + assert(NewDev == Dev); + + sycl::platform Plt = Dev.get_platform(); + auto NativePlt = Plt.get_native(); + + sycl::platform NewPlt = sycl::make_platform(NativePlt); + assert(NewPlt == Plt); + + sycl::context Ctx{Dev}; + auto NativeCtx = Ctx.get_native(); + + sycl::context NewCtx = sycl::make_context(NativeCtx); + assert(NewCtx == NativeCtx); + + sycl::queue Q{Ctx, Dev}; + auto NativeQ = Q.get_native(); + + sycl::queue NewQ = sycl::make_queue(NativeQ, Ctx); + assert(Q == NewQ); + + sycl::event Evt = Q.single_task([]{}); + auto NativeEvt = Evt.get_native(); + + sycl::event NewEvt = sycl::make_event(NativeEvt, Ctx); + assert(NewEvt == Evt); + + cl_mem NativeBuf = + clCreateBuffer(NativeCtx, CL_MEM_READ_WRITE, 128, nullptr, nullptr); + auto NewBuf = sycl::make_buffer(NativeBuf, Ctx); + assert(NewBuf.get_range()[0] == 128); + + return 0; +} diff --git a/sycl/test/on-device/basic_tests/interop/construction_ze.cpp b/sycl/test/on-device/basic_tests/interop/construction_ze.cpp new file mode 100644 index 0000000000000..3a79fd637e6e5 --- /dev/null +++ b/sycl/test/on-device/basic_tests/interop/construction_ze.cpp @@ -0,0 +1,30 @@ +// REQUIRES: level_zero +// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.ze.out +// RUN: %t.ze.out + +#include +#include + +constexpr auto BE = sycl::backend::level_zero; + +int main() { + sycl::device Dev{sycl::default_selector{}}; + sycl::context Ctx{Dev}; + + sycl::platform Plt = Dev.get_platform(); + auto NativePlt = Plt.get_native(); + + sycl::platform NewPlt = sycl::make_platform(NativePlt); + assert(NewPlt == Plt); + + sycl::queue Q{Ctx, Dev}; + + sycl::event Evt = Q.single_task([]{}); + auto NativeEvt = Evt.get_native(); + + sycl::event NewEvt = sycl::make_event(NativeEvt, Ctx); + assert(NewEvt == Evt); + + return 0; +} + From 1471900f11735f673bb559ce89b670d69f57b8ff Mon Sep 17 00:00:00 2001 From: Alexander Batashev Date: Mon, 15 Mar 2021 11:59:33 +0300 Subject: [PATCH 4/7] more fixes --- sycl/include/CL/sycl/backend.hpp | 15 +++++++------- sycl/include/CL/sycl/backend/level_zero.hpp | 2 +- sycl/include/CL/sycl/backend/opencl.hpp | 7 ++++++- .../include/CL/sycl/detail/backend_traits.hpp | 2 +- sycl/source/backend.cpp | 2 +- sycl/source/backend/level_zero.cpp | 2 +- .../basic_tests/interop/construction_ocl.cpp | 11 +++++----- .../basic_tests/interop/construction_ze.cpp | 20 +++++++++++-------- 8 files changed, 36 insertions(+), 25 deletions(-) diff --git a/sycl/include/CL/sycl/backend.hpp b/sycl/include/CL/sycl/backend.hpp index 1752db1a5db1c..7ea38c8b5e8b3 100644 --- a/sycl/include/CL/sycl/backend.hpp +++ b/sycl/include/CL/sycl/backend.hpp @@ -47,11 +47,11 @@ __SYCL_EXPORT platform make_platform(pi_native_handle NativeHandle, __SYCL_EXPORT device make_device(pi_native_handle NativeHandle, backend Backend); __SYCL_EXPORT context make_context(pi_native_handle NativeHandle, - const async_handler Handler, + const async_handler &Handler, backend Backend); __SYCL_EXPORT queue make_queue(pi_native_handle NativeHandle, const context &TargetContext, - const async_handler Handler, backend Backend); + const async_handler &Handler, backend Backend); __SYCL_EXPORT event make_event(pi_native_handle NativeHandle, const context &TargetContext, backend Backend); } // namespace detail @@ -68,7 +68,7 @@ make_platform(const typename interop::type &BackendObject) { template typename std::enable_if< detail::InteropFeatureSupportMap::MakeDevice == true, device>::type -make_device(const typename interop::type &BackendObject) { +make_device(const typename interop::type &BackendObject) { return detail::make_device(detail::pi::cast(BackendObject), Backend); } @@ -77,7 +77,7 @@ template typename std::enable_if< detail::InteropFeatureSupportMap::MakeContext == true, context>::type -make_context(const typename interop::type &BackendObject, +make_context(const typename interop::type &BackendObject, const async_handler &Handler = {}) { return detail::make_context(detail::pi::cast(BackendObject), Handler, Backend); @@ -86,7 +86,7 @@ make_context(const typename interop::type &BackendObject, template typename std::enable_if< detail::InteropFeatureSupportMap::MakeQueue == true, queue>::type -make_queue(const typename interop::type &BackendObject, +make_queue(const typename interop::type &BackendObject, const context &TargetContext, const async_handler Handler = {}) { return detail::make_queue(detail::pi::cast(BackendObject), TargetContext, Handler, Backend); @@ -95,7 +95,7 @@ make_queue(const typename interop::type &BackendObject, template typename std::enable_if< detail::InteropFeatureSupportMap::MakeEvent == true, event>::type -make_event(const typename interop::type &BackendObject, +make_event(const typename interop::type &BackendObject, const context &TargetContext) { return detail::make_event(detail::pi::cast(BackendObject), TargetContext, Backend); @@ -107,7 +107,8 @@ typename std::enable_if::MakeBuffer == true, buffer>::type make_buffer( - const interop> &BackendObject, + const typename interop>::type + &BackendObject, const context &TargetContext, event AvailableEvent = {}) { return buffer( reinterpret_cast(BackendObject), TargetContext, AvailableEvent); diff --git a/sycl/include/CL/sycl/backend/level_zero.hpp b/sycl/include/CL/sycl/backend/level_zero.hpp index 260025b077208..a8e967b48b120 100644 --- a/sycl/include/CL/sycl/backend/level_zero.hpp +++ b/sycl/include/CL/sycl/backend/level_zero.hpp @@ -50,7 +50,7 @@ struct interop class InteropFeatureSupportMap { +template <> struct InteropFeatureSupportMap { static constexpr bool MakePlatform = true; static constexpr bool MakeDevice = false; static constexpr bool MakeContext = false; diff --git a/sycl/include/CL/sycl/backend/opencl.hpp b/sycl/include/CL/sycl/backend/opencl.hpp index 96eab738adacc..be78a04bdb4a7 100644 --- a/sycl/include/CL/sycl/backend/opencl.hpp +++ b/sycl/include/CL/sycl/backend/opencl.hpp @@ -53,8 +53,13 @@ struct interop +struct interop> { + using type = cl_mem; +}; + namespace detail { -template <> class InteropFeatureSupportMap { +template <> struct InteropFeatureSupportMap { static constexpr bool MakePlatform = true; static constexpr bool MakeDevice = true; static constexpr bool MakeContext = true; diff --git a/sycl/include/CL/sycl/detail/backend_traits.hpp b/sycl/include/CL/sycl/detail/backend_traits.hpp index 861d1ec757436..8444ecba89a73 100644 --- a/sycl/include/CL/sycl/detail/backend_traits.hpp +++ b/sycl/include/CL/sycl/detail/backend_traits.hpp @@ -11,7 +11,7 @@ __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { namespace detail { -template class InteropFeatureSupportMap { +template struct InteropFeatureSupportMap { static constexpr bool MakePlatform = false; static constexpr bool MakeDevice = false; static constexpr bool MakeContext = false; diff --git a/sycl/source/backend.cpp b/sycl/source/backend.cpp index 7d30f7b121d2b..db3dbd12f4947 100644 --- a/sycl/source/backend.cpp +++ b/sycl/source/backend.cpp @@ -70,7 +70,7 @@ __SYCL_EXPORT context make_context(pi_native_handle NativeHandle, __SYCL_EXPORT queue make_queue(pi_native_handle NativeHandle, const context &Context, - const async_handler Handler, backend Backend) { + const async_handler &Handler, backend Backend) { const auto &Plugin = getPlugin(Backend); const auto &ContextImpl = getSyclObjImpl(Context); // Create PI queue first. diff --git a/sycl/source/backend/level_zero.cpp b/sycl/source/backend/level_zero.cpp index 94dac2f4d19b8..3fcd9b7142f4d 100644 --- a/sycl/source/backend/level_zero.cpp +++ b/sycl/source/backend/level_zero.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "CL/sycl/backend.hpp" #include +#include #include #include #include diff --git a/sycl/test/on-device/basic_tests/interop/construction_ocl.cpp b/sycl/test/on-device/basic_tests/interop/construction_ocl.cpp index 568919b7534c6..e49a75c1227e3 100644 --- a/sycl/test/on-device/basic_tests/interop/construction_ocl.cpp +++ b/sycl/test/on-device/basic_tests/interop/construction_ocl.cpp @@ -2,8 +2,8 @@ // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -lOpenCL %s -o %t.ocl.out // RUN: %t.ocl.out +#include #include -#include constexpr auto BE = sycl::backend::opencl; @@ -12,7 +12,8 @@ int main() { auto NativeDev = Dev.get_native(); sycl::device NewDev = sycl::make_device(NativeDev); - assert(NewDev == Dev); + assert(NewDev.get_info() == + Dev.get_info()); sycl::platform Plt = Dev.get_platform(); auto NativePlt = Plt.get_native(); @@ -24,19 +25,19 @@ int main() { auto NativeCtx = Ctx.get_native(); sycl::context NewCtx = sycl::make_context(NativeCtx); - assert(NewCtx == NativeCtx); + assert(NewCtx.get_native() == NativeCtx); sycl::queue Q{Ctx, Dev}; auto NativeQ = Q.get_native(); sycl::queue NewQ = sycl::make_queue(NativeQ, Ctx); - assert(Q == NewQ); + assert(NativeQ == NewQ.get_native()); sycl::event Evt = Q.single_task([]{}); auto NativeEvt = Evt.get_native(); sycl::event NewEvt = sycl::make_event(NativeEvt, Ctx); - assert(NewEvt == Evt); + assert(NativeEvt == NewEvt.get_native()); cl_mem NativeBuf = clCreateBuffer(NativeCtx, CL_MEM_READ_WRITE, 128, nullptr, nullptr); diff --git a/sycl/test/on-device/basic_tests/interop/construction_ze.cpp b/sycl/test/on-device/basic_tests/interop/construction_ze.cpp index 3a79fd637e6e5..d6a16486ae312 100644 --- a/sycl/test/on-device/basic_tests/interop/construction_ze.cpp +++ b/sycl/test/on-device/basic_tests/interop/construction_ze.cpp @@ -2,14 +2,15 @@ // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.ze.out // RUN: %t.ze.out +#include + +#include #include -#include constexpr auto BE = sycl::backend::level_zero; int main() { sycl::device Dev{sycl::default_selector{}}; - sycl::context Ctx{Dev}; sycl::platform Plt = Dev.get_platform(); auto NativePlt = Plt.get_native(); @@ -17,14 +18,17 @@ int main() { sycl::platform NewPlt = sycl::make_platform(NativePlt); assert(NewPlt == Plt); - sycl::queue Q{Ctx, Dev}; + // TODO uncomment once events are supported in L0 backend interop. + /* + sycl::context Ctx{Dev}; + sycl::queue Q{Ctx, Dev}; - sycl::event Evt = Q.single_task([]{}); - auto NativeEvt = Evt.get_native(); + sycl::event Evt = Q.single_task([]{}); + auto NativeEvt = Evt.get_native(); - sycl::event NewEvt = sycl::make_event(NativeEvt, Ctx); - assert(NewEvt == Evt); + sycl::event NewEvt = sycl::make_event(NativeEvt, Ctx); + assert(NativeEvt == NewEvt.get_native()); + */ return 0; } - From e9aa694834593388d529b872d8722a1914ff9fed Mon Sep 17 00:00:00 2001 From: Alexander Batashev Date: Mon, 15 Mar 2021 12:49:54 +0300 Subject: [PATCH 5/7] update symbols dump --- sycl/test/abi/sycl_symbols_linux.dump | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sycl/test/abi/sycl_symbols_linux.dump b/sycl/test/abi/sycl_symbols_linux.dump index a63b1e1624044..f9540b8637696 100644 --- a/sycl/test/abi/sycl_symbols_linux.dump +++ b/sycl/test/abi/sycl_symbols_linux.dump @@ -3717,6 +3717,8 @@ _ZN2cl4sycl6detail10image_implILi3EEC2ERSt10shared_ptrIvENS0_19image_channel_ord _ZN2cl4sycl6detail10image_implILi3EED0Ev _ZN2cl4sycl6detail10image_implILi3EED1Ev _ZN2cl4sycl6detail10image_implILi3EED2Ev +_ZN2cl4sycl6detail10make_eventEmRKNS0_7contextENS0_7backendE +_ZN2cl4sycl6detail10make_queueEmRKNS0_7contextERKSt8functionIFvNS0_14exception_listEEENS0_7backendE _ZN2cl4sycl6detail10waitEventsESt6vectorINS0_5eventESaIS3_EE _ZN2cl4sycl6detail11SYCLMemObjT10releaseMemESt10shared_ptrINS1_12context_implEEPv _ZN2cl4sycl6detail11SYCLMemObjT16determineHostPtrERKSt10shared_ptrINS1_12context_implEEbRPvRb @@ -3726,6 +3728,7 @@ _ZN2cl4sycl6detail11SYCLMemObjT20getBufSizeForContextERKSt10shared_ptrINS1_12con _ZN2cl4sycl6detail11SYCLMemObjTC1EP7_cl_memRKNS0_7contextEmNS0_5eventESt10unique_ptrINS1_19SYCLMemObjAllocatorESt14default_deleteISA_EE _ZN2cl4sycl6detail11SYCLMemObjTC2EP7_cl_memRKNS0_7contextEmNS0_5eventESt10unique_ptrINS1_19SYCLMemObjAllocatorESt14default_deleteISA_EE _ZN2cl4sycl6detail11buffer_impl11allocateMemESt10shared_ptrINS1_12context_implEEbPvRP9_pi_event +_ZN2cl4sycl6detail11make_deviceEmNS0_7backendE _ZN2cl4sycl6detail11stream_impl15accessGlobalBufERNS0_7handlerE _ZN2cl4sycl6detail11stream_impl18accessGlobalOffsetERNS0_7handlerE _ZN2cl4sycl6detail11stream_impl20accessGlobalFlushBufERNS0_7handlerE @@ -3733,6 +3736,7 @@ _ZN2cl4sycl6detail11stream_impl5flushEv _ZN2cl4sycl6detail11stream_implC1EmmRNS0_7handlerE _ZN2cl4sycl6detail11stream_implC2EmmRNS0_7handlerE _ZN2cl4sycl6detail12isOutOfRangeENS0_3vecIiLi4EEENS0_15addressing_modeENS0_5rangeILi3EEE +_ZN2cl4sycl6detail12make_contextEmRKSt8functionIFvNS0_14exception_listEEENS0_7backendE _ZN2cl4sycl6detail12sampler_impl18getOrCreateSamplerERKNS0_7contextE _ZN2cl4sycl6detail12sampler_implC1ENS0_29coordinate_normalization_modeENS0_15addressing_modeENS0_14filtering_modeERKNS0_13property_listE _ZN2cl4sycl6detail12sampler_implC1EP11_cl_samplerRKNS0_7contextE @@ -3760,6 +3764,7 @@ _ZN2cl4sycl6detail13MemoryManager7releaseESt10shared_ptrINS1_12context_implEEPNS _ZN2cl4sycl6detail13MemoryManager8allocateESt10shared_ptrINS1_12context_implEEPNS1_11SYCLMemObjIEbPvSt6vectorIS3_INS1_10event_implEESaISB_EERP9_pi_event _ZN2cl4sycl6detail13MemoryManager8copy_usmEPKvSt10shared_ptrINS1_10queue_implEEmPvSt6vectorIP9_pi_eventSaISB_EERSB_ _ZN2cl4sycl6detail13MemoryManager8fill_usmEPvSt10shared_ptrINS1_10queue_implEEmiSt6vectorIP9_pi_eventSaIS9_EERS9_ +_ZN2cl4sycl6detail13make_platformEmNS0_7backendE _ZN2cl4sycl6detail14getBorderColorENS0_19image_channel_orderE _ZN2cl4sycl6detail14host_half_impl4halfC1ERKf _ZN2cl4sycl6detail14host_half_impl4halfC2ERKf @@ -4119,6 +4124,7 @@ _ZNK2cl4sycl7context12get_propertyINS0_8property6buffer13context_boundEEET_v _ZNK2cl4sycl7context12get_propertyINS0_8property6buffer9use_mutexEEET_v _ZNK2cl4sycl7context12get_propertyINS0_8property6noinitEEET_v _ZNK2cl4sycl7context12get_propertyINS0_8property7context4cuda19use_primary_contextEEET_v +_ZNK2cl4sycl7context12get_propertyINS0_8property9reduction22initialize_to_identityEEET_v _ZNK2cl4sycl7context12has_propertyINS0_3ext6oneapi8property6buffer22use_pinned_host_memoryEEEbv _ZNK2cl4sycl7context12has_propertyINS0_8property5image12use_host_ptrEEEbv _ZNK2cl4sycl7context12has_propertyINS0_8property5image13context_boundEEEbv @@ -4129,7 +4135,6 @@ _ZNK2cl4sycl7context12has_propertyINS0_8property6buffer13context_boundEEEbv _ZNK2cl4sycl7context12has_propertyINS0_8property6buffer9use_mutexEEEbv _ZNK2cl4sycl7context12has_propertyINS0_8property6noinitEEEbv _ZNK2cl4sycl7context12has_propertyINS0_8property7context4cuda19use_primary_contextEEEbv -_ZNK2cl4sycl7context12get_propertyINS0_8property9reduction22initialize_to_identityEEET_v _ZNK2cl4sycl7context12has_propertyINS0_8property9reduction22initialize_to_identityEEEbv _ZNK2cl4sycl7context3getEv _ZNK2cl4sycl7context7is_hostEv @@ -4155,6 +4160,7 @@ _ZNK2cl4sycl7program12get_propertyINS0_8property6buffer13context_boundEEET_v _ZNK2cl4sycl7program12get_propertyINS0_8property6buffer9use_mutexEEET_v _ZNK2cl4sycl7program12get_propertyINS0_8property6noinitEEET_v _ZNK2cl4sycl7program12get_propertyINS0_8property7context4cuda19use_primary_contextEEET_v +_ZNK2cl4sycl7program12get_propertyINS0_8property9reduction22initialize_to_identityEEET_v _ZNK2cl4sycl7program12has_propertyINS0_3ext6oneapi8property6buffer22use_pinned_host_memoryEEEbv _ZNK2cl4sycl7program12has_propertyINS0_8property5image12use_host_ptrEEEbv _ZNK2cl4sycl7program12has_propertyINS0_8property5image13context_boundEEEbv @@ -4165,7 +4171,6 @@ _ZNK2cl4sycl7program12has_propertyINS0_8property6buffer13context_boundEEEbv _ZNK2cl4sycl7program12has_propertyINS0_8property6buffer9use_mutexEEEbv _ZNK2cl4sycl7program12has_propertyINS0_8property6noinitEEEbv _ZNK2cl4sycl7program12has_propertyINS0_8property7context4cuda19use_primary_contextEEEbv -_ZNK2cl4sycl7program12get_propertyINS0_8property9reduction22initialize_to_identityEEET_v _ZNK2cl4sycl7program12has_propertyINS0_8property9reduction22initialize_to_identityEEEbv _ZNK2cl4sycl7program16get_link_optionsB5cxx11Ev _ZNK2cl4sycl7program17get_build_optionsB5cxx11Ev @@ -4187,6 +4192,7 @@ _ZNK2cl4sycl7sampler12get_propertyINS0_8property6buffer13context_boundEEET_v _ZNK2cl4sycl7sampler12get_propertyINS0_8property6buffer9use_mutexEEET_v _ZNK2cl4sycl7sampler12get_propertyINS0_8property6noinitEEET_v _ZNK2cl4sycl7sampler12get_propertyINS0_8property7context4cuda19use_primary_contextEEET_v +_ZNK2cl4sycl7sampler12get_propertyINS0_8property9reduction22initialize_to_identityEEET_v _ZNK2cl4sycl7sampler12has_propertyINS0_3ext6oneapi8property6buffer22use_pinned_host_memoryEEEbv _ZNK2cl4sycl7sampler12has_propertyINS0_8property5image12use_host_ptrEEEbv _ZNK2cl4sycl7sampler12has_propertyINS0_8property5image13context_boundEEEbv @@ -4197,7 +4203,6 @@ _ZNK2cl4sycl7sampler12has_propertyINS0_8property6buffer13context_boundEEEbv _ZNK2cl4sycl7sampler12has_propertyINS0_8property6buffer9use_mutexEEEbv _ZNK2cl4sycl7sampler12has_propertyINS0_8property6noinitEEEbv _ZNK2cl4sycl7sampler12has_propertyINS0_8property7context4cuda19use_primary_contextEEEbv -_ZNK2cl4sycl7sampler12get_propertyINS0_8property9reduction22initialize_to_identityEEET_v _ZNK2cl4sycl7sampler12has_propertyINS0_8property9reduction22initialize_to_identityEEEbv _ZNK2cl4sycl7sampler18get_filtering_modeEv _ZNK2cl4sycl7sampler19get_addressing_modeEv From 0ac2d9282b869f72eeafab1aa8ea7ebbdd3ff078 Mon Sep 17 00:00:00 2001 From: Alexander Batashev Date: Mon, 15 Mar 2021 13:47:39 +0300 Subject: [PATCH 6/7] More fixes --- sycl/source/backend.cpp | 4 +++- sycl/test/on-device/basic_tests/interop/construction_ocl.cpp | 2 +- sycl/test/on-device/basic_tests/interop/construction_ze.cpp | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sycl/source/backend.cpp b/sycl/source/backend.cpp index db3dbd12f4947..71e2649fc2920 100644 --- a/sycl/source/backend.cpp +++ b/sycl/source/backend.cpp @@ -16,6 +16,8 @@ #include #include +#include + __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { namespace detail { @@ -27,7 +29,7 @@ static const plugin &getPlugin(backend Backend) { case backend::level_zero: return pi::getPlugin(); default: - assert(false && "Unsupported backend type"); + throw std::runtime_error{"Unsupported backend"}; } } diff --git a/sycl/test/on-device/basic_tests/interop/construction_ocl.cpp b/sycl/test/on-device/basic_tests/interop/construction_ocl.cpp index e49a75c1227e3..2ffdb9c18a3f0 100644 --- a/sycl/test/on-device/basic_tests/interop/construction_ocl.cpp +++ b/sycl/test/on-device/basic_tests/interop/construction_ocl.cpp @@ -1,6 +1,6 @@ // REQUIRES: opencl // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -lOpenCL %s -o %t.ocl.out -// RUN: %t.ocl.out +// RUN: env SYCL_DEVICE_FILTER="opencl" %t.ocl.out #include #include diff --git a/sycl/test/on-device/basic_tests/interop/construction_ze.cpp b/sycl/test/on-device/basic_tests/interop/construction_ze.cpp index d6a16486ae312..c4a6f96e70a74 100644 --- a/sycl/test/on-device/basic_tests/interop/construction_ze.cpp +++ b/sycl/test/on-device/basic_tests/interop/construction_ze.cpp @@ -1,6 +1,6 @@ // REQUIRES: level_zero // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.ze.out -// RUN: %t.ze.out +// RUN: env SYCL_DEVICE_FILTER="level_zero" %t.ze.out #include From 4638c8a0ee923dd19360c6e2c19be5b01b2df97d Mon Sep 17 00:00:00 2001 From: Alexander Batashev Date: Wed, 17 Mar 2021 14:23:59 +0300 Subject: [PATCH 7/7] Address comments --- sycl/include/CL/sycl/backend.hpp | 5 ++++- sycl/include/CL/sycl/backend/level_zero.hpp | 2 +- sycl/source/backend.cpp | 18 ++++++++---------- sycl/source/backend/opencl.cpp | 1 - .../basic_tests/interop/construction_ocl.cpp | 2 ++ .../basic_tests/interop/construction_ze.cpp | 12 ------------ 6 files changed, 15 insertions(+), 25 deletions(-) diff --git a/sycl/include/CL/sycl/backend.hpp b/sycl/include/CL/sycl/backend.hpp index 7ea38c8b5e8b3..8046699214f4a 100644 --- a/sycl/include/CL/sycl/backend.hpp +++ b/sycl/include/CL/sycl/backend.hpp @@ -10,9 +10,12 @@ #include #include +#include +#include #include -#include #include +#include +#include #include #include #include diff --git a/sycl/include/CL/sycl/backend/level_zero.hpp b/sycl/include/CL/sycl/backend/level_zero.hpp index a8e967b48b120..55f5d8241db43 100644 --- a/sycl/include/CL/sycl/backend/level_zero.hpp +++ b/sycl/include/CL/sycl/backend/level_zero.hpp @@ -55,7 +55,7 @@ template <> struct InteropFeatureSupportMap { static constexpr bool MakeDevice = false; static constexpr bool MakeContext = false; static constexpr bool MakeQueue = false; - static constexpr bool MakeEvent = true; + static constexpr bool MakeEvent = false; static constexpr bool MakeBuffer = false; static constexpr bool MakeKernel = false; }; diff --git a/sycl/source/backend.cpp b/sycl/source/backend.cpp index 71e2649fc2920..a56f8c8f56685 100644 --- a/sycl/source/backend.cpp +++ b/sycl/source/backend.cpp @@ -16,8 +16,6 @@ #include #include -#include - __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { namespace detail { @@ -29,15 +27,15 @@ static const plugin &getPlugin(backend Backend) { case backend::level_zero: return pi::getPlugin(); default: - throw std::runtime_error{"Unsupported backend"}; + throw sycl::runtime_error{"Unsupported backend", PI_INVALID_OPERATION}; } } -__SYCL_EXPORT platform make_platform(pi_native_handle NativeHandle, - backend Backend) { +platform make_platform(pi_native_handle NativeHandle, backend Backend) { const auto &Plugin = getPlugin(Backend); - pi::PiPlatform PiPlatform; + // Create PI platform first. + pi::PiPlatform PiPlatform = nullptr; Plugin.call(NativeHandle, &PiPlatform); @@ -49,7 +47,7 @@ __SYCL_EXPORT device make_device(pi_native_handle NativeHandle, backend Backend) { const auto &Plugin = getPlugin(Backend); - pi::PiDevice PiDevice; + pi::PiDevice PiDevice = nullptr; Plugin.call(NativeHandle, nullptr, &PiDevice); // Construct the SYCL device from PI device. @@ -62,7 +60,7 @@ __SYCL_EXPORT context make_context(pi_native_handle NativeHandle, backend Backend) { const auto &Plugin = getPlugin(Backend); - pi::PiContext PiContext; + pi::PiContext PiContext = nullptr; Plugin.call( NativeHandle, 0, nullptr, false, &PiContext); // Construct the SYCL context from PI context. @@ -76,7 +74,7 @@ __SYCL_EXPORT queue make_queue(pi_native_handle NativeHandle, const auto &Plugin = getPlugin(Backend); const auto &ContextImpl = getSyclObjImpl(Context); // Create PI queue first. - pi::PiQueue PiQueue; + pi::PiQueue PiQueue = nullptr; Plugin.call( NativeHandle, ContextImpl->getHandleRef(), &PiQueue); // Construct the SYCL queue from PI queue. @@ -88,7 +86,7 @@ __SYCL_EXPORT event make_event(pi_native_handle NativeHandle, const context &Context, backend Backend) { const auto &Plugin = getPlugin(Backend); - pi::PiEvent PiEvent; + pi::PiEvent PiEvent = nullptr; Plugin.call(NativeHandle, &PiEvent); diff --git a/sycl/source/backend/opencl.cpp b/sycl/source/backend/opencl.cpp index b8d7e7a46480d..7edc615580086 100644 --- a/sycl/source/backend/opencl.cpp +++ b/sycl/source/backend/opencl.cpp @@ -6,7 +6,6 @@ // //===----------------------------------------------------------------------===// -#include "CL/sycl/backend.hpp" #include #include #include diff --git a/sycl/test/on-device/basic_tests/interop/construction_ocl.cpp b/sycl/test/on-device/basic_tests/interop/construction_ocl.cpp index 2ffdb9c18a3f0..cb59975c0c000 100644 --- a/sycl/test/on-device/basic_tests/interop/construction_ocl.cpp +++ b/sycl/test/on-device/basic_tests/interop/construction_ocl.cpp @@ -2,7 +2,9 @@ // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -lOpenCL %s -o %t.ocl.out // RUN: env SYCL_DEVICE_FILTER="opencl" %t.ocl.out +#include #include + #include constexpr auto BE = sycl::backend::opencl; diff --git a/sycl/test/on-device/basic_tests/interop/construction_ze.cpp b/sycl/test/on-device/basic_tests/interop/construction_ze.cpp index c4a6f96e70a74..19c2ebae28e88 100644 --- a/sycl/test/on-device/basic_tests/interop/construction_ze.cpp +++ b/sycl/test/on-device/basic_tests/interop/construction_ze.cpp @@ -18,17 +18,5 @@ int main() { sycl::platform NewPlt = sycl::make_platform(NativePlt); assert(NewPlt == Plt); - // TODO uncomment once events are supported in L0 backend interop. - /* - sycl::context Ctx{Dev}; - sycl::queue Q{Ctx, Dev}; - - sycl::event Evt = Q.single_task([]{}); - auto NativeEvt = Evt.get_native(); - - sycl::event NewEvt = sycl::make_event(NativeEvt, Ctx); - assert(NativeEvt == NewEvt.get_native()); - */ - return 0; }