Commit Graph
8 Commits
Author SHA1 Message Date
pascallinxweilerandClaude Opus 5.5 43d84111c2 libxe2: the DSpark drafter's ops -- speculative decoding on the B65, greedy-identical
Every op MiniCPM5-2B bf16's DSpark drafter issues now has a libxe2 row, each libref's arithmetic in
libref's order: gemm_nt_q over fp8a8 block-scaled codes (quant_dot per output, the scale grids
worked out on the host as make_scales does), gemm_nt_q_gated with the gated fp8 epilogue, the w2a8
vocabulary head (gemm_zp; b_scale in libref's joined planes form through a copy of libref's layout
hook, so both libraries ask for the same stored bytes, its planes found on the device),
quant_act_i8, silu_mul, row_topk and dflash_select.

rad-kbench: MiniCPM5-2B 191/191 at rel_l2 0. The fixture found the gated GEMM refusing a 27B
geometry its row accepted (it held the whole N-wide row in local memory); it now keeps the n gated
values and declares N <= 57344. The engine oracle with speculation on: 1500/1500 issues
bit-identical, the w2a8 head included. Greedy with speculation on matches libref's greedy without
it on all eight prompts.

Install and oot: a SYCL build installs librad_sycl.so and libxe2.so, its executables find the
backend through $ORIGIN/../lib, and tests/oot_plugins.sh rebuilds libxe2 out of tree with icpx when
RAD_OOT_ICPX is set; it passes in build-sycl.

scripts/sycl/bench_report.sh: the report's screenshot is a JPEG, rendered with fonts (this host has
none, and the first post had no text). docs/SYCL_PROGRESS.md: the first quick benchmark (4.2 tok/s
decode, 17.3 tok/s prefill at 2000 tokens), Milestone B part 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
2026-10-23 19:31:29 +02:00
pascallinxweilerandClaude Opus 5.5 874f8d28b1 libxe2: strided cast and libref's sigmoid -- MiniCPM5-2B serves on the B65, greedy-identical
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
2026-10-23 16:49:14 +02:00
pascallinxweilerandClaude Opus 5.5 94923fbb53 libxe2: the thirteen sampler ops
Each is libref's arithmetic on the card. The serial stages (penalties, DRY, the n-gram ban, top-p,
min-p, typical, XTC, the pick) run libref's loops unchanged, one work-item a row, so their sums keep
libref's order. Temperature and the grammar mask are one work-item an element. argmax, top-k and
logprobs scan the vocabulary with one work-group a row, reducing a 64-bit key -- the value's
order-preserving bits above the complemented index -- so the largest value wins and ties go to the
lower id, libref's rule; top-k is libref's topk_next k times, and a greedy row takes no rounds.
DRY's per-token map is replaced by a first-occurrence scan that computes the same maxima.

rad-kbench against libref: the whole fixture with libxe2 first, 1101/1101; MiniCPM5-2B's sampler
cases 56/56, all at rel_l2 0. With this, every op MiniCPM5-2B bf16 issues with speculation off has
a device row in libxe2 (13 model ops, 13 sampler ops).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
2026-10-23 16:21:22 +02:00
pascallinxweilerandClaude Opus 5.5 bcd4ddc91b libxe2: kv_store and attn_paged, correctness first
The paged cache in libref's and libr4d's layout. attn_paged runs one work-group a (query row, head)
in libref's order: each key's dot summed over d serially by its lane, the max over the group, then
weights by chunk in local memory with the sum and every acc[d] accumulated in key order, exp in
double. Scores are recomputed rather than kept, since 131072 keys of them do not fit local memory.
Masks, sliding windows, ragged batches and fp8 descales are libref's. kv_store skips a slot past
the cache instead of refusing the launch, which would need the host to read device memory.

rad-kbench against libref: fixture 178/178, MiniCPM5-2B 160/160 (rel_l2 0).

docs/SYCL_PROGRESS.md: the HIP build compiles (785/785 targets for gfx1201 in the ROCm 10.1
container) at the commit holding every core-side change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
2026-10-23 16:12:32 +02:00
pascallinxweilerandClaude Opus 5.5 c52f76c33e libxe2: gemm_nt and logits_gemm, correctness first
One work-item an output, f32 over ascending k from zero with no fused multiply-add: libref's
gemm_plain order, so MiniCPM5-2B's projections and its 130560-row head agree with the reference
exactly. Slow on purpose; the XMX kernels of Phase 4 are checked against this and libref. The rows
take float weights only (a dtype constraint); a quantised weight is gemm_nt_q's.

rad-kbench against libref: fixture 276/276, MiniCPM5-2B 164/164 (rel_l2 0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
2026-10-23 16:09:17 +02:00
pascallinxweilerandClaude Opus 5.5 fca4cbe3b5 libxe2: rope, embed_lookup, gather_rows, cast
rope builds its frequency ladder on the host per launch exactly as libref's rope_freqs does (a
double pow, then YaRN or llama3 from rad_yarn.h) and takes cos and sin of the f32 angle in double on
the card, as libref does; positions reach 131072 at MiniCPM5's context. neox and gptj with one
position component; the row says so with a mode constraint and the launch refuses anything else by
name.

The gathers write a zero row for an index outside the table, libr4d's rule: libref instead checks
every index on the host before running, which a launch cannot do without waiting on its stream.

rad-kbench against libref: fixture 127/127 and MiniCPM5-2B 94/94, rel_l2 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
2026-10-23 16:05:59 +02:00
pascallinxweilerandClaude Opus 5.5 b2cdcb4420 libxe2: rmsnorm, rmsnorm_quant_fp8, quant_act_fp8, gated_quant_fp8
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
2026-10-23 16:02:58 +02:00
pascallinxweilerandClaude Opus 5.5 41a3c32a65 libxe2: the Intel kernel library's skeleton, and its first op, add
libxe2 is a kernel plugin like any other, built by rad_add_plugin from the icpx sub-build into the
build tree's $RADIANCE_HOME. It declares no schemas (every op it serves is libref's vocabulary), only
device rows, written with designated initialisers. xe2_common.h holds what every kernel needs: the
launch's queue (rad_sycl.h), row views over padded operands, refusals that name the geometry, and
libref's own dtype conversions so results round where the reference's do.

add passes rad-kbench against libref at tolerance zero, on the recorded fixture (30 cases) and on
MiniCPM5-2B's container (20 cases), inside guarded allocations. In a SYCL build the kbench replays
run libxe2 on the card, so they are labelled sycl there, as they are gpu in a HIP build.

scripts/sycl/notify.sh posts to the Discord webhook when the port needs the user.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
2026-10-23 15:55:39 +02:00