Skip to content

Eval bug: GLM-5.3-Flash decode stalls on Metal because fused Lightning Indexer falls back to CPU #29867

Open

Description

@hogshead-revival-widow

Name and Version

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.

Likely cause (suggested by AI):

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;

Build flags: -DCMAKE_BUILD_TYPE=Release -DGGML_METAL=ON -DGGML_METAL_EMBED_LIBRARY=ON -DGGML_NATIVE=ON -DBUILD_SHARED_LIBS=OFF

Related: #27773 (GLM-5.3-Flash support)

First Bad Commit

No response

Relevant log output

see above

Activity

  1. am17an commented on Oct 2, 2026

    @am17an
    Contributor

    I think just need to implement the lightining indexer for that head size. cc @ggml-org/ggml-metal

  2. ggerganov commented on Oct 3, 2026

    @ggerganov
    Member

    @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.

  3. ggerganov commented on Oct 3, 2026

    @ggerganov
    Member

    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.

  4. hogshead-revival-widow commented on Oct 3, 2026

    @hogshead-revival-widow
    Author

    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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions