[PR #5535] [Benchmark] int8-WMMA prompt attention on RDNA3 / gfx1100 (RX 7900 XTX): recipe, validation, results — and the RDNA4 (gfx12) relevance #5507

Open
opened 2026-11-08 05:53:46 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/5535
Author: @xyzzing
Created: 11/7/2026
Status: 🔄 Open

Base: main ← Head: results-0037-i8-wmma


📝 Commits (1)

  • 3d97786 [Benchmark] int8-WMMA prompt attention on RDNA3 / gfx1100: the probe-proven recipe, the kernel results (-32.1% vs the two-image f16 class, +3.8% vs the single-image fast class, KL-gated first-token 0.0036 vs a 0.0005 FP32-swap floor), and the end-to-end no-win on the fast configuration

📊 Changes

5 files changed (+249 additions, -0 deletions)

View changed files

➕ docs/rdna3-gfx1100/I8-WMMA-ATTENTION.md (+92 -0)
➕ docs/rdna3-gfx1100/i8-wmma-kl-20261108.json (+99 -0)
➕ docs/rdna3-gfx1100/i8-wmma-paired-20261108.txt (+30 -0)
➕ docs/rdna3-gfx1100/i8-wmma-probe-20261108.txt (+11 -0)
➕ docs/rdna3-gfx1100/i8-wmma-window-20261108.json (+17 -0)

📄 Description

Problem and result

RDNA3 (gfx1100) has no int8 matrix-core path in the prompt attention: the HIP WMMA prompt kernel (STRATA_HIP_WMMA=1) runs int8-KV with fp16 operand products, and the int8 WMMA instruction V_WMMA_I32_16X16X16_IU8 is unused. This report documents the missing tier — an int8 Q·K and P·V prompt-attention kernel with exact i32 accumulation and an fp32 online softmax — its probe-proven gfx11 fragment recipe, its numerics validation, and an honest performance map: −32.1 % kernel time vs the two-image f16-WMMA class on a real 94 K-depth replay (paired, interleaved), +3.8 % vs the single-image fast class (that config's fp16 q·k already needs one WMMA per step), first-token KL 0.0036 vs a 0.0005 FP32-swap floor with argmax identical on every prompt. The recipe and the validation method are the portable part: RDNA4 ships the same instruction family and already defaults to the f16 WMMA prompt path, where an int8 tier would meet its audience by default — the layout re-proof on an RDNA4 card is one probe run (see the report's RDNA4 section; measured on an R9700 it would settle the port question in minutes).

  • #5458 — the gfx1100 measurement report this doc is a companion to.
  • #5459 — the gfx1100 defaults row (scope agreement; the kernel here is a separate, opt-in capability, not a defaults change).
  • #3381 (RDNA2 int8-KV prompt attention), #3482/#3224 (RDNA4 WMMA prompt attention) — the sibling tiers this fills for RDNA3.

Approach

The gfx11 i8-WMMA recipe, each element probe-proven (256/256 against an exact CPU product): natural operand packing (reg t byte b = k 4t+b; the lane's row of A, column of B; lanes 16–31 repeat 0–15), the (true, true) neg flags as the signed emulation on the u8 containers (also exact for u8(0..127)×s8, P's quantization range), the C/D fragment D[2i + l/16][l%16], and the c-operand adding as-is under the neg flags (chained k-steps are safe; also passes through at A=B=0). Q·K carries Q as a hi/lo int8 pair (two chained i32 dots — the single hi image's qup/256 granularity flattens the softmax), K codes feed the WMMA as raw bytes (no int8→fp16 conversion), and the epilogue is (256·hi + lo) × k_scale — the codes already carry the qup factor the softmax's qdown cancels, so re-dividing by qup is the one place this kernel bites. P·V quantizes P to u8 (0..127) on the V-normalized range, one i32 dot per step, epilogue × (16384/127) × v_down × alpha. int8 products stay below 2³¹ everywhere, so the accumulator is exact with no fp32 magic-constant staging.

Validation (Passed/Failed/Not run)

  • Passed: the layout probe (packings × flags × layouts + the P·V u8×s8 check + the accumulator checks, all 256/256); the prompt-attention parity test (the f16 path stays bit-identical, output hash unchanged); replay accuracy vs the deployed f16-WMMA kernel: relative RMS 1.9e-2 overall, 6.5e-5 for the Q·K alone (the rounding lives in P's 1/127); the first-token KL gate on four real 31.5 K-token prompts (floor 0.000484, candidate 0.003638, argmax 4/4); a predeclared 2.00 % component bar vs the two-image class (passes 16×).
  • Failed: end-to-end on the single-image fast configuration — 94 K-token prefills, five interleaved pairs, fresh launch per launch: median prompt-throughput ratio 0.995, bootstrap 95 % CI [0.994, 1.004]. No end-to-end win there; the report says so plainly.
  • Not run: any RDNA4 measurement (no RDNA4 card in hand — the layout probe and this validation method are what a gfx12 port would reuse).

Limits

One machine (RX 7900 XTX, 24 GB), one artifact (Qwen3.8-Flash-Next IQ3_S, --kv int8), one recorded 94 K replay shape plus four real-prompt KL serves; other RDNA3 parts and other quantizations are unmeasured. The attention-output rounding (1.9e-2 relative RMS) is disclosed and KL-gated for chat use. This PR is docs-only (evidence files under docs/rdna3-gfx1100/); the kernel itself is implemented behind an opt-in flag with the parity/accuracy tests included, and its code PR follows only if scope is agreed here.


🔄 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/5535 **Author:** [@xyzzing](https://github.com/xyzzing) **Created:** 11/7/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `results-0037-i8-wmma` --- ### 📝 Commits (1) - [`3d97786`](https://github.com/Niko1221/Strata/commit/3d97786601938ad78e780d2bde0fb6863cc57455) [Benchmark] int8-WMMA prompt attention on RDNA3 / gfx1100: the probe-proven recipe, the kernel results (-32.1% vs the two-image f16 class, +3.8% vs the single-image fast class, KL-gated first-token 0.0036 vs a 0.0005 FP32-swap floor), and the end-to-end no-win on the fast configuration ### 📊 Changes **5 files changed** (+249 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `docs/rdna3-gfx1100/I8-WMMA-ATTENTION.md` (+92 -0) ➕ `docs/rdna3-gfx1100/i8-wmma-kl-20261108.json` (+99 -0) ➕ `docs/rdna3-gfx1100/i8-wmma-paired-20261108.txt` (+30 -0) ➕ `docs/rdna3-gfx1100/i8-wmma-probe-20261108.txt` (+11 -0) ➕ `docs/rdna3-gfx1100/i8-wmma-window-20261108.json` (+17 -0) </details> ### 📄 Description ## Problem and result RDNA3 (gfx1100) has no int8 matrix-core path in the prompt attention: the HIP WMMA prompt kernel (`STRATA_HIP_WMMA=1`) runs int8-KV with fp16 operand products, and the int8 WMMA instruction `V_WMMA_I32_16X16X16_IU8` is unused. This report documents the missing tier — an int8 Q·K and P·V prompt-attention kernel with exact i32 accumulation and an fp32 online softmax — its probe-proven gfx11 fragment recipe, its numerics validation, and an honest performance map: **−32.1 % kernel time vs the two-image f16-WMMA class** on a real 94 K-depth replay (paired, interleaved), **+3.8 % vs the single-image fast class** (that config's fp16 q·k already needs one WMMA per step), first-token KL **0.0036 vs a 0.0005 FP32-swap floor** with argmax identical on every prompt. The recipe and the validation method are the portable part: RDNA4 ships the same instruction family and already defaults to the f16 WMMA prompt path, where an int8 tier would meet its audience by default — the layout re-proof on an RDNA4 card is one probe run (see the report's RDNA4 section; measured on an R9700 it would settle the port question in minutes). ## Related discussion - #5458 — the gfx1100 measurement report this doc is a companion to. - #5459 — the gfx1100 defaults row (scope agreement; the kernel here is a separate, opt-in capability, not a defaults change). - #3381 (RDNA2 int8-KV prompt attention), #3482/#3224 (RDNA4 WMMA prompt attention) — the sibling tiers this fills for RDNA3. ## Approach The gfx11 i8-WMMA recipe, each element probe-proven (256/256 against an exact CPU product): natural operand packing (reg t byte b = k 4t+b; the lane's row of A, column of B; lanes 16–31 repeat 0–15), the `(true, true)` neg flags as the signed emulation on the u8 containers (also exact for u8(0..127)×s8, P's quantization range), the C/D fragment `D[2i + l/16][l%16]`, and the c-operand adding as-is under the neg flags (chained k-steps are safe; also passes through at A=B=0). Q·K carries Q as a hi/lo int8 pair (two chained i32 dots — the single hi image's qup/256 granularity flattens the softmax), K codes feed the WMMA as raw bytes (no int8→fp16 conversion), and the epilogue is `(256·hi + lo) × k_scale` — the codes already carry the `qup` factor the softmax's `qdown` cancels, so re-dividing by `qup` is the one place this kernel bites. P·V quantizes P to u8 (0..127) on the V-normalized range, one i32 dot per step, epilogue `× (16384/127) × v_down × alpha`. int8 products stay below 2³¹ everywhere, so the accumulator is exact with no fp32 magic-constant staging. ## Validation (Passed/Failed/Not run) - Passed: the layout probe (packings × flags × layouts + the P·V u8×s8 check + the accumulator checks, all 256/256); the prompt-attention parity test (the f16 path stays bit-identical, output hash unchanged); replay accuracy vs the deployed f16-WMMA kernel: relative RMS 1.9e-2 overall, 6.5e-5 for the Q·K alone (the rounding lives in P's 1/127); the first-token KL gate on four real 31.5 K-token prompts (floor 0.000484, candidate 0.003638, argmax 4/4); a predeclared 2.00 % component bar vs the two-image class (passes 16×). - Failed: end-to-end on the single-image fast configuration — 94 K-token prefills, five interleaved pairs, fresh launch per launch: median prompt-throughput ratio 0.995, bootstrap 95 % CI [0.994, 1.004]. No end-to-end win there; the report says so plainly. - Not run: any RDNA4 measurement (no RDNA4 card in hand — the layout probe and this validation method are what a gfx12 port would reuse). ## Limits One machine (RX 7900 XTX, 24 GB), one artifact (Qwen3.8-Flash-Next IQ3_S, `--kv int8`), one recorded 94 K replay shape plus four real-prompt KL serves; other RDNA3 parts and other quantizations are unmeasured. The attention-output rounding (1.9e-2 relative RMS) is disclosed and KL-gated for chat use. This PR is docs-only (evidence files under `docs/rdna3-gfx1100/`); the kernel itself is implemented behind an opt-in flag with the parity/accuracy tests included, and its code PR follows only if scope is agreed here. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#5507
No description provided.