Fix wrong hip compiler in subproject#4663
Open
macurtis-amd wants to merge 1 commit intoROCm:mainfrom
Open
Conversation
If CMAKE_HIP_COMPILER is not set, sub-projects will incorrectly find
/opt/rocm*/lib/llvm/bin/clang++.
This may causes a build failure if the installed compiler is missing features
needed by the sub-project.
I was seeing:
```
FAILED: catch_tests/unit/rtc/CMakeFiles/RTC.dir/RtcFunctions.cpp.o
/opt/rocm-7.1.1/lib/llvm/bin/clang++ ...
In file included from .../rocm-systems/projects/hip-tests/catch/unit/rtc/RtcFunctions.cpp:14:
In file included from .../core/clr/dist/include/hip/hip_fp16.h:13:
.../core/clr/dist/include/hip/amd_detail/amd_hip_fp16.h:952:21: error: use of undeclared identifier '__builtin_elementwise_exp10'
952 | return __half_raw{__builtin_elementwise_exp10(static_cast<__half_raw>(x).data)};
| ^
```
73285d9 to
1969318
Compare
ScottTodd
approved these changes
Apr 22, 2026
Comment on lines
+1604
to
+1605
| string(APPEND _toolchain_contents "set(CMAKE_HIP_COMPILER \"\${CMAKE_CXX_COMPILER}\")\n") | ||
| string(APPEND _toolchain_contents "set(CMAKE_HIP_FLAGS_INIT \"\${CMAKE_CXX_FLAGS_INIT}\")\n") |
Member
There was a problem hiding this comment.
If
CMAKE_HIP_COMPILERis not set, sub-projects will incorrectly find/opt/rocm*/lib/llvm/bin/clang++.
Including these options here in TheRock is fine, but I suspect we should also fix this somehow in the rocm projects themselves. See #3976 for a description of the broader problem. Discovering a (likely different/mismatched) tool from somewhere on the system other than the current install could be more risky than just raising an exception and requiring setting it explicitly (like what this PR does).
Do you know where this CMAKE_HIP_COMPILER is falling back to /opt/rocm/ if unset?
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
If
CMAKE_HIP_COMPILERis not set, sub-projects will incorrectly find/opt/rocm*/lib/llvm/bin/clang++.This may causes a build failure if the installed compiler is missing features needed by the sub-project.
I was seeing:
Technical Details
Sets HIP-specific variables to the corresponding CXX variable for amd-hip toolchains.
Test Plan
Test Result
Submission Checklist