From ef6c6e13fa14ab69e8350123d4fe9b6773938299 Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 25 Oct 2026 11:13:28 +0100 Subject: [PATCH] docs: the verify GEMM in ESIMD, the gdn load order, what other repos do Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1 --- docs/SYCL_PROGRESS.md | 71 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/docs/SYCL_PROGRESS.md b/docs/SYCL_PROGRESS.md index 9c899623..5409a2ed 100644 --- a/docs/SYCL_PROGRESS.md +++ b/docs/SYCL_PROGRESS.md @@ -651,6 +651,77 @@ staging loads changed nothing, skipping its compute did -- the cost is its local loads (~200 a step a sub-group, every query head re-reading the step's keys). A layout that shares the K operand across query heads (or oneDNN's SDPA) is the next attempt. +## Qwen3.8-27B: the verify GEMM in ESIMD (2026-10-25) + +Per round (5 tokens, `profile_decode.sh` at 256 tokens, `--embedding-placement vram`): device time +~110 ms, of it the m2xfp4 GEMMs ~69 (gate_up N=34816: 444 us a call for 100 MB, 226 GB/s), the +DeltaNet update ~11, givens ~6.8, rmsnorm_quant ~6.4, the logits head 3.5, attention 3.2. Wall +time is ~27 ms a token against ~22 of device time (the profile's own synchronisations included), +so ~25 ms a round is the card waiting on the host. + +**What the register-DPAS kernel spends its time on** (probe `m2v.cpp`, gate_up's shape, M = 8, +synthetic codes, GPU warmed up first -- the first runs after idle are 2x slow on clocks alone): + +| variant | us | GB/s | +|---|---|---| +| as in libxe2 | 333 | 301 | +| no weight decode (raw words as B) | 193 | 520 | +| no scale multiply (kh = 1) | 195 | 515 | +| no activation loads | 266 | 377 | +| no code loads | 250 | 401 | +| no DPAS | 302 | 332 | + +The weight stream is not the limit: the ALU work is. IGC's ISA for the SYCL kernel shows why: a +lane's `vec` multiply by the (1 + k/4) 2^d factor becomes two SIMD16 fp16 multiplies and +four moves splitting and repacking the pair -- ~10 instructions a weight pair, 499 moves in the +loop. ESIMD (what Intel's own int4 kernels in IPEX use) states the register layout directly: a +thread owns 16 columns, its codes arrive by LSC d32x4 gathers as [dword][lane] registers, so a +word of 8 nibbles is one register across the 16 columns and a decoded pair is one SIMD32 fp16 +multiply. `xe2_gemv_m2_esimd.cpp`, probe `m2e.cpp`: + +| variant | us | GB/s | +|---|---|---| +| ESIMD, loops left rolled by the VC compiler (indirect register access) | 400 | 250 | +| ESIMD, unrolled | **240** | **417** | +| ESIMD, raw words (its floor) | 185 | 543 | +| ESIMD, decode without the multiply | 217 | 463 | + +Bit-identical to the SIMT kernel's output (0 of 278528 differ); 64/128/256-register modes and work- +group sizes 4-16 change nothing; a double-buffered line load spilled and ran at 383; LSC prefetch +of the next step's codes 1/2/4 steps ahead ran at 295/328/435 (worse); scanning e_max 16 bytes a +lane at a time 279 (worse). Weights rotated over 4 copies (cold, as the engine streams them): 265. + +**In libxe2 the same kernel first ran at 379 us** (rad-kbench `--bench`, cold; SIMT 403): not +clocks, data, flags or memory placement -- compiled into a harness on the probe's data it was +still 380. The ISA showed why: the activation's 256-byte block load sat right before its DPAS, one +per DPAS, each waiting its own latency, where the probe's compiler had hoisted them. Loading the +step's eight A blocks together with the code lines (`As`) fixes it: 256 us. rad-kbench, cold, +libxe2 against libref 50/50 passed (worst rel_l2 1.4e-3): + +| shape (M = 8) | SIMT | ESIMD | ESIMD, A loaded with the codes | +|---|---|---|---| +| gate_up N=34816 K=5120 | 403 | 379 | **256** | +| 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 +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 +local-memory store through a generic pointer, which IGC must order behind the store: every load a +full round trip. Loading the rows into registers first, then storing: 234 -> 166 us a call +(`profile_decode.sh`). The same values reach the same local slots, so the arithmetic is unchanged; +rad-kbench has no shape recipe for the op, so it was checked end to end only (greedy output above). + +**Other repositories.** vLLM's XPU int4 (GPTQ) path is oneDNN's `int4_gemm_w4a8` +(vllm-xpu-kernels lists only FP8/MXFP4 GEMMs of its own); vLLM captures decode graphs on XPU +(`cudagraph_mode FULL_DECODE_ONLY` in the user's own launch line). llama.cpp's SYCL backend +reorders Q4_0/Q4_K weights at load (quants and scales separated for coalesced reads) and has SYCL +graph support, off by default ("not yet faster", host waits unsupported while recording). Intel's +weight-only-quantization write-up describes IPEX's int4 GEMMs as ESIMD kernels with templated +work-group/sub-group levels. + ## Next steps Deployment note: on this card (PCIe x1 2.5 GT/s, 10 GiB of VRAM unclaimed) run with