docs: the m2xfp4 planes tiled at load, quant_act_fp8, the launch floor and the null results, BetterBench 52.0 tok/s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
This commit is contained in:
claudeandClaude Opus 5.5 committed 2026-10-26 02:54:02 +01:00
1 parent ed8e26c2fc
commit c2160c9e45
1 file changed
+63 -10
+63 -10
View File
@@ -12,7 +12,7 @@ from it alone.
| 1 codebase study, `SYCL_PORTING.md` | done (`docs/SYCL_PORTING.md` §1-§3, Appendix A) |
| 2 design | done: device backend, build integration, core kernels (`device_test_sycl` on the B65) |
| 3 correctness-first kernels | **Milestone A reached 2026-10-23** (`874f8d2`): MiniCPM5-2B bf16 serves on the B65, greedy-identical to the libref host backend; Milestone B next |
| 4 performance | MiniCPM5-2B bf16: decode 4.2 -> 51.8 tok/s, prefill 17 -> 1576 tok/s (`b07da2a`); Qwen3.8-27B-PARO-M2XFP4 (the model from 2026-10-23): 0.1 -> 35-37 tok/s decode with the DFlash2 drafter, prefill 349 tok/s at ~1900 tokens (`4675fd1`; vLLM-SYCL's reference ~90 / ~1200), in progress |
| 4 performance | MiniCPM5-2B bf16: decode 4.2 -> 51.8 tok/s, prefill 17 -> 1576 tok/s (`b07da2a`); Qwen3.8-27B-PARO-M2XFP4 (the model from 2026-10-23): 0.1 -> 52.0 tok/s decode on BetterBench with the DFlash2 drafter (`68d510b`), prefill 356 tok/s at 2000 tokens ( vLLM-SYCL's reference ~90 / ~1200), in progress |
| 5 broaden and finish | not started |
## Open blockers / questions for the user
@@ -164,6 +164,7 @@ fonts (this host has none; the first post had no text) -- all unpacked without r
| 2026-10-24 | `b0e34c6` | qwen38-27b-m2xfp4 | sycl, the speculative round's kernels (draft head and logits on DPAS, exact selection ops, typed gdn, vector norm, register-DPAS verify GEMM) | `--max-model-len 8192 --max-num-seqs 1` | 131.3 / 130.6 @2000 | 28.9 / - | decode +51.5%, prefill +15.8% | `~/radiance-bench/runs/20261024-135808-qwen38-27b-m2xfp4-b0e34c6/results.html`, posted with `report.jpg` |
| 2026-10-25 | `ef6c6e1` | qwen38-27b-m2xfp4 | sycl, verify GEMM in ESIMD, gdn load order | `--max-model-len 8192 --max-num-seqs 1 --embedding-placement vram` | 356.4 / 355.6 @2000 | 44.4 / - | decode +19.8%, prefill +4.5% | `~/radiance-bench/runs/20261025-111356-qwen38-27b-m2xfp4-ef6c6e1/results.html`, posted with `report.jpg` |
| 2026-10-25 | `340231d` | qwen38-27b-m2xfp4 | sycl, + e_max in the prepass, range-copy staging, w2a8 head staging, 16-byte exponent gathers | same | 356.3 / 355.4 @2000 | 48.2 / - | decode +8.7% | `~/radiance-bench/runs/20261025-142422-qwen38-27b-m2xfp4-340231d/results.html`, posted with `report.jpg` |
| 2026-10-26 | `68d510b` | qwen38-27b-m2xfp4 | sycl, + m2xfp4 codes tiled at load | same | 356.0 / 354.8 @2000 | 52.0 / - | decode +7.9% | `~/radiance-bench/runs/20261026-014745-qwen38-27b-m2xfp4-68d510b/results.html`, posted with `report.jpg` |
| 2026-10-23 | `b07da2a` | minicpm5-2b-bf16 | sycl, Phase 4 steps 2-6 (XMX prefill, split-KV attention, norms, GEMV split) | same | 1575.6 / 1547.1 @2000 | 51.8 / 41.4 | decode +104.7%, prefill 90x | `~/radiance-bench/runs/20261023-221354-minicpm5-2b-bf16-b07da2a/results.html`, posted with `report.jpg` |
## Models
@@ -792,9 +793,60 @@ distance stalls); quant_act_fp8 and the bf16 gemm_nt (launch_dpas8) on distance
instruction-fetch stalls. None is byte-bound: launches that each do little, and ~2000 of them a
round -- fusion, or more work a launch, rather than faster loads.
**Layout headroom measured, not taken**: a tiled code layout (a 16-column tile's step 1 KiB
contiguous, read by block loads) on top of the 16-byte exponent gathers gives 246 -> 229 us at
gate_up's shape (probe m2d.cpp) -- a repack at load, which needs a layout hook for m2xfp4.
**Layout headroom measured**: a tiled code layout (a 16-column tile's step 1 KiB contiguous, read
by block loads) on top of the 16-byte exponent gathers gives 246 -> 229 us at gate_up's shape
(probe m2d.cpp) -- taken in the next section.
## Qwen3.8-27B: the m2xfp4 planes tiled at load, and the launch floor (2026-10-26)
**Tiled planes** (`68d510b`, `dad30c6`). libxe2's m2xfp4 layout hook no longer asks for libref's
"m2.codes.meta" where N % 16 == 0 and K % 512 == 0 (every linear of the 27B): the codes are stored
as the verify GEMM's registers ("xe2.m2.tiled16": a 16-column tile's 128-column step is 1 KiB,
dword w of the 16 columns side by side, four block loads a step), the meta bytes and the E8M0
exponents in chunks of a tile's 16 groups (256 bytes, [dword][lane]; the exponents as `b_scale`'s
own stored form, "xe2.m2.e8m0.t16"), and each column's largest exponent is computed once at load
and stored after the exponents, so no call scans the plane for it any more. Every m2 reader in
libxe2 (exact, SIMT GEMV, both DPAS forms, ESIMD, the prefill decode) reads the tiled forms;
unrelayout inverts them exactly (the column maxima are derived and dropped), so the oracle still
checks the op. M = 1 now takes the ESIMD kernel too. rad-kbench against libref: 70 checked, 70
passed (worst rel_l2 1.2e-3) after each step; greedy output identical.
| shape (us) | before | codes tiled | + meta, exponents, stored e_max |
|---|---|---|---|
| gate_up N=34816 K=5120, M = 8 | 240 | 222 | **205** |
| gate_up, M = 1 | 248 | 214 | **201** |
| down N=5120 K=17408, M = 8 | 140 | 119 | **113** |
| N=5120 K=25600, M = 8 | 213 | 178 | **160** |
| N=1024 K=5120, M = 8 | 50 | 25 | **24** |
The round (story prompt, unitrace -d): 84.4 -> 77.3 ms of device time; the verify GEMM 38.6 ->
31.9 ms (329 calls, 97 us a call), now ~75% of the 560 GB/s ceiling on average. BetterBench at
`68d510b` (codes only): decode 48.2 -> 52.0 tok/s.
**quant_act_fp8** (`ed8e26c`): a row's work-group walked its 128-column groups sixteen at a time,
~5 us a group of dependent loads, reduction and stores (49.6 us at n = 17408 whatever M). A
sub-group a (row, group) instead, as gated_quant_fp8 already did: 8.0 us, rel_l2 0 against libref.
**Probes, kept out:**
- *512-byte block loads* of the activation (four in place of eight 256-byte ones a step): no
change (246 vs 246 us). The activation loads are not what the send stalls are made of.
- *The ordered sum of squares in ESIMD*: one thread, the squares in registers, the chain as scalar
adds on register regions (bitwise libref's serial loop): 44 us for 5120 against the SIMT form's
31 -- the SIMT broadcast-and-add chain stays (probe chain3.cpp).
- *A replayed SYCL graph* (what the engine's tape would be on this backend, probe launch2.cpp):
an in-order queue costs the host ~4.4 us a submission and a replayed graph 0.72-0.82 us a kernel;
but a chain of 2000 kernels of 12.5 us each runs 12.6 us a kernel either way (48.2 vs 47.8 at
48 us). The card's own per-kernel cost is under a microsecond; a tape would win back only the
stretches where kernels are shorter than the host's submission, and after each host wait.
The small kernels' 5-50 us are their own latency, so they are the work, not the launches.
- *The GEMM prepass's loads issued before its row-scale reduction* (bit-identical): 9.1 -> 10.1 us
a call, worse.
- *A deeper draft window*: BetterBench quick decode at `--num-speculative-tokens` 7 (the drafter's
own operating point): 51.0 tok/s; 15 (16 verify rows): 29.5; 11: refused by the architecture at
declare. Depth 7 stays.
- Stall sampling of the server stays empty on SIGTERM too (the metrics file is written but empty);
rad-kbench has no recipe on this container for givens_dense_quant or the gdn ops, so those need
probes of their own.
## Next steps
@@ -802,14 +854,15 @@ Deployment note: on this card (PCIe x1 2.5 GT/s, 10 GiB of VRAM unclaimed) run w
`--embedding-placement vram`; the default pins the 2.4 GiB embedding in host memory and reads it over
the link (4 ms a round).
1. Decode (~85 ms of device time a round of ~4.3 tokens on BetterBench's prompts; 90 tok/s needs
~48): the verify GEMMs ~37 ms at ~70% of the 560 GB/s ceiling, bound by memory messages (send
stalls): next, fewer requests -- a tiled code layout repacked at load (-8% in the probe; two
tiles a thread was slower). Then the small kernels,
1. Decode (~77 ms of device time a round of ~4.3 tokens; 90 tok/s needs ~48): the verify GEMMs
~32 ms at ~75% of the 560 GB/s ceiling (planes tiled at load, above). The small kernels,
~45 ms together, most of them latency- or message-bound rather than byte-bound: run each through
`unitrace --stall-sampling` (rad-kbench or a probe) before changing it -- this session's guesses
without it mostly measured nothing. givens (21 us for ~3 MB), the gdn phases (39 / 63 us against
~11 / ~6 us of state traffic), attention, the draft head's per-group loads.
without it mostly measured nothing. givens (21 us for ~3 MB, 290 calls), the gdn phases (39 / 63
us against ~11 / ~6 us of state traffic), attention, the draft head (2.56 ms for ~0.35 GB of
2-bit codes), the fp8 logits head (3.5 ms, floor ~2.3). givens and the gdn ops have no rad-kbench
recipe on this container and the server's stall samples come back empty, so each needs a
standalone probe first.
2. Prefill (349 tok/s at ~1900 tokens; ~5.6 s): the GEMMs 1.67 s (oneMKL ~1.2 of it; the m2xfp4
decode to fp16 and the scale epilogue the rest), attention 0.99 (a DPAS kernel needs the K operand
shared across query heads, see above), the chunk scan 0.92 (exact; a DPAS chunked form would be