- gdn_chunk_scan for head_k = 128, chunk 64: a work-group of 256 a (sequence, head, block of 32
value columns), the chunk's k, q (rows padded), the block's slices of v, S, W, V' and the sA rows
in local memory (~124 KB); every phase of a chunk is thousands of independent chains -- W[j][e],
V'[i][e], R[i][j], O[i][e], S[d][e] -- each one work-item's, in libref's order, A staged in local
memory, the decays e^{g_i - g_j} (libref's double exp) once a call. Still bit-identical (rel_l2 0,
the 27B's geometry, 1..32 rows and multi-chunk). 233 -> 96 ms a call at 1792 tokens.
- m2xfp4 at M >= 17 now fp16 on XMX: the weight times 2^(127 - e_max(n)), exact in fp16; the
activation fp16(a * a_scale / R_m); y = acc * R_m * 2^(e_max - 127) in a new scaled fp16 XMX
kernel (xmx_f16_scaled). fp16's 2^-11 step instead of bf16's 2^-8.
KL on the 27B against an XE2_EXACT=1 reference (every kernel exact, each matched to libref bit for
bit; 250 positions, full vocabulary): mean 0.0041 -> 0.0035, p99 0.027 -> 0.021, top-1 96.8% ->
95.6%, PPL ratio 0.998. The fast set's KL is dominated by the model's own fp8 activation quantiser
re-rounding small upstream differences.
27B prefill of 1792 tokens: 26.3 -> 19.7 s (68 -> 91 tok/s).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
- m2xfp4 GEMV (M <= 16): e2m1 decoded to fp16 by bits alone ((mag << 9) | sign << 15 is exactly
e2m1 * 2^-14; the card keeps fp16 subnormals), K permuted (u, u + 4) inside each 8 so a code
pair is one shift and mask, the activation as fp16(a * a_scale / R * 2^14) in that order, half2
subgroup and group sums, f32 across groups; four columns a sub-group at decode. The scalar
form was ALU-bound (~10 ops a weight, 80 ms a token); this one runs at 415-525 GB/s on the
27B's shapes in a standalone probe. rad-kbench against libref on the container: rel_l2 ~5e-5 to
~3e-3, tolerance 4e-2.
- m2xfp4 prefill (M >= 17): the weight decoded to bf16 (exact) and the activation to
bf16(e4m3 * scale), then the bf16 XMX GEMM per part.
- givens_dense_quant: a sub-group an output, the rotation row read coalesced, libref's double sum
as a float pair (two-product and two-sum, ~48 bits); the double form stays for XE2_EXACT=1.
146 -> 5.4 ms a token.
- the joined fp8 head (logits_gemm, M <= 16): E4M3 to fp16 by bits ((b & 0x7F) << 7 is E4M3 *
2^-8), bytes (0, 2), (1, 3) as half pairs; an i8 head or a narrow scale block element by element.
43 -> 3.9 ms.
- gated delta net, still bit-identical to libref: the decode step split over 16-column blocks
(384 work-groups, not 48) with the gated norm in a second kernel and the anchor replay its own
launch (block 0 rewrites the factors other blocks read); the chunked scan and the kkt solve
work-group parallel; persistent staging (workspace slots) instead of a malloc and a wait a call.
- rmsnorm_quant_fp8: the row in local memory, loads issued before stores, the ordered sum fed by
sub-group broadcasts -- still libref's chain (a probe puts that chain's floor at ~32 us for 5120).
- round_dt converts the float dtypes directly.
rad-kbench: 1410/1410 on the fixture; the 27B container's M <= 32 bands 77/77. Decode (greedy, no
speculation) 12.1 tok/s, coherent text; with the DFlash2 drafter 5.3 tok/s and the same text.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
At one row a work-group, rmsnorm_quant_fp8 took 108 us and gated_quant_fp8 84 us a call (26% and 10%
of a decode step at a 1.8k context). The ordered sum of squares now reads its squares eight at a
time and adds them in the same order; quant_group computes a group's values once into registers and
writes out_bf16 itself; gated_quant_fp8 spreads a row's independent groups over ceil(groups/16)
work-groups. rad-kbench: 208/208 and 206/206 at rel_l2 0.
scripts/sycl/profile_decode.sh isolates decode steps' per-op device time (two profiled runs of the
same request, 1 and 1 + STEPS tokens, differenced). Decode at 1.8k context: 34.8 -> 26.6 ms of
device time a step; the two ops 9.1 -> 3.7 and 3.5 -> 0.9 ms.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
The profile of a MiniCPM5-2B decode step on the B65 (232.8 ms) was 79% gemm_nt, reading its
weights at 62 GB/s, and 13% the norms' serial sum of squares.
- xe2_gemm_nt_gemv / xe2_logits_gemm_gemv (priority 10, M <= 16, bf16): a sub-group an output
column, 16-byte coalesced weight loads, a tree reduction. Not libref's order: rad-kbench passes
them at the gemm tolerance (fixture 361/361, MiniCPM5 180/180, worst rel_l2 1.6e-4), and
XE2_EXACT=1 sends every launch to the exact kernel for bisecting.
- The norms form their squares in parallel into local memory and add them in index order: still
bit-identical to libref.
Decode 4.2 -> 35.5 tok/s. Against a libref-only host build, over 1914 positions of the repo's docs
with every position through the GEMV: KL mean 5.9e-4, p99 3.5e-3, top-1 98.5% -- libavx's own
distance from libref is 5.7e-4 / 3.0e-3 / 98.6%. The exact path scores KL 0, top-1 100%.
docs/SYCL_PROGRESS.md: the profile, the KL bound (D13), and the user's decision to use the bf16
container for Milestone B instead of the fp8 one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
Serving MiniCPM5-2B bf16 on the Arc Pro B65 found two things rad-kbench's dense operands did not:
- cast is handed the q slice of the fused qkv row (2048 of every 2560 elements) and refused it,
stopping the first step by name. It now walks any strides in libref's offlin order.
- gated_quant_fp8 took sigmoid with an f32 exp, within rad-kbench's tolerance but not libref's
double exp: now and then an ulp in silu moved the bf16 narrowing and one E4M3 code, in some of
the 42 layers, enough to flip a greedy near-tie tokens later. The engine's own op oracle
(RADIANCE_OP_ORACLE='*', which runs libref on the operands the device kernel was handed) found
it: 9 of 600 issues before, 600 of 600 bit-identical after, over a 26-token prefill.
With both, a greedy run on the B65 matches a libref-only host server token for token on all eight
prompts of scripts/sycl/greedy_compare.py (64 tokens each), and the top-5 logprobs agree exactly
over 96 decode steps. /v1/chat/completions answers coherently, reasoning split out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
One work-group a row; a quantisation group a sub-group. The arithmetic is libref's step for step,
and two things made it so on the card:
- Device code is generated at link time (AOT), so the flags that shape it now go to the link as
well as the compile: -ffp-contract=off, -ffp-model=precise, and -foffload-fp32-prec-div/-sqrt.
Without correctly rounded division a group's scale amax * (1/448) came out one ulp off, and
bf16 inputs sit exactly on E4M3 rounding ties often enough that 1780 of 524288 codes moved
(a standalone host/device comparison showed it; with the flags, none).
- The sum of squares is libref's ascending f32 sum, by one work-item. A tree reduction moved
normed values across bf16 ties on MiniCPM5-2B's real weights and failed rmsnorm_quant_fp8 at
M=1 (rel 7.7e-3 against its 4e-3 tolerance).
rad-kbench against libref: the fixture 228/228 and MiniCPM5-2B's container 140/140, worst rel_l2
1e-7, inside guarded allocations.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1