[clang][Driver][HIP] Support Debian multiarch libamdhip64.so layout #208525
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.38) × (1 − Review Confidence (0.64)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.38 · 55 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.50 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.241
Real PR Conversation Timeline
2 items
Small nit. Should we combine these two " if (ActiveKinds & Action::OFK_HIP)" statements? Line #898 and #909?
lamb-j
talhaHavadar
On Debian and derivatives (Ubuntu, Mint, Pop!_OS), libamdhip64.so is installed under /usr/lib/<multiarch-triple>/ rather than /usr/lib/. As a result, RocmInstallationDetector::detectHIPRuntime() sets LibPath = <install>/lib and the driver then emits an absolute path (<lib>/libamdhip64.so) via Linux::addOffloadRTLibs that does not exist:
$ clang++ -x hip --offload-arch=gfx900 hello.hip -lamdhip64 -o hello
ld.lld: error: cannot open /usr/lib/libamdhip64.so: No such file
or directory
clang-linker-wrapper: error: 'ld.lld' failed
clang++: error: linker command failed with exit code 1
Fix this in Linux::addOffloadRTLibs, where the ToolChain (and therefore Linux::getMultiarchTriple()) is available: probe
<LibPath>/<multiarch-triple>/libamdhip64.so and, when the probe succeeds, extend the HIP lib path with the multiarch subdirectory before it is emitted. Using getMultiarchTriple() rather than the raw target triple matters — builds whose default triple carries
-unknown-(e.g.x86_64-unknown-linux-gnu) still map to the correct Debian directory name (x86_64-linux-gnu). The probe is guarded by FS.exists() so non-multiarch layouts (Fedora, Arch, /opt/rocm) fall through unchanged.Doing the adjustment once in Linux::addOffloadRTLibs keeps the fix in one place: the resulting HIPLibPath is then reused by every consumer that previously called RocmInstallation->getLibPath() directly:
the absolute libamdhip64.so path emitted for the linker,
the
-Lsearch path added for HIP, and*
-rpath(opt-in via -frtlib-add-rpath).RocmInstallationDetector is left untouched, so MSVC.cpp — which uses getLibPath() but does not participate in Linux multiarch — is unaffected.
Reported at https://github.com/ROCm/llvm-project/issues/3169
Supersedes: https://github.com/llvm/llvm-project/pull/207624
Tool use disclosure (per LLVM AI Tool Policy)
The multiarch probe in AMDGPU.cpp was authored by me, the similar hunk
I already carry downstream in debian/patches/0010-fixing-rocm-path.patch
for the llvm-toolchain-rocm package. An AI tool (Claude, Anthropic)
was used to extract just the upstream-relevant hunk from that bundled
downstream patch (which also contains Debian-specific packaging paths
that do not belong upstream), to draft the commit message and this PR
description, and to write the lit test at
clang/test/Driver/hip-multiarch-libs-linux.hip. I reviewed all of
the above before posting, stand behind the change, and can answer
questions about any part of it during review.