Skip to content

feat(setup): match rocm-libraries commit to Quartz nightly's TheRock commit - #145

Closed
SamuelReeder wants to merge 2 commits into
fm/dnn-bench-quartz-nightlyfrom
users/sareeder/quartz-lock-rocm-libraries
Closed

SamuelReeder wants to merge 2 commits into
fm/dnn-bench-quartz-nightlyfrom
users/sareeder/quartz-lock-rocm-libraries

Conversation

@SamuelReeder

@SamuelReeder SamuelReeder commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Stacked on #135 (base: fm/dnn-bench-quartz-nightly). Retarget to main after #135 merges (or fold into #135).

In --torch-mode rocm, setup_env.py installs ROCm PyTorch and SDK wheels from a Quartz-selected TheRock nightly, then builds hipDNN and its providers (miopen-provider, hipblaslt-provider, hip-kernel-provider) from rocm-libraries against that wheel's MIOpen. When the pinned rocm-libraries submodule lags the nightly wheel across a MIOpen/miopen-provider ABI change (such as ROCm/rocm-libraries#16128, which renamed miopenConvolution*GetWorkSpaceSizeRange to *_impl in libMIOpen_private.so), libmiopen_plugin.so fails to load at runtime and MIOPEN_ENGINE disappears.

This change resolves the rocm-libraries submodule commit from ROCm/TheRock at the Quartz nightly's therock_commit, keeping miopen-provider and hipDNN in lockstep with the wheel's MIOpen by default:

  1. resolve_therock_rocm_libraries_commit() reads the rocm-libraries gitlink from https://github.com/ROCm/TheRock.git at therock_commit using a bare, tree-filtered git fetch (--depth 1 --filter=tree:0, ~10 KB, no GitHub REST API rate limit) and git ls-tree. Missing git and fetch failures produce actionable errors with captured stderr.
  2. Setup.ensure_rocm_libraries_checkout() resolves the rocm-libraries commit in this order:
    • Explicit --rocm-libraries-ref <sha>.
    • In rocm mode (or existing mode with a ROCm venv carrying dnn-bench-rocm-build.json), the rocm-libraries commit pinned by therock_commit. Setup caches rocm_libraries_commit in dnn-bench-rocm-build.json so reused venvs make no network call.
    • Otherwise (cpu, none, custom --torch-index-url without Quartz, or a --rocm-version unknown to Quartz), the repository's pinned rocm-libraries submodule commit.
  3. An existing rocm-libraries/ checkout is kept untouched: the TheRock lookup is advisory (required=False), warning instead of aborting if offline or unreachable, and warning if HEAD differs from the Quartz-matched commit.
  4. dockerfiles/build-dnn-benchmark-performance-image.sh validates --rocm-libraries-ref up front and resolves the Quartz-matched rocm-libraries commit on the host instead of overriding Quartz with the local submodule pin. Dockerfile.dnn-benchmark-performance-linux declares ARG ROCM_LIBRARIES_REF after COPY . . (next to ROCM_VERSION) so new nightlies reuse the apt layer.
  5. .github/workflows/setup.yml and .github/workflows/check-deserialize.yml print rocm_libraries_commit in the Log the ROCm build summary line.

Verification

  • pytest tests/unit/test_setup_env.py tests/unit/metrics/test_machine_info.py tests/unit/reporting/test_schema_v2.py -q: 179 passed, 1 skipped (including real-git bare-repo tests, advisory offline reuse, missing git handling, lockstep checkout + cache reuse, mismatch warning, --rocm-libraries-ref override, and non-Quartz fallbacks).
  • black==25.12.0 --check setup_env.py tests/unit/test_setup_env.py: passed.
  • bash -n dockerfiles/build-dnn-benchmark-performance-image.sh, invalid --rocm-libraries-ref early exit (code 2), and live dry run (--container-command true --device-target gfx950 -> ROCm 10.3.0a20261123, rocm-libraries 6b5f0a16f7562fdb94fe4405836998322b507431).

…commit

In --torch-mode rocm, setup_env.py installs ROCm PyTorch and SDK wheels
from a Quartz-selected TheRock nightly, then builds hipDNN and its
providers (including miopen-provider) from rocm-libraries against that
wheel's MIOpen. When the rocm-libraries submodule lags the nightly
wheel across a MIOpen/miopen-provider ABI change (for example the
MIOpen_private symbol rename in ROCm/rocm-libraries#16128),
libmiopen_plugin.so fails to load at runtime.

Resolve the rocm-libraries submodule gitlink from ROCm/TheRock at the
Quartz-selected nightly's therock_commit via a tree-filtered git fetch
(~10 KB, no GitHub REST API rate limit) and use it by default when
rocm-libraries/ is absent:

- Explicit --rocm-libraries-ref always takes precedence.
- Otherwise, in rocm mode (or existing mode on a ROCm venv) with a
  Quartz-known therock_commit, resolve and cache rocm_libraries_commit
  in dnn-bench-rocm-build.json so reused venvs make no network call.
- Non-ROCm modes and builds without a Quartz therock_commit keep the
  repository's pinned rocm-libraries submodule commit.
- build-dnn-benchmark-performance-image.sh resolves the matched
  rocm-libraries commit on the host (with an optional
  --rocm-libraries-ref override) instead of overriding Quartz with the
  local submodule pin.
- CI job summaries now print the matched rocm-libraries commit.
…Docker apt cache, validate ref

- Make Quartz therock_commit -> rocm-libraries resolution advisory when
  rocm-libraries/.git already exists: warn and keep the existing checkout
  instead of aborting setup when offline or git is unavailable.
- Capture git stderr cleanly and handle missing git (FileNotFoundError)
  without a traceback.
- Move ARG ROCM_LIBRARIES_REF below COPY . . in
  Dockerfile.dnn-benchmark-performance-linux so new nightlies reuse the
  apt layer.
- Validate --rocm-libraries-ref up front in
  build-dnn-benchmark-performance-image.sh before Quartz or docker build.
- Update docs/setup.md options table and Docker section, and add unit
  tests for offline existing-checkout reuse and missing git.
@SamuelReeder
SamuelReeder force-pushed the users/sareeder/quartz-lock-rocm-libraries branch from 4218f15 to 47df596 Compare November 23, 2026 19:20
@SamuelReeder
SamuelReeder changed the base branch from main to fm/dnn-bench-quartz-nightly November 23, 2026 19:20
@SamuelReeder
SamuelReeder added this pull request to stack #146 November 23, 2026 19:21
@SamuelReeder

Copy link
Copy Markdown
Collaborator Author

Superseded by #147.

@SamuelReeder
SamuelReeder deleted the users/sareeder/quartz-lock-rocm-libraries branch November 24, 2026 15:54
SamuelReeder added a commit that referenced this pull request Nov 24, 2026
…libraries submodule (ALMIOPEN-3465) (#147)

## Summary

> Builds on the Quartz reader from #135 (rebased onto `main`) and
supersedes #145.

Previously, `setup_env.py --torch-mode rocm` installed rolling
ROCm/PyTorch nightly wheels while building hipDNN and `miopen-provider`
from the pinned `rocm-libraries` git submodule. Whenever the nightly
wheel's MIOpen and `miopen-provider` changed together (such as
`ROCm/rocm-libraries#16128`, renaming
`miopenConvolution*GetWorkSpaceSizeRange` to `*_impl` in
`libMIOpen_private.so`), `libmiopen_plugin.so` failed to load on `main`.
Conversely, rolling both live on every CI run exposes developer PRs to
upstream regressions that Quartz does not test (for example rocKE, which
TheRock builds with `HIPKERNELPROVIDER_ENABLE_ROCKE=OFF`).

This PR replaces the `rocm-libraries` submodule with a per-architecture
checked-in **`rocm-pin.json`** updated via gated Quartz bump PRs:

1. **Per-arch checked-in lockstep pin (`rocm-pin.json`):** Maps each
architecture (`gfx90a`, `gfx942`, `gfx950`, `gfx1151`) to its own
last-known-good `rocm_version`, `build_date`, `therock_commit`,
`rocm_libraries_commit`, and `index_url`, with a `default` fallback
(`gfx950`) for unlisted architectures and non-ROCm modes.
- `gfx90a`: `10.3.0a20261120` / `rocm-libraries` `bd4da658…` (newest
nightly passing `gfx90a` Quartz tests)
- `gfx942`, `gfx950`, `gfx1151`: `10.3.0a20261123` / `rocm-libraries`
`6b5f0a16…`
- Default `setup_env.py`, CI (`setup.yml`, `check-deserialize.yml`), and
Docker builds read `rocm-pin.json` with zero Quartz/TheRock network
calls.
2. **Removed `rocm-libraries` git submodule:** Deleted the
`rocm-libraries` gitlink and `.gitmodules` entry (keeping `aiter`),
gitignored `/rocm-libraries/`, and updated `setup_env.py` to
sparse-clone from `https://github.com/ROCm/rocm-libraries.git` on
demand. Eliminates broken Dependabot `rocm-libraries` bump PRs.
3. **Opt-in live Quartz & overrides:**
- `--rocm-version latest` queries Quartz live and resolves the matching
`rocm-libraries` commit from `ROCm/TheRock` via a bare `--depth 1
--filter=tree:0` fetch (~10 KB, no GitHub REST API rate limit).
- `--rocm-version <VERSION>` pins another nightly and resolves its
matched `rocm-libraries` commit.
- `--rocm-libraries-ref <SHA>` or an existing `rocm-libraries/`
checkout/worktree overrides the source commit; on an existing checkout,
TheRock lookup is advisory (warns instead of failing offline).
4. **Scheduled per-arch Quartz bump workflow
(`.github/workflows/bump-rocm-pin.yml`):** Runs Mon/Wed (and on
`workflow_dispatch`), checks each architecture independently in Quartz
(`gfx90a`/`gfx942`/`gfx950` on Linux; `gfx1151` on Windows + Linux
builds), advances only architectures with a newer passing nightly,
leaves failing architectures untouched, opens/updates a PR on
`chore/bump-rocm-pin` (skipping redundant pushes when unchanged), and
enables squash auto-merge (`gh pr merge --auto --squash`). Updated
`check-deserialize.yml` path filters to include `rocm-pin.json` and
`setup_env.py`.
5. **Docker:** `build-dnn-benchmark-performance-image.sh` reads
`rocm-pin.json` for `--device-target` offline by default (no host `git`
or network required), validates `--rocm-version` /
`--rocm-libraries-ref` up front, and
`Dockerfile.dnn-benchmark-performance-linux` declares
`ROCM_TORCH_INDEX_URL`, `ROCM_VERSION`, and `ROCM_LIBRARIES_REF` below
`COPY . .` so new pins reuse the apt layer.

## Verification

- `.venv/bin/pytest tests/unit/test_setup_env.py
tests/unit/metrics/test_machine_info.py
tests/unit/reporting/test_schema_v3.py -q`: **186 passed, 1 skipped**
(Windows-only test).
- `uvx black==25.12.0 --check setup_env.py
tests/unit/test_setup_env.py`: passed.
- Workflow YAML syntax, `bash -n`, Docker dry runs across
`gfx90a`/`gfx942`/`gfx950`/`gfx1201`, and live simulations of
`.github/workflows/bump-rocm-pin.yml` (both no-op and single-arch bump
paths): all passed.

---------

Co-authored-by: Thomas Vy <tvy@amd.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant