Skip to content

Commit 500bfed

Browse files
authored
Relax ROCm restrictions with LLVM 21 (#28421)
Relaxes the restriction to use ROCm with a bundled LLVM. The new state as of this PR * With ROCm 6.3, you can use either the bundled LLVM or LLVM 21+ * With ROCm <6.3, you can still only use the bundled LLVM * This is a LLVM limitation, they require ROCm 6.3+ Note: I only ran the `COMM=none` test suite, which did not pass 100%. Most tests passed, a few edge cases (like interop printf) did not work quite right. I consider that future work. IMO, its more important for things to mostly work and we can improve specific cases as users run into issues. Resolves #28007 [Reviewed by @e-kayrakli]
2 parents 4deddb4 + 04476fb commit 500bfed

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

compiler/llvm/clangUtil.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3029,6 +3029,17 @@ static void helpComputeClangArgs(std::string& clangCC,
30293029
}
30303030
#endif
30313031

3032+
#if HAVE_LLVM_VER >= 210
3033+
if (usingGpuLocaleModel() &&
3034+
getGpuCodegenType() == GpuCodegenType::GPU_CG_AMD_HIP) {
3035+
// this is need to make hipcub wrappers work since
3036+
// TempStorage is marked deprecated, but I can't seem to find an alternative
3037+
// the rocm docs do not mention the deprecation and I can't find proper docs
3038+
// for the new API that the warning refers to
3039+
clangCCArgs.push_back("-Wno-deprecated-declarations");
3040+
}
3041+
#endif
3042+
30323043
// Add debug flags
30333044
if (fDebugSymbols) {
30343045
clangCCArgs.push_back("-g");
@@ -4966,7 +4977,7 @@ static void makeBinaryLLVMForHIP(const std::string& artifactFilename,
49664977
// So this loop should run exactly one iteration.
49674978
INT_ASSERT(gpuArches.size() == 1);
49684979

4969-
std::string targets = "-targets=host-x86_64-unknown-linux";
4980+
std::string targets = "-targets=host-x86_64-unknown-linux-unknown";
49704981
#if HAVE_LLVM_VER >= 150
49714982
std::string inputs = "-input=/dev/null ";
49724983
std::string outputs = "-output=" + fatbinFilename;

util/chplenv/chpl_gpu.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -465,23 +465,19 @@ def _validate_cuda_llvm_version_impl(gpu: gpu_type):
465465
)
466466

467467
def _validate_rocm_llvm_version_impl(gpu: gpu_type):
468-
major_version = get_sdk_version().split('.')[0]
468+
major_version, minor_version = get_sdk_version().split('.')[:2]
469469

470470
if major_version in ('5',) and chpl_llvm.get() == 'bundled':
471471
error("Cannot target AMD GPUs with CHPL_LLVM=bundled")
472-
elif major_version == '6' and chpl_llvm.get() != 'bundled' and os.environ.get("CHPL_LLVM_65188_PATCH", "0") != "1":
473-
# once https://github.com/llvm/llvm-project/issues/65188 is resolved,
474-
# this check can removed
475-
# 'CHPL_LLVM_65188_PATCH' is a temporary escape hatch to enable system
476-
# llvm with rocm 6.x if the user knows what they are doing
477-
error("Cannot target AMD GPUs with ROCm 6.x without CHPL_LLVM=bundled")
478-
# TODO: can we use LLVM 20 with ROCm 6.3?
479-
elif (
480-
major_version == "6"
481-
and chpl_llvm.get() == "system"
482-
and int(chpl_llvm.get_llvm_version()) < 18
483-
):
484-
error("Cannot target AMD GPUs with ROCm 6.x without LLVM 18+")
472+
elif major_version == '6':
473+
if int(minor_version) < 3:
474+
# it must be bundled LLVM or patched
475+
if chpl_llvm.get() != 'bundled' and os.environ.get("CHPL_LLVM_65188_PATCH", "0") != "1":
476+
error("Cannot target AMD GPUs with ROCm 6.0-6.2 without CHPL_LLVM=bundled")
477+
else:
478+
# it must be LLVM 21+ or the bundled LLVM
479+
if chpl_llvm.get() != 'bundled' and int(chpl_llvm.get_llvm_version()) < 21:
480+
error("Cannot target AMD GPUs with ROCm 6.3 without CHPL_LLVM=bundled or LLVM 21+")
485481
elif not validateLlvmBuiltForTgt(gpu.llvm_target):
486482
_reportMissingGpuReq(
487483
"LLVM not built for %s." % gpu.llvm_target, allowExempt=False

0 commit comments

Comments
 (0)