← Back to Pull requests

[HIP] Fix distro HIP headers shadowing ROCm includes #238058

Open
unknown opened this pull request with 217 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 02, 2026 18:20 UTC
Author

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.

Diff: 217 lines (+162 / -55) across 2 files Reviewer: david-salinas Review duration: 41002m
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
0.37
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
46%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
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
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 46.7% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 36.7% (MEDIUM) · Higher = larger blast radius
36.7%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 46.7% · Lower = rushed or shallow review
46.7%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 19.6% · Safe to merge
19.6%