Upstream: ggml-org#29351
The x86 AVX2 Q8_0 dot product returns the wrong sign when the first operand is negative and the second is -128.
Confirmed on Strix, Ryzen AI MAX+ 395, Linux x86_64, upstream 84e76d8a23162eca70490da131945ebec1f09bf4.
Use the public-API repro.c from the upstream issue:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DGGML_NATIVE=OFF -DGGML_AVX2=ON -DGGML_AVX512=OFF -DGGML_AVX_VNNI=OFF
cmake --build build --target ggml-cpu -j8
cc repro.c -Iggml/include -Lbuild/bin -lggml-cpu -lggml-base -o repro
LD_LIBRARY_PATH=build/bin ./repro
Observed: -1 * -128 yields -128 instead of 128; -128 * -128 yields -16384 instead of 16384. Three other cases pass. A separate build with AVX/AVX2/AVX512/AVX_VNNI/FMA/F16C/SSE42 disabled passes all five.
Cause: _mm256_sign_epi8(y, x) cannot represent negated -128. Introducing commit not bisected.
Scope: caller-supplied full-range int8 buffers. Standard llama.cpp activation quantization does not emit -128; ordinary model inference was not shown to fail.
Upstream: ggml-org#29351
The x86 AVX2 Q8_0 dot product returns the wrong sign when the first operand is negative and the second is -128.
Confirmed on Strix, Ryzen AI MAX+ 395, Linux x86_64, upstream
84e76d8a23162eca70490da131945ebec1f09bf4.Use the public-API
repro.cfrom the upstream issue:cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DGGML_NATIVE=OFF -DGGML_AVX2=ON -DGGML_AVX512=OFF -DGGML_AVX_VNNI=OFF cmake --build build --target ggml-cpu -j8 cc repro.c -Iggml/include -Lbuild/bin -lggml-cpu -lggml-base -o repro LD_LIBRARY_PATH=build/bin ./reproObserved:
-1 * -128yields-128instead of128;-128 * -128yields-16384instead of16384. Three other cases pass. A separate build with AVX/AVX2/AVX512/AVX_VNNI/FMA/F16C/SSE42 disabled passes all five.Cause:
_mm256_sign_epi8(y, x)cannot represent negated -128. Introducing commit not bisected.Scope: caller-supplied full-range int8 buffers. Standard llama.cpp activation quantization does not emit -128; ordinary model inference was not shown to fail.