diff --git a/src/kernels/cpu/native_expert.cpp b/src/kernels/cpu/native_expert.cpp index 50153002..c6cab9fd 100644 --- a/src/kernels/cpu/native_expert.cpp +++ b/src/kernels/cpu/native_expert.cpp @@ -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