Skip to content

amd-hip toolchain: pin CMAKE_HIP_COMPILER to TheRock's clang++#5489

Open
lumachad wants to merge 1 commit into
mainfrom
users/lumachad/hip_compiler
Open

amd-hip toolchain: pin CMAKE_HIP_COMPILER to TheRock's clang++#5489
lumachad wants to merge 1 commit into
mainfrom
users/lumachad/hip_compiler

Conversation

@lumachad
Copy link
Copy Markdown
Contributor

@lumachad lumachad commented May 28, 2026

Motivation

Guarantee that HIP compiler users are using the TheRock-built compiler instead of a system-discovered one (rocr-debug-agent-tests and libhipcxx).

Technical Details

Subprojects declared with COMPILER_TOOLCHAIN amd-hip whose source enables the HIP language (project(... LANGUAGES HIP) or enable_language(HIP)) were falling through to CMakeDetermineHIPCompiler, which scans the system and silently picks up /opt/rocm-*/bin/* when a system ROCm install is present. Inside the manylinux build container this was latent; on a developer machine with /opt/rocm-7.3 installed it caused rocr-debug-agent-tests and libhipcxx to compile against the wrong toolchain.

Emit CMAKE_HIP_PLATFORM, CMAKE_HIP_COMPILER_ROCM_ROOT, and CMAKE_HIP_COMPILER (forced into the cache so the determine module skips detection) from the generated toolchain file, mirroring the pattern in examples/CMakeLists.txt (#102).

Test Plan

Tested by observing the HIP compiler used to build the mentioned subprojects. Also validated with a local validation script that confirms the cmake env variables are pointing at TheRock's compiler.

Test Result

Confirmed the correct compiler is being used.

Subprojects declared with COMPILER_TOOLCHAIN amd-hip whose source enables
the HIP language (project(... LANGUAGES HIP) or enable_language(HIP)) were
falling through to CMakeDetermineHIPCompiler, which scans the system and
silently picks up /opt/rocm-*/bin/* when a system ROCm install is present.
Inside the manylinux build container this was latent; on a developer
machine with /opt/rocm-7.3 installed it caused rocr-debug-agent-tests and
libhipcxx to compile against the wrong toolchain.

Emit CMAKE_HIP_PLATFORM, CMAKE_HIP_COMPILER_ROCM_ROOT, and
CMAKE_HIP_COMPILER (forced into the cache so the determine module skips
detection) from the generated toolchain file, mirroring the pattern in
examples/CMakeLists.txt (#102).

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: TODO

Development

Successfully merging this pull request may close these issues.

1 participant