You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Eval bug: GLM-5.3-Flash decode stalls on Metal because fused Lightning Indexer falls back to CPU #29867
llama-cli --version
version: 0.5.0-dev (build 11349, commit fb4b273)
built with AppleClang 21.0.0.21000334 for Darwin arm64
Operating systems
Mac
GGML backends
Metal
Hardware
Apple M5
Models
GLM-5.3-Flash at UD-IQ3_XXS
Problem description & steps to reproduce
I've observed the following issue. Unfortunately, I don't fully understand the root cause; all I can tell after some trial and error is that disabling the LID results in a massive speedup. Would it be possible to expose the env var again (or could this point to a deeper underlying issue)? Currently, I have to patch the source code manually to make it usable under the conditions described below.
Problem: On Metal, GLM-5.3-Flash (glm5-next) decoding intermittently stalls for 1–9 s per token after a few dozen tokens. Without the stalls, it decodes at ~31 t/s; with them, the average drops to 0.5–10 t/s.
Context: Build b11347 (5fc4f3c), Apple M5, unsloth GLM-5.3-Flash-UD-IQ3_XXS (shard rewrite applied), -ngl 999 -fa on -c 65536. The stalls disappear when the fused lightning indexer is disabled.
The Metal lightning indexer kernel only supports exactly 64 indexer heads (ggml-metal-impl.h#L133); supports_op returns false otherwise (ggml-metal-device.m#L1772-L1776). GLM-5.3-Flash has 32 indexer heads, so the fused op falls back to the CPU, which presumably causes the stalls.
Suggested fix (suggested by AI, confirmed working locally): Set cparams.auto_flid = true so the probe runs, and/or re-expose LLAMA_FUSED_LID_DISABLE as a manual escape hatch.
Workaround: Build from source with the probe enabled in src/llama-context.cpp:
Line 238
Old: cparams.auto_flid = false;
New: cparams.auto_flid = true;
@am17an I can't reproduce the reported stalls. Metal already supports the lightning indexer. I think there is only one head size of DK = 128 and all models use that?
However, I do see graph reallocations using GLM5.3 every 256 tokens. This indicates a problem in the GLM5.3 compute graph or the reserve logic is not compatible with it for some reason. Should be investigated.
Yes, tested it with against current main branch: ~31 t/s (low ctx), ~25 t/s (high ctx), both steady, no more stalls, no manual flag necessary: works flawlessly!
Activity
am17an commentedon Oct 2, 2026
I think just need to implement the lightining indexer for that head size. cc @ggml-org/ggml-metal
ggerganov commentedon Oct 3, 2026
@am17an I can't reproduce the reported stalls. Metal already supports the lightning indexer. I think there is only one head size of DK = 128 and all models use that?
However, I do see graph reallocations using GLM5.3 every 256 tokens. This indicates a problem in the GLM5.3 compute graph or the reserve logic is not compatible with it for some reason. Should be investigated.
ggerganov commentedon Oct 3, 2026
Correction - I just see that the reported issue @hogshead-revival-widow has been resolved recently in #29825 by @ServeurpersoCom . So the stalls are explained with this and should no longer occur on
master. @hogshead-revival-widow Please confirm.However, the graph reallocation issue remains. It looks like it starts above ~2048 tokens.
hogshead-revival-widow commentedon Oct 3, 2026
Yes, tested it with against current main branch: ~31 t/s (low ctx), ~25 t/s (high ctx), both steady, no more stalls, no manual flag necessary: works flawlessly!