@@ -762,6 +762,27 @@ def remove_level_zero_suffix(devices):
762
762
# discovered already.
763
763
config .sycl_dev_features = {}
764
764
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
+
765
786
# Version of the driver for a given device. Empty for non-Intel devices.
766
787
config .intel_driver_ver = {}
767
788
for full_name , sycl_device in zip (
@@ -910,6 +931,8 @@ def remove_level_zero_suffix(devices):
910
931
# Add corresponding target feature
911
932
target = config .backend_to_target [be ]
912
933
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" )
913
936
914
937
if be == "hip" :
915
938
if not config .amd_arch :
0 commit comments