Archived
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
This commit is contained in:
1 parent
874f8d28b1
commit
43d84111c2
13 files changed
+1076
-36
No files matched your search
@@ -14,6 +14,12 @@ 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 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") };
|
||||
const RadConstraint cFp8Gated[] = { RAD_CIN("dtype", "fp8a8 fp8a8f32 fp8a16"), RAD_CLE("N", 57344) };
|
||||
/* The zero-point grids over quant_act_i8's activation (xe2_gemm_zp.cpp). */
|
||||
const RadConstraint cZpI8Dtype[] = { RAD_CIN("dtype", "w2a8 w4a8_asym") };
|
||||
|
||||
/* Rows by field name (C++20 designated initialisers must follow declaration order, so the compiler
|
||||
* checks it), unlike a positional table where a shifted field can still compile. */
|
||||
@@ -149,6 +155,46 @@ const RadKernelInfo kKernels[] = {
|
||||
.computes = "max, double normaliser and the top k (id, logit) pairs", .shape = "one work-group a row",
|
||||
.dtypes = "f32 logits and candidates, RadSampleParams rows",
|
||||
.domain = RAD_DOMAIN_DEVICE, .launch = xe2::sample_logprobs },
|
||||
|
||||
{ .name = "xe2_gemm_nt_q_fp8_ref", .op = "gemm_nt_q", .family = "gemm",
|
||||
.computes = "Y = A B^T over E4M3 codes with group and block scales, libref's quant_dot per "
|
||||
"output; the correctness-first form",
|
||||
.shape = "any M, N, K; 128x128 block or per-row group scale grids",
|
||||
.dtypes = "fp8a8, fp8a8f32, fp8a16: E4M3 weights, E4M3 or bf16 activations",
|
||||
.domain = RAD_DOMAIN_DEVICE, .constraints = cFp8Dtype, .n_constraints = 1,
|
||||
.launch = xe2::gemm_nt_q },
|
||||
{ .name = "xe2_gemm_nt_q_gated_fp8_ref", .op = "gemm_nt_q_gated", .family = "gemm",
|
||||
.computes = "gemm_nt_q over a gate_up plane with gated_quant_fp8 in the epilogue, one "
|
||||
"work-group a row",
|
||||
.shape = "N <= 57344 (n gated values in local memory)",
|
||||
.dtypes = "fp8a8, fp8a8f32, fp8a16; E4M3 (or i8) codes and f32 scales out",
|
||||
.domain = RAD_DOMAIN_DEVICE, .constraints = cFp8Gated, .n_constraints = 2,
|
||||
.launch = xe2::gemm_nt_q_gated },
|
||||
{ .name = "xe2_silu_mul", .op = "silu_mul", .family = "elem",
|
||||
.computes = "silu(gate) * up over a packed gate_up", .shape = "any n",
|
||||
.dtypes = "bf16 (any float)", .domain = RAD_DOMAIN_DEVICE, .launch = xe2::silu_mul },
|
||||
{ .name = "xe2_quant_act_i8", .op = "quant_act_i8", .family = "quant",
|
||||
.computes = "int8 codes with one scale a row, in the int8 WMMA step order; optional group sums",
|
||||
.shape = "n a multiple of 16", .dtypes = "float in, i8 codes, f32 scale",
|
||||
.domain = RAD_DOMAIN_DEVICE, .launch = xe2::quant_act_i8 },
|
||||
{ .name = "xe2_row_topk", .op = "row_topk", .family = "sample",
|
||||
.computes = "exact per-row top-R, descending, ties to the lower column; one work-group a row",
|
||||
.shape = "any N and R", .dtypes = "float x, integer ids and float values out",
|
||||
.domain = RAD_DOMAIN_DEVICE, .launch = xe2::row_topk },
|
||||
{ .name = "xe2_dflash_select", .op = "dflash_select", .family = "draft",
|
||||
.computes = "the block drafter's greedy walk over its candidate lattice, one work-item a "
|
||||
"sequence",
|
||||
.shape = "any steps, top_k and rank", .dtypes = "integer candidates, float scores and factors",
|
||||
.domain = RAD_DOMAIN_DEVICE, .launch = xe2::dflash_select },
|
||||
{ .name = "xe2_gemm_nt_q_zp_ref", .op = "gemm_nt_q", .family = "gemm",
|
||||
.computes = "Y = A B^T over an unsigned zero-point grid against quant_act_i8's activation, "
|
||||
"libref's gemm_zp per output; the correctness-first form",
|
||||
.shape = "any M, N; K a multiple of 16 and of group",
|
||||
.dtypes = "w2a8, w4a8_asym: u2/u4 codes, f16 scale and unsigned zero per (row, group), i8 "
|
||||
"activation in step order with row scale and group sums",
|
||||
.domain = RAD_DOMAIN_DEVICE, .constraints = cZpI8Dtype, .n_constraints = 1,
|
||||
.launch = xe2::gemm_nt_q_zp, .layout = xe2::gemm_zp_layout,
|
||||
.relayout = xe2::gemm_zp_relayout, .unrelayout = xe2::gemm_zp_unrelayout },
|
||||
};
|
||||
|
||||
const RadPluginInfo kInfo = {
|
||||
|
||||
Reference in new issue
Block a user