#1554·ggml

libggml 0.13.1 fails in MUL_MAT_ID() on i915 (Intel comet lake) on freebsd-16

Author: erikarnCreated Jul 6, 2026Updated Jul 15, 2026

This test fails on i915 (intel comet lake) on freebsd-16:

adrian@test-3:~/work/freebsd/head/freebsd-ports/misc/ggml/work/.build % ./bin/test-backend-ops -o 'MUL_MAT_ID(type_a=mxfp4,type_b=f32,n_mats=32,n_used=2,b=0,m=2880,n=32,k=2880)'
ggml_vulkan: Found 1 Vulkan devices:
ggml_vulkan: 0 = Intel(R) UHD Graphics 630 (CML GT2) (Intel open-source Mesa driver) | uma: 1 | fp16: 1 | bf16: 0 | warp size: 32 | shared memory: 49152 | int dot: 0 | matrix cores: none
Testing 2 devices

Backend 1/2: Vulkan0
  Device description: Intel(R) UHD Graphics 630 (CML GT2)
  Device memory: 48963 MB (29491 MB free)

[MUL_MAT_ID] ERR = 820.832519335 > 0.000500000 sentinel mismatch: sent_0 sentinel mismatch: sent_1 sentinel mismatch: sent_2 sentinel mismatch: sent_3   MUL_MAT_ID(type_a=mxfp4,type_b=f32,n_mats=32,n_used=2,b=0,m=2880,n=32,k=2880): FAIL

The i915 driver hits a fence timeout:

Fence expiration time out i915-drmn0:test-backend-ops[100911]:6e!
Fence expiration time out i915-drmn0:test-backend-ops[100911]:70!

After poking at it via some online searches and AI tooling, i landed on "maybe this is a degenerate case that is compiling to way too much work for the GPU shaders to do because the intel GPU is missing the datatypes needed here."

Disabling it works, but I'm not sure if this is the right solution:

adrian@test-3:~/work/freebsd/head/freebsd-ports/misc/ggml/work/.build % cat ../../files/patch-src-ggml-vulkan.cpp 
--- src/ggml-vulkan/ggml-vulkan.cpp.orig        2026-07-05 16:26:17.100975000 -0700
+++ src/ggml-vulkan/ggml-vulkan.cpp     2026-07-05 16:29:00.239048000 -0700
@@ -16321,7 +16321,15 @@
                         // If there's not enough shared memory for row_ids and the result tile, fallback to CPU
                         return false;
                     }
+                }
+
+                // Intel GPUs encounter severe shader loops / 10s ring buffer fence timeouts
+                // on large sparse Mixture of Experts (MoE) matrix arrays. Fallback to host CPU.
+                if (device->vendor_id == VK_VENDOR_ID_INTEL) {
+                    if (op->src[0]->ne[2] > 16)
+                        return false;
                 }
+
                 switch (src0_type) {
                     case GGML_TYPE_F32:
                     case GGML_TYPE_F16:

I've seen other tickets (eg https://github.com/ggml-org/llama.cpp/issues/19327) so I think there's something going on weird here. Would someone with some better knowledge about the matrix ops and hardware support involved here please chime in? Thanks!