libxe2: givens_dense_quant on XMX for prefill rows -- 2.07 -> 0.70 s over a 1792-token prefill

For 17 or more rows the rotation is a batch of GEMMs, one a (part, 128-column group): the input
fp16(x / D) per part, the f16 rotation as B, a batched form of the tiled fp16 XMX kernel
(xmx_f16_batched) into f32, then libref's quantiser a (row, part, group). The input rounded once
to fp16 where libref sums in double: a fast kernel. KL against the exact reference: mean 0.0037,
top-1 97.2% (0.0035 / 95.6% before: within the noise of 250 positions). Up to 16 rows the float-pair
kernel stays.

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 05:55:19 +02:00
1 parent 57f02bc12d
commit 5720a958e4
3 files changed
+127

No files matched your search

+5
View File
@@ -54,6 +54,11 @@ sycl::queue* queue_of(RadStream s);
* allocation fails. */
float* workspace(sycl::queue& q, size_t floats, int slot = 0);
/* Batched fp16 XMX GEMM into f32 (xe2_gemm_xmx.cpp): C rows padded up to a multiple of 128
* are written, so C + b * c_bs must hold ceil(M / 128) * 128 rows of N. */
int xmx_f16_batched(sycl::queue& q, const sycl::half* ab, int64_t ars, int64_t a_bs, const sycl::half* bb,
int64_t brs, int64_t b_bs, float* cb, int64_t c_bs, int64_t M, int64_t N, int64_t K,
int64_t batch);
/* fp16 XMX GEMM with a per-row and per-column output factor (xe2_gemm_xmx.cpp). */
int xmx_f16_scaled(sycl::queue& q, const sycl::half* ab, int64_t ars, const sycl::half* bb, int64_t brs,
char* yb, uint32_t ydt, int64_t yrs, int64_t ycs, int64_t M, int64_t mpad, int64_t N,