From e1e21935cc496b4137deeaf83252b07d7f6c58ed Mon Sep 17 00:00:00 2001 From: aneinander Date: Sun, 8 Nov 2026 13:28:22 +0100 Subject: [PATCH] docs: SYCL_PROGRESS, generic backend work of 2026-11-08 (changes 1-5, op coverage, gdn analysis) Co-Authored-By: Claude Opus 5.5 --- docs/SYCL_PROGRESS.md | 55 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/docs/SYCL_PROGRESS.md b/docs/SYCL_PROGRESS.md index a791c725..fd3e8ce1 100644 --- a/docs/SYCL_PROGRESS.md +++ b/docs/SYCL_PROGRESS.md @@ -1029,6 +1029,61 @@ prefill unchanged. Depth 5 is best on both files. `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. +## Generic backend work, not model work (2026-11-08) + +The user's rule from here: optimise the SYCL backend so it helps many models, not Qwen3.8-27B alone; +no model changes (recipes, heads, quants), nothing deep in the engine. Branch `xe2/generic-perf`. + +**What the Radeon backend does that this one does not** (libr4d, core/device/aql.cpp): its own AQL +packets instead of hipLaunchKernel, recorded passes (`tape_*`), chained launches (no barrier bit +between dependent kernels), weight prefetch beside the all-reduces (TP only), and fused rows +(`qk_norm_rope_gate`, `sample_chain`, the `_had_quant_i8g` folds of the rotated W8A8 trunk). All +three launch-side tricks target per-kernel cost. **Measured here first** (probe +`local/scratch/xe2perf/launchgap/lg.cpp`, 800 dependent kernels): a live submission costs ~4.5 us of host +time, the device gap between dependent kernels ~0.1-0.2 us either way, a recorded +sycl_ext_oneapi_graph replays at ~1 us a kernel. On both models the card is busy ~97% of a decode +token (MiniCPM5-2B: 14.1 of 14.4 ms; the 27B: device sum = wall), so recorded passes would save host +CPU, not tok/s, at one stream. They stay on the list for small models and busy hosts, below kernels. + +**The card's ceiling**: 603 GB/s reading random data (`xe2perf/bw/bw.cpp`); a constant buffer reads +at ~1,170 GB/s (Xe2's lossless compression), so bandwidth probes must use random data. + +| # | commit | change | check | result | +|---|---|---|---|---| +| 1 | `35829009` | DPAS flash attention (decode and prefill) at head_dim 64 and 128, not only 256 | rad-kbench attn_paged: fixture 207/207, MiniCPM5 160/160, 27B 160/160; KL vs `XE2_EXACT=1` mean 0.00060 / top-1 98.59%, the SIMT kernel's exactly | MiniCPM5-2B decode 69.3 -> 83.1, prefill @2k 1,806 -> 8,080 tok/s | +| 2 | `2f1fdd4d` | bf16 skinny GEMM at 9-16 rows: ESIMD RC = 16, two 8-row DPAS on each weight tile (was the SIMT form, 6-8x the 8-row time) | rad-kbench gemm_nt + logits_gemm: MiniCPM5 360/360, fixture 686/686 | M = 16 gate_up 712 -> 104 us; MiniCPM5 12 streams 198 -> 654 tok/s | +| 3 | `6abca01f` | w4a16 decode GEMM in 16-row blocks (launch16x2: two bands on each decoded group; was 8-row blocks, each re-reading the weight) | `XE2_W4_CHECK=50` on the 27B: rel_l2 <= 6.6e-5 every shape | 27B int4 MTP 3, 4 streams: 98 -> 110 tok/s; one stream unchanged | + +| 4 | `d04a27fa` | `gemm_nt_bias` (bias, gelu, residual: 22 architectures' vision/audio/embedding/diffusion linears) on the fast GEMMs, product into f32, libref's epilogue on it; was only the one-work-item-an-output ref row | rad-kbench fixture 210/210, full fixture 2144/2144, Qwen3.5-9B vision shapes agree with libref | 4608x4608 + gelu: M = 1 1,627 -> 81 us, M = 512 302,924 -> 721 us | +| 5 | `b0ac7fd4` | device rows for gelu, silu, gelu_tanh, scale, mul_weight, clamp, fill, iota, act_mul, gelu_mul (libref's chains, double transcendentals) | fixtures 339/339; a random-weight 2-layer Gemma3 `.rad` (local/scratch/tinyg3/gen.py): every kernel agrees with libref | a weightless op with no device row stops the engine at startup: that Gemma3 did not start on Intel, now serves | + +Escape hatches: `XE2_ATTN_SIMT=1`, `XE2_GEMV_SIMT=1`, `XE2_W4_RB8=1` restore the previous forms; +`XE2_EXACT=1` the ref rows of 4. + +**Second test model**: RedHatAI/Qwen3.5-9B-quantized.w4a16, converted as shipped (library folder +`aneinander/Qwen3.5-9B-quantized.w4a16-rad`): 56.9 tok/s decode, 94.6 with MTP 3, 4.4k prefill. +On its M = 1 shapes the bf16 GEMVs run at 91-97% of 603 GB/s (rad-kbench), the norms at the 4.2 +us launch floor. + +**Op coverage**: libxe2 serves 64 ops, libr4d 281. An op with weights and no device row runs +host-site (a join); one **without** weights stops the engine at startup. Still missing on Intel and +used by several architectures: the MoE family (moe_gemm, moe_gather/scatter, router_topk), +qk_norm_rope, relu, conv1d, group_norm, attn_cross and the diffusion ops. A static scan of arch/ is +noisy (shared headers name ops used only at tp > 1 or in one quant form): a converted container is +the check. + +**GDN recurrent update under stall sampling** (`gdn_recurrent_update`, Qwen3.5-9B, q_len 1: 36.8 +us against ~7 us of state traffic; 27B 46.4 against ~10): no dominant cause -- memory waits on the +state rows and the bf16 q/k/v ~25%, the libref-order chains ~25% (the q/k norm chains run scalar +and in every sub-group), barrier waits 13%, instruction fetch 10% (a large kernel, cold every +launch). Worth 3-5% of decode at the floor; left for now. rad-kbench cannot draw +`gdn_conv_recurrent_update`'s operands (dt_bias plane), unitrace -d does not see the server's +decode launches (SIGINT teardown). + +Next, generic: the GDN recurrent update (38.6 us a layer at M = 1 against ~10 us of state traffic: +48 work-groups of 8 threads, latency-bound; needs a probe under stall sampling first), then a +single-stream MTP profile (vLLM 58 vs 51.4 tok/s) through `--profile-ops`. + ## Next steps Deployment note: on this card (PCIe x1 2.5 GT/s, 10 GiB of VRAM unclaimed) run with