Commit 93cb37ea7 for llama.cpp
commit 93cb37ea7b5f134cc500b1c5b91d971190600a1a
Author: shalinib-ibm <Shalini.Salomi.Bodapati@ibm.com>
Date: Sat Nov 21 16:28:49 2026 +0530
ggml-cpu: fix nc aligment in tinyBLAS_PPC_Q0 (#32659)
Fixes https://github.com/ggml-org/llama.cpp/issues/31680
The matmul_tiled() implementation in tinyBLAS_Q0_PPC requires nc to be a multiple of 8 to perform matrix multiplication correctly.
The previous alignment logic contained a special case for n == 4, which allowed n_aligned to be 4. Consequently, the tiled path could be selected with nc = 4, violating the kernel's tile-width requirement.
This caused incorrect matrix multiplication results, observed as garbled inference output when running Flint Q4_K_M and Gemma 3 27B Instruct.
diff --git a/ggml/src/ggml-cpu/llamafile/sgemm.cpp b/ggml/src/ggml-cpu/llamafile/sgemm.cpp
index 5d6609113..36b80051b 100644
--- a/ggml/src/ggml-cpu/llamafile/sgemm.cpp
+++ b/ggml/src/ggml-cpu/llamafile/sgemm.cpp
@@ -2981,8 +2981,6 @@ class tinyBLAS_Q0_PPC {
int64_t n_aligned = 0;
if (n % n_chunk == 0) {
n_aligned = n;
- } else if (n == 4) {
- n_aligned = 4;
} else if (n < n_chunk) {
n_aligned = (n / 8) * 8;
} else {