Repository navigation
Conversation
PR Status: Approved 🚀Please fix all CI failures and trigger merge by commenting "@pytorchbot merge". ✅ AUTOMATED REVIEW - Ready for human review:
Findings (3): Reviewed commit: 🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/206478
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit d0ae17d with merge base 304eed3 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
Drafted until discussed with ROCm maintainers. |
|
@pytorchbot label "topic: not user facing" |
There was a problem hiding this comment.
Automated review of d0ae17d: nothing blocking; ready for human review.
On HIP builds, the PR adds ${ROCM_HOME}/include/hipccl to include_paths(device_type="cuda") when that directory exists, so cpp_extension builds can find libhipcxx. Recommendation: Approve. The review found nothing blocking and labels all three points non-blocking, though it asks that the include-order question be settled with the ROCm maintainers before the PR leaves draft.
⚪ 3 non-blocking findings
pytorch/torch/utils/cpp_extension.py
Line 1914 in d0ae17d
Include order when headers exist in both places (non-blocking, low confidence). hipccl is appended after ${ROCM_HOME}/include. If an install ships rocprim, hipCUB and rocThrust both at the top level and under include/hipccl, which copy wins depends on the layout. With ROCM_HOME=/opt/rocm, <hipcub/...>, <thrust/...> and <rocprim/...> come from the top-level copies and only <hip/std/...> comes from hipccl, so top-level hipCUB/rocThrust could be mixed with hipccl's libhipcxx. With ROCM_HOME=/usr, /usr/include is skipped, so the hipccl copies win. Also, JIT users who already pass hipccl via extra_include_paths (emitted as -I) will now get it as -isystem too. GCC and clang drop a -I dir that is also a system dir, so hipccl would quietly move after -isystem ${ROCM_HOME}/include. Please confirm whether these headers really exist in both places. If they do, either insert hipccl before rocm_home_include or say in the comment which copy is meant to win.
pytorch/torch/utils/cpp_extension.py
Line 1911 in d0ae17d
Comment wording (non-blocking). "In newer versions of ROCm" is vaguer than the existing note at cmake/public/LoadHIP.cmake:382-384, which says "ROCm 8.0 and later requires libhipcxx" and plans to make it REQUIRED once 8.0 is the minimum. Please name ROCm 8.0 and point to that find_package(libhipcxx), so both workarounds get cleaned up together.
pytorch/torch/utils/cpp_extension.py
Line 1910 in d0ae17d
PR description overstates where the fix applies (non-blocking). The description says the fix reaches "hipify header resolution", but it doesn't. In CUDAExtension, hipify gets header_include_dirs=include_dirs (line 1724), and include_paths(device_type="cuda") is only appended later (line 1758). JIT hipify gets only extra_include_paths (line 2561) and ignores everything under ROCM_HOME (line 2563). The code doesn't need hipify to see these headers, since they are already HIP. Please correct the description anyway, because it is meant to guide the ROCm/pytorch backport.
This review is AI-generated and advisory. Each new automated review replaces the previous one. Report a bad review
jeffdaily
left a comment
There was a problem hiding this comment.
Checked against the hipCCL staging ROCm that TheRock's failing run used (10.3.0.dev0+9c85da5) on MI300X, with torch built from this PR's merge base. Without the change, torchvision main and ROCm/audio release/2.11.0.2 fail with "Could not find libhipcxx!", exactly as in TheRock's logs. With only this change to cpp_extension.py, both build with no errors, import, and their GPU ops (nms, roi_align, rnnt_loss) match CPU.
|
@pytorchbot merge |
|
Pull workflow has not been scheduled for the PR yet. It could be because author doesn't have permissions to run those or skip-checks keywords were added to PR/commits, aborting merge. Please get/give approval for the workflows and/or remove skip ci decorators before next merge attempt. If you think this is a mistake, please contact PyTorch Dev Infra. |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
|
@pytorchbot merge -i |
|
The merge job was canceled or timed out. This most often happen if two merge requests were issued for the same PR, or if merge job was waiting for more than 6 hours for tests to finish. In later case, please do not hesitate to reissue the merge command |
Merge startedYour change will be merged while ignoring the following 1 checks: trunk / linux-jammy-cuda13.2-py3.11-gcc11 / test (pr_time_benchmarks, 1, 1, mt-l-bx86iavx512-94-344-t4-8) Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…pytorch#206478) (#4069) ## Linked issue or supporting maintainer Supported by @jeffdaily ## BC-breaking? No. Upcoming changes in ROCm/rocm-libraries (ROCm/rocm-libraries#15610) will likely break ROCm/HIP-based builds of plugins (torchaudio, torchvision, and any third-party `torch.utils.cpp_extension` consumers) unless they include this patch. Backporting is required, but should be done on [ROCm/pytorch](https://github.com/ROCm/pytorch). ## Summary * Plugins (torchaudio, torchvision) cannot be built because they cannot find libhipcxx, [see TheRock CI](https://github.com/ROCm/TheRock/actions/runs/45290518963/job/138097890882). * Root cause is that hipCUB and rocThrust now rely on libhipcxx, which is only provided under `${ROCM_HOME}/include/hipccl`. CMake-based builds (PyTorch itself) find it through `find_package(libhipcxx)`, but `cpp_extension` compiles have no such mechanism. * A minimal fix on the PyTorch side is to add this directory to `include_paths()` for HIP extensions, guarded by an existence check so it is a no-op on ROCm installs that do not ship hipccl. ## Agent details Key steps: traced the `Could not find libhipcxx!` error to `__has_include(<hip/std/version>)` probes in rocthrust's `thrust/detail/config/libcxx.h`; confirmed the probe path only resolves with `-I${ROCM_HOME}/include/hipccl`; placed the fix in `include_paths()` so it reaches the `CUDAExtension`/`CppExtension` setup.py flow, JIT `load()`/`load_inline()`, and hipify header resolution. Pull Request resolved: pytorch#206478 Approved by: https://github.com/jeffdaily Co-authored-by: Nara Prasetya <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
…pytorch#206478) (#4070) ## Linked issue or supporting maintainer Supported by @jeffdaily ## BC-breaking? No. Upcoming changes in ROCm/rocm-libraries (ROCm/rocm-libraries#15610) will likely break ROCm/HIP-based builds of plugins (torchaudio, torchvision, and any third-party `torch.utils.cpp_extension` consumers) unless they include this patch. Backporting is required, but should be done on [ROCm/pytorch](https://github.com/ROCm/pytorch). ## Summary * Plugins (torchaudio, torchvision) cannot be built because they cannot find libhipcxx, [see TheRock CI](https://github.com/ROCm/TheRock/actions/runs/45290518963/job/138097890882). * Root cause is that hipCUB and rocThrust now rely on libhipcxx, which is only provided under `${ROCM_HOME}/include/hipccl`. CMake-based builds (PyTorch itself) find it through `find_package(libhipcxx)`, but `cpp_extension` compiles have no such mechanism. * A minimal fix on the PyTorch side is to add this directory to `include_paths()` for HIP extensions, guarded by an existence check so it is a no-op on ROCm installs that do not ship hipccl. ## Agent details Key steps: traced the `Could not find libhipcxx!` error to `__has_include(<hip/std/version>)` probes in rocthrust's `thrust/detail/config/libcxx.h`; confirmed the probe path only resolves with `-I${ROCM_HOME}/include/hipccl`; placed the fix in `include_paths()` so it reaches the `CUDAExtension`/`CppExtension` setup.py flow, JIT `load()`/`load_inline()`, and hipify header resolution. Pull Request resolved: pytorch#206478 Approved by: https://github.com/jeffdaily Co-authored-by: Nara Prasetya <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
…pytorch#206478) (#4071) ## Linked issue or supporting maintainer Supported by @jeffdaily ## BC-breaking? No. Upcoming changes in ROCm/rocm-libraries (ROCm/rocm-libraries#15610) will likely break ROCm/HIP-based builds of plugins (torchaudio, torchvision, and any third-party `torch.utils.cpp_extension` consumers) unless they include this patch. Backporting is required, but should be done on [ROCm/pytorch](https://github.com/ROCm/pytorch). ## Summary * Plugins (torchaudio, torchvision) cannot be built because they cannot find libhipcxx, [see TheRock CI](https://github.com/ROCm/TheRock/actions/runs/45290518963/job/138097890882). * Root cause is that hipCUB and rocThrust now rely on libhipcxx, which is only provided under `${ROCM_HOME}/include/hipccl`. CMake-based builds (PyTorch itself) find it through `find_package(libhipcxx)`, but `cpp_extension` compiles have no such mechanism. * A minimal fix on the PyTorch side is to add this directory to `include_paths()` for HIP extensions, guarded by an existence check so it is a no-op on ROCm installs that do not ship hipccl. ## Agent details Key steps: traced the `Could not find libhipcxx!` error to `__has_include(<hip/std/version>)` probes in rocthrust's `thrust/detail/config/libcxx.h`; confirmed the probe path only resolves with `-I${ROCM_HOME}/include/hipccl`; placed the fix in `include_paths()` so it reaches the `CUDAExtension`/`CppExtension` setup.py flow, JIT `load()`/`load_inline()`, and hipify header resolution. Pull Request resolved: pytorch#206478 Approved by: https://github.com/jeffdaily Co-authored-by: Nara Prasetya <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
|
@jgong5 sorry for the direct ping. Would you be willing to support a small #206478 added Happy to go to @jithunnair-amd or wait for Jeff instead if you'd rather not. Please let me know. |
## Linked issue or supporting maintainer * Fixes ROCm/TheRock#10275 * Related to #206478 * Supported by @jeffdaily ## BC-breaking? No, though backporting may be useful on [ROCm/pytorch](https://github.com/ROCm/pytorch) downstream release branches. ## Summary (human written only) Upcoming changes to ROCm (ROCm/rocm-libraries#15610) start pulling in code that leaks macros from `windows.h` into HIP compilation for plugin builds (torchaudio, torchvision, etc.) unless `-DNOMINMAX` is added there too, leading to errors like: ``` 2026-11-25T08:40:22.9961647Z .../_rocm_sdk_devel/include/hipccl/rocprim/device/detail/device_reduce.hpp:124:41: error: expected unqualified-id 124 | std::min(valid_in_last_block, block_size), 2026-11-25T08:40:22.9962014Z C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\shared\minwindef.h:197:29: note: expanded from macro 'min' 197 | #define min(a,b) (((a) < (b)) ? (a) : (b)) 2026-11-25T08:40:22.9967949Z .../hipccl/hipcub/backend/rocprim/device/device_reduce.hpp:93:48: error: too few arguments provided to function-like macro invocation 93 | return _HIPCUB_STD::numeric_limits<T>::max(); ``` We would like to patch this in three places: 1. Here in PyTorch for future libraries that leak macro definitions (setting `-DNOMINMAX` is generally expected when compiling on Windows across many projects). Note that PyTorch already defines `NOMINMAX` for host code here: https://github.com/pytorch/pytorch/blob/a19fc3c3396233aac0d645be7952a76cfd4184b0/CMakeLists.txt#L1286-L1287 2. In TheRock, temporarily: ROCm/TheRock#10283 3. In libhipcxx where the macros are being leaked: ROCm/libhipcxx#44 Pull Request resolved: #206662 Approved by: https://github.com/jeffdaily
…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.
Linked issue or supporting maintainer
Supported by @jeffdaily
BC-breaking?
No. Upcoming changes in ROCm/rocm-libraries (ROCm/rocm-libraries#15610) will likely break ROCm/HIP-based builds of plugins (torchaudio, torchvision, and any third-party
torch.utils.cpp_extensionconsumers) unless they include this patch.Backporting is required, but should be done on ROCm/pytorch.
Summary
${ROCM_HOME}/include/hipccl. CMake-based builds (PyTorch itself) find it throughfind_package(libhipcxx), butcpp_extensioncompiles have no such mechanism.include_paths()for HIP extensions, guarded by an existence check so it is a no-op on ROCm installs that do not ship hipccl.Agent details
Key steps: traced the
Could not find libhipcxx!error to__has_include(<hip/std/version>)probes in rocthrust'sthrust/detail/config/libcxx.h; confirmed the probe path only resolves with-I${ROCM_HOME}/include/hipccl; placed the fix ininclude_paths()so it reaches theCUDAExtension/CppExtensionsetup.py flow, JITload()/load_inline(), and hipify header resolution.cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @jataylo @hongxiayang @naromero77amd @pragupta @jerrymannil @xinyazhang