From 207b10b3c3c51a81cff693d0cd03377974b9ed11 Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 25 Oct 2026 14:44:23 +0100 Subject: [PATCH] docs: the round on unitrace -- stall sampling, the 560 GB/s ceiling, fixes and null results, BetterBench 48.2 tok/s Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1 --- docs/SYCL_PROGRESS.md | 83 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 75 insertions(+), 8 deletions(-) diff --git a/docs/SYCL_PROGRESS.md b/docs/SYCL_PROGRESS.md index 5409a2ed..21979a04 100644 --- a/docs/SYCL_PROGRESS.md +++ b/docs/SYCL_PROGRESS.md @@ -162,6 +162,8 @@ fonts (this host has none; the first post had no text) -- all unpacked without r | 2026-10-24 | `5720a95` | qwen38-27b-m2xfp4 (Qwen3.8-27B-DFLASH2-PARO-M2XFP4) | sycl, fast m2xfp4 GEMV / DPAS verify / tiled XMX prefill, DFlash2 drafter on | `--max-model-len 8192 --max-num-seqs 4` | 113.4 / 113.3 @2000 | 19.1 / - | first run | `~/radiance-bench/runs/20261024-060226-qwen38-27b-m2xfp4-5720a95/results.html`, posted with `report.jpg` | | 2026-10-24 | `35708cd` | qwen38-27b-m2xfp4 | sycl, + verify GEMM epilogue fused, givens/attention/head on register DPAS, typed gdn, exact chunk-parallel kkt and 1024-wide chunk scan, oneMKL prefill GEMMs | `--max-model-len 8192 --max-num-seqs 1 --embedding-placement vram` | 341.0 / 340.2 @2000 | 37.0 / - | decode +28.2%, prefill +159.8% | `~/radiance-bench/runs/20261024-175851-qwen38-27b-m2xfp4-35708cd/results.html`, posted with `report.jpg` | | 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-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 @@ -704,8 +706,9 @@ libxe2 against libref 50/50 passed (worst rel_l2 1.4e-3): | down N=5120 K=17408 | 208 | 192 | **156** | | N=12288 K=5120 | 208 | 174 | **133** | -The verify GEMM now costs what the M = 1 GEMV does (gate_up 248-262 us), ~400 GB/s against the -card's 839 GB/s copy rate -- both kernels' next limit. Greedy output identical to before (8 +The verify GEMM now costs what the M = 1 GEMV does (gate_up 248-262 us), ~400 GB/s. (The "839 +GB/s" of rad-kbench's copy probe is not the card's read rate on real weights: see the next section, +~560 GB/s on incompressible data.) Greedy output identical to before (8 prompts x 64 tokens); a story prompt (3.3 tokens a round) decodes at 30.3 tok/s, was 24.6. **The DeltaNet update** (`gdn_conv_recurrent_update`) issued each of its 128 state loads after a @@ -722,18 +725,82 @@ graph support, off by default ("not yet faster", host waits unsupported while re weight-only-quantization write-up describes IPEX's int4 GEMMs as ESIMD kernels with templated work-group/sub-group levels. +## Qwen3.8-27B: the round on unitrace, and stall sampling (2026-10-25, continued) + +**Measuring.** `--profile-ops` synchronises every op and the profiling queues cost ~20 us a +submission, so a multi-kernel op's number is bounded by host submission, not device time (gdn's +"90 us of other kernels" was that). Intel's unitrace (pti-gpu, built from source without root: +`cmake -S pti-gpu/tools/unitrace -DBUILD_WITH_MPI=0 -DBUILD_WITH_ITT=0 -DBUILD_WITH_XPTI=0`) gives +per-kernel device time at no visible cost to tok/s (`unitrace -d`), and on this card **EU stall +sampling** works without root (`/proc/sys/dev/xe/observation_paranoid` is 0): `unitrace +--stall-sampling` reports, per ISA instruction, active cycles and stalls by cause (send, scoreboard, +pipe, ...). It works for probes and rad-kbench; the server's SIGINT teardown loses the samples. + +**The card's read rate.** An ESIMD streaming kernel reads 938 GB/s of a constant fill and **~560 +GB/s of hashed data** (probe bw2.cpp; flat-CCS compression). Real 4-bit codes do not compress, so +~560 GB/s is the ceiling to judge GEMVs by: a round's ~13.2 GB of weights cost >= ~24 ms. The card +has 160 EUs x 8 threads = 1280 resident threads (20 Xe cores). + +**Where a round goes** (story prompt, 2.8 tokens a round, 400 tokens, unitrace -d; before the +fixes below): 86.7 ms of device time a round against ~96 of wall time; the host is blocked in waits +80% of the time (instrumented rad_stream_sync / rad_event_sync) and xpu-smi shows the compute engine +100% busy, so decode is device-bound -- a graph/tape would recover at most the ~10 ms of gaps. + +| kernel | ms a round | calls | us a call | +|---|---|---|---| +| m2xfp4 verify GEMM (ESIMD) | 38.6 | 329 | 117 | +| rmsnorm_quant_fp8 | 6.2 | 129 | 48 | +| givens_dense_quant | 6.0 | 290 | 21 | +| gdn recurrent (two phases) | 4.8 | 96 | 50 | +| GEMM prepass + split reduce | 4.9 | 329 + 260 | 11 / 5 | +| logits head (head_dpas) | 3.5 | 1 | 3475 | +| attention | 3.2 | 21 | 150 | +| w2a8 draft head (zp_dpas) | 2.8 | 1 | 2807 | +| step-upload range copy | 1.95 | 3 | 648 | + +**Fixed** (each checked: rad-kbench against libref where it has a recipe, greedy output identical): +- *e_max in the prepass launch*: the split-K shapes' per-column exponent max was a launch of its + own (7.8 us x 260 a round); extra work-groups of the activation prepass form it now. Down + 156 -> 142 us. +- *Range copies*: the step upload's copy kernel read its range list and sources from pinned host + memory -- over PCIe x1 a round trip a load, 648 us a call. Staged into a per-stream device buffer + first (core/device/sycl.cpp): gone from the profile. +- *w2a8 head staging*: its activation staging loaded through a generic pointer after each local + store (the gdn pattern again): 2.81 -> 2.55 ms. +- *Exponents and metadata four steps a gather*: stall sampling put 43% of the verify GEMM's samples + on **send stalls** (the memory request queue full), 3.7% on scoreboard waits: the kernel is bound + by memory *messages*. 4-byte gathers of the exponents and metadata were a third of its cache-line + requests for an eighth of its bytes; 16-byte gathers covering four steps: gate_up 253 -> 244, + down 142 -> 131 us (probe: 276 -> 246). + +**Tried, no gain** (kept out): 2D block loads of the codes (transposed d32, 258 vs 240 us); a +double-buffered code line (274 vs 275); K splits 2/4 (worse); rotating each thread's K start to +break load/compute convoys (300 vs 275); LSC prefetch 1-4 steps ahead (worse); givens' T rows loaded +before staging (20.7 -> 20.5 us); the gdn phase-1 chains rescheduled for latency (norms a token a +lane, output and next sk2 fused; 49.9 -> 49.6 us -- the chains are not its limit); a ring of four +groups of codes and scales ahead in the w2a8 head (4.7 ms, worse); unrolling the prepass loads +(10.8 -> 14.6 us, worse). The ordered sum of squares in rmsnorm_quant runs at ~13 cycles an element +however it is staged (31 us for 5120: probe chain2.cpp), and a tree sum failed the op's tolerance +before (MiniCPM5), so ~30 us of its 44 stay. + +**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. + ## 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). -1. Decode (~112 ms a speculative round of ~4 tokens, vLLM ~68 ms of ~5): the m2xfp4 verify GEMMs are - ~60 ms of it at ~2.5x their bandwidth floor. Measured: the weight stream alone runs at ~526 GB/s - in this lane-a-row pattern; the activation loads and the decode do not overlap it, and neither - local-memory staging, longer runs, more splits, two tiles a lane, 256 registers nor L1 streaming - hints helped. Then the DeltaNet update (~11 ms), the norms (~6.6, bounded by the ordered sum's - ~37 us chain), the draft head (3 ms, its group terms through the generic accessors). +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, + ~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. 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