Archived
decode launches: gate_up + gated_quant_fp8 folded for MXFP4 (gemm_nt_q_gated_mx)
A decode step on Qwen3.8-27B at TP2 issues 631 kernels a card, and a dependent kernel costs the card 3.5-6.4 us in a replayed graph on gfx1201 however little it does, so launches are about 13 % of a step. - gemm_nt_q_gated_mx: gemm_nt_q_gated over an OCP-MXFP4 weight (b_ref after b_scale; a new op, not an optional operand on the old one). Row gemm_mxfp4a8_gated_gemv: M <= 8, a block per 128-column group of the gated output, a wave per gate or up tile running all of the gemv WMMA form's partials in its order, then gated_quant_fp8's epilogue -- byte-identical to gemv + gated_quant_fp8 (selftest, M = 1..8, Qwen's and TranslateGemma's gate_up). The MLP block declares it for a plain MXFP4 gate_up when a loaded library declares the op (libref does not), so a CPU-only engine takes the pair. Layout hooks map its b_ref (operand 4) to gemm_nt_q's index, so the weight is stored once. The fold: 82.5 us against 81 + 4.6 for the pair at Qwen's gate_up, 98.8 against 104 + 4.7 at TranslateGemma's. - --perfmxd times gated_quant_fp8 and the fold beside the gemv row at a gate_up shape. Greedy texts of four prompts, speculation 0 and 3, identical to the production build. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
486c933161
commit
f16854499c
9 files changed
+497
-7
No files matched your search
@@ -591,6 +591,7 @@ and is optional.
|
||||
| `gated_quant_fp8` | `M` `n` `group` `dtype` `act`:str/opt | `gate_up` → `q`, `scale`, `out_bf16`? |
|
||||
| `swiglu_clamped_quant_fp8` | `M`(range) `n` `limit`:f64 `group` `dtype` | `gate_up` → `q`, `scale`, `out_bf16`? |
|
||||
| `gemm_nt_q_gated` | `M` `N` `K` `group` `dtype` `act` | `a`, `a_scale`, `b`w, `b_scale`w → `q`, `scale`, `out_bf16`? |
|
||||
| `gemm_nt_q_gated_mx` | `M` `N` `K` `group` `dtype` `act` | `a`, `a_scale`, `b`w, `b_scale`w, `b_ref`w → `q`, `scale`, `out_bf16`? |
|
||||
|
||||
`quant_cols_fp8` is the same E4M3 quantiser with one scale per column over all `M` rows,
|
||||
`scale[c] = amax_r |x[r, c]| * (1/448)` (1 for an all-zero column), `scale` `[n]` f32: an
|
||||
@@ -604,6 +605,10 @@ it does not produce that op's `y`. `act` is required here, unlike on the quantis
|
||||
implementation may compile one gate only, and an optional parameter would let it resolve for
|
||||
another.
|
||||
|
||||
`gemm_nt_q_gated_mx` is the same fold over an OCP-MXFP4 weight (`dtype` `mxfp4a8`, `group` 32), which
|
||||
`gemm_nt_q` reads with the per-row reference exponent `b_ref` after `b_scale`. A schema of its own
|
||||
because an op's operand count is fixed for the plugins built against it.
|
||||
|
||||
`swiglu_clamped_quant_fp8` (device-only) is `swiglu_clamped` then `quant_act_fp8` over its
|
||||
product in one pass. The product is rounded to bf16 before the quantiser reads it, as the pair
|
||||
reads it from its bf16 tensor, so the codes, scales and `out_bf16` are the pair's bytes, NaN and
|
||||
|
||||
Reference in new issue
Block a user