Archived
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
This commit is contained in:
1 parent
5da5c1ba05
commit
a65ab54213
5 files changed
+196
-9
No files matched your search
@@ -14,6 +14,8 @@ namespace {
|
||||
const RadConstraint cRopeModes[] = { RAD_CIN("mode", "neox gptj") };
|
||||
/* The GEMMs here read float weights only; a quantised dtype key is gemm_nt_q's. */
|
||||
const RadConstraint cFloatDtype[] = { RAD_CIN("dtype", "bf16 f16 fp16 f32 fp32") };
|
||||
/* The decode band of the skinny bf16 GEMV (xe2_gemv.cpp). */
|
||||
const RadConstraint cGemvBf16[] = { RAD_CIN("dtype", "bf16"), RAD_CLE("M", 16) };
|
||||
/* The block-scaled pairs xe2_gemm_q.cpp serves; the zero-point grids (w2a8, w4*_asym) and mxfp4 are
|
||||
* other rows. */
|
||||
const RadConstraint cFp8Dtype[] = { RAD_CIN("dtype", "fp8a8 fp8a8f32 fp8a16") };
|
||||
@@ -77,6 +79,19 @@ const RadKernelInfo kKernels[] = {
|
||||
.dtypes = "any float or integer pair",
|
||||
.domain = RAD_DOMAIN_DEVICE, .launch = xe2::cast },
|
||||
|
||||
{ .name = "xe2_gemm_nt_gemv", .op = "gemm_nt", .family = "gemm",
|
||||
.computes = "skinny Y = A B^T for decode: a sub-group an output column, 16-byte coalesced "
|
||||
"weight loads, a tree reduction (not libref's order; checked at the gemm "
|
||||
"tolerance). XE2_EXACT=1 runs xe2_gemm_nt_ref instead",
|
||||
.shape = "M <= 16; bf16 rows 16-byte aligned, K a multiple of 8 (else the exact kernel)",
|
||||
.dtypes = "bf16 A and W, bf16 or f32 Y, f32 accumulate",
|
||||
.domain = RAD_DOMAIN_DEVICE, .priority = 10, .constraints = cGemvBf16, .n_constraints = 2,
|
||||
.launch = xe2::gemm_nt_gemv },
|
||||
{ .name = "xe2_logits_gemm_gemv", .op = "logits_gemm", .family = "gemm",
|
||||
.computes = "logits at decode, as xe2_gemm_nt_gemv", .shape = "M <= 16",
|
||||
.dtypes = "bf16 x and head, f32 logits",
|
||||
.domain = RAD_DOMAIN_DEVICE, .priority = 10, .constraints = cGemvBf16, .n_constraints = 2,
|
||||
.launch = xe2::logits_gemm_gemv },
|
||||
{ .name = "xe2_gemm_nt_ref", .op = "gemm_nt", .family = "gemm",
|
||||
.computes = "Y = A B^T, one work-item an output, f32 over ascending k (libref's order); the "
|
||||
"correctness-first form, not the fast one",
|
||||
|
||||
Reference in new issue
Block a user