From 04d4f8e9cce90e6f39b3214deeb6d50b328dcc79 Mon Sep 17 00:00:00 2001 From: claude Date: Wed, 28 Oct 2026 10:36:38 +0100 Subject: [PATCH] docs: the DPAS chunk scan, exact activations, the int4 MTP variant, BetterBench 51.4 / 689 and 54.2 / 691; pending work listed Benchmarks: 5ed4ff8 (49.4 / 491.5), 8e8b435 at depth 5 on the rtn file (51.4 / 688.8) and on the int4-MTP file (54.2 / 691.4). The session's prefill work, the chunk scan's KL check, the ESIMD private-memory trap, the int4 MTP block's conversion and results, and the work left uncommitted in the tree when the user asked to stop: the DPAS kkt solve, fast rmsnorm rows, the head at 9-16 rows (rad-kbench fixture 201/201) and the plain block norm (untested), each with what it still needs. Co-Authored-By: Claude Opus 5.5 --- docs/SYCL_PROGRESS.md | 90 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 82 insertions(+), 8 deletions(-) diff --git a/docs/SYCL_PROGRESS.md b/docs/SYCL_PROGRESS.md index afd9ed48..08acb025 100644 --- a/docs/SYCL_PROGRESS.md +++ b/docs/SYCL_PROGRESS.md @@ -168,6 +168,9 @@ fonts (this host has none; the first post had no text) -- all unpacked without r | 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-28 | `5ed4ff8` | qwen38-27b-w4a16 | sycl, + the decode GEMM's K splits reduced in local memory, the skinny bf16 GEMM in ESIMD | same | 491.5 / - @2000 | 49.4 / - | decode +6.5% | `local/radiance-bench/runs/20261028-082153-qwen38-27b-w4a16-5ed4ff8/results.html`, posted with `report.jpg` | +| 2026-10-28 | `8e8b435` | qwen38-27b-w4a16 | sycl, + the chunk scan on DPAS, exact activations at a third of the cost; `--num-speculative-tokens 5` | same + `--num-speculative-tokens 5` | 688.8 / 684.6 @2000 | 51.4 / - | decode +4.2%, prefill +40.1% | `local/radiance-bench/runs/20261028-101014-qwen38-27b-w4a16-8e8b435/results.html`, posted with `report.jpg` | +| 2026-10-28 | `8e8b435` | qwen38-27b-w4a16-mtp4 (`/models/out/qwen3.8-27b-w4a16-rtn-mtp4.rad`: the MTP block int4) | as the row above | same + `--num-speculative-tokens 5` | 691.4 / 684.6 @2000 | 54.2 / - | first run; decode +5.4% over the rtn file | `local/radiance-bench/runs/20261028-101821-qwen38-27b-w4a16-mtp4-8e8b435/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 @@ -957,21 +960,92 @@ near-floor kernels give ~80-85 tok/s; a calibrated quant of the trunk (the MTP b 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. +## qwen3.8-27b-w4a16: prefill on DPAS, the int4 MTP block (2026-10-28) + +**Prefill, the DeltaNet ops (2026-10-28).** At 2234 tokens (`--profile-ops`, the sum of op times): + +| op | before | after | how | +|---|---|---|---| +| gdn_chunk_scan | 1100 ms | 60 | DPAS (`8e8b435`, xe2_gdn_esimd.cpp): flash-linear-attention's chunked form in two launches -- a parallel pass over every (sequence, chunk, head) forming U = A beta V, W = -A beta e^g K, Q' = scale e^g Q, the decayed Q K^T and (e^{g_last - g} K)^T; then a serial pass a (sequence, head, 32 value columns), the f32 state in registers, V' = U + W S, O = Q' S + R V', S = e^{g_last} S + K'^T V' on bf16 DPAS. Tolerance-held: rel_l2 3-5e-3 (tol 2e-2); KL against the exact-kernel reference unchanged (below) | +| gdn_gated_rmsnorm | 230 | 37 | a sub-group a 128-wide row, libref's ordered sum by lane broadcasts; the gate's exp in float with libref's double chain repeated near a bf16 tie (`6969fcf`). Bit-identical | +| gated_quant_fp8 | 320 | 254 | the same float-exp / tie rule. Bit-identical | +| gdn_conv_prep | 320 | 294 | the convolution's silu the same way. Bit-identical | + +**The float exp near a bf16 tie** (`6969fcf`, xe2_common.h `near_bf16_tie`): libref takes exp in +double and rounds once, ~3x the cost of the rest of an activation on this card. Two f32 values a +few ulps apart round to the same bf16 unless they straddle a rounding tie, so an activation whose +result is rounded to bf16 runs with a float exp and repeats libref's double chain only where the f32 +result lies within 16 ulps of a tie (or is not finite). Probe silu.cpp: 0 of 21M bf16 outputs differ +from libref's (the float chain alone: 85), at a third of the time. + +**KL of the DPAS scan** (`local/scratch/w4/kld.sh`; reference recorded with `XE2_EXACT=1` over the +12-document corpus, 2002 positions, 2048-token batches): the fast set with the DPAS scan KLD mean +0.002376, top-1 96.80%, PPL x0.9991; with the exact scan (`XE2_GDN_SCAN1=1`) 0.002380, 96.65%, +x0.9982 -- the scan adds nothing measurable. + +**An ESIMD trap** (probe gdnp.cpp): `Lin::off` indexes its shape and stride arrays at run time, which +puts a private copy of the kernel argument in memory; an ESIMD kernel that does not spill gets no +scratch for it, and the card faults at stray addresses (device lost) even with every other statement +removed. Pass `cu` (and anything else indexed) as base and stride. + +**The int4 MTP block** (the user's go-ahead, 2026-10-28): `/models/out/qwen3.8-27b-w4a16-rtn-mtp4.rad`, +recipe `/models/q38-27b-w4a16-rtn-mtp4.recipe` (the rtn recipe without `blk.64.* cast dtype=bf16`, so +blk.64's six projections take the trunk's u4 rule), converted with `--reuse` of the rtn container: +1029 weights copied bit for bit, blk.64's projections 710 -> 184 MiB, 48 s. `mtp.fc` stays bf16 (the +MTP block declares it so). Decode proxy at depth 5: 56.8 tok/s against the rtn model's 53.1 (+7%), +tokens a round unchanged (the int4 drafter accepts as often); depth 6 56.1, 7 55.4, 8 18.6 (a cliff: +verify at M = 9 passes the 8-row kernels -- the int8 head's DPAS forms took M <= 8, and 9-16 rows +fell to its SIMT kernel, ~100 ms a call). BetterBench at depth 5: 54.2 against 51.4 (+5.4%), +prefill unchanged. Depth 5 is best on both files. + +**Pending in the working tree (built, not committed; the session stopped at the user's request):** + +- `gdn_kkt_solve` on DPAS (`launch_kkt`, xe2_gdn_esimd.cpp; dispatch in xe2_gdn.cpp): a work-group + of 4 threads a (sequence, chunk, head), K K^T on DPAS, the inverse by 16-row blocks in f32 (the + diagonal block by forward substitution in registers, then three barrier-separated levels of + X_tJ = -X_tt sum M_tK X_KJ through local memory). Probe gdnp.cpp (`GDNP_KKT=1`): rel_l2 <= 4.4e-6 + against libref (tol 2e-3), 299 of 6.3M bf16 outputs differ (ties), every row written; ~350-450 us of + device time at 2048 tokens and 48 heads (the exact kernel ~7.7 ms). Spills 768 bytes. rad-kbench + fixture: passed (below). Still to do: the container cases, the op oracle, KL, the profile. +- `rmsnorm` fast rows (xe2_norm.cpp): squares by a tree reduction, a sub-group a row up to 512 wide + (the q/k norms), a work-group above; `XE2_EXACT=1` keeps libref's chain. For the decode norms below + and the prefill's 117 rmsnorm calls (88 ms). +- the int8 head at 9-16 rows (xe2_gemm.cpp, logits_gemm_head_gemv): the DPAS forms once a block of 8 + rows instead of the SIMT kernel -- the depth-8 cliff above. +- rad-kbench fixture over these three (`--op gdn_kkt_solve --op rmsnorm --op logits_gemm`): 201/201, + worst rel_l2 1.83e-3 (the head at M = 16, tol 8e-3; libref's and libavx's own rows 1.82e-3 there). +- **The plain block norm** (abi/rad_builder.h `RadBuildCtx::plain_norm`, set by the engine on the + SYCL backend only; arch/common: `Geom::plain_norm`, `LinearFP8::codes_free`, + `NormQuantFP8::x_only`, and a probe of the norm's readers in the attention, delta-net and MLP fp8 + blocks): where no reader of a block norm's output takes the E4M3 pair (4-bit or plain bf16 + projections), the norm runs as `add` (the residual stored first) then `rmsnorm` -- exactly + rmsnorm_quant_fp8's residual and bf16 output in libref's semantics, without the codes, and with + the fast rmsnorm row instead of libref's ordered sum (~31 us of each ~48 us decode norm, 138 a + round: ~6 ms of a ~53 ms round). Other backends get 0 and declare what they did (AMD and CPU run + 4-bit models too, libr4d / libavx serve w4a16_asym). **Untested**: needs the host build and + `ctest --test-dir build -LE 'gpu|oot'`, then on the B65 the op oracle, KL against + `local/scratch/w4/kld_ref_exact` and greedy output, then the decode proxy. + ## 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): +For qwen3.8-27b-w4a16 (the model now; `qwen3.8-27b-w4a16-rtn-mtp4.rad`, the int4-MTP variant the user +approved, is 5% faster at decode; serve either with `--num-speculative-tokens 5`): -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. +0. Finish the pending items above: validate (host ctest for the plain norm; kbench container cases, + op oracle, KL, greedy), commit each, re-profile. +1. Decode (~53 ms a round, ~3 tokens at depth 5; 90 tok/s needs ~33 ms): the plain norm (~6 ms), + casts fused into the w4a16 GEMM's activation load (1.1 ms), `mtp.fc` int4 (an MTP-block change: + it is declared bf16), the 2-bit draft head (~0.6 ms a draft pass), the gdn decode ops (~3 ms), + decode attention (~2.5 ms), then deeper speculation once drafts are cheap. +2. Prefill (689 tok/s on BetterBench; op time ~3.5 s at 2234 tokens before the pending items): the + w4a8i8 GEMMs 1.62 s (~74 of ~200 int8 TOPS: bigger register tiles, B staged too), kkt 0.41 -> + ~0.03 (pending), conv_prep 0.29, attention 0.26 (flash attention spills 4.3 KB at 256 registers), + gated_quant 0.25, rmsnorm_quant 0.20 (the plain norm), the norms; `local/scratch/w4/pops.sh TAG` + profiles a request. For Qwen3.8-27B-PARO-M2XFP4 (the previous model; its list, kept):