@@ -512,17 +512,33 @@ class Chapel(AutotoolsPackage, CudaPackage, ROCmPackage):
512512 with when ("+rocm" ):
513513 conflicts ("llvm=none" , msg = "ROCm support requires building with LLVM" )
514514
515- # Chapel restricts the allowable ROCm versions
516- depends_on ("hsa-rocr-dev@6.0:6.2" )
517- depends_on ("hip@6.0:6.2" )
518-
519515 conflicts ("@:2.1" , msg = "ROCm support in spack requires Chapel 2.2.0 or later" )
520516
521- # This is the case because the package only supports ROCm 6, and Chapel
522- # requires bundled LLVM for that version.
523- # TODO: Modify this constrant and message if/when Chapel supports an
524- # additional ROCm version without tht requirement.
525- requires ("llvm=bundled" , msg = "Chapel ROCm support requires llvm=bundled" )
517+ # Chapel restricts the allowable ROCm versions
518+ with when ("@:2.7" ):
519+ depends_on ("hsa-rocr-dev@6.0:6.2" )
520+ depends_on ("hip@6.0:6.2" )
521+ with when ("@2.8:" ):
522+ depends_on ("hsa-rocr-dev@6.0:6.3,7" )
523+ depends_on ("hip@6.0:6.3,7" )
524+
525+ # Chapel requires using the (patched) bundled LLVM for some versions
526+ # of ROCm.
527+ # Switching off of hsa-rocr-dev version rather than both it and hip,
528+ # with the assumption they will always be the same, but if that changes
529+ # this will need to be adjusted.
530+ with when ("^hsa-rocr-dev@6.0:6.2" ):
531+ requires ("llvm=bundled" , msg = "Chapel ROCm 6.0-6.2 support requires llvm=bundled" )
532+ with when ("^hsa-rocr-dev@6.3:6" ):
533+ # For 6.3-6.x, either bundled LLVM or system LLVM >= 21 is allowed.
534+ depends_on ("llvm@21:" , when = "llvm=spack" )
535+ with when ("^hsa-rocr-dev@7" ):
536+ # For 7.x, we require LLVM >= 21, and as of release 2.8 the bundled
537+ # LLVM is 19, so effectively we require _system_ LLVM >= 21.
538+ # TODO: Modify this constraint and message when Chapel releases
539+ # with a bundled LLVM >= 21.
540+ requires ("llvm=spack" , msg = "Chapel ROCm 7 support currently requires llvm=spack" )
541+ depends_on ("llvm@21:" )
526542
527543 # Workaround for ROCmPackage forcing a dependency on llvm-amdgpu, which
528544 # provides %rocmcc, which we don't want to use.
0 commit comments