Skip to content

feat(rocke): enable mixed scaled GEMM on shared operand storage - #12279

Merged
tenpercent merged 29 commits into
developfrom
users/mpodkory/rocke/mixed-scaled-gemm
Oct 9, 2026
Merged

tenpercent merged 29 commits into
developfrom
users/mpodkory/rocke/mixed-scaled-gemm

Conversation

@tenpercent

@tenpercent tenpercent commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Enable different A/B matrix formats in gfx1250 SCALE/SCALE16 GEMM with E8M0 scales. The mixed example defaults to FP8 E4M3 x FP4 E2M1; --dtype-a and --dtype-b independently select FP8, BF8, FP6, BF6, or FP4. Equal normalized formats direct users to the homogeneous examples. --output-dtype selects BF16 or FP16 through the shared verifier.

Adds 40 mixed catalog entries (20 ordered pairs in each scale mode) in Python and C++, removes the homogeneous-only builder restriction, and adds the mixed example and focused coverage. Existing atom-selected storage, fragment loading, scale layouts, and lowering are reused. FP6 #12140, common storage #12457, and FP4 #11960 are merged; this branch incorporates develop at eb209ed0b414de157635b0b3737d57df85a6986f. Alternative scale formats remain outside this PR.

The review fixes regenerate all 40 mixed LLVM 23 golden hashes after the develop merge introduced p10–p15 in the emitted datalayout. Removing only those six entries from every emitted datalayout recovers all 40 previous hashes. The current datalayout is retained. Native validation success messages now name both canonical operand formats in A/B order, for example wmma_scale fp8xfp4 GEMM.

Validation for a5fd7b410757bc326e428977bb09fa2fbe3da4d6:

  • 245 focused host tests plus 26 subtests passed separately under Python, strict C++, and strict dual-backend modes using a fresh native build, with zero failures/errors/skips. Includes all 102 mixed-module cases and adjacent FP8/BF8, FP4, FP6, and mixed-example coverage.
  • All 14 native CTests passed.
  • Affected gfx1250 differential parity passed all 72 configurations for each of LLVM20/22/23. LLVM23 emitted identical bytes for all 72; LLVM20/22 each had 16 byte-identical results and 56 matching unsupported rejections. Includes all 40 mixed configurations.
  • Shared representative golden checks passed for LLVM20/22/23; homogeneous golden fixtures are unchanged by the review fixes.
  • Diagnostic smoke checks passed for both native modes, reversed operands, aliases, and homogeneous pairs. All eight exercised LLVM23 outputs and 32 invalid-spec decisions match the starting head.
  • Repository pre-commit hooks passed over the final committed PR range.

Historical GPU evidence, retained for its recorded source revisions:

  • Merge iteration: source a34575fa3e514887443365f1b5f65bc3adbcede2, archive SHA-256 ca63cb2be5b50293fbd699ed6f593c08d5242638faa905bac3c3e602910a5061, ROCm 10.1.0a20260820 / LLVM23, required gfx1250 device, strict dual backend: 147 GPU tests and 1,557 successful comparisons plus 25 host tests, zero failures/errors/skips. The final merge 72246e6f59741917060e289344c0112e5c3f6073 differed only by verified AST-equivalent host-test formatting.
  • Mixed FP16 coverage: exact source c0227dfc6b9ec212c456c643da3e3da5bf2ba17a, archive SHA-256 9d8ac059b24950458c291b2cc0aa52743cd348ac698a9cda0c31f3c7cb51c661, same ROCm/LLVM and required-device strict dual-backend setup: 88 mixed GPU tests (80 BF16 + 8 FP16), 1,408 successful comparisons, zero failures/errors/skips.

These GPU results predate the latest develop merge and are not current-head GPU validation. The review fixes change a success diagnostic and hash expectations; GPU tests were not rerun. The complete run_all.py runner and full differential sweep were not rerun for this follow-up. The earlier broad sweep retained an inherited gfx942 attention configuration-3 mismatch reproduced against its exact develop parent. Fixture-based GPU results do not establish arbitrary-input rounding or special-value semantics.

ISSUE ID : AICK-2285

@tenpercent
tenpercent force-pushed the users/mpodkory/rocke/fp6-scale-formats branch from 963beb5 to 054d1b3 Compare September 24, 2026 02:33
Report complete quant type aliases while preserving scalar quantization restrictions.
Keep empty descriptors valid while rejecting fragment loads before IR emission in both engines. Cover empty shapes and nonempty controls in Python and native tests.
Validate complete static fragment displacements before emitting i32 offsets in both engines. Resolve CTest readiness from registered commands and cover multi-config execution and failure propagation.
Size temporary load-pointer storage by addressable units so padded slots
cannot overrun the array. Preserve IR order and add mirrored transport
coverage for a layout requiring more loads than logical elements.

Simplify scale-width queries while retaining the shared packing adapter,
and clarify the contiguous-K matrix layout contract.
@therock-pr-bot

therock-pr-bot Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

🎉 All checks passed! This PR is ready for review.

@tenpercent
tenpercent marked this pull request as ready for review October 6, 2026 20:01
@tenpercent
tenpercent requested review from a team as code owners October 6, 2026 20:01
@tenpercent
tenpercent requested a balanced review from Copilot October 6, 2026 20:01

Copilot AI 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.

Copilot review overview

🟢 Approval recommended

Mixed-format support is consistently wired across catalogs, lowering, examples, and extensive tests, with only a minor stale test comment noted.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Enables mixed A/B low-bit formats for gfx1250 SCALE/SCALE16 GEMM while preserving independent operand storage contracts.

Changes:

  • Adds 40 mixed-format catalog entries across Python and C++.
  • Removes the homogeneous-only validation restriction and adds a mixed-format CLI example.
  • Adds parity, golden, host, and GPU numerical coverage.
File Description
platform/​tests/​instances/​test_gfx1250_mixed_scaled_gemm_numeric.py Adds GPU numerical coverage.
platform/​tests/​instances/​parity/​gfx1250_lowering_emit.py Adds Python parity configurations.
platform/​tests/​instances/​parity/​gfx1250_lowering_emit.c Mirrors mixed configurations natively.
platform/​tests/​core/​test_mma_catalog_lookup.cpp Updates catalog-count expectations.
platform/​tests/​core/​test_gfx1250_mixed_scaled_wmma.py Tests storage, lowering, and goldens.
platform/​tests/​core/​test_gfx1250_mixed_example.py Tests mixed-example CLI behavior.
platform/​tests/​core/​test_gfx1250_fp6_scaled_wmma.py Updates mixed-format validity tests.
platform/​tests/​core/​test_gfx1250_fp4_scaled_wmma.py Replaces a newly valid rejection case.
platform/​tests/​core/​test_arch_mma_ssot.py Validates expanded catalog identity.
platform/​tests/​core/​gfx1250_mixed_scaled_wmma_llvm23.json Records LLVM 23 golden hashes.
platform/​python/​rocke/​instances/​SUPPORT_MATRIX.md Documents mixed-format support.
platform/​python/​rocke/​instances/​gfx1250/​block_scaled_gemm.py Allows mixed native scaled GEMM specs.
platform/​python/​rocke/​examples/​gfx1250/​gemm/​README.md Documents the mixed example.
platform/​python/​rocke/​examples/​gfx1250/​gemm/​mixed_scaled_gemm.py Adds the mixed-format CLI.
platform/​python/​rocke/​examples/​gfx1250/​gemm/​block_scaled_gemm_verify.py Reports both operand formats.
platform/​python/​rocke/​core/​arch/​target.py Adds mixed fragment metadata.
platform/​python/​rocke/​core/​arch/​data/​arch_specs.json Adds Python catalog entries.
platform/​cpp/​core/​arch/​data.cpp Adds matching native catalog data.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Co-authored-by: tenpercent <4273004+tenpercent@users.noreply.github.com>

Copilot AI 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.

Copilot review overview

🔵 Needs a closer look

The large dual-backend GPU catalog and ISA-contract expansion warrants final human validation despite extensive automated coverage.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@cgmillette cgmillette 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.

PR #12279 — mixed scaled GEMM on shared operand storage (tenpercent, AICK-2285) — 🔴 REJECT: 40 stale llvm23 goldens fail at head; regenerate, then approve

Prior item Status
Copilot (1 inline + 2 overviews): wmma_scaled fixture header still FP8-only (gfx1250_lowering_emit.c:121); 2nd overview "needs human look", no findings 🟢 FIXED 3f7eff28: header now documents independent FP8/BF8/FP6/BF6/FP4 A/B; thread resolved
Bots: therock-pr-bot policy, base-freshness, Math CI 🟢 Policy pass (AICK-2285). Math CI SKIPPED: no tests ran on head
# Sev file:line Net-new finding
N1 🔴 tests/core/gfx1250_mixed_scaled_wmma_llvm23.json (all 40) Stale goldens. Head merge 64c7c18d pulled in develop #12672 (llvm23 datalayout gains p10–p15) without regenerating them. test_mixed_llvm23_golden fails 40/40 at head; every SHA matches only with p10–p15 stripped. Collected by quick-tier rocke_pytest, so develop goes red. Body's validation (72246e6f, develop e01aac56) predates this merge. Regenerate and re-run on head.
N2 🟡 block_scaled_gemm.py:239 is_valid_spec OK reason names only A (fp8×fp4 reports "native wmma_scale fp8 GEMM"); test_gfx1250_mixed_scaled_wmma.py:43 pins it. Report {a}x{b}.

Utility: 🟢 Positive. Completes AICK-2285 as a data-only extension: 40 catalog rows with Python/C++ parity (all 50 scaled rows field-checked), catalog-driven gate, per-operand selectors in both engines, unique kernel names, homogeneous goldens untouched. Approve once N1 is regenerated.


Legend: 🔴 blocking · 🟠 should-fix · 🟡 minor nit · 🟢 info/good

@tenpercent
tenpercent requested review from cgmillette and a balanced review from Copilot October 8, 2026 00:06

Copilot AI 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.

🔵 Needs a closer look

Hardware-specific catalog and lowering changes lack current-head GPU validation after the latest merge.

0 open findings

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@tenpercent
tenpercent requested a review from a team October 8, 2026 01:15

@CongMa13 CongMa13 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.

No new actionable findings on a5fd7b410757bc326e428977bb09fa2fbe3da4d6.

The previous fixture-header, stale-golden, and A/B diagnostic observations are addressed by the current head as documented in the existing review history. The PR is good to go for approval.

@tenpercent
tenpercent requested a review from a team October 9, 2026 05:04

@cgmillette cgmillette 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.

All green :)

PR #12279 — mixed scaled GEMM on shared operand storage (tenpercent, AICK-2285) — 🟢 ACCEPT: all items fixed

Prior item Status
Ours N1: 40 stale llvm23 goldens 🟢 FIXED a5fd7b41 — 40/40 pass at head and merged with current develop (ran)
Ours N2: OK reason names only A 🟢 FIXED — now {a}x{b}; only consumer is the pinning test
Copilot: fixture header FP8-only 🟢 FIXED — gfx1250_lowering_emit.c:121
Copilot (head): no current-head GPU run 🟢 Info — IR unchanged except the p10–p15 datalayout
CongMa13 (10-09): approve 🟢 Agree

Net-new: none.

Utility: 🟢 Positive — data-only AICK-2285 completion with dual-engine parity; approve.


Legend: 🔴 blocking · 🟠 should-fix · 🟡 minor nit · 🟢 info/good

@tenpercent
tenpercent merged commit 9347447 into develop Oct 9, 2026
94 of 95 checks passed
@tenpercent
tenpercent deleted the users/mpodkory/rocke/mixed-scaled-gemm branch October 9, 2026 17:13
@assistant-librarian

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants