From 0376adeb921723d5dd08668bf948aa1bc7521782 Mon Sep 17 00:00:00 2001 From: pascallinxweiler Date: Sat, 24 Oct 2026 04:43:34 +0200 Subject: [PATCH] docs: the 27B bring-up and its first fast kernels in SYCL_PROGRESS Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1 --- docs/SYCL_PROGRESS.md | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/docs/SYCL_PROGRESS.md b/docs/SYCL_PROGRESS.md index f1aecff0..8b2b186e 100644 --- a/docs/SYCL_PROGRESS.md +++ b/docs/SYCL_PROGRESS.md @@ -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 | in progress on MiniCPM5-2B bf16: decode 4.2 -> 51.8 tok/s, prefill 17 -> 1576 tok/s (BetterBench quick, `b07da2a`) | +| 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 -> 13.2 tok/s decode, in progress | | 5 broaden and finish | not started | ## Open blockers / questions for the user @@ -507,6 +507,45 @@ this container (`-m`), until the model serves and is greedy-identical to the lib (Milestone B); then the fast kernels (m2xfp4 GEMV/XMX, DeltaNet scan) under the KL bound, with BetterBench after each. +## Qwen3.8-27B on the B65: bring-up and the first fast kernels (2026-10-24) + +Goal set by the user: beat vLLM-SYCL on Qwen3.8-27B int4 (~90 tok/s decode, ~1200 tok/s prefill). + +**Bring-up (4921641).** Every op the container needs got a correctness-first libxe2 kernel in +libref's arithmetic and order: m2xfp4 gemm_nt_q with libref's m2 layout hooks, givens_dense_quant +(double, as libref), the gated delta net (seven ops), rope's mrope/imrope/axial and rope_table, +the fp8 joined logits head, gemm_nt_bias, mul, sigmoid, scatter_rows, layernorm, grid_embed, +attn_dense, dflash_conv, logit_rerank. libref's gemm_m2 gained the parts (pb1/pb2) every other +ParoQuant grid and libr4d already define (the oracle refused this model's fused projections), and +both m2 arms take the engine's u8 [N, K] view of the codes-then-meta blob. rad-kbench: every new +row at rel_l2 0 on the fixture; the exact m2 kernel rel_l2 0 against libref on the 27B (parts +included). First greedy answer: "The capital of France is" -> " Paris.\nThe capital of Germany is +Berlin...", 0.1 tok/s. + +**Fast kernels (07cdc54, 55a350f, and the gdn commits).** + +| op | form | 27B decode, before -> after | +|---|---|---| +| m2xfp4 GEMV, M = 1 | e2m1 to fp16 by bits ((mag << 9) \| sign << 15 = e2m1 * 2^-14, fp16 subnormals kept), K permuted (u, u+4), fp16 activation and group sums | 157.6 -> 40.5 ms a token (scalar f32 form: ALU-bound, ~10 ops a weight) | +| m2xfp4, 2 <= M <= 16 (verify) | lane-per-column decode into a VNNI slice of local memory, DPAS | gate_up at M = 8: 1159 -> ~490 us | +| m2xfp4, M >= 17 (prefill) | weight decoded to bf16 (exact), bf16 XMX | -- | +| givens_dense_quant | sub-group an output, coalesced rotation rows, the double sum as a float pair | 146 -> 5.4 ms | +| fp8 joined head | E4M3 to fp16 by bits ((b & 0x7F) << 7 = E4M3 * 2^-8) | 43 -> 3.9 ms | +| w2a8 draft head | sub-group a column, exact integer groups, libref's group terms in order: **bit-identical** (0 bytes differ, live) | 252 ms -> < 1 ms a call | +| logit_rerank | sub-group a candidate, float-pair sum, libref's selection | 136 ms -> negligible a call | +| gdn recurrence | 16-column blocks (384 work-groups), state in registers (grf 256), gates once a (token, head): **bit-identical** | 431 -> 173 us a call | +| rmsnorm_quant_fp8 | row in local memory, loads before stores, ordered sum by broadcasts: **bit-identical**; the chain alone has a ~32 us floor for 5120 (probe) | 103 -> 96 us a call | + +rad-kbench: 1410/1410 on the fixture; on the 27B the M <= 32 bands 77/77 and the verify band +50/50 (m2 rel_l2 ~1e-3, tolerance 4e-2). Measured: **12.1 tok/s plain greedy, 13.2 tok/s with the +DFlash2 drafter** (device time a token 78 / 71 ms). With the fast kernels the drafter's greedy text +departs from plain decoding at a near-tie (byte 246 of 256 tokens): the M = 8 verify and the M = 1 +GEMV round differently; with the exact kernels the two were identical. + +Probes in the scratch directory, not in the tree: `m2bench.cpp` (decode GEMV variants on synthetic +m2xfp4 data), `chain.cpp` (the ordered-sum floor), `jmap.cpp` (joint_matrix_apply coordinates on a +packed B -- lost the device; not used). + ## Next steps 1. ~~Milestone B, part 2: `minicpm5-2b-fp8.rad`~~ **Dropped by the user (2026-10-23): "instead of the