@@ -441,7 +441,7 @@ def open_check_file(file_name):
441441 "{} {}" .format (config .run_launcher , sycl_ls ) if config .run_launcher else sycl_ls
442442 )
443443 sp = subprocess .check_output (cmd , text = True , shell = True )
444- for line in sp .splitlines ():
444+ for line in sp .splitlines ():
445445 if not line .startswith ("[" ):
446446 continue
447447 (backend , device ) = line [1 :].split ("]" )[0 ].split (":" )
@@ -761,41 +761,37 @@ def open_check_file(file_name):
761761 # Use short names for LIT rules.
762762 features .add (be )
763763
764+ if be == "hip" and config .hip_platform == "AMD" :
765+ if not config .amd_arch :
766+ arch = ""
767+ for a in architecture_feature :
768+ arch = a
769+ amd_arch_prefix = "arch-amd_gpu_"
770+ if amd_arch_prefix not in arch or len (architecture_feature ) != 1 :
771+ lit_config .error (
772+ "Cannot detect architecture for AMD HIP device, specify it explicitly"
773+ )
774+ config .amd_arch = arch .replace (amd_arch_prefix , "" )
775+ llvm_config .with_system_environment ("ROCM_PATH" )
776+ config .available_features .add ("hip_amd" )
777+ arch_flag = (
778+ "-Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=" + config .amd_arch
779+ )
780+ config .substitutions .append (
781+ ("%rocm_path" , os .environ .get ("ROCM_PATH" , "/opt/rocm" ))
782+ )
783+ elif be == "hip" and config .hip_platform == "NVIDIA" :
784+ config .available_features .add ("hip_nvidia" )
785+ arch_flag = ""
786+ else :
787+ arch_flag = ""
788+
764789 config .sycl_dev_features [sycl_device ] = features .union (config .available_features )
765790 if is_intel_driver :
766791 config .intel_driver_ver [sycl_device ] = intel_driver_ver
767792 else :
768793 config .intel_driver_ver [sycl_device ] = {}
769794
770- if "hip:gpu" in config .sycl_devices and config .hip_platform == "AMD" :
771- if not config .amd_arch :
772- amd_arch_prefix = "arch-amd_gpu_"
773- amd_device_arch = [
774- i for i in config .sycl_dev_features ["hip:gpu" ] if amd_arch_prefix in i
775- ]
776- if len (amd_device_arch ) == 0 :
777- lit_config .error (
778- "Cannot detect architecture for AMD HIP device, specify it explicitly"
779- )
780- if len (amd_device_arch ) > 1 :
781- lit_config .warning (
782- "Multiple AMD HIP devices, using the architecture from the first one"
783- )
784- config .amd_arch = amd_device_arch [0 ].replace (amd_arch_prefix , "" )
785- llvm_config .with_system_environment ("ROCM_PATH" )
786- config .available_features .add ("hip_amd" )
787- arch_flag = (
788- "-Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=" + config .amd_arch
789- )
790- config .substitutions .append (
791- ("%rocm_path" , os .environ .get ("ROCM_PATH" , "/opt/rocm" ))
792- )
793- elif "hip:gpu" in config .sycl_devices and config .hip_platform == "NVIDIA" :
794- config .available_features .add ("hip_nvidia" )
795- arch_flag = ""
796- else :
797- arch_flag = ""
798-
799795if lit_config .params .get ("compatibility_testing" , False ):
800796 config .substitutions .append (("%clangxx" , " true " ))
801797 config .substitutions .append (("%clang" , " true " ))
@@ -808,13 +804,7 @@ def open_check_file(file_name):
808804 )
809805 config .substitutions .append (
810806 ("%clang" , " " + config .dpcpp_compiler + " " + config .c_flags )
811- )
812-
813- # Update each device's features with anything added during HIP device handling
814- for sycl_device in config .sycl_devices :
815- config .sycl_dev_features [sycl_device ] = config .sycl_dev_features [sycl_device ].union (
816- config .available_features
817- )
807+ )
818808
819809# Set timeout for a single test
820810try :
0 commit comments