Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/188429
Note: Links to docs will display an error until the docs builds have been completed. ⏳ 30 Pending, 5 Unrelated FailuresAs of commit 39c2c71 with merge base dafbce9 ( CRCR (non-blocking) - The following CRCR downstream CI jobs failed but are non-blocking:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
|
…heels Rework the wheel-level RPATH fix so it merges cleanly with, and keeps working after, the tarball -> TheRock-wheels migration (pytorch#188429), without depending on the soon-to-be-removed hardcoded /opt/rocm path. - Drop the install_rocm.sh ldconfig change entirely: it edits the exact theRock block pytorch#188429 rewrites (textual conflict) and hardcodes /opt/rocm, which pytorch#188429 removes. The wheel-level RPATH supersedes it for both the image and the wheel. - patch_rocm_sysdeps_rpath now encodes RPATH entries for BOTH ROCm layouts and self-guards: * TheRock wheels (pytorch#188429): the `rocm` pip package unpacks under <site-packages>/_rocm_sdk_core (per torch/utils/cpp_extension.py), a sibling of torch/ in site-packages. We compute an $ORIGIN-relative RPATH (torch/lib -> ../../_rocm_sdk_core/lib[/rocm_sysdeps/lib]) at build time so the produced wheel stays self-contained, mirroring cuda_rpaths() in .ci/manywheel/repair_wheel.py. * Tarball (current rocm-nightly): absolute /opt/rocm/lib and /opt/rocm/lib/rocm_sysdeps/lib, added only if that dir exists. Both entries can coexist and are harmless when one layout is absent, so neither breaks the other across the migration. The helper no-ops when neither layout is present (e.g. the apt-based ROCm path). - build.sh now calls the helper for all rocm builds (it self-guards), instead of gating on the /opt/rocm sysdeps dir, so it also fires in the wheels world where /opt/rocm no longer exists. This keeps the distributed pre-flight `import torch` (run via `sh -c` without sourcing /etc/rocm_env.sh) working in both worlds, and the fix travels with the wheel rather than only patching the CI image. Made with Cursor
…8429) Bring in the tarball -> TheRock-wheels migration from pytorch#188429 so this branch builds and tests against ROCm installed from the multi-arch TheRock wheel index (rocm[...] pip package under <site-packages>/_rocm_sdk_core) instead of the /opt/rocm tarball. Applied as the net diff of pytorch#188429 (its branch carries a merge commit, so a linear cherry-pick is not clean). Touches only files pytorch#188429 owns (.ci/docker/*, ubuntu-rocm/Dockerfile, workflows); no overlap with this branch's .ci/pytorch/* RPATH changes. Made with Cursor
Made with Cursor Co-authored-by: Faa Diallo <[email protected]>
Made with Cursor Co-authored-by: Faa Diallo <[email protected]>
Made with Cursor Co-authored-by: Faa Diallo <[email protected]>
Temporarily stacks Ethan Wee's pytorch#188429 (rocm-preview.yml workflow, ciflow/rocm-preview probot label, TheRock _rocm_sdk_core wheel install_rocm.sh, preview docker image) on top of the two-file TheRock self-containment fix so the rocm-preview MI300 wheel-path job can validate the fix end-to-end. To be un-stacked before merge.
Temporarily stacks Ethan Wee's pytorch#188429 (rocm-preview.yml workflow, ciflow/rocm-preview probot label, TheRock _rocm_sdk_core wheel install_rocm.sh, preview docker image) on top of the two-file TheRock self-containment fix so the rocm-preview MI300 wheel-path job can validate the fix end-to-end. To be un-stacked before merge.
…oad_rocm_deps`) (#188454) ## Summary This PR makes PyTorch ROCm/TheRock wheels **self-contained**: it fixes the two `import torch` failures that occur on the wheel (`_rocm_sdk_*` site-packages) layout, so `import torch` works without `LD_LIBRARY_PATH` or a sourced ROCm env (e.g. the ROCm distributed preflight `python .ci/pytorch/rocm_preflight.py`, which never sources `/etc/rocm_env.sh`). Both fixes live in torch **source**, so they travel with any build (including a bare `python -m build` in a TheRock env), not just CI-produced wheels. This is the **minimal, consolidated PR** carrying **both** import-discovery fixes — a **two-file** diff (`torch/__init__.py` + `torch/cuda/__init__.py`). Both changes are **no-ops on the traditional tarball `/opt/rocm` install**: each early-returns when the wheel package's `_rocm_sdk_core` is absent, so non-wheel ROCm CI (apt/`/opt/rocm`, whose libs are already on the loader path), CUDA, and CPU builds are unaffected. ## Fixes ### 1. `torch/__init__.py` — `_preload_rocm_deps()` Fixes `ImportError: librocm_sysdeps_liblzma.so.5: cannot open shared object file` at `from torch._C import *` - Adds `_preload_rocm_deps()`, the ROCm analogue of `_preload_cuda_deps()` (which handles the `nvidia-*-cu12` wheels). At import time, **before** `import torch._C`, it locates the `rocm` pip package's `_rocm_sdk_core` via `importlib.util.find_spec` (the same anchor `torch.utils.cpp_extension._find_rocm_home()` uses) and `ctypes.CDLL`-preloads (`RTLD_GLOBAL`) the vendored sysdeps (`librocm_sysdeps_*`) and core ROCm runtime libs from `_rocm_sdk_core/lib` and `_rocm_sdk_core/lib/rocm_sysdeps/lib`. Wired into `_load_global_deps()`. - Guarded to no-op on non-Linux, on non-ROCm builds (`torch.version.hip is None` → CUDA/CPU), and on OS-managed ROCm where `_rocm_sdk_core` is absent (the apt/`/opt/rocm` path). ### 2. `torch/cuda/__init__.py` — amdsmi / `libamd_smi.so` discovery hook + non-fatal guard Fixes the *next* failure that surfaces once `_preload_rocm_deps()` gets `import torch` past the `librocm_sysdeps` error: `KeyError: 'libamd_smi.so'` raised from the `amdsmi` Python binding at `import amdsmi` (inside `_C._initExtension`) On TheRock wheels the amdsmi package installs the native library as a versioned soname under `_rocm_sdk_core/lib` (e.g. `libamd_smi.so.26`), which amdsmi's own `find_smi_library()` fails to locate when `$ROCM_HOME`/`$ROCM_PATH` and the loader path are unset; its wrapper then does `_libraries['libamd_smi.so']` → `KeyError`, which escaped the existing guard (only `ModuleNotFoundError` was tolerated) and killed `import torch`. Two-part torch-side hardening: - Make `_amdsmi_cdll_hook` **TheRock-aware**: locate `_rocm_sdk_core` via `importlib.util.find_spec` and add its `lib/libamd_smi.so*` (glob, incl. versioned sonames) as last-resort candidate paths; match names whose basename **starts with** `libamd_smi.so` so amdsmi's bare `CDLL("libamd_smi.so")` is redirected to the real versioned file. Existing `ROCM_HOME`/`ROCM_PATH` behavior preserved; guarded to Linux. - Make a non-discoverable amdsmi **non-fatal**: broaden the guard so `KeyError`/`OSError` degrade to `_HAS_AMDSMI=False` instead of aborting `import torch`, matching the existing missing-module path. ## Consolidation note The amdsmi discovery fix (#2 above) originally shipped as standalone PR #188724. That PR has been **closed** and folded into this PR so **both** import-discovery fixes travel together in a single minimal two-file change. Scope note: the TheRock tarball→wheels migration and the earlier CI-only RPATH/ldconfig workarounds are **not** part of this PR. The wheels migration is tracked separately by #188429, which rebases on top of this change. ## Validation (TheRock wheel path) — PASSED Validated end-to-end by **temporarily** stacking Ethan's wheels-migration PR #188429 (which adds the `rocm-preview` wheel CI) on top of the two source fixes and running `ciflow/rocm-preview` (run [28581558341](https://github.com/pytorch/pytorch/actions/runs/28581558341)) on the stacked head. The temporary stack was then **removed**, so this PR remains the minimal two-file source diff. - **`build-osdc` (TheRock wheel-path build): SUCCESS** — [job 84742887851](https://github.com/pytorch/pytorch/actions/runs/28581558341/job/84742887851). - **`import torch` works on the `_rocm_sdk_*` wheel layout** — proven by the passing shard [`test (default, 5/6)` job 84772673709](https://github.com/pytorch/pytorch/actions/runs/28581558341/job/84772673709), which imports torch and prints the HIP 7.14 / MIOpen 3.5.2 build config. - **No** `ImportError: librocm_sysdeps*` (incl. `librocm_sysdeps_liblzma`) and **no** `KeyError: 'libamd_smi.so'` anywhere in the run → **both** fixes are validated on the **real TheRock wheel path**. - Remaining rocm-preview shard failures were **unrelated** to this PR — test-content failures (`test_CTCLoss_cudnn_cuda`, `test_cxx_flags` `RuntimeError map::at`, `test_hip_device_count`, `test_lazy_imports_are_lazy`) and infra (`ROCm pre-flight: no GPUs visible to the container` on the distributed shards). - Run: https://github.com/pytorch/pytorch/actions/runs/28581558341 ### rocm-preview distributed shards (register fat binary failed) Reference/evidence for the `register fat binary failed` (`code_object.cpp:1038`) investigation — the rocm-preview (TheRock wheel-path) distributed shards from run [28581558341](https://github.com/pytorch/pytorch/actions/runs/28581558341) (`linux-noble-rocm-preview-py3.12-gfx942`), all FAILED: - distributed 1/3: https://github.com/pytorch/pytorch/actions/runs/28581558341/job/84772673683 (`test (distributed, 1, 3, linux.rocm.gpu.gfx942.4, module:rocm, oncall:distributed)`) - distributed 2/3: https://github.com/pytorch/pytorch/actions/runs/28581558341/job/84772673678 (`test (distributed, 2, 3, linux.rocm.gpu.gfx942.4, module:rocm, oncall:distributed)`) - distributed 3/3: https://github.com/pytorch/pytorch/actions/runs/28581558341/job/84772673727 (`test (distributed, 3, 3, linux.rocm.gpu.gfx942.4, module:rocm, oncall:distributed)`) <details> <summary>Failure log the amdsmi fix addresses (pre-fix, run 28524549808)</summary> ``` /var/lib/jenkins/workspace/libamd_smi.so: cannot open shared object file: No such file or directory Unable to find libamd_smi.so library try installing amd-smi-lib from your package manager Traceback (most recent call last): File "/var/lib/jenkins/workspace/.ci/pytorch/rocm_preflight.py", line 21, in <module> import torch File ".../site-packages/torch/cuda/__init__.py", line 114, in <module> import amdsmi # type: ignore[import] File ".../site-packages/amdsmi/amdsmi_wrapper.py", line 218, in <module> amdsmi_free_name_value_pairs = _libraries['libamd_smi.so'].amdsmi_free_name_value_pairs KeyError: 'libamd_smi.so' ``` </details> ## Notes: amdsmi discovery + fat-binary logs - **Bare `CDLL("libamd_smi.so")`** comes from amdsmi's own `find_smi_library()` (unversioned candidate), not torch; torch's `_amdsmi_cdll_hook` intercepts it and retries the versioned `_rocm_sdk_core/lib/libamd_smi.so*`. - **Not just preload amdsmi via `_rocm_core_libs`:** amdsmi resolves by exact filename, so an RTLD_GLOBAL versioned `libamd_smi.so.26` won't satisfy it, and eager-preloading a non-`DT_NEEDED` lib reintroduces the ODR double-load the hook prevents — the CDLL-redirect hook is the correct fix. - **`E0702 … code_object.cpp:1038 register fat binary failed` is not caused by this PR:** it's emitted by the HIP/clr C++ runtime, appears ambiently (~4,774×/run across rocm-preview gfx942 jobs incl. the distributed shards above), and is non-fatal — a pre-existing TheRock rocm-preview build/toolchain matter, orthogonal to these two Python-only changes. - **Fix-plan pointer (fat-binary):** prove pre-existing on a PR-free `main` rocm-preview baseline → localize via `AMD_LOG_LEVEL=3/4` → scoped clr-log suppress/demote (escalate to clr/comgr pin or `PYTORCH_ROCM_ARCH` only on a real running-arch failure) → validate via `ciflow/rocm-preview`. Belongs in the build/CI layer, not torch source. Tracked in ROCm/frameworks-internal #17160. ## Test plan - [x] Validate on the TheRock wheel path via `ciflow/rocm-preview` (see **Validation** above). - [x] `ast.parse` both changed files (`torch/__init__.py`, `torch/cuda/__init__.py`). - [x] Confirm CUDA and CPU builds are unaffected (both fixes no-op when `torch.version.hip is None` / `_rocm_sdk_core` absent). Fixes #188561 Made with Cursor Pull Request resolved: #188454 Approved by: https://github.com/jeffdaily
|
@pytorchbot rebase |
|
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
|
Rebase failed due to Command |
031df7f to
76429da
Compare
…oad_rocm_deps`) (pytorch#188454) ## Summary This PR makes PyTorch ROCm/TheRock wheels **self-contained**: it fixes the two `import torch` failures that occur on the wheel (`_rocm_sdk_*` site-packages) layout, so `import torch` works without `LD_LIBRARY_PATH` or a sourced ROCm env (e.g. the ROCm distributed preflight `python .ci/pytorch/rocm_preflight.py`, which never sources `/etc/rocm_env.sh`). Both fixes live in torch **source**, so they travel with any build (including a bare `python -m build` in a TheRock env), not just CI-produced wheels. This is the **minimal, consolidated PR** carrying **both** import-discovery fixes — a **two-file** diff (`torch/__init__.py` + `torch/cuda/__init__.py`). Both changes are **no-ops on the traditional tarball `/opt/rocm` install**: each early-returns when the wheel package's `_rocm_sdk_core` is absent, so non-wheel ROCm CI (apt/`/opt/rocm`, whose libs are already on the loader path), CUDA, and CPU builds are unaffected. ## Fixes ### 1. `torch/__init__.py` — `_preload_rocm_deps()` Fixes `ImportError: librocm_sysdeps_liblzma.so.5: cannot open shared object file` at `from torch._C import *` - Adds `_preload_rocm_deps()`, the ROCm analogue of `_preload_cuda_deps()` (which handles the `nvidia-*-cu12` wheels). At import time, **before** `import torch._C`, it locates the `rocm` pip package's `_rocm_sdk_core` via `importlib.util.find_spec` (the same anchor `torch.utils.cpp_extension._find_rocm_home()` uses) and `ctypes.CDLL`-preloads (`RTLD_GLOBAL`) the vendored sysdeps (`librocm_sysdeps_*`) and core ROCm runtime libs from `_rocm_sdk_core/lib` and `_rocm_sdk_core/lib/rocm_sysdeps/lib`. Wired into `_load_global_deps()`. - Guarded to no-op on non-Linux, on non-ROCm builds (`torch.version.hip is None` → CUDA/CPU), and on OS-managed ROCm where `_rocm_sdk_core` is absent (the apt/`/opt/rocm` path). ### 2. `torch/cuda/__init__.py` — amdsmi / `libamd_smi.so` discovery hook + non-fatal guard Fixes the *next* failure that surfaces once `_preload_rocm_deps()` gets `import torch` past the `librocm_sysdeps` error: `KeyError: 'libamd_smi.so'` raised from the `amdsmi` Python binding at `import amdsmi` (inside `_C._initExtension`) On TheRock wheels the amdsmi package installs the native library as a versioned soname under `_rocm_sdk_core/lib` (e.g. `libamd_smi.so.26`), which amdsmi's own `find_smi_library()` fails to locate when `$ROCM_HOME`/`$ROCM_PATH` and the loader path are unset; its wrapper then does `_libraries['libamd_smi.so']` → `KeyError`, which escaped the existing guard (only `ModuleNotFoundError` was tolerated) and killed `import torch`. Two-part torch-side hardening: - Make `_amdsmi_cdll_hook` **TheRock-aware**: locate `_rocm_sdk_core` via `importlib.util.find_spec` and add its `lib/libamd_smi.so*` (glob, incl. versioned sonames) as last-resort candidate paths; match names whose basename **starts with** `libamd_smi.so` so amdsmi's bare `CDLL("libamd_smi.so")` is redirected to the real versioned file. Existing `ROCM_HOME`/`ROCM_PATH` behavior preserved; guarded to Linux. - Make a non-discoverable amdsmi **non-fatal**: broaden the guard so `KeyError`/`OSError` degrade to `_HAS_AMDSMI=False` instead of aborting `import torch`, matching the existing missing-module path. ## Consolidation note The amdsmi discovery fix (#2 above) originally shipped as standalone PR pytorch#188724. That PR has been **closed** and folded into this PR so **both** import-discovery fixes travel together in a single minimal two-file change. Scope note: the TheRock tarball→wheels migration and the earlier CI-only RPATH/ldconfig workarounds are **not** part of this PR. The wheels migration is tracked separately by pytorch#188429, which rebases on top of this change. ## Validation (TheRock wheel path) — PASSED Validated end-to-end by **temporarily** stacking Ethan's wheels-migration PR pytorch#188429 (which adds the `rocm-preview` wheel CI) on top of the two source fixes and running `ciflow/rocm-preview` (run [28581558341](https://github.com/pytorch/pytorch/actions/runs/28581558341)) on the stacked head. The temporary stack was then **removed**, so this PR remains the minimal two-file source diff. - **`build-osdc` (TheRock wheel-path build): SUCCESS** — [job 84742887851](https://github.com/pytorch/pytorch/actions/runs/28581558341/job/84742887851). - **`import torch` works on the `_rocm_sdk_*` wheel layout** — proven by the passing shard [`test (default, 5/6)` job 84772673709](https://github.com/pytorch/pytorch/actions/runs/28581558341/job/84772673709), which imports torch and prints the HIP 7.14 / MIOpen 3.5.2 build config. - **No** `ImportError: librocm_sysdeps*` (incl. `librocm_sysdeps_liblzma`) and **no** `KeyError: 'libamd_smi.so'` anywhere in the run → **both** fixes are validated on the **real TheRock wheel path**. - Remaining rocm-preview shard failures were **unrelated** to this PR — test-content failures (`test_CTCLoss_cudnn_cuda`, `test_cxx_flags` `RuntimeError map::at`, `test_hip_device_count`, `test_lazy_imports_are_lazy`) and infra (`ROCm pre-flight: no GPUs visible to the container` on the distributed shards). - Run: https://github.com/pytorch/pytorch/actions/runs/28581558341 ### rocm-preview distributed shards (register fat binary failed) Reference/evidence for the `register fat binary failed` (`code_object.cpp:1038`) investigation — the rocm-preview (TheRock wheel-path) distributed shards from run [28581558341](https://github.com/pytorch/pytorch/actions/runs/28581558341) (`linux-noble-rocm-preview-py3.12-gfx942`), all FAILED: - distributed 1/3: https://github.com/pytorch/pytorch/actions/runs/28581558341/job/84772673683 (`test (distributed, 1, 3, linux.rocm.gpu.gfx942.4, module:rocm, oncall:distributed)`) - distributed 2/3: https://github.com/pytorch/pytorch/actions/runs/28581558341/job/84772673678 (`test (distributed, 2, 3, linux.rocm.gpu.gfx942.4, module:rocm, oncall:distributed)`) - distributed 3/3: https://github.com/pytorch/pytorch/actions/runs/28581558341/job/84772673727 (`test (distributed, 3, 3, linux.rocm.gpu.gfx942.4, module:rocm, oncall:distributed)`) <details> <summary>Failure log the amdsmi fix addresses (pre-fix, run 28524549808)</summary> ``` /var/lib/jenkins/workspace/libamd_smi.so: cannot open shared object file: No such file or directory Unable to find libamd_smi.so library try installing amd-smi-lib from your package manager Traceback (most recent call last): File "/var/lib/jenkins/workspace/.ci/pytorch/rocm_preflight.py", line 21, in <module> import torch File ".../site-packages/torch/cuda/__init__.py", line 114, in <module> import amdsmi # type: ignore[import] File ".../site-packages/amdsmi/amdsmi_wrapper.py", line 218, in <module> amdsmi_free_name_value_pairs = _libraries['libamd_smi.so'].amdsmi_free_name_value_pairs KeyError: 'libamd_smi.so' ``` </details> ## Notes: amdsmi discovery + fat-binary logs - **Bare `CDLL("libamd_smi.so")`** comes from amdsmi's own `find_smi_library()` (unversioned candidate), not torch; torch's `_amdsmi_cdll_hook` intercepts it and retries the versioned `_rocm_sdk_core/lib/libamd_smi.so*`. - **Not just preload amdsmi via `_rocm_core_libs`:** amdsmi resolves by exact filename, so an RTLD_GLOBAL versioned `libamd_smi.so.26` won't satisfy it, and eager-preloading a non-`DT_NEEDED` lib reintroduces the ODR double-load the hook prevents — the CDLL-redirect hook is the correct fix. - **`E0702 … code_object.cpp:1038 register fat binary failed` is not caused by this PR:** it's emitted by the HIP/clr C++ runtime, appears ambiently (~4,774×/run across rocm-preview gfx942 jobs incl. the distributed shards above), and is non-fatal — a pre-existing TheRock rocm-preview build/toolchain matter, orthogonal to these two Python-only changes. - **Fix-plan pointer (fat-binary):** prove pre-existing on a PR-free `main` rocm-preview baseline → localize via `AMD_LOG_LEVEL=3/4` → scoped clr-log suppress/demote (escalate to clr/comgr pin or `PYTORCH_ROCM_ARCH` only on a real running-arch failure) → validate via `ciflow/rocm-preview`. Belongs in the build/CI layer, not torch source. Tracked in ROCm/frameworks-internal pytorch#17160. ## Test plan - [x] Validate on the TheRock wheel path via `ciflow/rocm-preview` (see **Validation** above). - [x] `ast.parse` both changed files (`torch/__init__.py`, `torch/cuda/__init__.py`). - [x] Confirm CUDA and CPU builds are unaffected (both fixes no-op when `torch.version.hip is None` / `_rocm_sdk_core` absent). Fixes pytorch#188561 Made with Cursor Pull Request resolved: pytorch#188454 Approved by: https://github.com/jeffdaily
…ck 7.14 Rework the rocm7.14 manywheel wheel install to match PR pytorch#188429's approach: discover the real ROCm SDK install root from the wheel (rocm-sdk path --root, i.e. <site-packages>/_rocm_sdk_core) and drive the build/bundling from there via /etc/rocm_env.sh, instead of faking an /opt/rocm symlink. - install_rocm_wheel.sh: drop the /opt/rocm symlink; export ROCM_PATH/ROCM_HOME pointing at the real rocm-sdk root in /etc/rocm_env.sh. Track the 7.14 line (rocm[...]==7.14.*) from https://repo.amd.com/rocm/whl-multi-arch/ instead of a hard-pinned version. - manywheel/build.sh: pass THEROCK_VERSION=7.14 (minor line; the install script expands it to ==7.14.*). Kept as a bare value so the unquoted docker build args don't glob/redirect. - Dockerfile_2_28 (rocm_wheel_final): remove the ENV ROCM_PATH=/opt/rocm default and the /opt/rocm-based MAGMA install; ROCm is discovered from the wheel env. - build_env_setup.py: add discover_rocm_home() (env -> /etc/rocm_env.sh -> rocm-sdk -> /opt/rocm fallback) and set ROCM_HOME dynamically; enable MAGMA only when $ROCM_HOME/magma exists, else USE_MAGMA=0. repair_wheel.py already reads ROCM_HOME, so it now bundles from the real wheel root. OS/tarball ROCm (rocm7.1) is unaffected.
_linux-build.yml no longer declares a use-arc input on current main (it hardcodes use-arc: true internally when calling setup-linux), so the rocm-preview caller passing use-arc: true failed workflow validation at startup: Invalid workflow file .github/workflows/rocm-preview.yml (Line: 49): Invalid input, use-arc is not defined in the referenced workflow. The input came from the pytorch#188429 payload, which was authored against an older main. Remove the line; arc runners are still selected via runner_prefix "mt-".
…eels Switch the ROCm nightly binary manywheel build from ROCm 7.2 (installed via the rocm/dev-almalinux-8 OS packages) to ROCm 7.14 installed from the multi-arch TheRock wheel index at https://repo.amd.com/rocm/whl-multi-arch/, mirroring the tarball->wheels approach from pytorch#188429. - generate_binary_build_matrix.py: ROCM_ARCHES 7.2 -> 7.14 and regenerate generated-linux-binary-manywheel-nightly.yml; bump the builder image tag in build-manywheel-images.yml. - manywheel/build.sh: add a dedicated rocm7.14 case that builds from a plain almalinux base and passes the TheRock index/version through, instead of the rocm/dev-almalinux-8 image. Handling 7.14 before the generic rocm* case also avoids the *"7.1"* substring match incorrectly bumping 7.14 to 7.14.1. - Dockerfile_2_28: new rocm_wheel_final stage that pip-installs ROCm from the wheel index via install_rocm_wheel.sh and builds MAGMA against it. - install_rocm_wheel.sh: new script that installs rocm[libraries,devel,device-all] from the multi-arch index, discovers the install root via `rocm-sdk path`, and symlinks it to /opt/rocm so the existing build/bundling pipeline keeps discovering ROCm at /opt/rocm. - repair_wheel.py: also bundle the TheRock-vendored rocm_sysdeps libs (libdrm, liblzma, ...) when present; no-op on the OS/tarball layout. The TheRock wheel version is temporarily pinned to 7.14.0a20260612 while the rolling multi-arch wheel index is unstable.
Expand the default test matrix in rocm-preview.yml back to 8 shards, reversing the 6-shard reduction from pytorch#188593. This matches the trunk MI350 shard count and reduces per-shard runtime. Test Plan: - Verified diff restores 8 default shards in rocm-preview.yml Authored with assistance from Cursor Co-authored-by: Cursor <[email protected]>
|
@pytorchbot merge -f "Lint/trunk/rocm-preview passed. linux-binary-manywheel jobs on rocm7.14 seem stuck due to infra issue." |
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 |
…14 (pytorch#188429) Replacement for pytorch#179639 to retrigger CI from a fresh branch with the same ROCm preview changes. Switch the ROCm preview Docker image from ROCm tarball installs to the multi-arch TheRock wheel index. This keeps the source build targeted to `gfx942` and `gfx950` while installing ROCm from `https://rocm.nightlies.amd.com/whl-multi-arch/` with the `device-all` extra, so the image gets the complete multi-arch ROCm wheel set without compiling PyTorch for every TheRock target. The TheRock wheel install is temporarily pinned to `7.14.0a20260712` while the rolling wheel index is unstable. ROCm environment exports were audited and trimmed for the TheRock wheel install path. The reduced `/etc/rocm_env.sh` keeps only the paths needed for PyTorch to discover and link against the wheel-provided ROCm SDK. Removed from the TheRock `/etc/rocm_env.sh` exports: - `ROCM_SOURCE_DIR` - `ROCM_BIN` - `ROCM_CMAKE` - `CMAKE_PREFIX_PATH` - `HIP_DEVICE_LIB_PATH` - `ROCM_DEVICE_LIB_PATH` - `MAGMA_HOME` Also removed stale image-level `/opt/rocm` defaults from `ubuntu-rocm/Dockerfile` so `rocm-preview` does not inherit tarball-era values after switching to wheels: - `ROCM_PATH` - `ROCM_HOME` - `ROCM_SOURCE_DIR` - `ROCM_BIN` - `ROCM_CMAKE` - `ROCM_DEVICE_LIB_PATH` - `HIP_DEVICE_LIB_PATH` - `MAGMA_HOME` - `/opt/rocm` additions to `PATH` - `/opt/rocm/lib` additions to `LD_LIBRARY_PATH` Validation: - Rebuilt the ROCm Docker image locally through the TheRock wheel install and `rocm-origami==0.0.2` install path. - Confirmed `rocm-origami` builds and installs successfully when sourcing `/etc/rocm_env.sh` and passing `CMAKE_PREFIX_PATH=${ROCM_PATH}` to the pip build environment. - Previously ran a full PyTorch ROCm source build with the TheRock wheel environment; CMake found HIP/ROCm from the wheel install path. - trunk.yml run succeeded: https://github.com/pytorch/pytorch/actions/runs/31154362487/job/92960121104 `ROCM_VERSION=7.14` - rocm-preview.yml run succeeded: https://github.com/pytorch/pytorch/actions/runs/31154364177/job/92810055863 `ROCM_VERSION=7.15.0a20260712` Pull Request resolved: pytorch#188429 Approved by: https://github.com/ScottTodd, https://github.com/jeffdaily Co-authored-by: Jithun Nair <[email protected]> Co-authored-by: Cursor <[email protected]>
## Summary Remove 21 temporary ROCm 7.14 test skips added by #188593. ROCm trunk now uses ROCm 7.14. These failures no longer reproduce. ## Child loader fixes #188429 fixed the ROCm wheel environment and library search paths. Child processes can now load the required ROCm libraries. Remove the skips for: - `test/test_multiprocessing.py::TestMultiprocessing::test_fs_sharing` - `test/test_multiprocessing.py::TestMultiprocessing::test_fs_preserve_sharing - `test/test_multiprocessing.py::TestMultiprocessing::test_fs_pool` - `test/test_multiprocessing.py::TestMultiprocessing::test_fs` - `test/test_multiprocessing.py::TestMultiprocessing::test_fs_is_shared` - `test/test_utils.py::TestStandaloneCPPJIT::test_load_standalone` - `test/inductor/test_gpu_cpp_wrapper.py::TestGpuWrapper::test_cuda_cpp_wrapper_keeps_vec_isa_for_host_vectorized_code` - `test/inductor/test_torchinductor_dynamic_shapes.py::DynamicShapesCpuTests::test_tmp_not_defined_issue3_dynamic_shapes_cpu` ## Other obsolete skips The following tests no longer fail with ROCm 7.14: - `test/test_optim.py::TestOptimRenewed::test_rosenbrock_sparse[SGD,cuda,float64,with_lrsched=False]` - `test/test_cuda.py::TestCudaAllocator::test_nvml_get_handler` - `test/test_cuda.py::TestCudaAllocator::test_temperature` - `test/test_cuda.py::TestCudaAllocator::test_device_memory_used` - `test/test_cuda.py::TestCudaAllocator::test_power_draw` - `test/test_cuda.py::TestCudaAllocator::test_clock_speed` - `test/test_cuda.py::TestCudaAllocator::test_raw_amdsmi_device_count` - `test/distributed/_composable/fsdp/test_fully_shard_training.py::TestFullyShard1DTrainingCore::test_post_optim_event` - `test/distributed/_composable/test_replicate_with_compiler.py::ReplicateTest::test_compile_gpu` - `test/distributed/_composable/test_replicate_with_compiler.py::ReplicateTest::test_compile_fp16` - `test/distributed/tensor/test_attention.py::CPFlexAttentionTest::test_cp_flex_attention_causal_mask` - `test/distributed/tensor/test_attention.py::CPFlexAttentionTest::test_cp_flex_attention_document_mask` - `test/test_torch.py::TestTorch::test_cxx_flags` ## ROCm/CUDA CI evidence The PR head (`6d80a47`) was tested in run [31399645566](https://github.com/pytorch/pytorch/actions/runs/31399645566). CI verified 20 of the 21 re-enabled tests; the remaining dynamic-shapes CPU test was not scheduled in the available TD shards. - Multiprocessing (`test_fs_sharing`, `test_fs_preserve_sharing`, `test_fs_pool`, `test_fs`, `test_fs_is_shared`) passed on CUDA 13.0 default shard 3/14: `test_multiprocessing 1/1 was successful` ([job 93495192855, lines 6970-6971](https://github.com/pytorch/pytorch/actions/runs/31399645566/job/93495192855#step:10:6970)). - `test_load_standalone` passed on CUDA 13.0 default shard 2/14: `test_utils 1/1 was successful` ([job 93495192828, line 6966](https://github.com/pytorch/pytorch/actions/runs/31399645566/job/93495192828#step:10:6966)). - `test_cuda_cpp_wrapper_keeps_vec_isa_for_host_vectorized_code` passed on CUDA 13.0 default shard 10/14: `inductor/test_gpu_cpp_wrapper 2/2 was successful` ([job 93495192873, line 7404](https://github.com/pytorch/pytorch/actions/runs/31399645566/job/93495192873#step:10:7404)); the shard list includes the test ([line 7894](https://github.com/pytorch/pytorch/actions/runs/31399645566/job/93495192873#step:10:7894)). - `test_tmp_not_defined_issue3_dynamic_shapes_cpu`: not found in the downloaded CUDA/ROCm TD shard lists for this run. The inductor CPU run [31399645147](https://github.com/pytorch/pytorch/actions/runs/31399645147) explicitly excludes `inductor/test_torchinductor_dynamic_shapes`; this test needs separate validation. - `test_rosenbrock_sparse[SGD,cuda,float64,with_lrsched=False]` passed on ROCm default shard 7/8: `test_optim 1/2 was successful` ([job 93498959456, lines 9052-9053](https://github.com/pytorch/pytorch/actions/runs/31399645566/job/93498959456#step:10:9052)). - The six CUDA allocator/AMD SMI tests (`test_nvml_get_handler`, `test_temperature`, `test_device_memory_used`, `test_power_draw`, `test_clock_speed`, `test_raw_amdsmi_device_count`) passed on ROCm default shard 1/8: `test_cuda 1/1 was successful` ([job 93498959446, lines 9442-9443](https://github.com/pytorch/pytorch/actions/runs/31399645566/job/93498959446#step:10:9442)). - `test_post_optim_event` passed on ROCm distributed shard 1/3: `distributed/_composable/fsdp/test_fully_shard_training 1/1 was successful` ([job 93498959453, line 9041](https://github.com/pytorch/pytorch/actions/runs/31399645566/job/93498959453#step:10:9041)). - `test_compile_gpu` and `test_compile_fp16` passed on ROCm distributed shard 2/3: `distributed/_composable/test_replicate_with_compiler 1/1 was successful` ([job 93498959538, line 9060](https://github.com/pytorch/pytorch/actions/runs/31399645566/job/93498959538#step:10:9060)). - `test_cp_flex_attention_causal_mask` and `test_cp_flex_attention_document_mask` passed on CUDA 13.2 distributed shard 3/3: `distributed/tensor/test_attention 1/1 was successful` ([job 93495192213, lines 6919-6920](https://github.com/pytorch/pytorch/actions/runs/31399645566/job/93495192213#step:10:6919)). - `test_cxx_flags` passed on the ROCm inductor shard: `test_torch 1/3 was successful` ([job 93498959536, line 8650](https://github.com/pytorch/pytorch/actions/runs/31399645566/job/93498959536#step:10:8650)). Individual `PASSED` lines are in the pytest artifacts referenced by these module-level success lines. Pull Request resolved: #192674 Approved by: https://github.com/jeffdaily Co-authored-by: Cursor <[email protected]>
…uctor-periodic (#193216) Unblocks the gfx950 half of #192862. `inductor-periodic` has been red on main for 23 consecutive runs, last green 2026-08-07, so the workflow currently cannot surface any real inductor regression. Not an inductor change. `bb96371605b` (#188429, "Switch rocm-preview to TheRock wheels and upgrade CI to 7.14") landed between the last green run and the first red one. Despite being scoped to `rocm-preview` by title it modified `.ci/docker/common/install_rocm.sh` and `.ci/docker/ubuntu-rocm/Dockerfile`, so the shared `pytorch-linux-jammy-rocm-n-py3-benchmarks` image was rebuilt and every ROCm job picked up the new stack (`BUILD_ROCM_VERSION` 7.2 -> 7.14, ROCm root moving from `/opt/rocm` to the TheRock wheel). ## Why flaky_models rather than rebaselining The first version of this PR pinned expected values per @naromero77amd's guidance in #192862. **I ran it against the real gfx950 jobs and it does not work.** Two of four jobs were fixed; two stayed red, both on the same mode: ``` dynamic_inductor_timm 2/2 vit_base_patch14_dinov2 IMPROVED: accuracy=pass, expected=fail_accuracy dynamic_inductor_torchbench 2/2 torch_multimodal_clip IMPROVED: accuracy=pass, expected=fail_accuracy ``` That invalidates the premise I gave for the pins: - I described `torch_multimodal_clip` as failing 100% consistently and one-directionally, so a genuine numerical change. It **passed** on the first run after being pinned to `fail_accuracy`. The 9/9 sample was real but not predictive. - I only changed `vit_base_patch14_dinov2` on the inference baselines, since only those were failing. The untouched **training** baseline then went red on an improvement. `check_accuracy.py` fails a job on a mismatch in *either* direction, so pinning a value for a nondeterministic model only changes which outcome turns the job red. `flaky_models` is the mechanism built for this: membership yields `PASS_BUT_FLAKY` / `FAIL_BUT_FLAKY`, and neither appends to `failed` or `improved`. The ROCm block already carries `alexnet` and `demucs` for precisely this root cause -- *"Discovered on gfx950 CI after ROCm 7.2 upgrade, eager mode non determinism"*. So this reverts the four CSV edits and adds the three models to the ROCm-scoped set. Nothing changes for CUDA. ## Tradeoff This suppresses accuracy signal for these three models on ROCm entirely, so a genuine regression in them would no longer be caught. That is the same tradeoff already accepted for `alexnet`/`demucs`, and #192862 stays open to investigate the nondeterminism -- consistent with "we will go back and triage later". If you would rather keep real signal for `torch_multimodal_clip` specifically, the alternative is extending `get_eager_nondeterministic_models()` to cover the ROCm paths (it currently returns entries only for two CUDA files). That tolerates only `pass -> eager_two_runs_differ` while still catching a genuine `fail_accuracy`. Happy to switch if preferred -- it is narrower but has no existing ROCm precedent. ## Test plan Every observed outcome simulated through the real `check_accuracy()` with the reverted CSV values: ``` observed=pass job_fails=False observed=eager_two_runs_differ job_fails=False observed=fail_accuracy job_fails=False ``` Under the pinned approach two of those three turn the job red. `ciflow/inductor-periodic` is applied so the gfx950 jobs actually run on this PR -- note `ciflow/trunk` and `ciflow/inductor` do **not** trigger this workflow, which is why the first revision went unverified. Final validation is those four jobs going green here. Authored with the assistance of an AI assistant. ## Maintainer decision @naromero77amd confirmed in #192862 that ROCm prefers the scoped `flaky_models` approach. The alternative eager-nondeterministic handling is therefore not part of this change. The tracking issue remains open for root-causing and eventually removing these exemptions. ## Final validation The `ciflow/inductor-periodic` branch run completed with all ROCm/gfx950 jobs green: https://github.com/pytorch/pytorch/actions/runs/31715044756. Its sole failure was an unrelated CPU Hugging Face offline-cache miss in `dynamic_cpu_inductor_timm 2/2`. Pull Request resolved: #193216 Approved by: https://github.com/naromero77amd, https://github.com/jansel
- [#3525](#3525) (`[release/2.13] Stabilize ROCm 7.14 testing on release/2.13`) added a module-level `sys.exit(0)` in `test/distributed/test_shmem_triton.py` for `ROCM_VERSION >= (7, 14)`. - This PR does two things: 1. **Unskip** that 7.14 `sys.exit(0)`. Keep the existing capability skip when the SHMEM backend is unavailable. 2. **Take the finder hunk** from upstream commit [`4a31e29`](pytorch@4a31e29) (`[ROCm][CI] Fix trunk rocSHMEM and CK failures`, from [pytorch#188429](pytorch#188429)): search `$ROCM_PATH/lib` when `ROCM_PATH` is set, else `/opt/rocm/lib`. - We did **not** take the rest of `4a31e29`. That commit also adds `@skipIfRocmVersionAtLeast([7, 14])` on `test/inductor/test_ck_backend.py`. That CK skip is already on `release/2.13` and is unrelated to this UT. Full `cherry-pick -x` of `4a31e29` would just restage it. We also did not backport the rest of pytorch#188429 (TheRock CI/docker switch). ## Test plan - [x] TheRock `test_pytorch_wheels_full.yml`, `test_configs=distributed`, `tests_to_include=distributed/test_shmem_triton` - gfx94X / `linux-gfx942-1gpu-ccs-csp-ossci-rocm`: https://github.com/ROCm/TheRock/actions/runs/32195967020/job/95904033020 ``` distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_barrier PASSED [13.5964s] distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_fence PASSED [2.5392s] distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_get_nbi_False PASSED [1.3613s] distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_get_nbi_True PASSED [1.4139s] distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_get_ring PASSED [1.7522s] distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_put PASSED [1.6263s] distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_put_signal_add PASSED [1.5214s] distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_put_signal_set PASSED [1.5903s] distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_quiet PASSED [1.5085s] distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_signal_wait_until PASSED [0.0122s] distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_sync PASSED [1.5976s] distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_wait_until PASSED [1.2603s] ======================= 12 passed, 25 skipped in 32.21s ======================== ``` - gfx950: https://github.com/ROCm/TheRock/actions/runs/32201312766/job/95915621757 ``` distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_barrier PASSED [8.2912s] distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_fence PASSED [1.2513s] distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_get_nbi_False PASSED [1.0780s] distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_get_nbi_True PASSED [1.0367s] distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_get_ring PASSED [1.1043s] distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_put PASSED [0.9847s] distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_put_signal_add PASSED [1.1261s] distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_put_signal_set PASSED [1.1993s] distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_quiet PASSED [1.1537s] distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_signal_wait_until PASSED [0.0080s] distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_sync PASSED [1.2694s] distributed/test_shmem_triton.py::SHMEMTritonTest::test_triton_wait_until PASSED [1.0119s] ======================= 12 passed, 25 skipped in 22.50s ======================== ``` - [x] Confirm the 12 Triton cases actually run (not a finder crash, not a module-level skip). Multiprocess alltoall/broadcast/reduces stay `@skip_if_rocm_multiprocess`.
## Problem #188429 pinned TheRock wheels with `==${ROCM_VERSION}`, so `7.14` matches 7.14.0 but not a later patch such as 7.14.1. ## Changes Major.minor pins use prefix matching (`==7.14.*`). Fully specified preview pins stay exact because PEP 440 rejects `==7.15.0a20260712.*`. ## Validation `bash -n .ci/docker/common/install_rocm.sh`. Regex check: `7.14`/`10.1` become `.*`; `7.15.0a20260712` stays exact. Trunk CI requested via `ciflow/trunk`. Pull Request resolved: #194102 Approved by: https://github.com/ScottTodd, https://github.com/jeffdaily
|
AI Generated: This PR's ROCM_VERSION 7.2 → 7.14 bump in .ci/docker/build.sh broke distributed/test_c10d_nccl.py::DistributedDataParallelTest::test_grad_layout_1devicemodule_1replicaperprocess on periodic-rocm-mi200, and it has been Evidence:
The failure is bit-for-bit deterministic across the entire 3-week span, which rules out flakiness: AssertionError: Tensor-likes are not close! It's the fp16 trial (conv0.weight, iter 0) of _test_grad_layout, which compares single-process grads against DDP grads with tol = 3.0e-3 if has_half else 1.0e-5 (test_c10d_nccl.py:3118). ROCm 7.14's MIOpen apparently shifted fp16 Since the delta is tiny and deterministic, the cheapest fix is bumping the half-precision tolerance to 4.0e-3 at that line (optionally ROCm-gated); the alternative is re-filing a DISABLED issue with Platforms: rocm (the previous |
## Summary Remove 21 temporary ROCm 7.14 test skips added by pytorch#188593. ROCm trunk now uses ROCm 7.14. These failures no longer reproduce. ## Child loader fixes pytorch#188429 fixed the ROCm wheel environment and library search paths. Child processes can now load the required ROCm libraries. Remove the skips for: - `test/test_multiprocessing.py::TestMultiprocessing::test_fs_sharing` - `test/test_multiprocessing.py::TestMultiprocessing::test_fs_preserve_sharing - `test/test_multiprocessing.py::TestMultiprocessing::test_fs_pool` - `test/test_multiprocessing.py::TestMultiprocessing::test_fs` - `test/test_multiprocessing.py::TestMultiprocessing::test_fs_is_shared` - `test/test_utils.py::TestStandaloneCPPJIT::test_load_standalone` - `test/inductor/test_gpu_cpp_wrapper.py::TestGpuWrapper::test_cuda_cpp_wrapper_keeps_vec_isa_for_host_vectorized_code` - `test/inductor/test_torchinductor_dynamic_shapes.py::DynamicShapesCpuTests::test_tmp_not_defined_issue3_dynamic_shapes_cpu` ## Other obsolete skips The following tests no longer fail with ROCm 7.14: - `test/test_optim.py::TestOptimRenewed::test_rosenbrock_sparse[SGD,cuda,float64,with_lrsched=False]` - `test/test_cuda.py::TestCudaAllocator::test_nvml_get_handler` - `test/test_cuda.py::TestCudaAllocator::test_temperature` - `test/test_cuda.py::TestCudaAllocator::test_device_memory_used` - `test/test_cuda.py::TestCudaAllocator::test_power_draw` - `test/test_cuda.py::TestCudaAllocator::test_clock_speed` - `test/test_cuda.py::TestCudaAllocator::test_raw_amdsmi_device_count` - `test/distributed/_composable/fsdp/test_fully_shard_training.py::TestFullyShard1DTrainingCore::test_post_optim_event` - `test/distributed/_composable/test_replicate_with_compiler.py::ReplicateTest::test_compile_gpu` - `test/distributed/_composable/test_replicate_with_compiler.py::ReplicateTest::test_compile_fp16` - `test/distributed/tensor/test_attention.py::CPFlexAttentionTest::test_cp_flex_attention_causal_mask` - `test/distributed/tensor/test_attention.py::CPFlexAttentionTest::test_cp_flex_attention_document_mask` - `test/test_torch.py::TestTorch::test_cxx_flags` ## ROCm/CUDA CI evidence The PR head (`6d80a47`) was tested in run [31399645566](https://github.com/pytorch/pytorch/actions/runs/31399645566). CI verified 20 of the 21 re-enabled tests; the remaining dynamic-shapes CPU test was not scheduled in the available TD shards. - Multiprocessing (`test_fs_sharing`, `test_fs_preserve_sharing`, `test_fs_pool`, `test_fs`, `test_fs_is_shared`) passed on CUDA 13.0 default shard 3/14: `test_multiprocessing 1/1 was successful` ([job 93495192855, lines 6970-6971](https://github.com/pytorch/pytorch/actions/runs/31399645566/job/93495192855#step:10:6970)). - `test_load_standalone` passed on CUDA 13.0 default shard 2/14: `test_utils 1/1 was successful` ([job 93495192828, line 6966](https://github.com/pytorch/pytorch/actions/runs/31399645566/job/93495192828#step:10:6966)). - `test_cuda_cpp_wrapper_keeps_vec_isa_for_host_vectorized_code` passed on CUDA 13.0 default shard 10/14: `inductor/test_gpu_cpp_wrapper 2/2 was successful` ([job 93495192873, line 7404](https://github.com/pytorch/pytorch/actions/runs/31399645566/job/93495192873#step:10:7404)); the shard list includes the test ([line 7894](https://github.com/pytorch/pytorch/actions/runs/31399645566/job/93495192873#step:10:7894)). - `test_tmp_not_defined_issue3_dynamic_shapes_cpu`: not found in the downloaded CUDA/ROCm TD shard lists for this run. The inductor CPU run [31399645147](https://github.com/pytorch/pytorch/actions/runs/31399645147) explicitly excludes `inductor/test_torchinductor_dynamic_shapes`; this test needs separate validation. - `test_rosenbrock_sparse[SGD,cuda,float64,with_lrsched=False]` passed on ROCm default shard 7/8: `test_optim 1/2 was successful` ([job 93498959456, lines 9052-9053](https://github.com/pytorch/pytorch/actions/runs/31399645566/job/93498959456#step:10:9052)). - The six CUDA allocator/AMD SMI tests (`test_nvml_get_handler`, `test_temperature`, `test_device_memory_used`, `test_power_draw`, `test_clock_speed`, `test_raw_amdsmi_device_count`) passed on ROCm default shard 1/8: `test_cuda 1/1 was successful` ([job 93498959446, lines 9442-9443](https://github.com/pytorch/pytorch/actions/runs/31399645566/job/93498959446#step:10:9442)). - `test_post_optim_event` passed on ROCm distributed shard 1/3: `distributed/_composable/fsdp/test_fully_shard_training 1/1 was successful` ([job 93498959453, line 9041](https://github.com/pytorch/pytorch/actions/runs/31399645566/job/93498959453#step:10:9041)). - `test_compile_gpu` and `test_compile_fp16` passed on ROCm distributed shard 2/3: `distributed/_composable/test_replicate_with_compiler 1/1 was successful` ([job 93498959538, line 9060](https://github.com/pytorch/pytorch/actions/runs/31399645566/job/93498959538#step:10:9060)). - `test_cp_flex_attention_causal_mask` and `test_cp_flex_attention_document_mask` passed on CUDA 13.2 distributed shard 3/3: `distributed/tensor/test_attention 1/1 was successful` ([job 93495192213, lines 6919-6920](https://github.com/pytorch/pytorch/actions/runs/31399645566/job/93495192213#step:10:6919)). - `test_cxx_flags` passed on the ROCm inductor shard: `test_torch 1/3 was successful` ([job 93498959536, line 8650](https://github.com/pytorch/pytorch/actions/runs/31399645566/job/93498959536#step:10:8650)). Individual `PASSED` lines are in the pytest artifacts referenced by these module-level success lines. Pull Request resolved: pytorch#192674 Approved by: https://github.com/jeffdaily Co-authored-by: Cursor <[email protected]>
…uctor-periodic (pytorch#193216) Unblocks the gfx950 half of pytorch#192862. `inductor-periodic` has been red on main for 23 consecutive runs, last green 2026-08-07, so the workflow currently cannot surface any real inductor regression. Not an inductor change. `bb96371605b` (pytorch#188429, "Switch rocm-preview to TheRock wheels and upgrade CI to 7.14") landed between the last green run and the first red one. Despite being scoped to `rocm-preview` by title it modified `.ci/docker/common/install_rocm.sh` and `.ci/docker/ubuntu-rocm/Dockerfile`, so the shared `pytorch-linux-jammy-rocm-n-py3-benchmarks` image was rebuilt and every ROCm job picked up the new stack (`BUILD_ROCM_VERSION` 7.2 -> 7.14, ROCm root moving from `/opt/rocm` to the TheRock wheel). ## Why flaky_models rather than rebaselining The first version of this PR pinned expected values per @naromero77amd's guidance in pytorch#192862. **I ran it against the real gfx950 jobs and it does not work.** Two of four jobs were fixed; two stayed red, both on the same mode: ``` dynamic_inductor_timm 2/2 vit_base_patch14_dinov2 IMPROVED: accuracy=pass, expected=fail_accuracy dynamic_inductor_torchbench 2/2 torch_multimodal_clip IMPROVED: accuracy=pass, expected=fail_accuracy ``` That invalidates the premise I gave for the pins: - I described `torch_multimodal_clip` as failing 100% consistently and one-directionally, so a genuine numerical change. It **passed** on the first run after being pinned to `fail_accuracy`. The 9/9 sample was real but not predictive. - I only changed `vit_base_patch14_dinov2` on the inference baselines, since only those were failing. The untouched **training** baseline then went red on an improvement. `check_accuracy.py` fails a job on a mismatch in *either* direction, so pinning a value for a nondeterministic model only changes which outcome turns the job red. `flaky_models` is the mechanism built for this: membership yields `PASS_BUT_FLAKY` / `FAIL_BUT_FLAKY`, and neither appends to `failed` or `improved`. The ROCm block already carries `alexnet` and `demucs` for precisely this root cause -- *"Discovered on gfx950 CI after ROCm 7.2 upgrade, eager mode non determinism"*. So this reverts the four CSV edits and adds the three models to the ROCm-scoped set. Nothing changes for CUDA. ## Tradeoff This suppresses accuracy signal for these three models on ROCm entirely, so a genuine regression in them would no longer be caught. That is the same tradeoff already accepted for `alexnet`/`demucs`, and pytorch#192862 stays open to investigate the nondeterminism -- consistent with "we will go back and triage later". If you would rather keep real signal for `torch_multimodal_clip` specifically, the alternative is extending `get_eager_nondeterministic_models()` to cover the ROCm paths (it currently returns entries only for two CUDA files). That tolerates only `pass -> eager_two_runs_differ` while still catching a genuine `fail_accuracy`. Happy to switch if preferred -- it is narrower but has no existing ROCm precedent. ## Test plan Every observed outcome simulated through the real `check_accuracy()` with the reverted CSV values: ``` observed=pass job_fails=False observed=eager_two_runs_differ job_fails=False observed=fail_accuracy job_fails=False ``` Under the pinned approach two of those three turn the job red. `ciflow/inductor-periodic` is applied so the gfx950 jobs actually run on this PR -- note `ciflow/trunk` and `ciflow/inductor` do **not** trigger this workflow, which is why the first revision went unverified. Final validation is those four jobs going green here. Authored with the assistance of an AI assistant. ## Maintainer decision @naromero77amd confirmed in pytorch#192862 that ROCm prefers the scoped `flaky_models` approach. The alternative eager-nondeterministic handling is therefore not part of this change. The tracking issue remains open for root-causing and eventually removing these exemptions. ## Final validation The `ciflow/inductor-periodic` branch run completed with all ROCm/gfx950 jobs green: https://github.com/pytorch/pytorch/actions/runs/31715044756. Its sole failure was an unrelated CPU Hugging Face offline-cache miss in `dynamic_cpu_inductor_timm 2/2`. Pull Request resolved: pytorch#193216 Approved by: https://github.com/naromero77amd, https://github.com/jansel
) ## Problem pytorch#188429 pinned TheRock wheels with `==${ROCM_VERSION}`, so `7.14` matches 7.14.0 but not a later patch such as 7.14.1. ## Changes Major.minor pins use prefix matching (`==7.14.*`). Fully specified preview pins stay exact because PEP 440 rejects `==7.15.0a20260712.*`. ## Validation `bash -n .ci/docker/common/install_rocm.sh`. Regex check: `7.14`/`10.1` become `.*`; `7.15.0a20260712` stays exact. Trunk CI requested via `ciflow/trunk`. Pull Request resolved: pytorch#194102 Approved by: https://github.com/ScottTodd, https://github.com/jeffdaily
…el and re-enable CI tests (#195658) Advances the `rocm-composable-kernel` pin and generates the one CK header the wheel does not ship. Restores CK autotuning in CI disabled due to stale pin. ## Motivation ROCm 7.14 stopped installing the CK headers system-wide, so the inductor CK backends now compile against what the `ck4inductor` wheel ships. Every header they `#include` is checked into CK except one: `ck/config.h` is generated by CK's build from `include/ck/config.h.in`, so it exists in neither ROCm nor the wheel's source tree. Without it every CK choice fails to compile and is silently discarded, so the CK backends contribute no autotune candidates at all rather than reporting a missing header. Scope: this restores CK autotuning in CI. The ROCm CD path has routed through the Python build pipeline since #182696 and has no CK step. ## Changes **Generate `ck/config.h`** (`.ci/pytorch/rocm_utils.sh`, `.ci/pytorch/generate_ck_config_h.cmake`) `build_rocm_ck_wheel()` now generates the header for `gfx90a;gfx942;gfx950` and packages it with the rest of `include/ck`. This replaces the `ck_tile` `pyproject.toml` patch, which the new pin makes a no-op. CK's own CMake cannot produce it in the wheel-build container: `CMakeLists.txt` calls `find_package(ROCM)`, `find_package(hip REQUIRED)` and `enable_language(HIP)`, and the image has `hipcc` but no ROCm CMake packages. `config.h.in` substitutes only plain variables, so the helper sets them and runs the same `configure_file` in `cmake -P` script mode. The helper mirrors CK's arch rules rather than referencing them, so it assigns every variable unconditionally — `"ON"` or empty — instead of only in the true branch. Leaving one undefined would be indistinguishable from a deliberate OFF, which both defeats the drift check and makes the script reject any target list that does not happen to enable everything. > **Note for CI:** this step shells out to `cmake -P`, so the wheel-build image must > provide `cmake`. **Pin bump** `4266f867` → `e2daf442` The outgoing pin is from February. The new one packages the `ck_tile` headers in `pyproject.toml`, which makes the patch #189646 added to `rocm_utils.sh` a no-op. It also makes instance enumeration deterministic and duplicate-free, so a given wheel offers the same candidates on every machine instead of depending on filesystem order. This pin is also a prerequisite for follow-up PRs adding gfx1250 WMMA support. **Re-enable version-skipped tests** (`test/inductor/test_ck_backend.py`) Removes seven `skipIfRocmVersionAtLeast([7, 14])` decorators, added in #188593 (and one in #188429) for known 7.14 failures. The predicate is `>=`, so on ROCm 10.x it evaluates true and these subtests are skipped on every current ROCm CI job rather than only on the 7.14 release they were written for. ## Test plan Verified on hardware with both wheels built from this branch — the CK wheel by the real `build_rocm_ck_wheel()`, so the code under test is what produced the artifact. | Arch | Collected | Result | |---|---|---| | gfx942 (MI300X) | 84 | 76 passed, 8 skipped | | gfx942 (MI325X) | 84 | 76 passed, 8 skipped | The 8 skips are the `scaled_mm` cells, skipped upstream for unrelated reasons. @pytorchbot label "topic: not user facing" Pull Request resolved: #195658 Approved by: https://github.com/jeffdaily
Replacement for #179639 to retrigger CI from a fresh branch with the same ROCm preview changes.
Switch the ROCm preview Docker image from ROCm tarball installs to the multi-arch TheRock wheel index.
This keeps the source build targeted to
gfx942andgfx950while installing ROCm fromhttps://rocm.nightlies.amd.com/whl-multi-arch/with thedevice-allextra, so the image gets the complete multi-arch ROCm wheel set without compiling PyTorch for every TheRock target.The TheRock wheel install is temporarily pinned to
7.14.0a20260712while the rolling wheel index is unstable.ROCm environment exports were audited and trimmed for the TheRock wheel install path. The reduced
/etc/rocm_env.shkeeps only the paths needed for PyTorch to discover and link against the wheel-provided ROCm SDK.Removed from the TheRock
/etc/rocm_env.shexports:ROCM_SOURCE_DIRROCM_BINROCM_CMAKECMAKE_PREFIX_PATHHIP_DEVICE_LIB_PATHROCM_DEVICE_LIB_PATHMAGMA_HOMEAlso removed stale image-level
/opt/rocmdefaults fromubuntu-rocm/Dockerfilesorocm-previewdoes not inherit tarball-era values after switching to wheels:ROCM_PATHROCM_HOMEROCM_SOURCE_DIRROCM_BINROCM_CMAKEROCM_DEVICE_LIB_PATHHIP_DEVICE_LIB_PATHMAGMA_HOME/opt/rocmadditions toPATH/opt/rocm/libadditions toLD_LIBRARY_PATHValidation:
rocm-origami==0.0.2install path.rocm-origamibuilds and installs successfully when sourcing/etc/rocm_env.shand passingCMAKE_PREFIX_PATH=${ROCM_PATH}to the pip build environment.ROCM_VERSION=7.14ROCM_VERSION=7.15.0a20260712cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @jataylo @hongxiayang @naromero77amd @pragupta @jerrymannil @xinyazhang @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben