Skip to content

[OPUS] [Bugfix] Restore shadowed OPUS A16W16 cache-policy registrations - #5972

Merged
yifehuan merged 3 commits into
ROCm:mainfrom
adenzhou1350:codex/fix-opus-cache-policy-kids
Oct 13, 2026
Merged

yifehuan merged 3 commits into
ROCm:mainfrom
adenzhou1350:codex/fix-opus-cache-policy-kids

Conversation

@adenzhou1350

Copy link
Copy Markdown
Contributor

Summary

The split-barrier A16W16 cache-policy dictionaries currently overlap: the
offset + 1000 nooob mirror overwrites the next policy's OOB ids, and the
4g-safe family then overwrites the balanced nooob ids. This silently removes
18 declared configurations from the canonical registry used by codegen and
exact-kid dispatch.

Use explicit OOB/nooob offsets and move only the previously shadowed variants:

Configuration New ids
Nheavy, OOB 7004–7009
Balanced, OOB 7104–7109
Balanced, nooob 7204–7209

All previously visible ids keep exactly the same configuration, including
3004–3009 (Mheavy nooob), 4004–4009 (Nheavy nooob), and 5004–5009 (legacy
4g-safe). Existing tuned rows and compiled-kid sidecars need no migration.
No device kernel implementation or default compile floor is changed.

Testing

  • New CPU-only registry suite: 4 tests pass on Windows Python 3.12 and WSL
    Python; against unmodified main, coverage/registration/routing tests fail
    while the legacy-id compatibility test passes.
  • Independent full-registry comparison: all 927 existing id-to-dataclass
    bindings unchanged; 18 restored ids; all 945 family ids unique.
  • Actual gen_instances.py with GPU_ARCHS=gfx950 and the 18 new ids passed;
    generated BF16/FP32 dispatch tables and source instances contain the restored
    configurations. This is source generation, not GPU compilation.
  • Black 26.3.0, Ruff 0.15.7, and git diff --check pass.

Reproduce the registry tests without Torch/ROCm:

python -m unittest op_tests.test_opus_a16w16_registry

No AMD GPU was available locally, so HIP compilation and GPU numerical tests
have not been run. No performance improvement is claimed.

AI-assisted implementation; the evidence above was checked independently of
the Scout's original proposal.

@adenzhou1350
adenzhou1350 requested a review from a team September 30, 2026 04:29
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
multigpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 5972 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

@github-actions github-actions Bot changed the title [Bugfix] Restore shadowed OPUS A16W16 cache-policy registrations [OPUS] [Bugfix] Restore shadowed OPUS A16W16 cache-policy registrations Sep 30, 2026
@github-actions github-actions Bot added the OPUS label Sep 30, 2026
@adenzhou1350

Copy link
Copy Markdown
Contributor Author

@demonsan could you review the ID allocation? This keeps every existing ID's configuration unchanged and restores only the 18 shadowed cache-policy variants. CPU registry and source-generation checks pass; I don't have an AMD GPU for compilation/runtime validation.

@zufayu
zufayu requested a review from yifehuan October 1, 2026 00:35
@demonsan
demonsan self-requested a review October 1, 2026 10:26
@demonsan

demonsan commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

@demonsan could you review the ID allocation? This keeps every existing ID's configuration unchanged and restores only the 18 shadowed cache-policy variants. CPU registry and source-generation checks pass; I don't have an AMD GPU for compilation/runtime validation.

These changes will make the exist kid change. Will check them.

@adenzhou1350

Copy link
Copy Markdown
Contributor Author

Thanks for checking. The declared-but-shadowed variants do get new IDs; the compatibility boundary is the effective merged kernels_list. I rechecked all 927 existing ID-to-configuration bindings against the PR baseline, and none changed. For example, 3004 still selects Mheavy/nooob; the previously overwritten Nheavy/OOB variant is restored at 7004. Only 18 previously unreachable variants are added. Happy to adjust the new ID allocation if you prefer another range.

demonsan
demonsan previously approved these changes Oct 4, 2026
@zufayu

zufayu commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

@aiter-bot review


Trying the review bot on a few representative PRs across different areas, so the team can see what it actually produces on real diffs.

How to use it — just comment on any PR:

  • @aiter-bot review — first pass
  • @aiter-bot re-review — after you push fixes

What it is: advisory only. It surfaces hints for a human reviewer — perf regressions, silent correctness bugs, dispatch-gate holes, AI-generated code patterns. Its judgement is stochastic, it never blocks a merge, and every verdict (✅ / ⚠️ / 🔴) is posted so the reviewer who asked for it sees the result.

It runs on a self-hosted box against a local model, so a pass takes roughly 25–30 min.

Who can trigger it: the logins in authorized.txt — the aiter review roster. Details in SKILL.md.

@aiter-bot

Copy link
Copy Markdown

ROCm/aiter PR #5972 — [OPUS] [Bugfix] Restore shadowed OPUS A16W16 cache-policy registrations

Restores 18 shadowed OPUS A16W16 cache-policy registrations on gfx950 by giving the three colliding variant families explicit disjoint kid offsets (7000/7100/7200 band) in csrc/opus_gemm/opus_gemm_common.py, keeping every previously visible kid's configuration identical so existing tuned CSVs and compiled-kid sidecars need no migration.

Review (advisory): ⚠️ NEEDS WORK
Validation (deterministic): NOT RUN — auto-validation disabled (REVIEW_AUTO_VALIDATE=0) and no report supplied; the single CPU-only target op_tests/test_opus_a16w16_registry.py exists (hand-run: 4/4 pass on head, 37 failures on unmodified base)
Perf (advisory): NOT RUN — target exposes no benchmark entry point (no --scenario bench, no perftest/@benchmark harness); no kernel code changed and no perf claim is made

📝 [verified] The 18 restored variants in csrc/opus_gemm/opus_gemm_common.py have never been compiled: Nheavy-OOB and balanced-OOB were unreachable in the merged kernels_list from the day the family landed (the +1000 mirror is already in commit 2981058), the PR states no AMD GPU was available for HIP compilation, and they auto-enter the next a16w16 tune run's candidate pool (opus_gemm_tune.py builds it from NON_SPLITK_KIDS) — so a variant that fails to compile would abort that tune run loudly, mid-run. Author must run a gfx950 compile smoke of the 18 new ids (gen_instances --extra_kids 7004-7209 + module build) before the next tuning run relies on them.
📝 [verified] The PR fixes the two colliding families but not the hazard class: the kernels_list merge at csrc/opus_gemm/opus_gemm_common.py:1724 is a plain dict literal that silently overwrites colliding kids, and the new regression test guards only a16w16_kernels_list_cpol/cpol_nooob — the next family registered at an occupied offset would be shadowed silently again (today the registry is collision-free: 0 shadowed declarations across all 25 families). Author must extend the uniqueness check to every family dict (or assert it at module level) so a future colliding offset fails at import/test time instead of silently dropping variants.
📝 [verified] The neighboring band comment this PR did not touch is wrong: csrc/opus_gemm/opus_gemm_common.py:786 says the persistent nooob mirrors are "legacy (1300..1305) and cpol (1306..1323)" but the registry actually holds 1300-1303 and 1304-1315, so a maintainer extending that family from the comment would pick a band they believe is free. Reviewer should ask for the two ranges to be corrected while this file's band documentation is being made truthful.

@adenzhou1350

Copy link
Copy Markdown
Contributor Author

Added a merge-wide uniqueness test in 8bccd47: it derives all 25 families from the actual merge, and each injected duplicate ID is rejected. All 5 CPU tests pass. Also corrected the persistent mirror ranges.

I still don't have gfx950 hardware, so compilation of the 18 restored variants remains unverified. Could a reviewer run that smoke before the tuning pool uses them?

@adenzhou1350

adenzhou1350 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor Author

CI follow-up for 8bccd47: the current head has 9 workflows awaiting maintainer approval, and the previous approval was dismissed by the new push. @yifehuan could you approve the relevant CI and review this head, including the outstanding gfx950 compile smoke?

demonsan
demonsan previously approved these changes Oct 12, 2026
@demonsan

Copy link
Copy Markdown
Contributor

please fix code style and pass basic CI Test. Functions seems fine

@adenzhou1350

Copy link
Copy Markdown
Contributor Author

Thanks, @demonsan. Fixed the Ruff I001 import-order failure in 09e3e63; this commit only reorders the test imports. On Linux, the CI-pinned Ruff 0.16.0 reproduces I001 before the fix and passes both changed files afterward; Black 26.3.0 also passes both files. All 5 CPU registry tests pass on Linux and Windows, and git diff --check passes.

The new push dismissed the approval, so I requested re-review. The new hosted checks have not completed yet; could a maintainer approve any pending workflows so the basic CI can run? The gfx950 compile smoke for the 18 restored variants remains unverified in my environment.

@adenzhou1350

Copy link
Copy Markdown
Contributor Author

Hosted-CI update for 09e3e63: Black, Ruff and the repository-dependency checks now pass. Both OPUS jobs (MI35X and MI300X), the wheel build and all eight MI35X standard-test shards also pass. The eight MI300X standard-test shards are still queued, so the required Aiter Test Gate is not complete. These job results do not establish a targeted compile smoke for all 18 restored IDs.

@adenzhou1350

Copy link
Copy Markdown
Contributor Author

CI has now completed for 09e3e63: 37 checks passed and 24 were skipped; the required Aiter Test Gate passed. Black/Ruff, both OPUS jobs and the standard GPU test shards are green. The current head is ready for the requested re-review. A targeted compile smoke covering all 18 restored IDs is still not established by these job summaries.

@yifehuan yifehuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! I ran the gfx950 smoke you asked for on MI355X. All 18 restored kids compile and match the fp32 reference, the same as the existing kids with the same tiles. LGTM 👍

@yifehuan
yifehuan merged commit 748aa48 into ROCm:main Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants