@@ -442,8 +442,6 @@ def open_check_file(file_name):
442442 )
443443 sp = subprocess .check_output (cmd , text = True , shell = True )
444444 for line in sp .splitlines ():
445- if "gfx90a" in line :
446- config .available_features .add ("gpu-amd-gfx90a" )
447445 if not line .startswith ("[" ):
448446 continue
449447 (backend , device ) = line [1 :].split ("]" )[0 ].split (":" )
@@ -540,42 +538,6 @@ def open_check_file(file_name):
540538 config .cuda_libs_dir = os .path .join (os .environ ["CUDA_PATH" ], r"lib64" )
541539 config .cuda_include = os .path .join (os .environ ["CUDA_PATH" ], "include" )
542540
543- # FIXME: This needs to be made per-device as well, possibly with a helper.
544- if "hip:gpu" in config .sycl_devices and config .hip_platform == "AMD" :
545- if not config .amd_arch :
546- lit_config .error (
547- "Cannot run tests for HIP without an offload-arch. Please "
548- + "specify one via the 'amd_arch' parameter or 'AMD_ARCH' CMake "
549- + "variable."
550- )
551- llvm_config .with_system_environment ("ROCM_PATH" )
552- config .available_features .add ("hip_amd" )
553- arch_flag = (
554- "-Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=" + config .amd_arch
555- )
556- config .substitutions .append (
557- ("%rocm_path" , os .environ .get ("ROCM_PATH" , "/opt/rocm" ))
558- )
559- elif "hip:gpu" in config .sycl_devices and config .hip_platform == "NVIDIA" :
560- config .available_features .add ("hip_nvidia" )
561- arch_flag = ""
562- else :
563- arch_flag = ""
564-
565- if lit_config .params .get ("compatibility_testing" , False ):
566- config .substitutions .append (("%clangxx" , " true " ))
567- config .substitutions .append (("%clang" , " true " ))
568- else :
569- config .substitutions .append (
570- (
571- "%clangxx" ,
572- " " + config .dpcpp_compiler + " " + config .cxx_flags + " " + arch_flag ,
573- )
574- )
575- config .substitutions .append (
576- ("%clang" , " " + config .dpcpp_compiler + " " + config .c_flags )
577- )
578-
579541config .substitutions .append (("%threads_lib" , config .sycl_threads_lib ))
580542
581543if lit_config .params .get ("ze_debug" ):
@@ -799,12 +761,50 @@ def open_check_file(file_name):
799761 # Use short names for LIT rules.
800762 features .add (be )
801763
764+ if be == "hip" and config .hip_platform == "AMD" :
765+ if not config .amd_arch :
766+ # Guaranteed to be a single element in the set
767+ arch = [x for x in architecture_feature ][0 ]
768+ amd_arch_prefix = "arch-amd_gpu_"
769+ if amd_arch_prefix not in arch or len (architecture_feature ) != 1 :
770+ lit_config .error (
771+ "Cannot detect architecture for AMD HIP device, specify it explicitly"
772+ )
773+ config .amd_arch = arch .replace (amd_arch_prefix , "" )
774+ llvm_config .with_system_environment ("ROCM_PATH" )
775+ config .available_features .add ("hip_amd" )
776+ arch_flag = (
777+ "-Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=" + config .amd_arch
778+ )
779+ config .substitutions .append (
780+ ("%rocm_path" , os .environ .get ("ROCM_PATH" , "/opt/rocm" ))
781+ )
782+ elif be == "hip" and config .hip_platform == "NVIDIA" :
783+ config .available_features .add ("hip_nvidia" )
784+ arch_flag = ""
785+ else :
786+ arch_flag = ""
787+
802788 config .sycl_dev_features [sycl_device ] = features .union (config .available_features )
803789 if is_intel_driver :
804790 config .intel_driver_ver [sycl_device ] = intel_driver_ver
805791 else :
806792 config .intel_driver_ver [sycl_device ] = {}
807793
794+ if lit_config .params .get ("compatibility_testing" , False ):
795+ config .substitutions .append (("%clangxx" , " true " ))
796+ config .substitutions .append (("%clang" , " true " ))
797+ else :
798+ config .substitutions .append (
799+ (
800+ "%clangxx" ,
801+ " " + config .dpcpp_compiler + " " + config .cxx_flags + " " + arch_flag ,
802+ )
803+ )
804+ config .substitutions .append (
805+ ("%clang" , " " + config .dpcpp_compiler + " " + config .c_flags )
806+ )
807+
808808# Set timeout for a single test
809809try :
810810 import psutil
0 commit comments