@@ -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" ):
@@ -805,6 +767,44 @@ def open_check_file(file_name):
805767 else :
806768 config .intel_driver_ver [sycl_device ] = {}
807769
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 = [i for i in config .sycl_dev_features ["hip:gpu" ] if amd_arch_prefix in i ]
774+ if len (amd_device_arch ) == 0 :
775+ lit_config .error (
776+ "Cannot detect architecture for AMD HIP device, specify it explicitly"
777+ )
778+ if len (amd_device_arch ) > 1 :
779+ lit_config .warning ("Multiple AMD HIP devices, using the architecture from the first one" )
780+ config .amd_arch = amd_device_arch [0 ].replace (amd_arch_prefix , "" )
781+ llvm_config .with_system_environment ("ROCM_PATH" )
782+ config .available_features .add ("hip_amd" )
783+ arch_flag = (
784+ "-Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=" + config .amd_arch
785+ )
786+ config .substitutions .append (
787+ ("%rocm_path" , os .environ .get ("ROCM_PATH" , "/opt/rocm" ))
788+ )
789+ elif "hip:gpu" in config .sycl_devices and config .hip_platform == "NVIDIA" :
790+ config .available_features .add ("hip_nvidia" )
791+ arch_flag = ""
792+ else :
793+ arch_flag = ""
794+
795+ if lit_config .params .get ("compatibility_testing" , False ):
796+ config .substitutions .append (("%clangxx" , " true " ))
797+ config .substitutions .append (("%clang" , " true " ))
798+ else :
799+ config .substitutions .append (
800+ (
801+ "%clangxx" ,
802+ " " + config .dpcpp_compiler + " " + config .cxx_flags + " " + arch_flag ,
803+ )
804+ )
805+ config .substitutions .append (
806+ ("%clang" , " " + config .dpcpp_compiler + " " + config .c_flags )
807+ )
808808# Set timeout for a single test
809809try :
810810 import psutil
0 commit comments