Archived
gemma3: the gated gate_up fold up to 64 rows (RADIANCE_G3_FOLD_ROWS), and prefetch knobs
The gate_up GEMM + gelu_mul + quant_act_fp8 fold ran only up to 8 rows; at 2-8 concurrent translations with speculation a step is 16-64 rows and the three kernels ran apart. gemm_mxfp4a8_gated_gemv_wide (9 <= M <= 64, K >= 2688) is gemv_wide at two column tiles a block, the gate tile j and its up tile n/16 + j: each K-wave loads both tiles' weights and reads the activation once; the wave partials are summed in gemv_wide's order and the narrow fold's epilogue quantises, so codes and scales are byte-identical to the unfused path. No spill (96-196 VGPRs, RT 1-4). RADIANCE_G3_FOLD_ROWS (0 = today's 8) sets the fold band; RADIANCE_G3_PF_ROWS / _PF_MIB / _PF_EARLY expose the prefetch beside the all-reduces (measured: no gain, defaults unchanged). Unset knobs keep the pinned graph and steps. Measured on 2x Radeon AI PRO R9700, TranslateGemma 27B (MXFP4 GPTQ, DFlash2 drafter, speculation 7), greedy held-out translations, aggregate tok/s, 2 interleaved rounds: | fold ceiling | x2 | x4 | x8 | | 8 (today) | 289.9 | 521.2 | 686.3 | | 16 | 298.6 (+3.0 %) | 521.0 (-0.0 %) | 686.9 (+0.1 %) | | 32 | 296.9 (+2.4 %) | 541.6 (+3.9 %) | 682.7 (-0.5 %) | | 64 | 297.8 (+2.7 %) | 549.0 (+5.3 %) | 700.0 (+2.0 %) | Tests: r4d_selftest gated wide fold byte-for-byte against gemv_wide + gelu_mul + quant_act_fp8 (or gated_quant_fp8) for TranslateGemma's 21504x5376 at M 9-64 and other shapes (156 ok, 0 FAIL on gfx1201); arch_test gemma3 16/16 (defaults keep the pinned graph and steps, knobs move only what they name). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
96bc0465b3
commit
b6ad757bfa
10 files changed
+645
-42
No files matched your search
@@ -3489,6 +3489,10 @@ The four slots are what the amdgpu kernel driver leaves to user queues. It keeps
|
||||
| `RADIANCE_CALIB_TOKENS` | with `RADIANCE_CALIB_DIR`, the tokens the calibration tap accumulates before it writes and switches itself off (default 65536) |
|
||||
| `RADIANCE_G3_CALIB_LAYERS` | `lo:hi`: `arch/gemma3`'s calibration tap over layers lo to hi - 1 only, to take a large model's Grams in passes (docs/ARCHITECTURES.md) |
|
||||
| `RADIANCE_G4_CALIB_LAYERS` | `lo:hi`: the same for `arch/gemma4`'s tap, which takes the Gemma 4 31B's Grams from its bf16 checkpoint (docs/GEMMA4-31B-GPTQ.md) |
|
||||
| `RADIANCE_G3_FOLD_ROWS` | `arch/gemma3`, an A/B knob: the gated fold (gate_up, GeGLU and down's E4M3 quantiser in one launch, libr4d `gemm_nt_q_gated_mx`) on decode and verify steps of up to this many rows, 9..64 through `gemm_mxfp4a8_gated_gemv_wide`; `0` or unset is 8. Bit for bit at any value. Read at startup; anything but an integer 0..64 refuses to start |
|
||||
| `RADIANCE_G3_PF_EARLY` | `arch/gemma3`, an A/B knob: `1` issues the weight read beside a bare (unfused, lossy-wire) all-reduce in front of it rather than after it, so it overlaps the reduction rather than the post-norm, the junction and the next GEMM; `0` or unset is the old order. The fused all-reduce junction's steps have it in front either way |
|
||||
| `RADIANCE_G3_PF_MIB` | `arch/gemma3`, an A/B knob: the size in MiB (1..256) of the weight reads beside the all-reduces on decode steps of more than 32 rows (default 24, the narrow steps' size); declared only when `RADIANCE_G3_PF_ROWS` reaches past 32 |
|
||||
| `RADIANCE_G3_PF_ROWS` | `arch/gemma3`, an A/B knob: the tallest decode or verify step that reads beside its all-reduces (default 32; 64 covers eight sequences at speculation 7). Never on a step with a prompt's rows |
|
||||
| `RADIANCE_PROFILE_EVERY` | with `--profile-ops`, dump the per-op table every N steps (default 32) |
|
||||
| `RADIANCE_AQL_STAMP`, `RADIANCE_AQL_STAMP_OUT` | `N`: every dispatch of one recorded pass in N on card 0 gets a completion signal of its own, which carries its start and end; the barrier bits and chains stay as unstamped, unlike `--profile-ops`, which plays no recorded pass. One CSV line a dispatch (pass, record, queue, kernel, whether it waited for the one before, whether it was chained, start and end in ns) is appended to `RADIANCE_AQL_STAMP_OUT` (default `/tmp/radiance-stamps-<pid>.csv`) once the card is done with it; `scripts/stampgaps.py` reads it per kind of pass (idle share, gaps before ordered starts, kernels by time). AQL backend only |
|
||||
| `RADIANCE_LOG_STEPS` | log one line per step: its phase, sequences, and each one's token count and context (§4.5) |
|
||||
|
||||
+1
-1
@@ -753,7 +753,7 @@ The `--perf*` modes time rows at one shape on a card. Two that cover the dense G
|
||||
| | |
|
||||
|---|---|
|
||||
| `--perf N K M [iters]` | the fp8 decode GEMMs, and the fp8 head (`logits_gemm_fp8`) |
|
||||
| `--perfmxd N K M [iters]` | the dense OCP-MXFP4 rows (`gemm_mxfp4a8_gemv`, `_decode`, `_nt_m64`, `_tiled`) at one shape, with the weight bandwidth each reaches; at a gate_up shape (N a multiple of 256, K of 128) also `gated_quant_fp8` and the fold that replaces the pair, `gemm_mxfp4a8_gated_gemv` |
|
||||
| `--perfmxd N K M [iters]` | the dense OCP-MXFP4 rows (`gemm_mxfp4a8_gemv`, `_decode`, `_nt_m64`, `_tiled`) at one shape, with the weight bandwidth each reaches; at a gate_up shape (N a multiple of 256, K of 128, M up to 64) also the ops after the GEMM, `gated_quant_fp8` (SwiGLU) and `gelu_mul` + `quant_act_fp8` (GeGLU), and the fold that replaces them at both activations, `gemm_mxfp4a8_gated_gemv` (M ≤ 8) or `_gated_gemv_wide` (9..64) |
|
||||
|
||||
`--perfmx` is the MXFP4 expert GEMM (`M`, experts, `top_k`, skew), not the dense rows. `--cold MIB`
|
||||
times each launch alone behind a cache flush instead of back to back.
|
||||
|
||||
Reference in new issue
Block a user