libref: w4a4 reference implementation and dequant_w4 op

libref side of the w4a4 work; the libr3d kernels ship separately (submitted as PR 403).
- ref_moe_gemm_w4a4_shape; ref_moe_gemm_w4a8_shape now N_odd/K_odd-aware (ref_shapes.cpp)
- dequant_w4 schema with pDequantW4/oDequantW4 (ref_registry.cpp)
- ref_dequant_w4 zero-row guard (ref_quant.cpp)
- w4a4 reference GEMM and op declarations (ref_moe.cpp, ref_ops.h)
- dequant_w4 in kOps plus sweep geometry (tests/ref_test.cpp)
This commit is contained in:
Asim Siddiqui authored and StillDeadcode committed 2026-11-05 14:59:08 +01:00
1 parent 4bd9c39728
commit b87010c7dd
6 files changed
+370 -3

No files matched your search

+3 -1
View File
@@ -1221,7 +1221,7 @@ TEST(op_vocabulary) {
"dflash_tree", "attn_paged_tree", "attn_paged_anchor_window",
"rmsnorm_had_quant_i8",
"gated_had_quant_i8",
"dequant",
"dequant", "dequant_w4",
"gemm_nt", "gemm_nt_bias", "gemm_nt_q", "gemm_nt_q_bias", "grid_embed",
/* Runtime LoRA's two halves, issued by the core beside a trunk GEMM. */
"lora_shrink", "lora_expand", "lora_expand_mm",
@@ -10356,6 +10356,8 @@ std::vector<Geo> geometries() {
G("givens_rotate", "M", 3, a.i("M", R).i("n", 8).i("group", 8).s("dtype", "f32")
.i("stages", 2).i("parts", 1)),
G("dequant", "M", 3, a.i("M", R).i("n", 32).i("group", 16).s("dtype", "f32")),
G("dequant_w4", "N", 16, a.i("N", R).i("K", 64).i("group", 64).i("twos", 1)
.s("dtype", "w4a8")),
G("rmsnorm_quant_fp8", "M", 3, a.i("M", R).i("n", 32).d("eps", 1e-6).i("group", 16)
.s("dtype", "bf16")),
G("gated_quant_fp8", "M", 3, a.i("M", R).i("n", 32).i("group", 16).s("dtype", "bf16")