From 2c139c2e5ee7a0820fdcf5e1a308322027453eac Mon Sep 17 00:00:00 2001 From: Xuan-Son Nguyen Date: Mon, 8 Jun 2026 08:03:18 +0200 Subject: [PATCH] metal : fix im2col 1D case (audio models) (llama/24220) --- ggml/src/ggml-metal/ggml-metal-device.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ggml/src/ggml-metal/ggml-metal-device.cpp b/ggml/src/ggml-metal/ggml-metal-device.cpp index 5d4b10d34..ce847dd8b 100644 --- a/ggml/src/ggml-metal/ggml-metal-device.cpp +++ b/ggml/src/ggml-metal/ggml-metal-device.cpp @@ -1738,10 +1738,14 @@ ggml_metal_pipeline_with_params ggml_metal_library_get_pipeline_im2col(ggml_meta GGML_ASSERT(op->src[1]->type == GGML_TYPE_F32); GGML_ASSERT(op->type == GGML_TYPE_F16 || op->type == GGML_TYPE_F32); + const bool is_2D = ((const int32_t *)(op->op_params))[6] == 1; + const int64_t KH = is_2D ? ne01 : 1; + const int64_t KW = ne00; + char base[256]; char name[256]; - if (ne00*ne01 <= 1024) { + if (KH*KW <= 1024) { snprintf(base, 256, "kernel_im2col_%s", ggml_type_name(op->type)); } else { snprintf(base, 256, "kernel_im2col_ext_%s", ggml_type_name(op->type));