From: Xuan-Son Nguyen Date: Mon, 8 Jun 2026 06:03:18 +0000 (+0200) Subject: metal : fix im2col 1D case (audio models) (llama/24220) X-Git-Tag: upstream/1.9.2~228 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=2c139c2e5ee7a0820fdcf5e1a308322027453eac;p=pkg%2Fggml%2Fsources%2Fwhisper.cpp metal : fix im2col 1D case (audio models) (llama/24220) --- diff --git a/ggml/src/ggml-metal/ggml-metal-device.cpp b/ggml/src/ggml-metal/ggml-metal-device.cpp index 5d4b10d3..ce847dd8 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));