From 15d640eedf7a99a20fd058a49b104160f1428e24 Mon Sep 17 00:00:00 2001 From: Alberto Cabrera Date: Wed, 26 Nov 2025 13:11:25 +0000 Subject: [PATCH] Fix chunks being too small with small matrix sizes --- ggml/src/ggml-cpu/repack.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ggml/src/ggml-cpu/repack.cpp b/ggml/src/ggml-cpu/repack.cpp index d1321191358..875faedf2df 100644 --- a/ggml/src/ggml-cpu/repack.cpp +++ b/ggml/src/ggml-cpu/repack.cpp @@ -1731,12 +1731,13 @@ template = min_chunk_size)) { nchunk0 = nth; + dr0 = (nr0 + nchunk0 - 1) / nchunk0; } - const int64_t dr0 = (nr0 + nchunk0 - 1) / nchunk0; - // Ensure nchunk doesn't exceed the number of rows divided by minimum chunk size // This prevents creating too many tiny chunks that could overlap after alignment const int64_t max_nchunk = (nr0 + min_chunk_size - 1) / min_chunk_size;