Skip to content

Eval bug: GLM 4.7 Flash not working with flash attention on #19307

Closed as not planned

Description

@niraj-rayalla

Name and Version

build that I start llama-server from:

ggml_cuda_init: found 1 ROCm devices:
  Device 0: AMD Radeon RX 6900 XT, gfx1030 (0x1030), VMM: no, Wave Size: 32
version: 7917 (91ea44e89)
built with GNU 13.3.0 for Linux x86_64

build that I start rpc-server from:

ggml_cuda_init: found 1 CUDA devices:
  Device 0: NVIDIA GeForce RTX 5080, compute capability 12.0, VMM: yes
version: 7917 (91ea44e89)
built with GNU 13.3.0 for Linux x86_64

Operating systems

Linux

GGML backends

HIP

Hardware

1 RTX 8080
1 RX 6900 XT

Models

GLM-4.7-Flash-MXFP4_MOE.gguf https://huggingface.co/noctrex/GLM-4.7-Flash-MXFP4_MOE-GGUF

Problem description & steps to reproduce

I have GLM 4.7 Flash (GLM-4.7-Flash-MXFP4_MOE) running on llama.cpp but it only works when I turn off quantization of the key-value cache. I want the quantization to increase context space and speed like it does with Qwen3-coder.

With flash attention on the server does start up, but when I send a request it fails with the given log output.

Without flash attention, it seems too slow. I do see that the CPU is being used a bit more than I would expect. Maybe the cpu usage is causing some of that slow down.

Setup:

I have an RTX 5080 and RX 6900 XT, with a llama.cpp release built from yesterday.

The RTX is used through an the llama rpc server and the RX on normal llama-server.

server commands:

~/Documents/llama.cpp/build-cuda/bin/rpc-server -p 50052

~/Documents/llama.cpp/build/bin/llama-server \
-m ~/Documents/llama.cpp_models/GLM-4.7-Flash-MXFP4_MOE.gguf \ 
--host 0.0.0.0 \
--rpc localhost:50052 \
--split-mode layer \
-fa on \
--cache-type-k q4_0 \
--cache-type-v q4_0 \
--batch-size 512 \
--ubatch-size 64 \
--tensor-split 1,0.9 \
-fit off \
-ngl 99 \
-c 100000 \
--n-predict 8192 \
--temp 0.7 --top-p 1.0 --min-p 0.01 \
--defrag-thold 0.1

First Bad Commit

No response

Relevant log output

Logs
Feb 03 15:19:07 homeserver llama-server[183387]: slot update_slots: id  3 | task 0 | prompt processing progress, n_tokens = 512, batch.n_tokens = 512, progress = 0.412571
Feb 03 15:19:07 homeserver llama-server[183387]: /home/niraj/Documents/llama.cpp/ggml/src/ggml-cuda/template-instances/../fattn-common.cuh:919: GGML_ASSERT(max_blocks_per_sm > 0) failed
Feb 03 15:19:07 homeserver llama-server[184087]: gdb: warning: Couldn't determine a path for the index cache directory.
Feb 03 15:19:07 homeserver llama-server[184087]: [New LWP 183592]
Feb 03 15:19:07 homeserver llama-server[184087]: [New LWP 183407]
Feb 03 15:19:07 homeserver llama-server[184087]: [New LWP 183406]
Feb 03 15:19:07 homeserver llama-server[184087]: [New LWP 183405]
Feb 03 15:19:07 homeserver llama-server[184087]: [New LWP 183404]
Feb 03 15:19:07 homeserver llama-server[184087]: [New LWP 183403]
Feb 03 15:19:07 homeserver llama-server[184087]: [New LWP 183402]
Feb 03 15:19:07 homeserver llama-server[184087]: [New LWP 183401]
Feb 03 15:19:07 homeserver llama-server[184087]: [New LWP 183400]
Feb 03 15:19:07 homeserver llama-server[184087]: [New LWP 183399]
Feb 03 15:19:07 homeserver llama-server[184087]: [New LWP 183398]
Feb 03 15:19:07 homeserver llama-server[184087]: [New LWP 183397]
Feb 03 15:19:07 homeserver llama-server[184087]: [New LWP 183396]
Feb 03 15:19:07 homeserver llama-server[184087]: [New LWP 183395]
Feb 03 15:19:07 homeserver llama-server[184087]: [New LWP 183394]
Feb 03 15:19:07 homeserver llama-server[184087]: [New LWP 183393]
Feb 03 15:19:07 homeserver llama-server[184087]: [New LWP 183392]
Feb 03 15:19:07 homeserver llama-server[184087]: [New LWP 183391]
Feb 03 15:19:07 homeserver llama-server[184087]: [New LWP 183388]
Feb 03 15:19:10 homeserver llama-server[184087]: [Thread debugging using libthread_db enabled]
Feb 03 15:19:10 homeserver llama-server[184087]: Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Feb 03 15:19:10 homeserver llama-server[184087]: 0x00007fc726f10813 in __GI___wait4 (pid=184087, stat_loc=0x0, options=0, usage=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:30
Feb 03 15:19:10 homeserver llama-server[184087]: warning: 30        ../sysdeps/unix/sysv/linux/wait4.c: No such file or directory
Feb 03 15:19:10 homeserver llama-server[184087]: #0  0x00007fc726f10813 in __GI___wait4 (pid=184087, stat_loc=0x0, options=0, usage=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:30
Feb 03 15:19:10 homeserver llama-server[184087]: 30        in ../sysdeps/unix/sysv/linux/wait4.c
Feb 03 15:19:10 homeserver llama-server[184087]: #1  0x00007fc7279a9703 in ggml_print_backtrace () from /home/niraj/Documents/llama.cpp/build/bin/libggml-base.so.0
Feb 03 15:19:10 homeserver llama-server[184087]: #2  0x00007fc7279a98ab in ggml_abort () from /home/niraj/Documents/llama.cpp/build/bin/libggml-base.so.0
Feb 03 15:19:10 homeserver llama-server[184087]: #3  0x00007fc72673b274 in void launch_fattn<512, 8, 4>(ggml_backend_cuda_context&, ggml_tensor*, void (*)(char const*, char const*, char const*, char const*, char const*, int const*, float*, HIP_vector_type<float, 2u>*, float, float, float, float, unsigned int, float, int, HIP_vector_type<unsigned int, 3u>, int, int, int, int, int, int, int, int, int, int, int, long, int, int, long, int, int, int, int, int, long), int, unsigned long, int, bool, bool, bool, int) () from /home/niraj/Documents/llama.cpp/build/bin/libggml-hip.so.0
Feb 03 15:19:10 homeserver llama-server[184087]: #4  0x00007fc726736c2d in void ggml_cuda_flash_attn_ext_tile_case<576, 512>(ggml_backend_cuda_context&, ggml_tensor*) () from /home/niraj/Documents/llama.cpp/build/bin/libggml-hip.so.0
Feb 03 15:19:10 homeserver llama-server[184087]: #5  0x00007fc7265bda61 in ggml_cuda_graph_evaluate_and_capture(ggml_backend_cuda_context*, ggml_cgraph*, bool, bool, void const*) () from /home/niraj/Documents/llama.cpp/build/bin/libggml-hip.so.0
Feb 03 15:19:10 homeserver llama-server[184087]: #6  0x00007fc7265bb9b1 in ggml_backend_cuda_graph_compute(ggml_backend*, ggml_cgraph*) () from /home/niraj/Documents/llama.cpp/build/bin/libggml-hip.so.0
Feb 03 15:19:10 homeserver llama-server[184087]: #7  0x00007fc7279c5e17 in ggml_backend_sched_graph_compute_async () from /home/niraj/Documents/llama.cpp/build/bin/libggml-base.so.0
Feb 03 15:19:10 homeserver llama-server[184087]: #8  0x00007fc7276bc441 in llama_context::graph_compute(ggml_cgraph*, bool) () from /home/niraj/Documents/llama.cpp/build/bin/libllama.so.0
Feb 03 15:19:10 homeserver llama-server[184087]: #9  0x00007fc7276bdf04 in llama_context::process_ubatch(llama_ubatch const&, llm_graph_type, llama_memory_context_i*, ggml_status&) () from /home/niraj/Documents/llama.cpp/build/bin/libllama.so.0
Feb 03 15:19:10 homeserver llama-server[184087]: #10 0x00007fc7276c53ea in llama_context::decode(llama_batch const&) () from /home/niraj/Documents/llama.cpp/build/bin/libllama.so.0
Feb 03 15:19:10 homeserver llama-server[184087]: #11 0x00007fc7276c6e5f in llama_decode () from /home/niraj/Documents/llama.cpp/build/bin/libllama.so.0
Feb 03 15:19:10 homeserver llama-server[184087]: #12 0x00006096f2a4e638 in server_context_impl::update_slots() ()
Feb 03 15:19:10 homeserver llama-server[184087]: #13 0x00006096f2a962de in server_queue::start_loop(long) ()
Feb 03 15:19:10 homeserver llama-server[184087]: #14 0x00006096f29af2a0 in main ()
Feb 03 15:19:10 homeserver llama-server[184087]: [Inferior 1 (process 183387) detached]

Activity

  1. changed the title [-]Eval bug:[/-] [+]Eval bug: GLM 4.7 Flash not working with flash attention on[/+] on Feb 3, 2026
  2. niraj-rayalla commented on Feb 4, 2026

    @niraj-rayalla
    Author

    I should mention that I've tried some other models, with flash attention on with quantization, such as:

    • Qwen3-30B-A3B-Thinking-2507-Q4_K_M
    • DeepSeek-R1-Distill-Qwen-32B-Q4_K_M
    • QwQ-32B-Q4_K_M
    • Qwen3-Coder-30B-A3B-Instruct-Q4_K_M

    and they all fail with fattn-common.cuh:919: GGML_ASSERT(max_blocks_per_sm > 0) failed,
    EXCEPT for Qwen3-Coder-30B-A3B-Instruct-Q4_K_M.

  3. JohannesGaessler commented on Feb 4, 2026

    @JohannesGaessler
    Contributor

    I'm having presumably the same issue on my RX 6800 even on versions that were definitely working before. However, this is on an Arch-based Linux distribution and I did a system upgrade inbetween. So I'm thinking this may be an issue with ROCm versions.

  4. JohannesGaessler commented on Feb 4, 2026

    @JohannesGaessler
    Contributor

    On my system with ROCm v7.1.1 I can reproduce this issue on base metal. However, the llama.cpp Docker container that we build with ROCm v7.0 I do not encounter this issue. Can you post your ROCm version and confirm whether or not this is also the case for you?

  5. fungos commented on Feb 4, 2026

    @fungos

    I'm having a crash (assertion) with flash attention models too, it is a gfx1030 card and rocm 7.1.1 on arch linux.

    #1  0x00007f051903e3a0 in raise () from /usr/lib/libc.so.6
    #2  0x00007f051902557a in abort () from /usr/lib/libc.so.6
    #3  0x00007f051d99fcee in ggml_abort () from libggml-base.so.0
    #4  0x00007f051c829f74 in void launch_fattn<256, 4, 8>(ggml_backend_cuda_context&, ggml_tensor*, void (*)(char const*, char const*, char const*, char const*, char const*, int const*, float*, HIP_vector_type<float, 2u>*, float, float, float, float, unsigned int, float, int, HIP_vector_type<unsigned int, 3u>, int, int, int, int, int, int, int, int, int, int, int, long, int, int, long, int, int, int, int, int, long), int, unsigned long, int, bool, bool, bool, int) () from libggml-hip.so.0
    #5  0x00007f051c8281ed in void ggml_cuda_flash_attn_ext_tile_case<256, 256>(ggml_backend_cuda_context&, ggml_tensor*) () from libggml-hip.so.0
    #6  0x00007f051c6cb198 in ggml_cuda_graph_evaluate_and_capture(ggml_backend_cuda_context*, ggml_cgraph*, bool, bool, void const*) () from libggml-hip.so.0
    #7  0x00007f051c6c90c1 in ggml_backend_cuda_graph_compute(ggml_backend*, ggml_cgraph*) () from libggml-hip.so.0
    #8  0x00007f051d9bb943 in ggml_backend_sched_graph_compute_async () from libggml-base.so.0
    #9  0x00007f051d0b16e0 in llama_context::graph_compute(ggml_cgraph*, bool) () from libllama.so.0
    #10 0x00007f051d0b35e6 in llama_context::process_ubatch(llama_ubatch const&, llm_graph_type, llama_memory_context_i*, ggml_status&) () from libllama.so.0
    #11 0x00007f051d0ba58f in llama_context::decode(llama_batch const&) () from libllama.so.0
    #12 0x00007f051d0bc0ce in llama_decode () from libllama.so.0
    #13 0x0000563cbc3b5928 in server_context_impl::update_slots() ()
    #14 0x0000563cbc3510af in server_queue::start_loop(long) ()
    #15 0x00007f05194e55a4 in std::execute_native_thread_routine (__p=0x563ceb9c3530) at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:104
    #16 0x00007f051909698b in ?? () from /usr/lib/libc.so.6
    #17 0x00007f051911a9cc in ?? () from /usr/lib/libc.so.6
    
  6. niraj-rayalla commented on Feb 4, 2026

    @niraj-rayalla
    Author

    Yep, I'm on ROCm version 7.1.1 as well.
    I also happened to have another RTX 5080 on my daily use computer and instead of using the 5080 and 6900 combo on the server machine I RPCed both 5080s across the network and it seems I can use flash attention now.
    So it definitely seems like an AMD/ROCm issue.

  7. fungos commented on Feb 4, 2026

    @fungos

    I compiled in both debug and release, and in debug it works, but I'm unsure if it is actually taking the gpu path with launch_fattn problematic code.

    eg, in debug: cmake -S . -B build-debug -G Ninja -DCMAKE_BUILD_TYPE=Debug -DGGML_ACCELERATE=ON -DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_COMMON=ON -DGGML_LTO=ON -DGGML_HIP=ON -DGPU_TARGETS=gfx1030 -DGGML_HIP_ROCWMMA_FATTN=ON -DGGML_BACKEND_DL=ON

    ggml_cuda_init: found 1 ROCm devices:
      Device 0: AMD Radeon RX 6750 XT, gfx1030 (0x1030), VMM: no, Wave Size: 32
    load_backend: loaded ROCm backend from /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-hip.so
    register_backend: registered backend ROCm (1 devices)
    register_device: registered device ROCm0 (AMD Radeon RX 6750 XT)
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-piledriver.so score: 24
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-sse42.so score: 5
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-cascadelake.so score: 0
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-cannonlake.so score: 0
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-zen4.so score: 0
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-skylakex.so score: 0
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-haswell.so score: 64
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-sapphirerapids.so score: 0
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-ivybridge.so score: 23
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-alderlake.so score: 0
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-x64.so score: 1
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-sandybridge.so score: 21
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-icelake.so score: 0
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-cooperlake.so score: 0
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-piledriver.so score: 24
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-sse42.so score: 5
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-cascadelake.so score: 0
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-cannonlake.so score: 0
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-zen4.so score: 0
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-skylakex.so score: 0
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-haswell.so score: 64
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-sapphirerapids.so score: 0
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-ivybridge.so score: 23
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-alderlake.so score: 0
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-x64.so score: 1
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-sandybridge.so score: 21
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-icelake.so score: 0
    ggml_backend_load_best: /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-cooperlake.so score: 0
    load_backend: loaded CPU backend from /home/data/services/llama-swap/llama.cpp/build-debug/bin/libggml-cpu-haswell.so
    register_backend: registered backend CPU (1 devices)
    register_device: registered device CPU (AMD Ryzen 9 5900X 12-Core Processor)
    
    Loading model...  
    
    
    ▄▄ ▄▄
    ██ ██
    ██ ██  ▀▀█▄ ███▄███▄  ▀▀█▄    ▄████ ████▄ ████▄
    ██ ██ ▄█▀██ ██ ██ ██ ▄█▀██    ██    ██ ██ ██ ██
    ██ ██ ▀█▄██ ██ ██ ██ ▀█▄██ ██ ▀████ ████▀ ████▀
                                        ██    ██
                                        ▀▀    ▀▀
    
    build      : b7928-6a9bf2f78
    model      : GLM-4.7-Flash-Q8_0.gguf
    modalities : text
    
    available commands:
      /exit or Ctrl+C     stop or exit
      /regen              regenerate the last response
      /clear              clear the chat history
      /read               add a text file
    
    
    > hi
    
    [Start thinking]
    The user just said "hi". This is a very standard, open-ended greeting.
    I need to respond in a friendly, helpful, and open manner to encourage further interaction.
    .....
    

    But it is very slow, 1tk/s, which may be because of debug build but also not using gpu, unsure.

  8. niraj-rayalla commented on Feb 4, 2026

    @niraj-rayalla
    Author

    Oops. I accidentally closed this issue and can't reopen.

  9. niraj-rayalla commented on Feb 4, 2026

    @niraj-rayalla
    Author

    On my system with ROCm v7.1.1 I can reproduce this issue on base metal. However, the llama.cpp Docker container that we build with ROCm v7.0 I do not encounter this issue. Can you post your ROCm version and confirm whether or not this is also the case for you?

    I downgraded to ROCm 7.0.1 and now GLM 4.7 Flash works with flash attention on!

  10. ayylmaonade commented on Feb 6, 2026

    @ayylmaonade

    On my system with ROCm v7.1.1 I can reproduce this issue on base metal. However, the llama.cpp Docker container that we build with ROCm v7.0 I do not encounter this issue. Can you post your ROCm version and confirm whether or not this is also the case for you?

    I downgraded to ROCm 7.0.1 and now GLM 4.7 Flash works with flash attention on!

    How is the actual pre-fill/prompt processing speed? I've been having immense issues with prefill speed using this model on my RX 7900 XTX using both ROCm & Vulkan.

  11. niraj-rayalla commented on Feb 6, 2026

    @niraj-rayalla
    Author

    On my system with ROCm v7.1.1 I can reproduce this issue on base metal. However, the llama.cpp Docker container that we build with ROCm v7.0 I do not encounter this issue. Can you post your ROCm version and confirm whether or not this is also the case for you?

    I downgraded to ROCm 7.0.1 and now GLM 4.7 Flash works with flash attention on!

    How is the actual pre-fill/prompt processing speed? I've been having immense issues with prefill speed using this model on my RX 7900 XTX using both ROCm & Vulkan.

    I'm getting anywhere from 400 to close to 2000 tokens per second for prefill and low 50s to high 50s for postfill.
    Although my setup is not a pure AMD GPU setup.

  12. l29ah commented on Feb 6, 2026

    @l29ah
    Contributor

    likely related to #19128

  13. github-actions commented on Mar 24, 2026

    @github-actions
    Contributor

    This issue was closed because it has been inactive for 14 days since being marked as stale.

  14. tenortim commented on May 9, 2026

    @tenortim

    I know that this is closed, but if anybody is following, I ran into the same assertion failure trying to build llama.cpp on a system where I have a Ryzen 8745HS (gfx1103) and an external GPU hookup with a 6900XT (gfx1030) era card. I was able to successfully build a HIP/ROCm version that supports both cards (using -DCMAKE_HIP_ARCHITECTURES="gfx1030;gfx1103" to force building for both rather than using autodetection which only built for the builtin APU), but attempting to test (with gemma-3-1b-it-GGUF as the model) threw the exact same error.

    On investigation, the problem seems to be because attempting to the use the tile kernel on this era of card can exceed the gfx1030's VGPR budget on many current models. This card is from the RDNA2 era and only has two SIMD32 units per CU. For a model where D=256 trying to use the tile kernel needs 164-200 VGPRs/thread which, in turn requires 8x wave32 wavefronts/block. At only 2x SIMD32 units/CU we're capped at 6 wave32s. 6 < 8 and so we were returning occupancy=0 triggering the assert failure.

    I'm have simple workaround that explicitly checks for RDNA2 and uses the VEC kernel instead (or none). I'm working on a more general fix.

  15. midnightx86 commented on Jul 16, 2026

    @midnightx86

    I have the same issue with my RX 6600 xt.

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