@@ -365,18 +365,24 @@ def __init__(self, *args, **kwargs):
365365 # There are (old) toolchains with CUDA as part of the toolchain
366366 cuda_toolchain = hasattr (self .toolchain , 'COMPILER_CUDA_FAMILY' )
367367 if 'cuda' in deps or cuda_toolchain or cuda_cc_list :
368- build_targets .append (BUILD_TARGET_NVPTX )
369- self .offload_targets += ['cuda' ] # Used for LLVM >= 19
370- self .log .debug (f"{ BUILD_TARGET_NVPTX } enabled by CUDA dependency/cuda_compute_capabilities" )
368+ if LooseVersion (self .version ) < LooseVersion ('18' ):
369+ self .log .warning ("CUDA support is only available in LLVM >= 18" )
370+ else :
371+ build_targets .append (BUILD_TARGET_NVPTX )
372+ self .offload_targets += ['cuda' ] # Used for LLVM >= 19
373+ self .log .debug (f"{ BUILD_TARGET_NVPTX } enabled by CUDA dependency/cuda_compute_capabilities" )
371374
372375 # For AMDGPU support we need ROCR-Runtime and
373376 # ROCT-Thunk-Interface, however, since ROCT is a dependency of
374377 # ROCR we only check for the ROCR-Runtime here
375378 # https://openmp.llvm.org/SupportAndFAQ.html#q-how-to-build-an-openmp-amdgpu-offload-capable-compiler
376379 if 'rocr-runtime' in deps or amd_gfx_list :
377- build_targets .append (BUILD_TARGET_AMDGPU )
378- self .offload_targets += ['amdgpu' ] # Used for LLVM >= 19
379- self .log .debug (f"{ BUILD_TARGET_AMDGPU } enabled by rocr-runtime dependency/amd_gfx_list" )
380+ if LooseVersion (self .version ) < LooseVersion ('18' ):
381+ self .log .warning ("AMDGPU support is only available in LLVM >= 18" )
382+ else :
383+ build_targets .append (BUILD_TARGET_AMDGPU )
384+ self .offload_targets += ['amdgpu' ] # Used for LLVM >= 19
385+ self .log .debug (f"{ BUILD_TARGET_AMDGPU } enabled by rocr-runtime dependency/amd_gfx_list" )
380386
381387 self .cfg ['build_targets' ] = build_targets
382388 self .log .debug ("Using %s as default build targets for CPU architecture %s." , build_targets , arch )
0 commit comments