Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/189114
Note: Links to docs will display an error until the docs builds have been completed. ❌ 4 Unclassified FailuresAs of commit c625920 with merge base 9f9df93 ( UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
62cd6a3 to
5e0422f
Compare
…ch` deadlock (pytorch#189110) `import torch` from ROCm 2.13 wheels intermittently hangs forever on hosts without a usable GPU / kfd (CPU-only nodes, or GPU nodes without amdgpu/amdkfd loaded). Root cause chain (native backtrace): import torch -> dlopen(_C) -> static init of libtorch_rocshmem.so -> rocshmem::NUMAWrapper::NUMAWrapper() (upstream rocSHMEM global ctor) -> dlopen("libnuma.so") == NULL -> exit(1) -> atexit -> rocprofiler::registration::finalize() -> ThreadPool::destroy_threadpool() -> std::thread::join() # HANGS Why it regressed at pytorch#182696: the old build_rocm.sh renamed bundled OS deps to bare sonames, so torch/lib shipped `libnuma.so`. The new repair_wheel.py keeps them versioned (`libnuma.so.1`) only. rocSHMEM's NUMAWrapper ctor does `dlopen("libnuma.so")` (bare) via libtorch_rocshmem.so's $ORIGIN RPATH; with only `libnuma.so.1` present that dlopen fails and NUMAWrapper calls exit() at library-load time, which trips a racy rocprofiler-sdk atexit finalize deadlock (hence the intermittency). The good (0513) wheel shipped bare `libnuma.so` and never hangs; the bad (0514+) wheel ships only `libnuma.so.1` and does. Fix: when bundling a versioned OS dep, also create a bare-name symlink (libnuma.so -> libnuma.so.1, etc.), restoring build_rocm.sh behavior. The bare symlink satisfies rocSHMEM's dlopen while the versioned file still satisfies NEEDED references. Verified: adding this symlink to an installed wheel makes `import torch` succeed deterministically on a no-kfd host. The underlying rocSHMEM bug (NUMAWrapper must not exit() from a global ctor; should dlopen "libnuma.so.1") is fixed upstream after our pinned commit (ROCm/rocm-systems pytorch#5918, pytorch#6640) and should be picked up via a pin bump too.
5e0422f to
c625920
Compare
|
@pytorchmergebot merge -f "lint and rest of the jobs look ok" |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…ock (pytorch#189114) ## Summary `import torch` from ROCm 2.13 wheels **intermittently hangs forever** on hosts without a usable GPU / kfd (CPU-only nodes, or GPU nodes where `amdgpu`/`amdkfd` isn't loaded). Fixes pytorch#189110. This is related to this fix PR in upstream: ROCm/rocm-systems#6640 (this is not included in pytorch, hence a failure) ### Root cause (native backtrace) ``` import torch → dlopen(_C) → static init of libtorch_rocshmem.so → rocshmem::NUMAWrapper::NUMAWrapper() (upstream rocSHMEM global ctor) → dlopen("libnuma.so") == NULL → exit(1) (at library-load time!) → atexit → rocprofiler::registration::finalize() → ThreadPool::destroy_threadpool() → std::thread::join() # HANGS ``` ### Why it regressed here (and why 0513 was fine but 0514 hangs) This is a **packaging** regression from the ROCm manywheel pipeline port (pytorch#182696), not the rocSHMEM binary: | | bundled `libnuma` | `dlopen("libnuma.so")` from `$ORIGIN` | result | |---|---|---|---| | old `build_rocm.sh` (0513) | **`libnuma.so`** (bare) | resolves | ✅ no `exit()` → never hangs | | new `repair_wheel.py` (0514+) | **`libnuma.so.1`** only | fails (no bare name in-wheel) | ❌ `exit(1)` → rocprofiler atexit deadlock → intermittent hang | The old `build_rocm.sh` renamed bundled OS deps to **bare** sonames, so `torch/lib` shipped `libnuma.so`. `repair_wheel.py` keeps them **versioned** (`libnuma.so.1`). rocSHMEM's `NUMAWrapper` global ctor does `dlopen("libnuma.so")` (bare) via `libtorch_rocshmem.so`'s `$ORIGIN` RPATH — with only `libnuma.so.1` present it fails and `exit(1)`s at load, tripping a **racy** rocprofiler-sdk atexit `finalize()` deadlock (hence the intermittency; the `agent.cpp:608` kfd warning is a red herring). Same rocSHMEM binary in both wheels — only the bundled `libnuma` filename differs. ## Fix When bundling a versioned OS dep, also create a **bare-name symlink** (`libnuma.so` → `libnuma.so.1`, etc.), restoring `build_rocm.sh` behavior. The bare symlink satisfies rocSHMEM's `dlopen`; the versioned file still satisfies `NEEDED` references. **Verified:** adding this symlink to an installed wheel makes `import torch` succeed deterministically on a no-`kfd` host (loop-tested; the hang no longer reproduces). ## Follow-ups (upstream) The underlying rocSHMEM bug — `NUMAWrapper` must not `exit()` from a global constructor, and should `dlopen("libnuma.so.1")` — is already fixed upstream *after* PyTorch's pinned commit (`cb8a2d6`): ROCm/rocm-systems **pytorch#5918** (runtime numalib check) and **pytorch#6640** (link numa directly, no `dlopen` — removes `numa_wrapper.cpp`). Bumping `ROCSHMEM_VERSION` in `.ci/docker/common/install_rocSHMEM.sh` would also fix it and is worth doing separately. The rocprofiler-sdk atexit `finalize()` deadlock ("does not exit cleanly") is a separate AMD-side bug. Pull Request resolved: pytorch#189114 Approved by: https://github.com/huydhn, https://github.com/albanD
…ock (pytorch#189114) ## Summary `import torch` from ROCm 2.13 wheels **intermittently hangs forever** on hosts without a usable GPU / kfd (CPU-only nodes, or GPU nodes where `amdgpu`/`amdkfd` isn't loaded). Fixes pytorch#189110. This is related to this fix PR in upstream: ROCm/rocm-systems#6640 (this is not included in pytorch, hence a failure) ### Root cause (native backtrace) ``` import torch → dlopen(_C) → static init of libtorch_rocshmem.so → rocshmem::NUMAWrapper::NUMAWrapper() (upstream rocSHMEM global ctor) → dlopen("libnuma.so") == NULL → exit(1) (at library-load time!) → atexit → rocprofiler::registration::finalize() → ThreadPool::destroy_threadpool() → std::thread::join() # HANGS ``` ### Why it regressed here (and why 0513 was fine but 0514 hangs) This is a **packaging** regression from the ROCm manywheel pipeline port (pytorch#182696), not the rocSHMEM binary: | | bundled `libnuma` | `dlopen("libnuma.so")` from `$ORIGIN` | result | |---|---|---|---| | old `build_rocm.sh` (0513) | **`libnuma.so`** (bare) | resolves | ✅ no `exit()` → never hangs | | new `repair_wheel.py` (0514+) | **`libnuma.so.1`** only | fails (no bare name in-wheel) | ❌ `exit(1)` → rocprofiler atexit deadlock → intermittent hang | The old `build_rocm.sh` renamed bundled OS deps to **bare** sonames, so `torch/lib` shipped `libnuma.so`. `repair_wheel.py` keeps them **versioned** (`libnuma.so.1`). rocSHMEM's `NUMAWrapper` global ctor does `dlopen("libnuma.so")` (bare) via `libtorch_rocshmem.so`'s `$ORIGIN` RPATH — with only `libnuma.so.1` present it fails and `exit(1)`s at load, tripping a **racy** rocprofiler-sdk atexit `finalize()` deadlock (hence the intermittency; the `agent.cpp:608` kfd warning is a red herring). Same rocSHMEM binary in both wheels — only the bundled `libnuma` filename differs. ## Fix When bundling a versioned OS dep, also create a **bare-name symlink** (`libnuma.so` → `libnuma.so.1`, etc.), restoring `build_rocm.sh` behavior. The bare symlink satisfies rocSHMEM's `dlopen`; the versioned file still satisfies `NEEDED` references. **Verified:** adding this symlink to an installed wheel makes `import torch` succeed deterministically on a no-`kfd` host (loop-tested; the hang no longer reproduces). ## Follow-ups (upstream) The underlying rocSHMEM bug — `NUMAWrapper` must not `exit()` from a global constructor, and should `dlopen("libnuma.so.1")` — is already fixed upstream *after* PyTorch's pinned commit (`cb8a2d6`): ROCm/rocm-systems **pytorch#5918** (runtime numalib check) and **pytorch#6640** (link numa directly, no `dlopen` — removes `numa_wrapper.cpp`). Bumping `ROCSHMEM_VERSION` in `.ci/docker/common/install_rocSHMEM.sh` would also fix it and is worth doing separately. The rocprofiler-sdk atexit `finalize()` deadlock ("does not exit cleanly") is a separate AMD-side bug. Pull Request resolved: pytorch#189114 Approved by: https://github.com/huydhn, https://github.com/albanD
…ock (pytorch#189114) ## Summary `import torch` from ROCm 2.13 wheels **intermittently hangs forever** on hosts without a usable GPU / kfd (CPU-only nodes, or GPU nodes where `amdgpu`/`amdkfd` isn't loaded). Fixes pytorch#189110. This is related to this fix PR in upstream: ROCm/rocm-systems#6640 (this is not included in pytorch, hence a failure) ### Root cause (native backtrace) ``` import torch → dlopen(_C) → static init of libtorch_rocshmem.so → rocshmem::NUMAWrapper::NUMAWrapper() (upstream rocSHMEM global ctor) → dlopen("libnuma.so") == NULL → exit(1) (at library-load time!) → atexit → rocprofiler::registration::finalize() → ThreadPool::destroy_threadpool() → std::thread::join() # HANGS ``` ### Why it regressed here (and why 0513 was fine but 0514 hangs) This is a **packaging** regression from the ROCm manywheel pipeline port (pytorch#182696), not the rocSHMEM binary: | | bundled `libnuma` | `dlopen("libnuma.so")` from `$ORIGIN` | result | |---|---|---|---| | old `build_rocm.sh` (0513) | **`libnuma.so`** (bare) | resolves | ✅ no `exit()` → never hangs | | new `repair_wheel.py` (0514+) | **`libnuma.so.1`** only | fails (no bare name in-wheel) | ❌ `exit(1)` → rocprofiler atexit deadlock → intermittent hang | The old `build_rocm.sh` renamed bundled OS deps to **bare** sonames, so `torch/lib` shipped `libnuma.so`. `repair_wheel.py` keeps them **versioned** (`libnuma.so.1`). rocSHMEM's `NUMAWrapper` global ctor does `dlopen("libnuma.so")` (bare) via `libtorch_rocshmem.so`'s `$ORIGIN` RPATH — with only `libnuma.so.1` present it fails and `exit(1)`s at load, tripping a **racy** rocprofiler-sdk atexit `finalize()` deadlock (hence the intermittency; the `agent.cpp:608` kfd warning is a red herring). Same rocSHMEM binary in both wheels — only the bundled `libnuma` filename differs. ## Fix When bundling a versioned OS dep, also create a **bare-name symlink** (`libnuma.so` → `libnuma.so.1`, etc.), restoring `build_rocm.sh` behavior. The bare symlink satisfies rocSHMEM's `dlopen`; the versioned file still satisfies `NEEDED` references. **Verified:** adding this symlink to an installed wheel makes `import torch` succeed deterministically on a no-`kfd` host (loop-tested; the hang no longer reproduces). ## Follow-ups (upstream) The underlying rocSHMEM bug — `NUMAWrapper` must not `exit()` from a global constructor, and should `dlopen("libnuma.so.1")` — is already fixed upstream *after* PyTorch's pinned commit (`cb8a2d6`): ROCm/rocm-systems **pytorch#5918** (runtime numalib check) and **pytorch#6640** (link numa directly, no `dlopen` — removes `numa_wrapper.cpp`). Bumping `ROCSHMEM_VERSION` in `.ci/docker/common/install_rocSHMEM.sh` would also fix it and is worth doing separately. The rocprofiler-sdk atexit `finalize()` deadlock ("does not exit cleanly") is a separate AMD-side bug. Pull Request resolved: pytorch#189114 Approved by: https://github.com/huydhn, https://github.com/albanD
…ock (pytorch#189114) ## Summary `import torch` from ROCm 2.13 wheels **intermittently hangs forever** on hosts without a usable GPU / kfd (CPU-only nodes, or GPU nodes where `amdgpu`/`amdkfd` isn't loaded). Fixes pytorch#189110. This is related to this fix PR in upstream: ROCm/rocm-systems#6640 (this is not included in pytorch, hence a failure) ### Root cause (native backtrace) ``` import torch → dlopen(_C) → static init of libtorch_rocshmem.so → rocshmem::NUMAWrapper::NUMAWrapper() (upstream rocSHMEM global ctor) → dlopen("libnuma.so") == NULL → exit(1) (at library-load time!) → atexit → rocprofiler::registration::finalize() → ThreadPool::destroy_threadpool() → std::thread::join() # HANGS ``` ### Why it regressed here (and why 0513 was fine but 0514 hangs) This is a **packaging** regression from the ROCm manywheel pipeline port (pytorch#182696), not the rocSHMEM binary: | | bundled `libnuma` | `dlopen("libnuma.so")` from `$ORIGIN` | result | |---|---|---|---| | old `build_rocm.sh` (0513) | **`libnuma.so`** (bare) | resolves | ✅ no `exit()` → never hangs | | new `repair_wheel.py` (0514+) | **`libnuma.so.1`** only | fails (no bare name in-wheel) | ❌ `exit(1)` → rocprofiler atexit deadlock → intermittent hang | The old `build_rocm.sh` renamed bundled OS deps to **bare** sonames, so `torch/lib` shipped `libnuma.so`. `repair_wheel.py` keeps them **versioned** (`libnuma.so.1`). rocSHMEM's `NUMAWrapper` global ctor does `dlopen("libnuma.so")` (bare) via `libtorch_rocshmem.so`'s `$ORIGIN` RPATH — with only `libnuma.so.1` present it fails and `exit(1)`s at load, tripping a **racy** rocprofiler-sdk atexit `finalize()` deadlock (hence the intermittency; the `agent.cpp:608` kfd warning is a red herring). Same rocSHMEM binary in both wheels — only the bundled `libnuma` filename differs. ## Fix When bundling a versioned OS dep, also create a **bare-name symlink** (`libnuma.so` → `libnuma.so.1`, etc.), restoring `build_rocm.sh` behavior. The bare symlink satisfies rocSHMEM's `dlopen`; the versioned file still satisfies `NEEDED` references. **Verified:** adding this symlink to an installed wheel makes `import torch` succeed deterministically on a no-`kfd` host (loop-tested; the hang no longer reproduces). ## Follow-ups (upstream) The underlying rocSHMEM bug — `NUMAWrapper` must not `exit()` from a global constructor, and should `dlopen("libnuma.so.1")` — is already fixed upstream *after* PyTorch's pinned commit (`cb8a2d6`): ROCm/rocm-systems **pytorch#5918** (runtime numalib check) and **pytorch#6640** (link numa directly, no `dlopen` — removes `numa_wrapper.cpp`). Bumping `ROCSHMEM_VERSION` in `.ci/docker/common/install_rocSHMEM.sh` would also fix it and is worth doing separately. The rocprofiler-sdk atexit `finalize()` deadlock ("does not exit cleanly") is a separate AMD-side bug. Pull Request resolved: pytorch#189114 Approved by: https://github.com/huydhn, https://github.com/albanD
ROCm 7.14 wheels print this to stderr on every `import torch`: ``` E-001h rocSHMEM Could not open libnuma. Returning NUMAWrapper@src/gda/numa_wrapper.cpp:48 ``` The machinery to prevent it already exists. `repair_wheel.py`'s `rocm_os_deps()` lists `/usr/lib64/libnuma.so.1`, `rocm_bundle()` copies it into `torch/lib`, and pytorch#189114 adds a bare `libnuma.so` symlink beside it so rocSHMEM's `dlopen("libnuma.so")` resolves via `$ORIGIN` on its RPATH. Verified on the shipped artifact: $ readelf -d torch/lib/libtorch_rocshmem.so RPATH: $ORIGIN/../../_rocm_sdk_core/lib:...:$ORIGIN What was missing is the library itself on the build machine. `install_rocm.sh` installs `libnuma-dev` in `install_ubuntu()` -- with a comment naming rocSHMEM as the reason -- but `install_almalinux()`, which the manywheel builder uses, installs nothing. So `rocm_os_deps()` returns a path that does not exist, and the loop skips absent deps, so the wheel ships without libnuma and without the symlink. That also explains why CI never saw this: the Ubuntu test image has libnuma, the AlmaLinux wheel builder does not. Only users of the wheels are affected. Install `numactl-libs` (provides `/usr/lib64/libnuma.so.1`) in the AlmaLinux branch, matching what the Ubuntu branch already does. Also warn when an OS dep is absent rather than skipping in silence. A missing entry here yields a wheel that imports fine and misbehaves later; this one reached both nightlies and the 2.14 release candidate unnoticed. Left as a warning rather than a hard failure, since some deps in that list are legitimately absent on some builders. Not just cosmetic: pytorch#189110 reports the same failed dlopen making rocSHMEM call `exit()` at load, tripping a rocprofiler-sdk atexit deadlock that hangs `import torch` on hosts without a GPU or kfd. Fixes pytorch#195670 Test Plan: - Confirmed the wheel currently ships no libnuma at all. Read the central directory of `torch-2.14.0+rocm7.14-cp312-cp312-manylinux_2_28_x86_64.whl` (1.39GB, 13,287 entries) over HTTP range requests: the only `numa` matches are `torch/include/c10/util/numa.h` and the unrelated `torch/numa/` Python package. No `torch/lib/libnuma.so` and no `torch/lib/libnuma.so.1`. - Extracted `torch/lib/libtorch_rocshmem.so` from that wheel and confirmed via `readelf -d` that `$ORIGIN` is on its RPATH, so a bundled `torch/lib/libnuma.so` is found, and that libnuma is absent from its NEEDED entries -- it is reached only through `dlopen`, which is why the SONAME rewrite never covered it. - `bash -n .ci/docker/common/install_rocm.sh` passes; `repair_wheel.py` parses. - Occurrence counts in the affected jobs: 5 in the nightly `manywheel-py3_15t-rocm7_14-test`, 7 in test-infra's release/2.14 `manywheel-py3_12-rocm7_14`, 0 in ROCm 10.0 and 0 in the Ubuntu ROCm CI job. The real check is the next ROCm 7.14 nightly: `torch/lib/libnuma.so` and `torch/lib/libnuma.so.1` present in the wheel, and no rocSHMEM line in the binary smoke test.
Summary
import torchfrom ROCm 2.13 wheels intermittently hangs forever on hosts without a usable GPU / kfd (CPU-only nodes, or GPU nodes whereamdgpu/amdkfdisn't loaded). Fixes #189110.This is related to this fix PR in upstream: ROCm/rocm-systems#6640 (this is not included in pytorch, hence a failure)
Root cause (native backtrace)
Why it regressed here (and why 0513 was fine but 0514 hangs)
This is a packaging regression from the ROCm manywheel pipeline port (#182696), not the rocSHMEM binary:
libnumadlopen("libnuma.so")from$ORIGINbuild_rocm.sh(0513)libnuma.so(bare)exit()→ never hangsrepair_wheel.py(0514+)libnuma.so.1onlyexit(1)→ rocprofiler atexit deadlock → intermittent hangThe old
build_rocm.shrenamed bundled OS deps to bare sonames, sotorch/libshippedlibnuma.so.repair_wheel.pykeeps them versioned (libnuma.so.1). rocSHMEM'sNUMAWrapperglobal ctor doesdlopen("libnuma.so")(bare) vialibtorch_rocshmem.so's$ORIGINRPATH — with onlylibnuma.so.1present it fails andexit(1)s at load, tripping a racy rocprofiler-sdk atexitfinalize()deadlock (hence the intermittency; theagent.cpp:608kfd warning is a red herring). Same rocSHMEM binary in both wheels — only the bundledlibnumafilename differs.Fix
When bundling a versioned OS dep, also create a bare-name symlink (
libnuma.so→libnuma.so.1, etc.), restoringbuild_rocm.shbehavior. The bare symlink satisfies rocSHMEM'sdlopen; the versioned file still satisfiesNEEDEDreferences.Verified: adding this symlink to an installed wheel makes
import torchsucceed deterministically on a no-kfdhost (loop-tested; the hang no longer reproduces).Follow-ups (upstream)
The underlying rocSHMEM bug —
NUMAWrappermust notexit()from a global constructor, and shoulddlopen("libnuma.so.1")— is already fixed upstream after PyTorch's pinned commit (cb8a2d6): ROCm/rocm-systems #5918 (runtime numalib check) and #6640 (link numa directly, nodlopen— removesnuma_wrapper.cpp). BumpingROCSHMEM_VERSIONin.ci/docker/common/install_rocSHMEM.shwould also fix it and is worth doing separately. The rocprofiler-sdk atexitfinalize()deadlock ("does not exit cleanly") is a separate AMD-side bug.cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @jataylo @hongxiayang @naromero77amd @pragupta @jerrymannil @xinyazhang