[HIP] Fix distro HIP headers shadowing ROCm includes #238058
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.37) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 217 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 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
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.322
Real PR Conversation Timeline
1 comments
"Review active on #238058"
general
weight: 0.35
david-salinas
When ROCm is installed in a non-system directory (e.g. /opt/rocm) alongside a distro HIP package that places older headers in /usr/include/hip/, the unconditional use of -idirafter for the ROCm include path causes /usr/include to be searched first. This silently picks up the older distro headers
instead of the ROCm ones, leading to build failures with newer APIs and version mismatches at runtime.
Split AddHIPIncludeArgs into two phases so the ROCm toolkit include path is emitted at the correct position in the cc1 search order:
- Early (AddHIPIncludeArgs, existing call site): emits only wrapper headers (cuda_wrappers/) before C++ stdlib headers, preserving #include_next chains.
- Late (AddHIPIncludeArgsLate, new call site between AddClangCXXStdlibIncludeArgs and AddClangSystemIncludeArgs): emits the ROCm toolkit include path (/opt/rocm/include, /usr/include, etc.) after C++ stdlib but before C system headers.
This produces the correct search order for all install locations:
1. cuda_wrappers/ (early, -internal-isystem)
2. C++ stdlib (AddClangCXXStdlibIncludeArgs)
3. ROCm include (late, -internal-isystem) ← beats /usr/include
4. /usr/include (AddClangSystemIncludeArgs)
The previous commit used a path-based conditional (IncPath.starts_with(SysRoot + "/usr/")) to choose between -idirafter and -internal-isystem. Review identified two bugs: a double-slash when sysroot has a trailing /, and --rocm-path=/usr/local/rocm still using -idirafter. The positional approach
handles all install locations uniformly without path comparisons, and preserves the #include_next fix from cd59758 by construction rather than by special-casing.