Skip to content

Commit da48b70

Browse files
committed
[SYCL][E2E] Add lit feature to check that multi-device emulation is supported
1 parent 5726072 commit da48b70

File tree

7 files changed

+29
-6
lines changed

7 files changed

+29
-6
lines changed

sycl/test-e2e/AddressSanitizer/dependency/shadow-virtual-mem.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// REQUIRES: aspect-ext_oneapi_virtual_mem, linux, (gpu && level_zero)
1+
// REQUIRES: aspect-ext_oneapi_virtual_mem, linux, (gpu && level_zero) && multi-device-emulation
22
// RUN: %{build} -o %t.out
33
// RUN: %{run} NEOReadDebugKeys=1 CreateMultipleRootDevices=2 %t.out
44

sycl/test-e2e/KernelAndProgram/persistent-cache-multi-device.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// REQUIRES: (level_zero || opencl) && linux && gpu
1+
// REQUIRES: (level_zero || opencl) && linux && gpu && multi-device-emulation
22

33
// RUN: %{build} -o %t.out
44
// RUN: rm -rf %t/cache_dir

sycl/test-e2e/KernelCompiler/opencl_multi_device.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// REQUIRES: (opencl || level_zero) && ocloc
9+
// REQUIRES: (opencl || level_zero) && ocloc && multi-device-emulation
1010
// UNSUPPORTED: accelerator
1111
// UNSUPPORTED-INTENDED: while accelerator is AoT only, this cannot run there.
1212

sycl/test-e2e/ProgramManager/multi_device_bundle/build_twice.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// REQUIRES: gpu && linux && (opencl || level_zero)
1+
// REQUIRES: gpu && linux && (opencl || level_zero) && multi-device-emulation
22

33
// Test to check that we can create input kernel bundle and call build twice for
44
// overlapping set of devices and execute the kernel on each device.

sycl/test-e2e/ProgramManager/multi_device_bundle/compile_link.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// REQUIRES: gpu && linux && (opencl || level_zero)
1+
// REQUIRES: gpu && linux && (opencl || level_zero) && multi-device-emulation
22

33
// RUN: %{build} -o %t.out
44
// RUN: env NEOReadDebugKeys=1 CreateMultipleRootDevices=3 %{run} %t.out

sycl/test-e2e/ProgramManager/multi_device_bundle/device_libs_and_caching.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// REQUIRES: ocloc && gpu && linux && target-spir
1+
// REQUIRES: ocloc && gpu && linux && target-spir && multi-device-emulation
22

33
// Test to check several use cases for multi-device kernel bundles.
44
// Test covers AOT and JIT cases. Kernel is using some math functions to enforce

sycl/test-e2e/lit.cfg.py

+23
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,27 @@ def remove_level_zero_suffix(devices):
762762
# discovered already.
763763
config.sycl_dev_features = {}
764764

765+
# Function to check if multi-device-emulation feature is available
766+
def check_multi_device_emulation(device):
767+
try:
768+
with test_env():
769+
cmd = "{} {}".format(config.run_launcher or "", sycl_ls)
770+
mod_env = os.environ.copy()
771+
mod_env["ONEAPI_DEVICE_SELECTOR"] = device
772+
sp = subprocess.run(cmd, env=mod_env, text=True, shell=True, capture_output=True)
773+
sp.check_returncode()
774+
regular_device_count = sum(1 for line in sp.stdout.splitlines() if line.startswith("["))
775+
mod_env["NEOReadDebugKeys"] = "1"
776+
mod_env["CreateMultipleRootDevices"] = str(regular_device_count * 2)
777+
sp = subprocess.run(cmd, env=mod_env, text=True, shell=True, capture_output=True)
778+
sp.check_returncode()
779+
emulated_device_count = sum(1 for line in sp.stdout.splitlines() if line.startswith("["))
780+
if emulated_device_count == regular_device_count * 2:
781+
return True
782+
return False
783+
except Exception as e:
784+
return False
785+
765786
# Version of the driver for a given device. Empty for non-Intel devices.
766787
config.intel_driver_ver = {}
767788
for full_name, sycl_device in zip(
@@ -910,6 +931,8 @@ def remove_level_zero_suffix(devices):
910931
# Add corresponding target feature
911932
target = config.backend_to_target[be]
912933
features.add(target)
934+
if (sycl_device == "opencl:gpu" or sycl_device == "level_zero:gpu") and check_multi_device_emulation(sycl_device):
935+
features.add("multi-device-emulation")
913936

914937
if be == "hip":
915938
if not config.amd_arch:

0 commit comments

Comments
 (0)