fix(rocthrust): don't pick up NVIDIA libcu++ in HIP builds #13342
All Vouch review confidence checks passed
Residual risk 0.29 = Change Risk (0.52) × (1 − Review Confidence (0.45)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 406 lines diff across 5 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
Diff Size
diff_size
0.359
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #13342"
general
weight: 0.35
umfranzw
Motivation
Fixes #104. HIP builds of rocThrust fail with
reference to __host__ function ... in __host__ __device__ functionwhen NVIDIA's libcu++ headers are in a default include directory (e.g. Debian/Ubuntulibcu++-dev, pulled in bynvidia-cuda-toolkitorlibthrust-dev).thrust/detail/config/libcxx.hprobes<cuda/std/version>to detect libhipcxx, but that also matches NVIDIA's libcu++. It pulls in NVIDIA's<nv/target>, which shares its include guard with rocThrust's HIP shim and always selects the host branch ofNV_IF_TARGET, even in device code.Technical Details
In
thrust/detail/config/libcxx.h:THRUST_DEVICE_SYSTEM, not the compiler, so host-compiled and HIP-compiled sources agree. Non-CUDA device systems only probe libhipcxx's<hip/std/version>alias (exported by its CMake target), which NVIDIA doesn't ship;<cuda/std/version>is only probed forTHRUST_DEVICE_SYSTEM_CUDA.<hip/std/version>branch (it compared MAJOR against the required MINOR, so the branch could never succeed).#errorwith a clear message if NVIDIA's<nv/target>is included in a HIP build, instead of many unrelated-looking errors.libcxx.hnow includesdevice_system.hitself, sinceconfig.hincludes it later (in rocthrust/hipccl2,device_system.hnow includescompiler.hfor its default). Builds without NVIDIA's headers are functionally unchanged. Applied toprojects/rocthrustand thehipccl2/hipccl3copies.Test Plan
Compiled the reproducer from #104 and a broader smoke test (sort_by_key, scans, unique, copy_if, binary_search) with NVIDIA's libcu++ added via
-idirafterto mimic/usr/include: versions 1.6.0, 1.8.1, 1.9.0, 2.3.2, 2.5.0, 2.8.5, 3.0.3 (Debian, Ubuntu and NVIDIA builds). Also: no CCCL, libhipcxx 10.1 (with and without NVIDIA's headers), the old-DUSE_LIBCUDACXX=0 -DUSE_LIBHIPCXX=0workaround, a g++ host-only build, and device resource usage of a kernel usingthrust::seq.After review, re-ran with 1.9.0, 2.8.5, 3.0.3 and libhipcxx 385f456 (hipccl3's pin), adding GCC/Clang host TUs with
-DTHRUST_DEVICE_SYSTEM=5, athrust::paircall split between a Clang host TU and a hipcc TU, and a preprocessed-output comparison against develop.Test Result
-DTHRUST_DEVICE_SYSTEM=5now select the same library as HIP TUs (previously NVIDIA'scuda::std, which failed to link against the HIP TU). Without NVIDIA's headers, preprocessed output matches develop (hipccl3 with libhipcxx differs only inhip::/cuda::aliases).#error.No regression test is included. Reviewers: is one wanted? It would compile the reproducer against two small fake NVIDIA headers via a per-test
test/<name>.cmake.Submission Checklist