]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
ggml : fix conv 2d dw (#25490)
authorGeorgi Gerganov <redacted>
Thu, 9 Jul 2026 14:56:32 +0000 (17:56 +0300)
committerGitHub <redacted>
Thu, 9 Jul 2026 14:56:32 +0000 (17:56 +0300)
ggml/src/ggml-cpu/ops.cpp
ggml/src/ggml-cuda/ggml-cuda.cu

index e1f47e5ab0943d82e06105c61839e4ba2edf1aca..df0028cf15e3adbd20445ac56d422a57a813b2a0 100644 (file)
@@ -7324,11 +7324,12 @@ static void ggml_compute_forward_conv_2d_dw_cwhn(
 
 #ifdef GGML_SIMD
     int64_t c_pkg_end = 0;
+    int64_t pkg_size = GGML_F32_EPR;
     if (knl_type == GGML_TYPE_F32) {
     #if defined(__ARM_FEATURE_SVE)
-        const int64_t pkg_size = svcntw();
+        pkg_size = svcntw();
     #else
-        const int64_t pkg_size = GGML_F32_EPR;
+        pkg_size = GGML_F32_EPR;
     #endif
         c_pkg_end = (c / pkg_size) * pkg_size;
     }
@@ -7345,7 +7346,7 @@ static void ggml_compute_forward_conv_2d_dw_cwhn(
             const int64_t src_x_base = dst_x * p.stride_x - p.pad_x;
 
 #ifdef GGML_SIMD
-            for (int64_t c_i = 0; c_i < c_pkg_end; c_i += GGML_F32_EPR) {
+            for (int64_t c_i = 0; c_i < c_pkg_end; c_i += pkg_size) {
                 GGML_F32_VEC sum = GGML_F32_VEC_ZERO;
                 for (int64_t knl_y = 0; knl_y < p.knl_h; ++knl_y) {
                     const int64_t src_y = src_y_base + knl_y * p.dilation_y;
index bfe449878ea512779098e0a300ce7d09eec9907e..98816f885cf6aa864615507cde33318e905267ce 100644 (file)
@@ -4917,7 +4917,9 @@ static bool ggml_backend_cuda_device_supports_op(ggml_backend_dev_t dev, const g
         case GGML_OP_IM2COL:
         case GGML_OP_IM2COL_3D:
         case GGML_OP_CONV_2D:
+            return true;
         case GGML_OP_CONV_2D_DW:
+            return op->src[0]->type == GGML_TYPE_F32;
         case GGML_OP_CONV_TRANSPOSE_2D:
         case GGML_OP_POOL_2D:
             return true;