ggml-vulkan: env knob for the concat transpose fast path

GGML_VK_CONCAT_FASTPATH=0 forces the generic path and =log reports each
fast-path dispatch, so validation can prove the path fires at prefill and
not at decode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
LumpiastyandClaude Opus 5.5 committed 2026-11-22 20:38:32 +01:00
1 parent 83cc51c9da
commit 70f3d25045
1 file changed
+10 -1
+10 -1
View File
@@ -11696,9 +11696,18 @@ void ggml_vk_concat(ggml_backend_vk_context * ctx, vk_context& subctx, const ggm
const bool s0_trans = dim0_ok && types_ok && shapes_ok && off_fits
&& src_transposed_2d(src0) && ggml_is_contiguous(src1);
if (s1_trans || s0_trans) {
// validation/A-B knob: GGML_VK_CONCAT_FASTPATH=0 forces the generic path, =log reports every
// fast-path dispatch on stderr
static const char * fastpath_env = getenv("GGML_VK_CONCAT_FASTPATH");
static const bool fastpath_off = fastpath_env != nullptr && std::string(fastpath_env) == "0";
static const bool fastpath_log = fastpath_env != nullptr && std::string(fastpath_env) == "log";
if (!fastpath_off && (s1_trans || s0_trans)) {
const ggml_tensor * ctg = s1_trans ? src0 : src1; // contiguous source
const ggml_tensor * trp = s1_trans ? src1 : src0; // transposed source
if (fastpath_log) {
std::cerr << "ggml_vk_concat: transpose fast path, transposed ne0=" << trp->ne[0] << std::endl;
}
// dst offsets (in elements) where each source region begins
const uint32_t off_ctg = s1_trans ? 0u : (uint32_t) src1->ne[0];
const uint32_t off_trp = s1_trans ? (uint32_t) src0->ne[0] : 0u;