Repository navigation
[ROCm] Use HIP include paths in libtorch_agnostic version-compatibility test - #206919
amd-mcieslak wants to merge 1 commit into
Conversation
PR Status: in progressPlease address review feedback on your PR either with a code/PR description change. If a review comment is irrelevant, react with 👎 on that specific comment to reject it, and leave a short reply explaining why. The change must pass any running CI and existing failures must be classified as unrelated (see status below in this comment). Passing automated review does not guarantee that this PR will be merged. It still requires maintainer review and may be closed if its design or direction does not align with the project. To minimize iteration time, feel free to run the pr-review skill from the repo locally. To trigger a fresh automated review, make a new push or comment @pytorchbot review. To bypass automated review, please add the "no automated review" label. ✅ AUTOMATED REVIEW - OUTDATED (earlier commit) - Ready for human review:
Findings (3): Reviewed commit: 🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/206919
Note: Links to docs will display an error until the docs builds have been completed.
|
|
One or more co-authors of this pull request were not found. You must specify co-authors in commit message trailer via: Supported
Alternatively, if the co-author should not be included, remove the Please update your commit message(s) by doing |
…ty test The hipccl include dir added in pytorch#206478 reaches torch.utils.cpp_extension consumers but not this test, which never uses the extension builder: it assembles its own hipcc command line from the device_type "cpu" include set plus a hardcoded -I$GPU_HOME/include. The "cpu" set carries no ROCm paths at all, and $GPU_HOME/include is the parent of hipccl rather than hipccl itself, so libhipcxx stays unreachable and test_cuda_kernel_works_with_2_9 still fails on ROCm with "thrust/detail/config/libcxx.h:91: error: Could not find libhipcxx!". Request the "cuda" include set when IS_HIP_EXTENSION, reusing the directory list from pytorch#206478 rather than hardcoding the path a second time. Strict no-op on CUDA builds, which keep the "cpu" set.
27ee79c to
66639b0
Compare
|
/easycla |
Linked issue or supporting maintainer
Supported by @jeffdaily
BC-breaking?
No. Strict no-op on CUDA builds:
IS_HIP_EXTENSIONis false there, so the test keeps thedevice_type="cpu"include set it uses today. Only ROCm/HIP builds get a different include list.Summary (human written)
This is a follow-up to PR #206478, which added
<rocm>/include/hipcclto the include path. However, it does not fix tests that do not use the extension builder. In particular,test_cuda_kernel_works_with_2_9usestorch_include_paths(device_type="cpu")which does not have ROCm paths in it. Because of this, libhipcxx is unreachable and the test does not compile, producing the error: "Could not find libhipcxx!".The change in this PR is to request the
"cuda"include set when torch is built against ROCm (IS_HIP_EXTENSIONis true). In that case, it reuses the folder list from PR #206478 (that is where the path for ROCm headers lives). Thetest_cuda_kernel_works_with_2_9now requests that set.I verified on gfx90a with
torch 2.15.0and ROCm-10.3.0a20261126 nightly. The full test class passes, with all 40 negative tests correctly failing to compile.I also considered an alternative where the include set could be from
include_paths("cuda", torch_include_dirs=False), but the proposed change keeps a no-op on CUDA instead.Agent details
Claude Code assisted with the investigation and produced the trace and measurements below. I reviewed the change and the results and can speak to both.
Why the test reaches rocThrust at all —
cuda_kernel.cuincludes no thrust header directly; the dependency arrives throughtorch/headeronly:complex.hpulls in<thrust/complex.h>under#if defined(__CUDACC__) || defined(__HIPCC__), so anyhipcccompile of a source reachingScalarType.hhits this unlessinclude/hipcclis on the include path. Note thrust resolves from hipcc's builtin include path (<rocm>/lib/llvm/bin/../../../include/thrust/), not from the-I$GPU_HOME/includethe test passes, so that flag plays no part in the failure.Measured include sets, with #206478 applied:
Reconstructing the test's exact command line, still with #206478 applied:
Full class result after this change (gfx90a,
torch 2.15.0+rocm10.3.0a20261126, ROCm devel wheels):The negative cases matter here: they assert that 2.10+ sources fail to compile, so a wider include set could in principle turn one into a false pass. Gating on
IS_HIP_EXTENSIONrather thanGPU_HOMEkeeps CUDA builds byte-identical, and the run above confirms none flipped on ROCm.cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @jataylo @hongxiayang @naromero77amd @pragupta @jerrymannil @xinyazhang