Commit 94a0ae3e7 for llama.cpp

commit 94a0ae3e7298127b74d5b31370e83a1b4f143070
Author: Ankit Khandelwal <ankk98@gmail.com>
Date:   Tue Sep 29 23:08:59 2026 +0530

    vulkan: MOE aware mat_mul_id tile selection (#29182)

    mut_mul_id selected its matmul tile with total token count.
    For MoE dispatch grid the true N per workgroup is per-expert rows.
    At pp128 on Sarvam 30B that is 6, not 128, so the picker took the l-tile for ~6 live rows.
    Most workers in each group had nothing to do.
    This wasted time. The slow part was 55% of the whole job.

diff --git a/ggml/src/ggml-vulkan/ggml-vulkan.cpp b/ggml/src/ggml-vulkan/ggml-vulkan.cpp
index 38ec1f9e8..6c5a57394 100644
--- a/ggml/src/ggml-vulkan/ggml-vulkan.cpp
+++ b/ggml/src/ggml-vulkan/ggml-vulkan.cpp
@@ -7407,10 +7407,11 @@ static void ggml_vk_mul_mat_id_q_f16(ggml_backend_vk_context * ctx, vk_context&

     GGML_ASSERT(mmp_map != nullptr);

-    const uint32_t kpad = quantize_y ? 0 : ggml_vk_align_size(ne10, ggml_vk_guess_matmul_pipeline_align_map(ctx, *mmp_map, ne01, nei1, true));
-    const bool aligned = !quantize_y && ne10 == kpad && ne01 > 8 && nei1 > 8;
+    const uint32_t n_per_expert = (uint32_t)CEIL_DIV(nei0 * nei1, n_as);
+    const uint32_t kpad = quantize_y ? 0 : ggml_vk_align_size(ne10, ggml_vk_guess_matmul_pipeline_align_map(ctx, *mmp_map, ne01, n_per_expert, true));
+    const bool aligned = !quantize_y && ne10 == kpad && ne01 > 8 && n_per_expert > 8;

-    vk_pipeline pipeline = ggml_vk_guess_matmul_pipeline_map(ctx, *mmp_map, ne01, nei1, aligned, true);
+    vk_pipeline pipeline = ggml_vk_guess_matmul_pipeline_map(ctx, *mmp_map, ne01, n_per_expert, aligned, true);

     if (ggml_nbytes(src0) > ctx->device->properties.limits.maxStorageBufferRange) {
         pipeline = ggml_vk_get_64b_indexing_pipeline(ctx, pipeline);