From 93cb37ea7b5f134cc500b1c5b91d971190600a1a Mon Sep 17 00:00:00 2001 From: shalinib-ibm Date: Sat, 21 Nov 2026 16:28:49 +0530 Subject: [PATCH] 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. --- ggml/src/ggml-cpu/llamafile/sgemm.cpp | 2 -- 1 file changed, 2 deletions(-) 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 {