docs: the int4 W4A16 Qwen3.8-27B on the B65 -- bring-up, kernels, checks, the round's profile, BetterBench 46.4 / 490

SYCL_PROGRESS.md: the gdn fusion and row_topk commits, the repository's move (build trees, venv,
fonts.conf), the w4a16 model's kernels and their checks, the ESIMD compiler's mad fusion, how to
measure on this model (unitrace's v2-adapter blind spot, the v1 adapter, --profile-ops, the
BetterBench proxy), where a decode round goes, the acceptance analysis, next steps. README: the
current numbers and to-dos.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
claudeandClaude Opus 5.5 committed 2026-10-28 01:19:14 +01:00
1 parent 13c64a3d78
commit dd0ee312a4
2 files changed
+109 -16

No files matched your search

+89 -1
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 -> 53.2 tok/s decode on BetterBench with the DFlash2 drafter (`2a5e815`), prefill 356 tok/s at 2000 tokens (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: 0.1 -> 53.2 tok/s decode with the DFlash2 drafter (`2a5e815`), prefill 356 tok/s. **From 2026-10-27 the model is the user's `qwen3.8-27b-w4a16-rtn.rad`** (int4 W4A16, MTP drafter): decode 44.9 -> 46.4 tok/s, prefill 301 -> 490 tok/s (`13c64a3`, BetterBench quick); target: vLLM-SYCL's ~90 / ~1200 as a floor. In progress |
| 5 broaden and finish | not started |
## Open blockers / questions for the user
@@ -166,6 +166,8 @@ fonts (this host has none; the first post had no text) -- all unpacked without r
| 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% | `local/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% | `local/radiance-bench/runs/20261026-014745-qwen38-27b-m2xfp4-68d510b/results.html`, posted with `report.jpg` |
| 2026-10-26 | `2a5e815` | qwen38-27b-m2xfp4 | sycl, + meta/exponents tiled with stored e_max, quant_act_fp8 per group, the w2a8 head on u2 DPAS | same | 355.3 / 354.6 @2000 | 53.2 / - | decode +2.2% | `local/radiance-bench/runs/20261026-034439-qwen38-27b-m2xfp4-2a5e815/results.html`, posted with `report.jpg` |
| 2026-10-28 | `e85124c` | qwen38-27b-w4a16 (`/models/out/qwen3.8-27b-w4a16-rtn.rad`) | sycl, the w4 GEMMs (fp16 DPAS decode, int8 DPAS prefill), int8 head in ESIMD, MTP drafter depth 3 | `--max-model-len 8192 --max-num-seqs 1 --embedding-placement vram` | 301.3 / 300.1 @2000 | 44.9 / - | first run | `local/radiance-bench/runs/20261028-000752-qwen38-27b-w4a16-e85124c/results.html`, posted with `report.jpg` |
| 2026-10-28 | `13c64a3` | qwen38-27b-w4a16 | sycl, + the prefill GEMM through local memory, quant_act_i8g typed, flash attention on DPAS | same | 489.7 / 486.6 @2000 | 46.4 / - | decode +3.4%, prefill +62.5% | `local/radiance-bench/runs/20261028-010909-qwen38-27b-w4a16-13c64a3/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 | `local/radiance-bench/runs/20261023-221354-minicpm5-2b-bf16-b07da2a/results.html`, posted with `report.jpg` |
## Models
@@ -881,12 +883,98 @@ decode 52.0 -> 53.2 tok/s.
rad-kbench has no recipe on this container for givens_dense_quant or the gdn ops, so those need
probes of their own.
## Qwen3.8-27B: the gdn update fused, row_topk filtered (2026-10-26/27)
- `d87dd86` gdn recurrent state rows as a lane's own 16-byte vectors (50 -> 28 us a call: the 8.3 KB
local-memory block let only ~300 of 384 work-groups fit, two waves a phase); `55db8c7` the gated
norm a sub-group a (token, head), 31.8 -> 24.9 us; `7dd17c6` the recurrent update one launch a step
(replay, token pass, gates, gated norm and fp8 group fused; 4.31 -> 3.76 ms a round;
`XE2_GDN_SPLIT=1` keeps the split form). rad-kbench 90/90 gdn cases at rel_l2 0, greedy identical.
- `2d1f168` row_topk filtered: the R-th largest of a row's 64 sub-group maxima bounds its R-th largest
key, so the top R are among the few keys above it, ranked by counting in local memory: 0.93 ms ->
37 us a round at R = 32 of 248320; rad-kbench fixture 21/21, both 27B containers at rel_l2 0.
## The repository moved (2026-10-26 21:31)
The checkout moved from `~/radiance` to `~/projects/radiance`. The build trees, BetterBench's venv
(script shebangs, the editable install's `.pth`) and Chromium's `fonts.conf` held the old absolute
path: `build-sycl` was configured afresh (`cmake --preset sycl`, the old tree kept as
`build-sycl.old`; rad-kbench's cache copied over), and the venv and fonts.conf were rewritten in
place. `build/` (the host-only build) still holds the old path: reconfigure it before using it.
## qwen3.8-27b-w4a16-rtn: the user's int4 release (2026-10-27/28)
The user converted Qwen3.8-27B bf16 to `/models/out/qwen3.8-27b-w4a16-rtn.rad` (recipe
`/models/q38-27b-w4a16-rtn.recipe`, "a quant more in line with intel cards"): every trunk linear u4
codes with an f16 scale and u4 zero per 128 of K (RTN), the head int8 with a bf16 scale per 128, the
MTP block (blk.64) bf16 with a 2-bit draft head. It is the model from now on; the targets are the
user's vLLM-SYCL numbers, ~90 tok/s decode and ~1200 tok/s prefill, "the bare minimum".
The engine casts a 4-bit linear's input to f16 for `gemm_nt_q` at `w4a16_asym` up to 64 rows a step
and quantises it with `quant_act_i8g` for `w4a8i8_asym` above; none had a device kernel, and the
int8 head fell into head_dpas's per-lane fallback (96 ms a call). Done (`ab01755`..`13c64a3`):
| piece | form | check |
|---|---|---|
| planes | tiled at load ("xe2.w4.t16": a tile's codes side by side, even codes in each dword's low half so `(w >> 4s) & 0x000F000F` is a VNNI pair; "xe2.w4.sz.t16": f16 scale and f16(1024 + zero) a dword) | unrelayout exact |
| exact form | libref's gemm_zp loop per output (`XE2_W4_EXACT=1`, `XE2_EXACT=1`) | 0 differences |
| w4a16_asym, M <= 64 | ESIMD, a thread a 16-column tile: `(code \| 0x6400) - f16(1024 + zero)` is code - zero exactly, fp16 DPAS of RC = 1/2/4/8 rows, a group summed in f32 and scaled once; narrow outputs split K | 0 and 2 of 20480 bf16 outputs differ (ties) |
| w4a8i8_asym | int8 DPAS with the codes as its u4 B operand (probe: nibble i meets A's byte i); a prepass reorders the activation's bytes evens first and forms each group's sum; 8 threads share 16 rows through local memory, the epilogue on whole blocks: 62-78 int8 TOPS | libref's result bit for bit |
| quant_act_i8g | quant_act_fp8's form at top 127; bf16 rows of groups of 128 by typed vector loads | rad-kbench 153/153 + 96/96, rel_l2 0 |
| int8 head | ESIMD, d32x4 gathers, `(b ^ 0x80) \| 0x6400` less 1152 is b exactly, fp16 DPAS a 128-block: 96 ms -> ~2.4 ms | rad-kbench 28/28 (1.7e-3, tol 8e-3) |
| prefill attention | flash attention on DPAS (xe2_attn_flash_esimd.cpp): 1.41 s -> ~0.3 s at 2234 tokens | rad-kbench 240/240 (2.3e-3, tol 2e-2) |
rad-kbench and the op oracle cannot draw the zero-point grids, so `XE2_W4_CHECK=n` checks the first n
calls of each w4 form against libref's loop on the host, on the engine's own operands.
**The ESIMD vector compiler fuses a multiply and an add into a mad whatever the front end's
-ffp-contract** (probe fmac.cpp: 14062 of 65536 lanes; SIMT unaffected); libxe2 now links with
`-Xsycl-target-backend "-options -ffp-contract=off"` (`ab01755`), without which an ESIMD epilogue that
copies libref's chain (the w2a8 head's claimed bit-exactness included) is exact only by luck.
**Measuring.** unitrace's `-d` summary leaves out kernels the Level Zero v2 adapter launches through
`zeCommandListAppendLaunchKernelWithArguments` (all of libxe2's on this model), and its trace stops
timing after ~1600 kernels; on the v1 adapter (`SYCL_UR_USE_LEVEL_ZERO_V2=0`) `-d` sees everything
(it crashed once on a long prefill). Decode rounds: `local/scratch/w4/prof_v1.sh` + `utsum.py`;
prefill: `--profile-ops` (ops are milliseconds long). A quick BetterBench proxy:
`local/scratch/w4/dec_quick.py` (two prompts of each weighted category of its corpus, its sampling;
45.5 against BetterBench's 44.9). And never `pkill -f '<pattern>'` from a tool shell whose own
command line holds the pattern: it kills the shell (`pkill -f '[b]uild-sycl/bin/radiance'`).
**Where a decode round goes** (`e85124c`, story prompt, v1 adapter, per round of ~2.5 tokens, device
time ~58 ms = wall time: the card is never waiting): w4a16 GEMMs at M = 4 27.6 ms (295 calls; floor
~22.7 at 560 GB/s), rmsnorm_quant_fp8 6.6 (138 calls, libref's serial sum ~31 us of each 48), MTP
drafting ~7.5 (three passes of bf16 GEMVs and the 2-bit head), gdn 3.7, attention 2.5, int8 head 2.4,
the N = 96 bf16 GEMV (ssm_ab) 1.9 (38 us for 1 MB: 6 work-groups each staging 80 KB), casts 1.2,
the rest ~3.
**Acceptance is the other half.** MTP at depth 3 lands 2.1-3.4 tokens a round (BetterBench's
categories); greedy is barely higher (proxy 48.9 vs 45.5), drafting from the int8 head instead of the
2-bit draft head barely moves it (2.73 vs 2.70 tokens a round, slower overall), and the engine
accepts on agreement with the sampled token, which equals rejection sampling for greedy drafts. So
per-position acceptance is ~0.7-0.8; vLLM's ~5.3 tokens a round at MTP6 implies ~0.9. At ~0.75 even
near-floor kernels give ~80-85 tok/s; a calibrated quant of the trunk (the MTP block was trained on
the bf16 trunk; RTN moves the trunk ~10% a weight) and an int4 MTP block (draft passes ~4x cheaper)
are model-side levers for the user to decide.
## Next steps
Deployment note: on this card (PCIe x1 2.5 GT/s, 10 GiB of VRAM unclaimed) run with
`--embedding-placement vram`; the default pins the 2.4 GiB embedding in host memory and reads it over
the link (4 ms a round).
For qwen3.8-27b-w4a16-rtn (the model now):
1. Decode (~58 ms a round, ~2.6 tokens): the w4a16 GEMM at M = 4 (27.6 -> ~23 ms; narrow shapes and
their split-K reduce launches), the N = 96 bf16 GEMV (1.9 ms -> ~0.3), the MTP block's bf16 GEMVs
(~300 GB/s on N 5120-12288), rmsnorm_quant_fp8 (the fp8 codes are unused by 4-bit linears; the
serial sum), casts fused into their producers, then the speculation depth.
2. Prefill (490 tok/s at ~2000 tokens, ~4.8 s at 2234): the gdn ops ~2 s (chunk scan 1.1, kkt 0.4,
conv_prep 0.3, gated norm 0.2), the w4a8i8 GEMMs ~1.3 s (62-78 TOPS), gated_quant_fp8 0.3 (double
exp), the norms; profile with `--profile-ops` after each step.
For Qwen3.8-27B-PARO-M2XFP4 (the previous model; its list, kept):
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