libxe2: prefill GEMMs on oneMKL -- 27B prefill 208 -> 305 tok/s

oneMKL's SYCL GEMM (part of oneAPI; libxe2 links it when CMake finds it, RAD_XE2_MKL=OFF or
XE2_NO_MKL=1 keep the hand-written kernels) runs the fp16 prefill GEMMs at 85-91 TFLOPS on random
data at the 27B's shapes, deterministic run to run, against ~23-30 for the hand-tiled XMX kernel:
xmx_f16_scaled (the m2xfp4 prefill) and xmx_f16_batched (the rotation's) go to its gemm and
gemm_batch, and bf16 gemm_nt at M >= 17 to its bf16 GEMM (N = 96 had fallen to the exact kernel,
5 ms a call). The m2xfp4 weight decode to fp16 now takes a (column, 32-group) a work-item. fp16 or
bf16 products with f32 accumulation, as before: the 27B's cases 133/133 (rel_l2 <= 1.42e-3), the
fixture 1410/1410. Prefill GEMMs over a 1882-token prompt 4.06 -> 1.66 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
This commit is contained in:
pascallinxweilerandClaude Opus 5.5 committed 2026-10-24 17:49:44 +02:00
1 parent 3f782b935c
commit c81aa869a0
4 files changed
+123 -11

No files matched your search

+17
View File
@@ -610,6 +610,23 @@ tok/s at 2584 tokens (unchanged).
- VTune's GPU analyses do not run here (it does not recognise the host CPU); the per-kernel split
above came from temporary waits around each sub-kernel.
## Qwen3.8-27B: prefill (2026-10-24, continued)
1882-token prompt, device time by op (`--profile-ops`), before -> after:
| op | before | after | how |
|---|---|---|---|
| gdn_chunk_scan | 4.80 s | 0.92 | typed loads for the engine's bf16/f32 operands (4.8 -> 2.7), then 1024 work-items a work-group: its ~124 KB of local memory leaves one a Xe core, and 256 left three quarters of the core idle (2.7 -> 0.92). Exact |
| gdn_kkt_solve | 1.51 | 0.33 | a work-group a (head, chunk) -- chunks are independent -- the row terms over 512 work-items, then the solve from local memory. Exact |
| gdn_conv_prep | 0.54 | 0.45 | the conv a work-item a (token, channel), the gate cumsum a work-item a (head, chunk). Exact |
| gdn_gated_rmsnorm | 0.38 | 0.20 | the row staged in local memory before the ordered sum. Exact |
| m2xfp4 GEMMs (M >= 17) | 4.06 | see below | oneMKL's fp16 GEMM (f32 accumulate) in place of the hand-tiled XMX kernel |
oneMKL (part of oneAPI, linked by libxe2 when found; `RAD_XE2_MKL=OFF` or `XE2_NO_MKL=1` keeps the
hand-tiled kernel): 85-91 TFLOPS on random fp16 data at the 27B's shapes (probe `mklg.cpp`:
M=941 N=34816 K=5120 3.8 ms, M=1882 N=5120 K=17408 3.7 ms), deterministic run to run, against
~23-30 for the hand-tiled kernel. The prefill rotation's batched GEMMs use its `gemm_batch`.
## Next steps
1. The verify round, ~137 ms now against vLLM's ~68: the m2xfp4 verify GEMMs (~75 ms, ~2.5x their