From 3ab97b345f57c370425e0465d48bd4e7700bd8b1 Mon Sep 17 00:00:00 2001 From: Lumpiasty Date: Sat, 21 Nov 2026 19:39:36 +0100 Subject: [PATCH] ggml-vulkan: gate upstream's tiled concat below one tile, honour the fast-path knob Upstream #30591 added its own tiled-transpose concat pipelines, selected for any dim-0 concat whose src1 is transposed. Behind the fork's fast path (which already takes ne0 >= 32 and honours GGML_VK_CONCAT_FASTPATH) that selector still caught the decode case (ne0 < 32), bringing back the decode regression the TILE_DIM gate fixed (FORK.md F3), and GGML_VK_CONCAT_FASTPATH=0 no longer gave the generic kernel. Apply the same gate and the knob to upstream's selector. Co-Authored-By: Claude Sonnet 5.5 --- ggml/src/ggml-vulkan/ggml-vulkan.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ggml/src/ggml-vulkan/ggml-vulkan.cpp b/ggml/src/ggml-vulkan/ggml-vulkan.cpp index ce3a783d5..483141fd2 100644 --- a/ggml/src/ggml-vulkan/ggml-vulkan.cpp +++ b/ggml/src/ggml-vulkan/ggml-vulkan.cpp @@ -9749,7 +9749,21 @@ static vk_pipeline ggml_vk_rms_norm_pipeline(const std::array & return pipelines[2]; } +// fork: GGML_VK_CONCAT_FASTPATH=0 forces the generic concat kernel (validation / A-B knob, see ggml_vk_concat) +static bool ggml_vk_concat_transpose_enabled() { + static const char * env = getenv("GGML_VK_CONCAT_FASTPATH"); + static const bool off = env != nullptr && std::string(env) == "0"; + return !off; +} + static bool ggml_vk_concat_is_transposed(const vk_device & device, const ggml_tensor * src0, const ggml_tensor * src1, const ggml_tensor * dst) { + if (!ggml_vk_concat_transpose_enabled()) { + return false; + } + // below one tile (decode, n_tokens < 32) the tiled path is pure overhead, the generic kernel is faster (FORK.md F3) + if (src1->ne[0] < 32) { + return false; + } if (ggml_get_op_params_i32(dst, 0) != 0) { // dim 0 only return false; }