summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/hip/package.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/hip/package.py b/var/spack/repos/builtin/packages/hip/package.py
index 483b6d43bd..f0235f1aea 100644
--- a/var/spack/repos/builtin/packages/hip/package.py
+++ b/var/spack/repos/builtin/packages/hip/package.py
@@ -475,6 +475,19 @@ class Hip(CMakePackage):
env.set("HIP_PATH", self.spec.prefix)
env.set("HIP_PLATFORM", "nvidia")
+ # Set up hipcc/hip-clang to use the specific GCC toolchain that is
+ # being used to compile. This is only important for external ROCm
+ # installations, which may otherwise pick up the wrong GCC toolchain.
+ if self.spec.external and self.spec.satisfies("%gcc"):
+ # This is picked up by hipcc.
+ env.append_path(
+ "HIPCC_COMPILE_FLAGS_APPEND",
+ f"--gcc-toolchain={self.compiler.prefix}",
+ separator=" ",
+ )
+ # This is picked up by CMake when using HIP as a CMake language.
+ env.append_path("HIPFLAGS", f"--gcc-toolchain={self.compiler.prefix}", separator=" ")
+
def setup_build_environment(self, env):
self.set_variables(env)