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
This commit is contained in:
claudeandClaude Opus 5.5 committed 2026-10-23 22:13:39 +02:00
1 parent 199d4a017e
commit 879b9de3ce
2 files changed
+100 -1

No files matched your search

+35
View File
@@ -441,6 +441,41 @@ and every value computed twice, a double exp each).
1.62 s = 1109 tok/s (was 4.61 s).** Device time a 1.8k-context step 23.4 ms (profiled):
gemm_nt 9.7, attn 4.7, rmsnorm_quant_fp8 3.8.
## Phase 4, step 6 (2026-10-23): the decode GEMV, and what GRIMOIRE suggested
Per-shape times from `rad-kbench -m ... --timing-only --op gemm_nt --report FILE` (cold weights),
M = 1, MiniCPM5-2B: gate_up N=12288 K=2048 93.3 us (540 GB/s), down N=2048 K=6144 59.7 (420),
qkv N=2560 K=2048 21.0, o N=2048 K=2048 18.1. A plain read kernel reaches ~600 GB/s with
incompressible data (1042 GB/s on a memset buffer: the card compresses).
- Two columns a sub-group (commit 7a58b31): gemm_nt 9.1 -> 8.5 ms a step at 1.8k.
- **down_proj splits K two ways inside the work-group** (partials added in chunk order through
local memory, deterministic): 59.7 -> 52.2 us. 4/8/16 ways no better; splitting the K=2048 shapes
made them slower (18.1 -> 21.6 us), so only K >= 4096 splits.
- Tried and dropped: four columns a sub-group (10.9 ms a step, fewer sub-groups), K unrolled 2/4/8
loads ahead (9.2 / 9.4 / 12.3 against 8.8 ms).
- rad-kbench 361/361, 350/350; KL (chunk 16) mean 6.0e-4; greedy against libref 7/8, the eighth a
near-tie at token 14 (" and" vs " Neptune", 0.025 nats apart here, 0.048 in libref).
- **Decode 57.3 tok/s short, 51.4 tok/s after a 1797-token prompt.**
`rad_memcpy_ranges_async` read its range list on the host (commit 10455f2); device.h has the kernel
read it, and rad-kbench's timer keeps it on the card, so `--bench` / `--timing-only` crashed. Fixed:
the list is read by a kernel. rad-kbench's timer is slow on this backend (a 4-op `-m` run 7 min:
each unit restores its inputs with a small host copy).
**GRIMOIRE** (github.com/doopeworld/GRIMOIRE, a SYCL engine for the Arc Pro B70) was read on the
user's suggestion. It is GPL-3.0 and radiance is Apache-2.0, so no code comes from it; only measured
ideas were tried:
- wide loads with several in flight, sub-group-contiguous ("vec16x4", 626 GB/s there): our GEMV
already reads 16 B a lane contiguously; more loads in flight lost (above).
- decode split-K scaled with context (their attention went 3650 -> 1197 us a layer): ours already
splits each row's visible keys 32 ways (step 5).
- low-N decode GEMVs underfilling the card: the down_proj split above.
- the decode step as a replayed SYCL command graph: not taken yet. Profiled device time (21.3 ms a
step at short context, inflated by the timing events) already exceeds wall time (17.5 ms), so the
card is not waiting on the host; a graph would only trim launch gaps. Radiance's tape hooks
(`tape_begin` / `tape_play` in device.h) are where it would go.
## Next steps
1. ~~Milestone B, part 2: `minicpm5-2b-fp8.rad`~~ **Dropped by the user (2026-10-23): "instead of the