Repository navigation
fix(compiler): pin host LLVM_ENABLE_PER_TARGET_RUNTIME_DIR to OFF - #7559
Merged
Merged
Conversation
The amd-llvm subproject declares INTERFACE_LINK_DIRS and INTERFACE_INSTALL_RPATH_DIRS as lib/llvm/lib, so every consumer links and runs against a flat host runtime directory. LLVM defaults LLVM_ENABLE_PER_TARGET_RUNTIME_DIR to ON on Linux, which installs libomp.so, libomptarget, libunwind and libc++abi into lib/llvm/lib/<host-triple>/ instead - outside the RUNPATH TheRock hands out. rocsparse-test, for example, has NEEDED libomp.so and RUNPATH $ORIGIN/../lib/llvm/lib, and fails at load with "libomp.so: cannot open shared object file". Builds have not hit this because amd-staging carries an unconditional override of the default in llvm/CMakeLists.txt. TheRock should not depend on a compiler-side patch for its own install layout: the knob is a CACHE BOOL, so pinning it on the configure line makes the requirement explicit and keeps the build correct against a stock upstream LLVM. This is the host triple only. The device runtimes keep the per-target layout via RUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_PER_TARGET_RUNTIME_DIR, unchanged. ISSUE ID: #7557
✅ All Checks Passed — Ready for Review
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🎉 All checks passed! This PR is ready for review. |
lamb-j
commented
Aug 21, 2026
kasaurov
approved these changes
Aug 21, 2026
kasaurov
left a comment
Contributor
There was a problem hiding this comment.
LGTM, very reasonable solution.
ronlieb
pushed a commit
to ROCm/llvm-project
that referenced
this pull request
Aug 30, 2026
…rride (#4179) ## Downstream delta removed `amd-staging` carries a one-line AMD-local override that clobbers upstream's platform default immediately after it is computed: ```cmake if(CMAKE_SYSTEM_NAME MATCHES "BSD|Linux|OS390|AIX") set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default ON) else() set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default OFF) endif() set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default OFF) # <-- removed ``` After this change `llvm/CMakeLists.txt` has **zero** `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR` divergence from `upstream/main`. Upstream is moving toward keeping this ON by default and dropping the option entirely, so carrying the override moves us further from upstream over time. ## Why it existed ROCm consumers assumed the flat `lib/llvm/lib` layout. With the per-target directory on, `libomp.so` moves to `lib/llvm/lib/<host-triple>/` while consumer RUNPATHs still point at `lib/llvm/lib` — the library ships but cannot be loaded. ## Why TheRock is unaffected TheRock passes `-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR` explicitly (ROCm/TheRock#7559; ROCm/TheRock#7082 moves it to `ON` and fixes the consumers). A command-line `-D` beats a `set(... CACHE ...)` without `FORCE`, so TheRock's value wins regardless of the default here.
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.
Passes
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFFfor the host triple in theamd-llvmsubproject'sCMAKE_ARGS.The subproject declares its interface directories as a flat host runtime tree —
INSTALL_DESTINATION "lib/llvm",INTERFACE_LINK_DIRS "lib/llvm/lib",INTERFACE_INSTALL_RPATH_DIRS "lib/llvm/lib"— but never sets the knob that controls whether LLVM actually installs there. Upstream defaults it ON forBSD|Linux|OS390|AIX, which putslibomp.so,libomptarget,libunwindandlibc++abiinlib/llvm/lib/<host-triple>/, one directory below the RUNPATH TheRock hands its own consumers.From a shipped 7.12 tree:
With the default in effect,
rocsparse-testand rocFFT fail at load withlibomp.so: cannot open shared object file.This has not bitten us because
amd-stagingpins the default OFF unconditionally inllvm/CMakeLists.txt, right after the platform block. That makes TheRock's install layout depend on a compiler-side patch it does not own — any LLVM branch without the override, including stock upstream, produces a broken dist. The knob is aCACHE BOOL, so setting it on the configure line needs no LLVM source change and makes the requirement explicit at the point that relies on it.Setting it unconditionally is a no-op on Windows, where the upstream default is already OFF.
This is the host triple only.
RUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON— the device runtimes, which TheRock does want per-target — is unchanged; the two now sit adjacent with a comment distinguishing them.ISSUE ID: #7557