[PR #999] [CLOSED] hip: the fused-int8 MoE kernels on gfx1100 rocWMMA - opt-in STRATA_PF_FUSED arm + parity fixture (engagement: parity, REJECT-at-parity recorded) #2954

Closed
opened 2026-11-04 02:04:28 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/999
Author: @xyzzing
Created: 10/5/2026
Status: ❌ Closed

Base: main ← Head: moe-fused-wmma-gfx1100


📝 Commits (10+)

  • 749d957 setup (--backend hip): a system ROCm without the HIP development files falls back to the wheels (#446)
  • 5a30024 calibrate: the engine's arguments come from the server's engine_args; a failed tuning says why (#447)
  • 9f60d13 serve, setup: name the small split card that caps the prompt chunk; setup recommends the big card alone (#448)
  • eb8da1d /metrics: each request's speculative draft counts, and their sums in the totals (#457)
  • 6a09387 setup (--gguf-dir): GGUFs Strata cannot run are named as such, with the --family/--model to use (#444)
  • d6a91e2 docs: the Coder is weaker outside code, Chinese/CJK text included; the unpruned sizes for that (#438)
  • d8d4ad3 Merge branch 'f-135-eng' into rel-0.1.35
  • 7b600d5 Merge branch 'f-135-small' into rel-0.1.35
  • d9ab843 Engine 0.1.35: Windows AMD uses its bundled HIP runtime (#468 #461), the low-RAM resident mode on Windows 32 GB PCs (#467), fixes #460 #459 #446 #447 #457 #448 #444; setup requires it
  • 57bd713 sycl: pipeline the expert cache's profile fill (model load 3-4x faster)

📊 Changes

1 file changed (+10 additions, -6 deletions)

View changed files

📝 CMakeLists.txt (+10 -6)

📄 Description

What this is

The fused-int8 MoE expert kernels (moe_fused_iq.cu, CUDA sm_80-only upstream) translated to rocWMMA 16×16×16 INT8→INT32 for gfx1100/RDNA3: native_kernel_wmma<T, GU, WW> behind the existing opt-in env (STRATA_PF_FUSED=1, plus STRATA_PF_FUSED_NATIVE semantics preserved) — same batch machinery (grouping tables, work-item walk, per-row IQ decode via the project's convert()/signed8 semantics), plain LDS int8 tiles (the ldmatrix swizzles dropped — rocWMMA reads unswizzled tiles), the mma_tile_16 rocWMMA primitive chained per 16-k slice, and the original per-half/per-sub-block fp32 scale folds applied per-lane from the i32 readbacks (the m16n8 lane mapping — so the SwiGLU/requant and down-scatter epilogues run verbatim).

Verdict up front: engagement REJECT at parity — measured, not promoted, per the project's arm pattern. On gfx1100 (7900 XTX, nightly ROCm, 128K × 3 paired engine cells): the production MMQ path and this arm are at parity (-0.8% end-to-end; gate/up +1.7%, noise). The pinned ggml's MMQ tiles are already RDNA3-aware (mmq-config-rdna3.cuh), so the generic-tile headroom this translation targeted does not exist. The arm ships opt-in dormant and parity-protected.

The fixture (the substance)

prefill_fused_iq_wmma_test (HIP CTest): the IQ3_S gate/up chain — decode (verbatim convert()/signed8 semantics) → plain LDS int8 tiles → rocWMMA mma → per-half/per-sub-block fp32 scale folds — against a double reference on the same quantized activations:

  • IQ3_S gate/up: rel RMS 0.000e+00 (the int8 dots and INT32 accumulation are integer-exact, as the arithmetic gives), worst row 1.27e-05 (fp32 accumulation order only)
  • Q2_0 down decode: bit-exact vs ggml to_float
  • deterministic: a double-launch probe diffs 0/327680 output elements

Bounds pre-declared before the kernel existed (1e-4 RMS / 1e-3 worst row); no tolerance moved.

Traps the fixture caught (all in the translation, all fixed)

  1. signed8 mis-port: the sign spread is one bit per value (__vcmpne4(s & 0x08040201, 0) masks), not bit-7 replication — half the values decoded wrong with the naive port
  2. __half2float((unsigned short) x) on HIP converts the integer, not the bits — needs __ushort_as_half (the CUDA arm never runs this path on HIP, so it never showed)
  3. A decode-coverage pass missing (rows 64–127 never decoded)
  4. Per-sub-block scale slots (ws[2*uj], ws[2*uj+1]) vs per-16-group reads — the fold must index the sub-block's own scale
  5. rocWMMA headers at global scope; __half2float-class traps aside, the fixture also pinned matrix_b col_major = ptr[n·ld + k] and 16×16 accumulators (ld = N)

Testing

  • prefill_fused_iq_wmma_test: PASS (bounds 1e-4/1e-3 RMS/worst-row), deterministic ×3
  • gdn_wy_check, gdn_wy_wmma_test suites: unchanged, green on the same tree
  • Engagement: 3 paired 128K cells, STRATA_PF_FUSED=1 vs absent, same binary — parity within noise; decode untouched (prefill-only arm, --max-new 8 cells)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/999 **Author:** [@xyzzing](https://github.com/xyzzing) **Created:** 10/5/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `moe-fused-wmma-gfx1100` --- ### 📝 Commits (10+) - [`749d957`](https://github.com/Niko1221/Strata/commit/749d957a1790b1a171dd4a01ab3e31b3882c9892) setup (--backend hip): a system ROCm without the HIP development files falls back to the wheels (#446) - [`5a30024`](https://github.com/Niko1221/Strata/commit/5a3002446dbb9dfcabb7d0bd9f113da90cc2f3c0) calibrate: the engine's arguments come from the server's engine_args; a failed tuning says why (#447) - [`9f60d13`](https://github.com/Niko1221/Strata/commit/9f60d13246e46b02b1dd0841980b4d18b0faaea7) serve, setup: name the small split card that caps the prompt chunk; setup recommends the big card alone (#448) - [`eb8da1d`](https://github.com/Niko1221/Strata/commit/eb8da1d8c26ec41e6ffb084fdf579dba7cad10bd) /metrics: each request's speculative draft counts, and their sums in the totals (#457) - [`6a09387`](https://github.com/Niko1221/Strata/commit/6a093874fe037020f49bd5cf053879ff6a133c21) setup (--gguf-dir): GGUFs Strata cannot run are named as such, with the --family/--model to use (#444) - [`d6a91e2`](https://github.com/Niko1221/Strata/commit/d6a91e2d1770d0f469d6ec15890acc7ee93e764c) docs: the Coder is weaker outside code, Chinese/CJK text included; the unpruned sizes for that (#438) - [`d8d4ad3`](https://github.com/Niko1221/Strata/commit/d8d4ad337d3c98ba21d3bd0af1a16e9177e112b6) Merge branch 'f-135-eng' into rel-0.1.35 - [`7b600d5`](https://github.com/Niko1221/Strata/commit/7b600d55ff801caaaa11542af1523050992e049b) Merge branch 'f-135-small' into rel-0.1.35 - [`d9ab843`](https://github.com/Niko1221/Strata/commit/d9ab8435f654c368c586340d490915f6addf56a3) Engine 0.1.35: Windows AMD uses its bundled HIP runtime (#468 #461), the low-RAM resident mode on Windows 32 GB PCs (#467), fixes #460 #459 #446 #447 #457 #448 #444; setup requires it - [`57bd713`](https://github.com/Niko1221/Strata/commit/57bd713454ddb4b965f994e95d95cacd68c93fb1) sycl: pipeline the expert cache's profile fill (model load 3-4x faster) ### 📊 Changes **1 file changed** (+10 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+10 -6) </details> ### 📄 Description ## What this is The fused-int8 MoE expert kernels (`moe_fused_iq.cu`, CUDA sm_80-only upstream) translated to **rocWMMA 16×16×16 INT8→INT32 for gfx1100/RDNA3**: `native_kernel_wmma<T, GU, WW>` behind the existing opt-in env (`STRATA_PF_FUSED=1`, plus `STRATA_PF_FUSED_NATIVE` semantics preserved) — same batch machinery (grouping tables, work-item walk, per-row IQ decode via the project's `convert()`/`signed8` semantics), plain LDS int8 tiles (the ldmatrix swizzles dropped — rocWMMA reads unswizzled tiles), the `mma_tile_16` rocWMMA primitive chained per 16-k slice, and the original per-half/per-sub-block fp32 scale folds applied per-lane from the i32 readbacks (the m16n8 lane mapping — so the SwiGLU/requant and down-scatter epilogues run verbatim). **Verdict up front: engagement REJECT at parity** — measured, not promoted, per the project's arm pattern. On gfx1100 (7900 XTX, nightly ROCm, 128K × 3 paired engine cells): the production MMQ path and this arm are at parity (-0.8% end-to-end; gate/up +1.7%, noise). The pinned ggml's MMQ tiles are **already RDNA3-aware** (`mmq-config-rdna3.cuh`), so the generic-tile headroom this translation targeted does not exist. The arm ships opt-in dormant and parity-protected. ## The fixture (the substance) `prefill_fused_iq_wmma_test` (HIP CTest): the IQ3_S gate/up chain — decode (verbatim `convert()`/`signed8` semantics) → plain LDS int8 tiles → rocWMMA mma → per-half/per-sub-block fp32 scale folds — against a double reference on the same quantized activations: - IQ3_S gate/up: **rel RMS 0.000e+00** (the int8 dots and INT32 accumulation are integer-exact, as the arithmetic gives), worst row 1.27e-05 (fp32 accumulation order only) - Q2_0 down decode: bit-exact vs ggml `to_float` - deterministic: a double-launch probe diffs 0/327680 output elements Bounds pre-declared before the kernel existed (1e-4 RMS / 1e-3 worst row); no tolerance moved. ## Traps the fixture caught (all in the translation, all fixed) 1. `signed8` mis-port: the sign spread is **one bit per value** (`__vcmpne4(s & 0x08040201, 0)` masks), not bit-7 replication — half the values decoded wrong with the naive port 2. `__half2float((unsigned short) x)` on HIP converts the **integer**, not the bits — needs `__ushort_as_half` (the CUDA arm never runs this path on HIP, so it never showed) 3. A decode-coverage pass missing (rows 64–127 never decoded) 4. Per-sub-block scale slots (`ws[2*uj]`, `ws[2*uj+1]`) vs per-16-group reads — the fold must index the sub-block's own scale 5. rocWMMA headers at global scope; `__half2float`-class traps aside, the fixture also pinned `matrix_b col_major` = `ptr[n·ld + k]` and 16×16 accumulators (ld = N) ## Testing - `prefill_fused_iq_wmma_test`: PASS (bounds 1e-4/1e-3 RMS/worst-row), deterministic ×3 - `gdn_wy_check`, `gdn_wy_wmma_test` suites: unchanged, green on the same tree - Engagement: 3 paired 128K cells, `STRATA_PF_FUSED=1` vs absent, same binary — parity within noise; decode untouched (prefill-only arm, `--max-new 8` cells) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:04:28 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2954
No description provided.