Skip to content

Commit 0181367

Browse files
[SYCL][E2E] fix reenabled tests (#15975)
1 parent 931a93b commit 0181367

File tree

4 files changed

+34
-24
lines changed

4 files changed

+34
-24
lines changed

sycl/include/sycl/backend.hpp

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,17 @@ make_queue(const typename backend_traits<Backend>::template input_type<queue>
339339
const context &TargetContext, const async_handler Handler = {}) {
340340
auto KeepOwnership =
341341
Backend == backend::ext_oneapi_cuda || Backend == backend::ext_oneapi_hip;
342-
return detail::make_queue(detail::ur::cast<ur_native_handle_t>(BackendObject),
343-
false, TargetContext, nullptr, KeepOwnership, {},
344-
Handler, Backend);
342+
if constexpr (Backend == backend::ext_oneapi_level_zero) {
343+
return detail::make_queue(
344+
detail::ur::cast<ur_native_handle_t>(
345+
std::get<ze_command_queue_handle_t>(BackendObject.NativeHandle)),
346+
false, TargetContext, nullptr, KeepOwnership, {}, Handler, Backend);
347+
}
348+
if constexpr (Backend != backend::ext_oneapi_level_zero) {
349+
return detail::make_queue(
350+
detail::ur::cast<ur_native_handle_t>(BackendObject), false,
351+
TargetContext, nullptr, KeepOwnership, {}, Handler, Backend);
352+
}
345353
}
346354

347355
template <backend Backend>
@@ -350,8 +358,16 @@ std::enable_if_t<detail::InteropFeatureSupportMap<Backend>::MakeEvent == true,
350358
make_event(const typename backend_traits<Backend>::template input_type<event>
351359
&BackendObject,
352360
const context &TargetContext) {
353-
return detail::make_event(detail::ur::cast<ur_native_handle_t>(BackendObject),
354-
TargetContext, Backend);
361+
if constexpr (Backend == backend::ext_oneapi_level_zero) {
362+
return detail::make_event(
363+
detail::ur::cast<ur_native_handle_t>(BackendObject.NativeHandle),
364+
TargetContext, Backend);
365+
}
366+
if constexpr (Backend != backend::ext_oneapi_level_zero) {
367+
return detail::make_event(
368+
detail::ur::cast<ur_native_handle_t>(BackendObject), TargetContext,
369+
Backend);
370+
}
355371
}
356372

357373
template <backend Backend>

sycl/test-e2e/Basic/interop/interop_all_backends.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
// XFAIL: any-device-is-opencl, any-device-is-cuda, any-device-is-level_zero, gpu-intel-dg2, hip_amd
2-
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/15819
1+
// XFAIL: any-device-is-cuda
2+
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/16070
33
// RUN: %if any-device-is-opencl %{ %{build} -o %t-opencl.out %}
4-
// RUN: %if any-device-is-level_zero %{ %{build} -DBUILD_FOR_L0 -o %t-l0.out %}
5-
// RUN: %if any-device-is-cuda %{ %{build} -DBUILD_FOR_CUDA -o %t-cuda.out %}
4+
// RUN: %if any-device-is-cuda %{ %{build} -isystem %sycl_include -DBUILD_FOR_CUDA -o %t-cuda.out %}
65
// RUN: %if any-device-is-hip %{ %{build} -DBUILD_FOR_HIP -o %t-hip.out %}
76

87
#include <sycl/backend.hpp>
@@ -20,17 +19,12 @@ using nativeEvent = CUevent;
2019
#elif defined(BUILD_FOR_HIP)
2120
#include <sycl/ext/oneapi/backend/hip.hpp>
2221
constexpr auto BACKEND = backend::ext_oneapi_hip;
23-
using nativeDevice = hipDevice_t;
24-
using nativeQueue = hipStream_t;
25-
using nativeEvent = hipEvent_t;
26-
#elif defined(BUILD_FOR_L0)
27-
constexpr auto BACKEND = backend::ext_oneapi_level_zero;
28-
using nativeDevice = ze_device_handle_t;
29-
using nativeQueue = ze_command_queue_handle_t;
30-
using nativeEvent = ze_event_handle_t;
22+
using nativeDevice = device;
23+
using nativeQueue = ihipStream_t;
24+
using nativeEvent = ihipEvent_t;
3125
#else
3226
constexpr auto BACKEND = backend::opencl;
33-
using nativeDevice = cl_device;
27+
using nativeDevice = cl_device_id;
3428
using nativeQueue = cl_command_queue;
3529
using nativeEvent = cl_event;
3630
#endif

sycl/test-e2e/OptionalKernelFeatures/is_compatible/Inputs/is_compatible_with_env.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <sycl/detail/core.hpp>
2+
#include <sycl/kernel_bundle.hpp>
23

34
int main() {
45
sycl::device dev;
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
// REQUIRES: ocloc, level_zero, gpu, cpu
1+
// REQUIRES: ocloc, any-device-is-level_zero, any-device-is-gpu, any-device-is-cpu
22
// REQUIRES: build-and-run-mode
33

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

6-
// RUN: env ONEAPI_DEVICE_SELECTOR=opencl:cpu %{run} not %t.out
7-
// RUN: env ONEAPI_DEVICE_SELECTOR=opencl:fpga %{run} %t.out
8-
// RUN: env ONEAPI_DEVICE_SELECTOR=opencl:gpu %{run} %t.out
9-
// RUN: env ONEAPI_DEVICE_SELECTOR=level_zero:gpu %{run} %t.out
6+
// RUN: env ONEAPI_DEVICE_SELECTOR=opencl:cpu %{run-unfiltered-devices} not %t.out
7+
// RUN: env ONEAPI_DEVICE_SELECTOR=opencl:gpu %{run-unfiltered-devices} %t.out
8+
// RUN: env ONEAPI_DEVICE_SELECTOR=level_zero:gpu %{run-unfiltered-devices} %t.out

0 commit comments

Comments
 (0)