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
26 changes: 21 additions & 5 deletions sycl/include/sycl/backend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,17 @@ make_queue(const typename backend_traits<Backend>::template input_type<queue>
const context &TargetContext, const async_handler Handler = {}) {
auto KeepOwnership =
Backend == backend::ext_oneapi_cuda || Backend == backend::ext_oneapi_hip;
return detail::make_queue(detail::ur::cast<ur_native_handle_t>(BackendObject),
false, TargetContext, nullptr, KeepOwnership, {},
Handler, Backend);
if constexpr (Backend == backend::ext_oneapi_level_zero) {
return detail::make_queue(
detail::ur::cast<ur_native_handle_t>(
std::get<ze_command_queue_handle_t>(BackendObject.NativeHandle)),
false, TargetContext, nullptr, KeepOwnership, {}, Handler, Backend);
}
if constexpr (Backend != backend::ext_oneapi_level_zero) {
return detail::make_queue(
detail::ur::cast<ur_native_handle_t>(BackendObject), false,
TargetContext, nullptr, KeepOwnership, {}, Handler, Backend);
}
}

template <backend Backend>
Expand All @@ -350,8 +358,16 @@ std::enable_if_t<detail::InteropFeatureSupportMap<Backend>::MakeEvent == true,
make_event(const typename backend_traits<Backend>::template input_type<event>
&BackendObject,
const context &TargetContext) {
return detail::make_event(detail::ur::cast<ur_native_handle_t>(BackendObject),
TargetContext, Backend);
if constexpr (Backend == backend::ext_oneapi_level_zero) {
return detail::make_event(
detail::ur::cast<ur_native_handle_t>(BackendObject.NativeHandle),
TargetContext, Backend);
}
if constexpr (Backend != backend::ext_oneapi_level_zero) {
return detail::make_event(
detail::ur::cast<ur_native_handle_t>(BackendObject), TargetContext,
Backend);
}
}

template <backend Backend>
Expand Down
20 changes: 7 additions & 13 deletions sycl/test-e2e/Basic/interop/interop_all_backends.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// XFAIL: any-device-is-opencl, any-device-is-cuda, any-device-is-level_zero, gpu-intel-dg2, hip_amd
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/15819
// XFAIL: any-device-is-cuda
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/16070
// RUN: %if any-device-is-opencl %{ %{build} -o %t-opencl.out %}
// RUN: %if any-device-is-level_zero %{ %{build} -DBUILD_FOR_L0 -o %t-l0.out %}
// RUN: %if any-device-is-cuda %{ %{build} -DBUILD_FOR_CUDA -o %t-cuda.out %}
// RUN: %if any-device-is-cuda %{ %{build} -isystem %sycl_include -DBUILD_FOR_CUDA -o %t-cuda.out %}
// RUN: %if any-device-is-hip %{ %{build} -DBUILD_FOR_HIP -o %t-hip.out %}

#include <sycl/backend.hpp>
Expand All @@ -20,17 +19,12 @@ using nativeEvent = CUevent;
#elif defined(BUILD_FOR_HIP)
#include <sycl/ext/oneapi/backend/hip.hpp>
constexpr auto BACKEND = backend::ext_oneapi_hip;
using nativeDevice = hipDevice_t;
using nativeQueue = hipStream_t;
using nativeEvent = hipEvent_t;
#elif defined(BUILD_FOR_L0)
constexpr auto BACKEND = backend::ext_oneapi_level_zero;
using nativeDevice = ze_device_handle_t;
using nativeQueue = ze_command_queue_handle_t;
using nativeEvent = ze_event_handle_t;
using nativeDevice = device;
using nativeQueue = ihipStream_t;
using nativeEvent = ihipEvent_t;
#else
constexpr auto BACKEND = backend::opencl;
using nativeDevice = cl_device;
using nativeDevice = cl_device_id;
using nativeQueue = cl_command_queue;
using nativeEvent = cl_event;
#endif
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <sycl/detail/core.hpp>
#include <sycl/kernel_bundle.hpp>

int main() {
sycl::device dev;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// REQUIRES: ocloc, level_zero, gpu, cpu
// REQUIRES: ocloc, any-device-is-level_zero, any-device-is-gpu, any-device-is-cpu
// REQUIRES: build-and-run-mode

// RUN: %clangxx -fsycl -fsycl-targets=spir64_fpga,spir64_gen -Xsycl-target-backend "-device *" %S/Inputs/is_compatible_with_env.cpp -o %t.out
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen "-device *" %S/Inputs/is_compatible_with_env.cpp -o %t.out

// RUN: env ONEAPI_DEVICE_SELECTOR=opencl:cpu %{run} not %t.out
// RUN: env ONEAPI_DEVICE_SELECTOR=opencl:fpga %{run} %t.out
// RUN: env ONEAPI_DEVICE_SELECTOR=opencl:gpu %{run} %t.out
// RUN: env ONEAPI_DEVICE_SELECTOR=level_zero:gpu %{run} %t.out
// RUN: env ONEAPI_DEVICE_SELECTOR=opencl:cpu %{run-unfiltered-devices} not %t.out
// RUN: env ONEAPI_DEVICE_SELECTOR=opencl:gpu %{run-unfiltered-devices} %t.out
// RUN: env ONEAPI_DEVICE_SELECTOR=level_zero:gpu %{run-unfiltered-devices} %t.out
Loading