From 0946bbd7742b0c4c013fb5474894cfd8e4db9df5 Mon Sep 17 00:00:00 2001 From: null Date: Sat, 7 Nov 2026 21:08:41 +0900 Subject: [PATCH] [Engine] distinguish missing VNNI from a disabled CPU tier --- docs/DETAILS.md | 1 + include/strata/kernels/cpu/expert_layout.hpp | 5 +++-- sycl/src/program/generate.cpp | 9 +++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/DETAILS.md b/docs/DETAILS.md index 1327e6a4dc..994c5fd77a 100644 --- a/docs/DETAILS.md +++ b/docs/DETAILS.md @@ -1086,6 +1086,7 @@ them on your own card. | `STRATA_CPU_IQ_ALL_EXACT1=1` | AVX2 CPUs without AVX-512 | Strata's AVX-2 decode for one-token i-quant gate/up rows, with ggml's float order, so the output does not change. On by default on sm_86. | End to end +0.4 to +2.5%, so left off elsewhere. | | `STRATA_Q2_BITPLANE=1` | AVX2 CPUs without AVX-512 | A bit-plane row kernel for Q2_0. Changes the last bits. | | | `STRATA_NO_AVXVNNI=1` | CPUs with AVX-VNNI | Turns the AVX-VNNI row forms off (they give the same bits, 4-25% faster rows). | A diagnostic. | +| `STRATA_VNNI_TIER=1` | Native packs on CPUs with AVX-512 F/DQ/BW/VL and VNNI, without VBMI (e.g. Cascade Lake) | Enables the 512-bit VNNI Q2_0, supported i-quant and Q5_0 rows, and activation quantizer. Set it in the engine's environment before starting. `STRATA_FORCE_AVX2=1` and `STRATA_FORCE_ISA=avx2\|avx\|sse` still cap dispatch. NVFP4 and trellis rows, and the canonical Q2_0 pack, still require VBMI. | Off by default: these rows round differently from the AVX-2 rows. No speed gain is assumed. | | `STRATA_PREFILL_EQUAL=1` | CUDA | A prompt segment is read in chunks of equal size, not full chunks and a short last one. Changes rounding. | | | `STRATA_OWNED_PRICE=exact` | CUDA | The cache sizing prices the prompt path's own buffers by their real allocation. | | | `--lookup-max-t N` (up to 16), `--lookup-sizes A,B` | CUDA, one conversation on one GPU (a layer split, batch and pipelined windows stay at 8) | Prompt-lookup windows up to N tokens while the MTP keeps `--spec`. A window past 8 tokens runs as two groups of 8; each size is a CUDA graph of its own (about 20-35 MiB), a size that finds no VRAM is dropped. Same answers on file rewrites. On by default at 12 in the serve engine of the 8-row CUDA build on one GPU (no batch, DFlash2 or layer split); `--lookup-max-t 0` or `STRATA_LOOKUP_MAX_T=0` turns it off. | File rewrites and the edit turns of an agent loop decode +11 to +14% (RTX A6000 IQ3_S, greedy and sampled), +13 to +18% on a Tesla P100 IQ3_XXS; ordinary prose and code are within 1% at 12. 16 gains 1-3 points more on rewrites and costs 3-4% on some prose. A wide-window build (`-DSTRATA_WINDOW_MAX_T=12` or 16) gains less (+7 to +9%) and is not needed. | diff --git a/include/strata/kernels/cpu/expert_layout.hpp b/include/strata/kernels/cpu/expert_layout.hpp index 38610cd6de..8cf8d11136 100644 --- a/include/strata/kernels/cpu/expert_layout.hpp +++ b/include/strata/kernels/cpu/expert_layout.hpp @@ -47,9 +47,10 @@ bool cpu_avx512_ok(); /// The same probes with VBMI required only (the multishift unpack and other byte-permute shuffles): a CPU may run /// every other feature the kernels use and miss it (Cascade Lake Xeon). bool cpu_vbmi_ok(); -/// AVX-512F + BW + VL + VNNI, VBMI NOT required: the dpbusd row dots, the q8 quantizer and the dq/bw arithmetic +/// AVX-512F + DQ + BW + VL + VNNI, VBMI NOT required: the dpbusd row dots, the q8 quantizer and the dq/bw arithmetic /// need no byte-permute shuffles (the q2 unpack's op has a substitute in expert.cpp). A CPU this answers yes on -/// used to run every expert through the AVX-2 fallback. +/// used to run every expert through the AVX-2 fallback. Without VBMI, STRATA_VNNI_TIER=1 opts in; unset keeps +/// the AVX-2 rows' rounding. STRATA_FORCE_AVX2 and STRATA_FORCE_ISA still cap this probe. bool cpu_vnni_ok(); /// Scattered pieces: the copy above is a declaration only (defined in expert.cpp, the AVX-512 TU, because it reads /// its STRATA_CPU_YMM switch): whether the 512-bit q2 row dot may run at all (VNNI and not the YMM env). diff --git a/sycl/src/program/generate.cpp b/sycl/src/program/generate.cpp index 22114dd47d..e2508fd6ec 100644 --- a/sycl/src/program/generate.cpp +++ b/sycl/src/program/generate.cpp @@ -2810,11 +2810,16 @@ int main(int argc, char **argv) try { "(build it again with tools/iq_pack.py, or run setup again).\n"); } strata::kernels::cpu::cpu_require_expert_support(); - } else if (!strata::kernels::cpu::cpu_avx512_ok()) - std::fprintf(stderr, "strata generate: this CPU has no AVX-512: the expert kernels run on %s " + } else if (!strata::kernels::cpu::cpu_vnni_ok()) + std::fprintf(stderr, "strata generate: %s: the expert kernels run on %s " "(multi-token for the i-quant gate/up rows)\n", + strata::kernels::cpu::cpu_features().avx512_vnni + ? "AVX-512 VNNI tier disabled or unavailable" + : "this CPU has no AVX512-VNNI", !strata::kernels::cpu::cpu_avx2_ok() ? "ggml-cpu vec_dot (no AVX2: the older-CPU build)" : std::getenv("STRATA_NO_IQ256") == nullptr ? "AVX-2" : "ggml-cpu vec_dot (STRATA_NO_IQ256 set)"); + else if (!strata::kernels::cpu::cpu_avx512_ok()) + std::fprintf(stderr, "strata generate: AVX-512 VNNI tier enabled (no VBMI)\n"); // the compiled shape; a native model's file replaces it below with its own metadata (read_geometry), which a // pruned variant (GSQ-RCO Coder, fewer than 512 experts) differs from strata::core::ModelGeometry g;