amd-hip toolchain: pin CMAKE_HIP_COMPILER to TheRock's clang++#5489
Open
lumachad wants to merge 1 commit into
Open
amd-hip toolchain: pin CMAKE_HIP_COMPILER to TheRock's clang++#5489lumachad wants to merge 1 commit into
lumachad wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.