diff --git a/sycl/test-e2e/KernelAndProgram/persistent-cache-multi-device.cpp b/sycl/test-e2e/KernelAndProgram/persistent-cache-multi-device.cpp index 9d7f28849458a..783a747d8e436 100644 --- a/sycl/test-e2e/KernelAndProgram/persistent-cache-multi-device.cpp +++ b/sycl/test-e2e/KernelAndProgram/persistent-cache-multi-device.cpp @@ -1,4 +1,4 @@ -// REQUIRES: (level_zero || opencl) && linux && gpu +// REQUIRES: (level_zero || opencl) && linux && gpu && multi-device-emulation // RUN: %{build} -o %t.out // RUN: rm -rf %t/cache_dir diff --git a/sycl/test-e2e/KernelCompiler/opencl_multi_device.cpp b/sycl/test-e2e/KernelCompiler/opencl_multi_device.cpp index fe4e8c377aa58..b234f33c07513 100644 --- a/sycl/test-e2e/KernelCompiler/opencl_multi_device.cpp +++ b/sycl/test-e2e/KernelCompiler/opencl_multi_device.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: (opencl || level_zero) && ocloc +// REQUIRES: (opencl || level_zero) && ocloc && multi-device-emulation // UNSUPPORTED: accelerator // UNSUPPORTED-INTENDED: while accelerator is AoT only, this cannot run there. diff --git a/sycl/test-e2e/ProgramManager/multi_device_bundle/build_twice.cpp b/sycl/test-e2e/ProgramManager/multi_device_bundle/build_twice.cpp index 221d136dacf38..46348e956c255 100644 --- a/sycl/test-e2e/ProgramManager/multi_device_bundle/build_twice.cpp +++ b/sycl/test-e2e/ProgramManager/multi_device_bundle/build_twice.cpp @@ -1,4 +1,4 @@ -// REQUIRES: gpu && linux && (opencl || level_zero) +// REQUIRES: gpu && linux && (opencl || level_zero) && multi-device-emulation // Test to check that we can create input kernel bundle and call build twice for // overlapping set of devices and execute the kernel on each device. diff --git a/sycl/test-e2e/ProgramManager/multi_device_bundle/compile_link.cpp b/sycl/test-e2e/ProgramManager/multi_device_bundle/compile_link.cpp index 9ce40303a3e8d..41856a3f65b0c 100644 --- a/sycl/test-e2e/ProgramManager/multi_device_bundle/compile_link.cpp +++ b/sycl/test-e2e/ProgramManager/multi_device_bundle/compile_link.cpp @@ -1,4 +1,4 @@ -// REQUIRES: gpu && linux && (opencl || level_zero) +// REQUIRES: gpu && linux && (opencl || level_zero) && multi-device-emulation // RUN: %{build} -o %t.out // RUN: env NEOReadDebugKeys=1 CreateMultipleRootDevices=3 %{run} %t.out diff --git a/sycl/test-e2e/ProgramManager/multi_device_bundle/device_libs_and_caching.cpp b/sycl/test-e2e/ProgramManager/multi_device_bundle/device_libs_and_caching.cpp index 2012b8a55a773..b02c5b934e0f3 100644 --- a/sycl/test-e2e/ProgramManager/multi_device_bundle/device_libs_and_caching.cpp +++ b/sycl/test-e2e/ProgramManager/multi_device_bundle/device_libs_and_caching.cpp @@ -1,4 +1,4 @@ -// REQUIRES: ocloc && gpu && linux && target-spir +// REQUIRES: ocloc && gpu && linux && target-spir && multi-device-emulation // Test to check several use cases for multi-device kernel bundles. // Test covers AOT and JIT cases. Kernel is using some math functions to enforce diff --git a/sycl/test-e2e/lit.cfg.py b/sycl/test-e2e/lit.cfg.py index c53aaadebb430..e7214995927d0 100644 --- a/sycl/test-e2e/lit.cfg.py +++ b/sycl/test-e2e/lit.cfg.py @@ -762,6 +762,37 @@ def remove_level_zero_suffix(devices): # discovered already. config.sycl_dev_features = {} + +# Function to check if multi-device-emulation feature is available +def check_multi_device_emulation(device): + try: + with test_env(): + cmd = "{} {}".format(config.run_launcher or "", sycl_ls) + mod_env = os.environ.copy() + mod_env["ONEAPI_DEVICE_SELECTOR"] = device + sp = subprocess.run( + cmd, env=mod_env, text=True, shell=True, capture_output=True + ) + sp.check_returncode() + regular_device_count = sum( + 1 for line in sp.stdout.splitlines() if line.startswith("[") + ) + mod_env["NEOReadDebugKeys"] = "1" + mod_env["CreateMultipleRootDevices"] = str(regular_device_count * 2) + sp = subprocess.run( + cmd, env=mod_env, text=True, shell=True, capture_output=True + ) + sp.check_returncode() + emulated_device_count = sum( + 1 for line in sp.stdout.splitlines() if line.startswith("[") + ) + if emulated_device_count == regular_device_count * 2: + return True + return False + except Exception as e: + return False + + # Version of the driver for a given device. Empty for non-Intel devices. config.intel_driver_ver = {} for full_name, sycl_device in zip( @@ -910,6 +941,9 @@ def remove_level_zero_suffix(devices): # Add corresponding target feature target = config.backend_to_target[be] features.add(target) + if sycl_device == "opencl:gpu" or sycl_device == "level_zero:gpu": + if check_multi_device_emulation(sycl_device): + features.add("multi-device-emulation") if be == "hip": if not config.amd_arch: