cpu: the exact singleton rows only where ggml-cpu is itself the AVX2 build (not AVX-512, not an ISA-floor build)

STRATA_CPU_IQ_ALL_EXACT1 reproduces ggml-cpu's AVX2 single-token dot bit for bit, which only
holds if the ggml-cpu in this binary is that dot: a STRATA_ISA_FLOOR build runs ggml's AVX1/SSE
dots, and a native build on an AVX-512 CPU run with STRATA_FORCE_AVX2=1 runs its AVX-512 one.
The guard is #2215's (ggml_cpu_has_avx2 / ggml_cpu_has_avx512).

Co-authored-by: Andy Slater <aslater3@googlemail.com>
This commit is contained in:
Niko1221andAndy Slater committed 2026-10-14 07:20:05 +02:00
1 parent 051b970303
commit b558df67b4
1 file changed
+4 -1
+4 -1
View File
@@ -165,9 +165,12 @@ void native_gu_rows(const NativeFmt& f, const uint8_t* blob, const void* const*
// as the AVX-2 kernels, and STRATA_IQ_MT_MIN=1 takes the kernel for one token too (its rows are then
// independent of the drafting: iq_avx1_parity checks every width bit for bit).
static const bool avx1 = !cpu_avx2_ok() && cpu_avx1_ok() && std::getenv("STRATA_NO_IQ128") == nullptr;
// The exact rows are ggml-cpu's AVX2 single-token dot bit for bit, so they need ggml-cpu itself built for AVX2 and
// not AVX-512 (ggml_cpu_has_*): a STRATA_ISA_FLOOR build runs ggml's AVX1/SSE dots, a native build on an AVX-512 CPU
// run with STRATA_FORCE_AVX2=1 runs its AVX-512 one, and both round differently (#2215's guard).
static const bool exact_one = [] {
const char* v = std::getenv("STRATA_CPU_IQ_ALL_EXACT1");
return v && v[0] == '1' && v[1] == '\0';
return v && v[0] == '1' && v[1] == 0 && ggml_cpu_has_avx2() && !ggml_cpu_has_avx512();
}();
// only where ggml's dot runs today (below the #152 multi-token rule): with STRATA_IQ_MT_MIN=1 a lone token keeps the
// multi-token kernel, so a token's rows still do not depend on how many tokens share its expert