Commit Graph
14 Commits
Author SHA1 Message Date
claudeandClaude Opus 5.5 d47d4b50b5 sycl: profile_decode.sh reports calls and us a call; the BetterBench runs recorded
The decode profile now prints calls a step and the time a call for every op, from the same two
differenced runs. SYCL_PROGRESS records the a869226 run that was missing from the table and the
b07da2a run: decode 51.8 / 41.4 tok/s (median / 1% low), prefill 1575.6 tok/s @2000.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
2026-10-23 23:01:05 +02:00
claudeandClaude Opus 5.5 879b9de3ce libxe2: the long-K decode GEMV splits K two ways in the work-group -- decode 55 -> 57 tok/s
At M = 1 a GEMV is N / 2 sub-groups: for down_proj (N=2048, K=6144) that is a tenth of the card's
threads, each walking K alone. With K >= 4096 the work-group's sub-groups now take two halves of K
for the same columns and add the halves in order through local memory (deterministic, one kernel).
Per shape, cold: 59.7 -> 52.2 us; 4-16 ways no better, and splitting the K=2048 shapes slowed them,
so they keep one.

rad-kbench 361/361 and 350/350; KL mean 6.0e-4; greedy against libref 7/8 (the eighth a near-tie).
Decode 57.3 tok/s at a short context, 51.4 after a 1797-token prompt.

SYCL_PROGRESS records the per-shape times, the variants dropped, and what was taken from reading
GRIMOIRE (ideas only: it is GPL-3.0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
2026-10-23 22:13:39 +02:00
claudeandClaude Opus 5.5 c0497e040e libxe2: attention scores a key a lane with 16-byte loads -- decode 32 -> 55 tok/s
Each sub-group now takes sixteen keys a step, one a lane: the lane scores its key in full against
the query in local memory, one max and one sum update the flash state, and the value rows are added
with each key's weight taken from its lane. bf16 cache rows are read 16 bytes at a time, and each
row's own visible span is split evenly 32 ways on the device instead of the context limit (which
left most partitions empty at a short context).

rad-kbench 138/138 and 132/132; KL against libref mean 5.7e-4, p99 3.1e-3, top-1 98.6%.
MiniCPM5-2B on the B65: decode 55 tok/s at a short context and 49 tok/s after a 1797-token prompt
(was 32 and 30); that prompt's prefill 1.62 s, 1109 tok/s (was 4.61 s).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
2026-10-23 20:58:52 +02:00
claudeandClaude Opus 5.5 a71783806a libxe2: the norm and the fp8 quantisers 3-4x faster at decode, still bit-identical to libref
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
2026-10-23 20:47:13 +02:00
claudeandClaude Opus 5.5 b57c2db60c libxe2: split-KV attention -- a kv head's keys read once for its query heads, decode across the card
The long-context decode profile was 70% attention: one work-group a (row, head) left most of the
card idle at one row and read each kv head eight times. xe2_attn_paged now splits a row's keys into
partitions of 32 or more across work-groups, each work-group a (row, kv head, partition) whose
sub-groups are the kv head's query heads, the partial softmax states merged from 64 MiB of scratch
(the scratch hook); prefill-sized row counts take one partition and write directly.

rad-kbench 138/138 and 132/132, KL against libref mean 5.8e-4, p99 3.2e-3, top-1 98.5%. Decode
after a 1797-token prompt 16.2 -> 29.8 tok/s; short-context decode 32 tok/s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
2026-10-23 20:42:38 +02:00
claudeandClaude Opus 5.5 96b3e1be83 libxe2: Phase 4 step 2 -- bf16 XMX GEMM for prefill and a one-pass paged attention
xe2_gemm_nt_xmx / xe2_logits_gemm_xmx (M >= 17, bf16): joint_matrix M8 N16 K16 with use::b loaded
column-major straight from the [N, K] weight, eight sub-groups a work-group on one 64-column slice
so a B tile is in cache for all of them; tail rows go to the GEMV and shapes the tiles cannot read
to the exact kernel. xe2_attn_paged: one pass with an online softmax, keys over eight sub-groups,
head_dim over lanes, libref's masks, windows, ragged batches and fp8 descales. Both keep their
exact twins under XE2_EXACT=1.

rad-kbench: fixture 499/499, MiniCPM5-2B 482/482 (worst rel_l2 1.7e-4). KL against the libref
reference over 1914 positions: mean 5.8e-4, p99 3.2e-3, top-1 98.7% -- inside the bound.
Prefill of a 1795-token prompt: 4.57 s, 393 tok/s (was ~17); decode 33.2 tok/s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
2026-10-23 20:34:02 +02:00
claudeandClaude Opus 5.5 a65ab54213 libxe2: Phase 4 step 1 -- a bandwidth-bound decode GEMV and an ordered sum from local memory
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
2026-10-23 19:48:40 +02:00
claudeandClaude Opus 5.5 5da5c1ba05 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
claudeandClaude Opus 5.5 ed76fc8aaa 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
claudeandClaude Opus 5.5 ea065f596c 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
claudeandClaude Opus 5.5 8addda231b device: the SYCL backend -- Intel GPUs through oneAPI over Level Zero
A fourth DeviceBackend, in librad_sycl.so: in-order sycl::queues on one context, events as
barriers, copies and fills on the queue, gates as a spin kernel on a pinned flag, and the core's
advance and weight-table kernels as SYCL twins of their .hip files. RadStreams are RadSyclStreams
(abi/rad_sycl.h). Pinned host memory is page-aligned memory registered for device copies, since
O_DIRECT cannot read into SYCL's malloc_host pages; event timing is opt-in (RADIANCE_SYCL_TIMING=1)
because profiling queues cost ~20 us of host time a submission.

The SYCL code is its own CMake project, sycl/, configured with icpx through ExternalProject, so the
engine and every host plugin stay on the main compiler: a SYCL build's host code is the default
build's. RAD_SYCL (default OFF), build.sh --sycl, the sycl presets; HIP and SYCL in one build are
refused at configure.

On the SYCL backend --tp > 1 and ops resolved only to host kernels stop the start, since the Intel
backend runs on one card and never puts an op on the CPU. A SYCL build that sees no GPU warns that
it runs on the CPU and names the missing oneAPI environment.

device_test runs on the Arc Pro B65 as device_test_sycl (label sycl): 36 cases pass, 12 skip
(elastic memory, not provided; host-backend-only cases). Host tests hide Level Zero GPUs with
ONEAPI_DEVICE_SELECTOR. The host tier is the baseline's in both the default and the SYCL build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
2026-10-23 15:38:42 +02:00
claudeandClaude Opus 5.5 17524c95bd abi: rad_sycl.h -- what a RadStream is under the SYCL backend
A SYCL kernel library has no hipLaunchKernel for the engine to serve, so under the SYCL backend a
RadStream points to a RadSyclStream: a magic, its own version, and the engine's in-order
sycl::queue. rad_sycl_queue() hands a plugin the queue or null for any other stream. The struct is
versioned by RAD_SYCL_STREAM_VERSION rather than RAD_ABI_VERSION, since no shape an existing plugin
compiles against changes; rad_abi.h and rad_types.h say so.

The layout tests cover it: strict C11 in abi_c_test.c, and its rows in abi_layout_rows.h, where a
struct the frozen table predates is allowed without a version bump.

docs/SYCL_PROGRESS.md: D6 revised. Building everything with icpx fails in libavx (_pdep_u64 without
-mbmi2, which GCC accepts and clang refuses), so the main build stays GCC and only SYCL code is
built by icpx, as shared libraries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
2026-10-23 15:38:42 +02:00
claudeandClaude Opus 5.5 58bca7602e sycl: Phase 1 -- docs/SYCL_PORTING.md: where the core meets HIP, the op set, the design
The core's HIP use is already behind the DeviceBackend vtable except three core kernels (advance,
wtab, xprefetch), the engine's interposed hipLaunchKernel that plugins launch through, and build
switches; each site is listed with file and line. The minimal set for MiniCPM5-2B is measured with
--debug-graph on the test suite's synthetic llama containers (13 model ops, 13 sampler ops; fp8 adds
gemm_nt_q / gemm_nt_q_gated), since no MiniCPM5 container is in the model library.

The design: a fourth DeviceBackend over SYCL, a RadSyclStream hand-off for plugins with its own
version instead of an ABI bump, libxe2 AOT for bmg-g31, and on that backend a fatal error where the
planner would otherwise put a weighted op on the CPU.

scripts/sycl/op_inventory.sh generates the 238-op appendix: libref's schemas through rad-schemas,
libr4d's 407 rows parsed from source by r4d_rows.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
2026-10-23 15:38:42 +02:00
claudeandClaude Opus 5.5 c10caa44fb sycl: Phase 0 of the Intel backend -- the B65's limits and XMX types, the host baseline
scripts/sycl/probe.sh builds and runs two probes on the Arc Pro B65 (Level Zero, xe driver): the
device's limits and joint_matrix combinations, and an ESIMD DPAS check of E4M3 / E5M2 against bf16
and s8 controls in the same harness. bf16, fp16, s8 and tf32 XMX are exact; fp8 DPAS compiles for
bmg-g31 but returns garbage, so fp8 weights are widened to bf16 in-register (exact for E4M3).

docs/SYCL_PROGRESS.md is the resume log: device tables, the host baseline (82/88 of -LE 'gpu|oot';
the six failures are FFmpeg-less builds and CPU-time budgets on this VM), BetterBench setup, the
model library survey and the open blockers (no MiniCPM5 container in the library, no ROCm here).

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