Skip to content

Eval bug: vk::DeviceLostError on linux-7.x kernels (RADV_STRIXHALO) #25664

Open

Description

@khimaros

Name and Version

$ llama-cli --version
version: 10005 (7f575c3)
built with GNU 15.3.0 for Linux x86_64

Operating systems

Linux 7.0.13

GGML backends

Vulkan

Hardware

Strix Halo (Framework Desktop) 128GB

Models

  • unsloth/DeepSeek-V4-Flash-GGUF:UD-IQ3_XXS
  • unsloth/Qwen-3.8-27B-GGUF:Q8_0

Problem description & steps to reproduce

users on linux-6.x kernels don't seem to have this issue

ROOT CAUSE: seems to be vulkan op timeouts (various)

CONFOUNDING FACTOR: compute lockup_timeout default for AMD driver changed from 60s to 2s.

WORKAROUND: restore linux 6.x behavior with cmdline: amdgpu.lockup_timeout=10000,60000,10000,10000

model loads fine, but within 2-3 turns, the server crashes with vk::DeviceLostError

the same installation works fine with other models, such as qwen3.6-27b and gemma-4-31b

First Bad Commit

No response

Relevant log output

Logs
3.38.895.141 D srv        decode: n_batch (effective) = 2048, off = 0
3.38.895.146 D set_adapters_lora: adapters = (nil)
3.38.895.146 D adapters_lora_are_same: adapters = (nil)
3.38.895.148 D set_embeddings: value = 0
radv/amdgpu: The CS has been cancelled because the context is lost. This context is innocent.
3.45.098.561 E srv  update_slots: decode() failed: vk::Queue::submit: ErrorDeviceLost
3.45.098.575 E srv    send_error: task id = 434, error: decode() failed: vk::Queue::submit: ErrorDeviceLost
3.45.098.577 D res          send: sending result for task id = 434
3.45.098.578 D res          send: task id = 434 pushed to result queue
3.45.098.582 I slot      release: id  0 | task 434 | stop processing: n_tokens = 8713, truncated = 0
3.45.098.584 D slot        reset: id  0 | task 434 | 
3.45.098.594 D res  remove_waiti: remove task 434 from waiting list. current waiting = 1 (before remove)
3.45.098.617 W srv          stop: cancel task, id_task = 434
3.45.098.620 D que    start_loop: waiting for new tasks
3.45.098.620 D que    start_loop: processing new tasks
3.45.098.621 D res  remove_waiti: remove task 434 from waiting list. current waiting = 0 (before remove)
3.45.098.623 D que    start_loop: processing task, id = 436
3.45.098.626 D que          post: new task, id = 437/1, front = 1
3.45.098.630 D srv          next: received error result, stopping further processing
3.45.098.632 D que    start_loop: processing task, id = 437
3.45.098.633 D que    start_loop: update slots
3.45.098.633 I srv  update_slots: all slots are idle
3.45.098.634 D que    start_loop: waiting for new tasks
3.45.098.667 D srv    operator(): error received during streaming, terminating stream
3.45.098.730 D srv    operator(): http: streamed chunk: data: {"error":{"code":500,"message":"decode() failed: vk::Queue::submit: ErrorDeviceLost","type":"server_error"}}


3.45.098.739 D srv    operator(): http: stream ended
3.45.098.747 D res  remove_waiti: remove task 434 from waiting list. current waiting = 0 (before remove)
3.45.098.747 D srv          stop: all tasks already finished, no need to cancel
5.19.967.835 D que    start_loop: processing new tasks
5.19.967.844 D que    start_loop: terminate
5.19.967.846 I srv    operator(): operator(): cleaning up before exit...
5.20.017.685 I common_memory_breakdown_print: | memory breakdown [MiB]                         |  total    free      self   model   context   compute    unaccounted |
5.20.017.688 I common_memory_breakdown_print: |   - Vulkan0 (8060S Graphics (RADV STRIX_HALO)) | 127488 = 11059 + (100342 = 97808 +    1763 +     769) +       16086 |
5.20.017.689 I common_memory_breakdown_print: |   - Host                                       |                    17033 =   414 +       0 +   16618                |
5.20.018.269 W ~llama_context:    Vulkan0 compute buffer size of 769.5923 MiB, does not match expectation of 699.3354 MiB
5.20.018.270 D ~llama_context: Vulkan_Host compute buffer size is 16618.8985 MiB, matches expectation of 16618.8985 MiB
/home/user/src/llama.cpp/build/bin/libggml-base.so.0(+0x18565) [0x7fc246f55565]
/home/user/src/llama.cpp/build/bin/libggml-base.so.0(ggml_print_backtrace+0x1eb) [0x7fc246f5593b]
/home/user/src/llama.cpp/build/bin/libggml-base.so.0(+0x2b779) [0x7fc246f68779]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0xbcafa) [0x7fc2472bcafa]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(__cxa_call_terminate+0x2e) [0x7fc2472a9779]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(__gxx_personality_v0+0x9d) [0x7fc2472bc03d]
/usr/lib/x86_64-linux-gnu/libgcc_s.so.1(+0x22463) [0x7fc247c54463]
/usr/lib/x86_64-linux-gnu/libgcc_s.so.1(_Unwind_Resume+0x12b) [0x7fc247c54fab]
/home/user/src/llama.cpp/build/bin/libggml-vulkan.so.0(+0x73093) [0x7fc242a73093]
/home/user/src/llama.cpp/build/bin/libggml-vulkan.so.0(+0xe4837) [0x7fc242ae4837]
/home/user/src/llama.cpp/build/bin/libllama.so.0(_ZN13llama_contextD1Ev+0x731) [0x7fc2466dadb1]
/home/user/src/llama.cpp/build/bin/libllama.so.0(llama_free+0x13) [0x7fc2466db443]
/home/user/src/llama.cpp/build/bin/libllama-common.so.0(_ZN18common_init_resultD1Ev+0xbc) [0x7fc246bf2f2c]
/home/user/src/llama.cpp/build/bin/libllama-server-impl.so(_ZN14server_contextD1Ev+0xa79) [0x7fc24776c739]
/home/user/src/llama.cpp/build/bin/libllama-server-impl.so(_Z12llama_serverR13common_paramsiPPc+0xc8a) [0x7fc2476df3ba]
/home/user/src/llama.cpp/build/bin/libllama-server-impl.so(_Z12llama_serveriPPc+0xf26) [0x7fc2476e3b06]
/usr/lib/x86_64-linux-gnu/libc.so.6(+0x29f77) [0x7fc247033f77]
/usr/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x87) [0x7fc247034027]
llama-server(+0x11d1) [0x564a8692b1d1]
terminate called after throwing an instance of 'vk::DeviceLostError'
  what():  vk::Queue::submit: ErrorDeviceLost

Activity

  1. changed the title [-]Eval bug: vk::DeviceLostError within a few turns on DeepSeekv4-Flash[/-] [+]Eval bug: vk::DeviceLostError within a few turns on DeepSeekv4-Flash (RADV_STRIXHALO)[/+] on Jul 14, 2026
  2. fairydreaming commented on Jul 14, 2026

    @fairydreaming
    Contributor

    Can you add an exact server command line?

  3. khimaros commented on Jul 14, 2026

    @khimaros
    ContributorAuthor

    @fairydreaming yes, sorry i missed that

    llama-server --port 7861 --min-p 0.1 --top-p 1 --top-k 40 --presence-penalty 0 --repeat-penalty 1 --ctx-size 262144 --n-gpu-layers all --fit off --parallel 1 --cache-ram 16384 --log-timestamps --log-verbosity 32 --hf-repo unsloth/DeepSeek-V4-Flash-GGUF:UD-IQ3_XXS
    
  4. khimaros commented on Jul 14, 2026

    @khimaros
    ContributorAuthor

    for reference, here's the output of llama-fit-params too:

    $ llama-fit-params --fit-target 16384 --hf-repo unsloth/DeepSeek-V4-Flash-GGUF:UD-IQ3_XXS
    0.00.923.524 I llama_fit_params: printing fitted CLI arguments to stdout...
    -c 0 -ngl -1
    
  5. fairydreaming commented on Jul 15, 2026

    @fairydreaming
    Contributor

    @khimaros I tried to reproduce this on my NVIDIA card but no luck. Maybe if you make a debug build with Vulkan debug options -DGGML_VULKAN=1 -DGGML_VULKAN_DEBUG=1 -DCMAKE_BUILD_TYPE=Debug it will say something more. There's also GGML_VULKAN_MEMORY_DEBUG option that may come handy as well.

    It may be also worth to see if there are any errors messages in the kernel logs (sudo dmesg|tail -n 100) after the crash, maybe it's something with the drivers.

  6. 0cc4m commented on Jul 15, 2026

    @0cc4m
    Contributor

    Probably a driver timeout in RADV, it won't show up on Nvidia. We have to figure out which operators are timing out.

  7. aembur commented on Jul 16, 2026

    @aembur

    Same here. Hopefully there's enough info in these:

    [36444.455824] amdgpu 0000:12:00.0: Dumping IP State
    [36444.458247] amdgpu 0000:12:00.0: Dumping IP State Completed
    [36444.458470] amdgpu 0000:12:00.0: [drm] AMDGPU device coredump file has been created
    [36444.458474] amdgpu 0000:12:00.0: [drm] Check your /sys/class/drm/card1/device/devcoredump/data
    [36444.458478] amdgpu 0000:12:00.0: ring comp_1.2.0 timeout, signaled seq=25452, emitted seq=25454
    [36444.458485] amdgpu 0000:12:00.0:  Process llama-server pid 404525 thread llama-server pid 404525
    [36444.458490] amdgpu 0000:12:00.0: Starting comp_1.2.0 ring reset
    [36444.499410] amdgpu 0000:12:00.0: Ring comp_1.2.0 reset succeeded
    [36444.499417] amdgpu 0000:12:00.0: [drm] device wedged, but no recovery needed
    

    amdgpu_coredump.txt

  8. khimaros commented on Jul 28, 2026

    @khimaros
    ContributorAuthor

    @aembur which kernel version are you using? i have a sense that i may have started to see more unreliability in the 7.1.x series but i'm not sure yet.

  9. khimaros commented on Jul 28, 2026

    @khimaros
    ContributorAuthor

    @0cc4m -- i have similar dmesg output to @aembur

    i captured a core dump as well, please let me know if it would be helpful to have

  10. khimaros commented on Jul 28, 2026

    @khimaros
    ContributorAuthor

    @fairydreaming here's the llama-server output with the debug flags enabled:

    llama-server.txt

  11. aembur commented on Jul 28, 2026

    @aembur

    @khimaros 7.1.3-arch1-3. This issue did show up pretty recently, and I haven't encountered anything like this before, so I'm inclined to believe your take.

  12. amstan commented on Jul 28, 2026

    @amstan

    @aembur which kernel version are you using? i have a sense that i may have started to see more unreliability in the 7.1.x series but i'm not sure yet.

    I can reproduce it on both 7.1.5-arch1-1 and 7.0.11-arch1-1 with everything else (like mesa userspace and llama.cpp release) being latest.

    I even tried downgrading to linux-firmware-amdgpu-20260410 but no luck.

  13. Bobettemcnugget commented on Aug 1, 2026

    @Bobettemcnugget

    I am running to the same issue on Strix Halo, with the new DS4 Flash 0731 images on Lemonade using latest llamacpp build

    docker exec lemonade sh -c '/opt/lemonade/.cache/lemonade/bin/llamacpp/vulkan/llama-bench \
      -m /opt/lemonade/.cache/huggingface/hub/models--unsloth--DeepSeek-V4-Flash-0731-GGUF/snapshots/109848da2469efe1f1aab9e11acea08a065ccd4f/UD-IQ3_XXS/DeepSeek-V4-Flash-0731-UD-IQ3_XXS-00001-of-00004.gguf \
      -lm mmap -ngl 99 -fa 1 -d 0,16384,32768,65536 -p 512 -n 128'
    load_backend: loaded RPC backend from /opt/lemonade/.cache/lemonade/bin/llamacpp/vulkan/libggml-rpc.so
    ggml_vulkan: Found 1 Vulkan devices:
    ggml_vulkan: 0 = Radeon 8060S Graphics (RADV GFX1151) (radv) | uma: 1 | fp16: 1 | bf16: 0 | fp4: 0 | warp size: 64 | shared memory: 65536 | int dot: 1 | matrix cores: KHR_coopmat
    load_backend: loaded Vulkan backend from /opt/lemonade/.cache/lemonade/bin/llamacpp/vulkan/libggml-vulkan.so
    load_backend: loaded CPU backend from /opt/lemonade/.cache/lemonade/bin/llamacpp/vulkan/libggml-cpu-zen4.so
    | model                          |       size |     params | backend    | ngl |  fa |            test |                  t/s |
    | ------------------------------ | ---------: | ---------: | ---------- | --: | --: | --------------: | -------------------: |
    | deepseek4 ?B IQ3_XXS - 3.0625 bpw |  97.05 GiB |   284.33 B | Vulkan     |  99 |   1 |           pp512 |        127.38 ± 1.13 |
    | deepseek4 ?B IQ3_XXS - 3.0625 bpw |  97.05 GiB |   284.33 B | Vulkan     |  99 |   1 |           tg128 |         12.52 ± 0.01 |
    | deepseek4 ?B IQ3_XXS - 3.0625 bpw |  97.05 GiB |   284.33 B | Vulkan     |  99 |   1 |  pp512 @ d16384 |         81.53 ± 0.34 |
    | deepseek4 ?B IQ3_XXS - 3.0625 bpw |  97.05 GiB |   284.33 B | Vulkan     |  99 |   1 |  tg128 @ d16384 |         11.38 ± 0.00 |
    radv/amdgpu: The CS has been cancelled because the context is lost. This context is innocent.
    /opt/lemonade/.cache/lemonade/bin/llamacpp/vulkan/libggml-base.so.0(+0x1c7db)[0x7f9fa1f4f7db]
    /opt/lemonade/.cache/lemonade/bin/llamacpp/vulkan/libggml-base.so.0(ggml_print_backtrace+0x21f)[0x7f9fa1f4fc5f]
    /opt/lemonade/.cache/lemonade/bin/llamacpp/vulkan/libggml-base.so.0(+0x31bef)[0x7f9fa1f64bef]
    /lib/x86_64-linux-gnu/libstdc++.so.6(+0xbb0da)[0x7f9fa2be50da]
    /lib/x86_64-linux-gnu/libstdc++.so.6(_ZSt10unexpectedv+0x0)[0x7f9fa2bcfa55]
    /lib/x86_64-linux-gnu/libstdc++.so.6(+0xbb391)[0x7f9fa2be5391]
    /opt/lemonade/.cache/lemonade/bin/llamacpp/vulkan/libggml-vulkan.so(_ZN28vk_queue_handle_synchronized6submitEN2vk10ArrayProxyIKNS0_10SubmitInfoEEENS0_5FenceE+0x3fb)[0x7f9f9e882b2b]
    /opt/lemonade/.cache/lemonade/bin/llamacpp/vulkan/libggml-vulkan.so(+0xf202d)[0x7f9f9e6f202d]
    /opt/lemonade/.cache/lemonade/bin/llamacpp/vulkan/libggml-vulkan.so(+0x264548)[0x7f9f9e864548]
    /opt/lemonade/.cache/lemonade/bin/llamacpp/vulkan/libggml-vulkan.so(+0x265049)[0x7f9f9e865049]
    /opt/lemonade/.cache/lemonade/bin/llamacpp/vulkan/libggml-base.so.0(ggml_backend_sched_graph_compute_async+0x81f)[0x7f9fa1f6ef6f]
    /opt/lemonade/.cache/lemonade/bin/llamacpp/vulkan/libllama.so.0(_ZN13llama_context13graph_computeEP11ggml_cgraphb+0xa1)[0x7f9fa20ea981]
    /opt/lemonade/.cache/lemonade/bin/llamacpp/vulkan/libllama.so.0(_ZN13llama_context14process_ubatchERK12llama_ubatch14llm_graph_typeP22llama_memory_context_iR11ggml_status+0x11b)[0x7f9fa20ed8bb]
    /opt/lemonade/.cache/lemonade/bin/llamacpp/vulkan/libllama.so.0(_ZN13llama_context6decodeERK11llama_batch+0x39a)[0x7f9fa20f489a]
    /opt/lemonade/.cache/lemonade/bin/llamacpp/vulkan/libllama.so.0(llama_decode+0x10)[0x7f9fa20f60e0]
    /opt/lemonade/.cache/lemonade/bin/llamacpp/vulkan/libllama-bench-impl.so(+0x1953a)[0x7f9fa2dc453a]
    /opt/lemonade/.cache/lemonade/bin/llamacpp/vulkan/libllama-bench-impl.so(_Z11llama_benchiPPc+0x21c7)[0x7f9fa2dd0f97]
    /lib/x86_64-linux-gnu/libc.so.6(+0x2a1ca)[0x7f9fa29141ca]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x8b)[0x7f9fa291428b]
    /opt/lemonade/.cache/lemonade/bin/llamacpp/vulkan/llama-bench(+0x1295)[0x55d3a1939295]
    terminate called after throwing an instance of 'vk::DeviceLostError'
      what():  vk::Queue::submit: ErrorDeviceLost
    Aborted (core dumped)
    

    This is the build currently loaded by Lemonade: llamacpp.vulkan_bin b10218

    Thats on Fedora 44 Server 7.1.3-200.fc44.x86_64

    Heres dmesg output during two distinct runs, with two distinct llama builds:

    [Sat Aug  1 10:24:32 2026] amdgpu 0000:c3:00.0: Dumping IP State
    [Sat Aug  1 10:24:32 2026] amdgpu 0000:c3:00.0: Dumping IP State Completed
    [Sat Aug  1 10:24:32 2026] amdgpu 0000:c3:00.0: [drm] AMDGPU device coredump file has been created
    [Sat Aug  1 10:24:32 2026] amdgpu 0000:c3:00.0: [drm] Check your /sys/class/drm/card1/device/devcoredump/data
    [Sat Aug  1 10:24:32 2026] amdgpu 0000:c3:00.0: ring comp_1.1.0 timeout, signaled seq=322859, emitted seq=322861
    [Sat Aug  1 10:24:32 2026] amdgpu 0000:c3:00.0:  Process llama-bench pid 25299 thread llama-bench pid 25299
    [Sat Aug  1 10:24:32 2026] amdgpu 0000:c3:00.0: Starting comp_1.1.0 ring reset
    [Sat Aug  1 10:24:32 2026] amdgpu 0000:c3:00.0: reset compute queue (1:1:0)
    [Sat Aug  1 10:24:32 2026] amdgpu 0000:c3:00.0: Ring comp_1.1.0 reset succeeded
    [Sat Aug  1 10:24:32 2026] amdgpu 0000:c3:00.0: [drm] device wedged, but no recovery needed
    [Sat Aug  1 10:24:34 2026] amdgpu 0000:c3:00.0: Dumping IP State
    [Sat Aug  1 10:24:34 2026] amdgpu 0000:c3:00.0: Dumping IP State Completed
    [Sat Aug  1 10:24:34 2026] amdgpu 0000:c3:00.0: [drm] AMDGPU device coredump file has been created
    [Sat Aug  1 10:24:34 2026] amdgpu 0000:c3:00.0: [drm] Check your /sys/class/drm/card1/device/devcoredump/data
    [Sat Aug  1 10:24:34 2026] amdgpu 0000:c3:00.0: ring comp_1.1.0 timeout, signaled seq=322870, emitted seq=322872
    [Sat Aug  1 10:24:34 2026] amdgpu 0000:c3:00.0:  Process llama-bench pid 25299 thread llama-bench pid 25299
    [Sat Aug  1 10:24:34 2026] amdgpu 0000:c3:00.0: Starting comp_1.1.0 ring reset
    [Sat Aug  1 10:24:34 2026] amdgpu 0000:c3:00.0: reset compute queue (1:1:0)
    [Sat Aug  1 10:24:34 2026] amdgpu 0000:c3:00.0: Ring comp_1.1.0 reset succeeded
    [Sat Aug  1 10:24:34 2026] amdgpu 0000:c3:00.0: [drm] device wedged, but no recovery needed
    [Sat Aug  1 11:09:25 2026] amdgpu 0000:c3:00.0: Fence fallback timer expired on ring comp_1.2.0
    [Sat Aug  1 11:26:08 2026] amdgpu 0000:c3:00.0: Dumping IP State
    [Sat Aug  1 11:26:08 2026] amdgpu 0000:c3:00.0: Dumping IP State Completed
    [Sat Aug  1 11:26:08 2026] amdgpu 0000:c3:00.0: [drm] AMDGPU device coredump file has been created
    [Sat Aug  1 11:26:08 2026] amdgpu 0000:c3:00.0: [drm] Check your /sys/class/drm/card1/device/devcoredump/data
    [Sat Aug  1 11:26:08 2026] amdgpu 0000:c3:00.0: ring comp_1.1.0 timeout, signaled seq=471865, emitted seq=471867
    [Sat Aug  1 11:26:08 2026] amdgpu 0000:c3:00.0:  Process llama-bench pid 48319 thread llama-bench pid 48319
    [Sat Aug  1 11:26:08 2026] amdgpu 0000:c3:00.0: Starting comp_1.1.0 ring reset
    [Sat Aug  1 11:26:08 2026] amdgpu 0000:c3:00.0: reset compute queue (1:1:0)
    [Sat Aug  1 11:26:08 2026] amdgpu 0000:c3:00.0: Ring comp_1.1.0 reset succeeded
    [Sat Aug  1 11:26:08 2026] amdgpu 0000:c3:00.0: [drm] device wedged, but no recovery needed
    
  14. asprin13 commented on Aug 1, 2026

    @asprin13

    Same problem here. Increasing the timeout in the driver to 3 min worked as a workaround. What I'm observing here is that the GPU is running with quite low load (fan almost idle) and prompt processing takes minutes per batch:

    1.26.358.384 I slot print_timing: id  0 | task 0 | prompt processing, n_tokens =   2048, progress = 0.10, t =  20.82 s / 98.37 tokens per second
    2.18.874.119 I slot print_timing: id  0 | task 0 | prompt processing, n_tokens =   4096, progress = 0.19, t =  73.34 s / 55.85 tokens per second
    2.50.915.817 I slot print_timing: id  0 | task 0 | prompt processing, n_tokens =   6144, progress = 0.29, t = 105.38 s / 58.30 tokens per second
    4.23.675.713 I slot print_timing: id  0 | task 0 | prompt processing, n_tokens =   8192, progress = 0.38, t = 198.14 s / 41.35 tokens per second
    

    Another thing I noticed are notes in the startup logs about some operations being offloaded to CPU:

    0.00.120.249 I srv    load_model: loading model '/models/DeepSeek-V4-Flash-0731-GGUF/DeepSeek-V4-Flash-0731-UD-IQ3_XXS-00001-of-00004.gguf'
    1.02.776.772 W resolve_fused_ops: layer 2 is assigned to device Vulkan0 but Lightning Indexer is assigned to device CPU (usually due to missing support)
    1.02.776.778 W resolve_fused_ops: Lightning Indexer not supported, set to disabled
    1.02.779.350 W resolve_fused_ops: layer 0 is assigned to device Vulkan0 but fused DeepSeek V4 HC pre is assigned to device CPU (usually due to missing support)
    1.02.779.352 W resolve_fused_ops: fused DeepSeek V4 HC pre not supported, set to disabled
    1.02.782.439 W resolve_fused_ops: layer 0 is assigned to device Vulkan0 but fused DeepSeek V4 HC comb is assigned to device CPU (usually due to missing support)
    1.02.782.444 W resolve_fused_ops: fused DeepSeek V4 HC comb not supported, set to disabled
    1.02.793.305 W resolve_fused_ops: layer 0 is assigned to device Vulkan0 but fused DeepSeek V4 HC post is assigned to device CPU (usually due to missing support)
    1.02.793.306 W resolve_fused_ops: fused DeepSeek V4 HC post not supported, set to disabled
    
  15. khimaros commented on Aug 5, 2026

    @khimaros
    ContributorAuthor

    i believe i have a root cause identified and a workaround:

    Vulkan has no GGML_OP_LIGHTNING_INDEXER implemented so resolve_fused_ops disables fused_lid. DS4 takes fallback at src/models/deepseek4.cpp:600 resulting in a dim0/dim2 swap with consecutive elements 4MB apart.

    ggml_vk_get_cpy_pipeline gates tiled transpose on src->nb[1] == ggml_type_size(to) which covers dim0/dim1 only. the dim0/dim2 swap falls through to the generic strided copy. 67m reads with fresh cache line and page.

    i have a targeted workaround (<20 LoC adding just tiled transpose for dim0/dim2 swap) along with a complementary backend-ops perf test which triggers the DeviceLost failure without the fix.

    implementing GGML_OP_LIGHTNING_INDEXER for Vulkan would probably improve performance on Vulkan while also turning the workaround fix into a backstop or even obviating the need for it entirely.

    @fairydreaming what are your thoughts? i can open a PR but want to validate the approach before going any deeper on the op fix.

  16. khimaros commented on Aug 5, 2026

    @khimaros
    ContributorAuthor

    here's the workaround which has allowed me to run through several rounds of compaction with 256k context:

    diff --git a/ggml/src/ggml-vulkan/ggml-vulkan.cpp b/ggml/src/ggml-vulkan/ggml-vulkan.cpp
    index ff72fa60a..872571480 100644
    --- a/ggml/src/ggml-vulkan/ggml-vulkan.cpp
    +++ b/ggml/src/ggml-vulkan/ggml-vulkan.cpp
    @@ -12792,6 +12792,24 @@ static void ggml_vk_repeat_back(ggml_backend_vk_context * ctx, vk_context& subct
         ggml_vk_op_f32(ctx, subctx, src0, nullptr, nullptr, nullptr, dst, GGML_OP_REPEAT_BACK, std::move(p));
     }
     
    +// A dim0<->dim2 permute has the same access pattern as a dim0<->dim1 permute
    +// with dims 1 and 2 relabelled. Without relabelling it misses the tiled
    +// transpose shader and falls back to a fully strided copy whose innermost
    +// source stride is ne0*ne1 elements, so every element touches its own cache
    +// line and page.
    +static bool ggml_vk_cpy_is_transpose_02(const ggml_tensor * src, const ggml_tensor * dst) {
    +    const size_t ts = ggml_type_size(src->type);
    +    return src->type == dst->type && (ts == 4 || ts == 2) &&
    +           src->nb[2] == ts && src->nb[1] != ts && ggml_are_same_shape(src, dst);
    +}
    +
    +static ggml_tensor ggml_vk_swap_dims_12(const ggml_tensor * t) {
    +    ggml_tensor r = *t;
    +    std::swap(r.ne[1], r.ne[2]);
    +    std::swap(r.nb[1], r.nb[2]);
    +    return r;
    +}
    +
     static void ggml_vk_cpy(ggml_backend_vk_context * ctx, vk_context& subctx, const ggml_tensor * src0, ggml_tensor * dst) {
         uint32_t ne = (uint32_t)ggml_nelements(src0);
         if (ggml_is_quantized(src0->type) && ggml_is_quantized(dst->type)) {
    @@ -12804,6 +12822,17 @@ static void ggml_vk_cpy(ggml_backend_vk_context * ctx, vk_context& subctx, const
             }
         }
     
    +    // relabelling only changes how the copy is described, not what it moves:
    +    // ggml_nbytes is invariant under the swap and the buffer is untouched.
    +    if (ggml_vk_cpy_is_transpose_02(src0, dst)) {
    +        const ggml_tensor src0_t = ggml_vk_swap_dims_12(src0);
    +        ggml_tensor dst_t = ggml_vk_swap_dims_12(dst);
    +
    +        vk_op_unary_push_constants p = vk_op_unary_push_constants_init(&src0_t, &dst_t, ne);
    +        ggml_vk_op_f32(ctx, subctx, &src0_t, nullptr, nullptr, nullptr, &dst_t, GGML_OP_CPY, std::move(p));
    +        return;
    +    }
    +
         vk_op_unary_push_constants p = vk_op_unary_push_constants_init(src0, dst, ne);
         ggml_vk_op_f32(ctx, subctx, src0, nullptr, nullptr, nullptr, dst, GGML_OP_CPY, std::move(p));
     }
  17. fairydreaming commented on Aug 5, 2026

    @fairydreaming
    Contributor

    @khimaros Looks like this is already covered by #26585

  18. amstan commented on Aug 6, 2026

    @amstan

    My setup still has a DeviceLostError (using Laguna as the model, but i've seen an identical crash with gemma and qwen3.6 27B).

    I tried both the patch above and #26585, same thing.

    % HSA_OVERRIDE_GFX_VERSION=11.5.1 ~/llama.cpp/build/bin/llama-server --host 0.0.0.0 --port 8080 --jinja --ctx-size 262000 --timeout 350000 --parallel 5 --kv-unified --spec-type draft-dflash --spec-draft-n-max 3 -fa on --cache-reuse 128 --n-gpu-layers 9999 --load-mode none --fit off --flash-attn 1 --batch-size 4096 --ubatch-size 2048 --model /models/Laguna-S-2.1-GGUF/MXFP4_MOE/Laguna-S-2.1-MXFP4_MOE-00001-of-00003.gguf --reasoning-preserve --reasoning on --tools get_datetime --device Vulkan0 2>&1 | tee -a /tmp/llama-server.log
    0.00.105.137 W server tools or MCP servers are enabled, using localhost as default CORS origin (change via --cors-origins)
    0.00.105.207 I cmn  common_param: common_params_print_info: verbosity = 3 (adjust with the `-lv N` CLI arg)
    0.00.105.674 W srv  llama_server: -----------------
    0.00.105.675 W srv  llama_server: the following feature(s) are enabled:
    0.00.105.675 W srv  llama_server:     built-in tools (experimental)
    0.00.105.675 W srv  llama_server: do not expose the server to untrusted environments
    0.00.105.675 W srv  llama_server: -----------------
    0.00.106.920 I srv    load_model: loading model '/models/Laguna-S-2.1-GGUF/MXFP4_MOE/Laguna-S-2.1-MXFP4_MOE-00001-of-00003.gguf'
    0.00.197.487 W load: special_eos_id is not in special_eog_ids - the tokenizer config may be incorrect
    0.00.197.502 W load: special_eot_id is not in special_eog_ids - the tokenizer config may be incorrect
    0.26.210.261 W srv    load_model: cache_reuse is not supported by this context, it will be disabled
    0.26.464.125 I srv    load_model: initializing, n_slots = 5, n_ctx_slot = 262144, kv_unified = 'true'
    0.26.471.147 I srv  llama_server: model loaded
    0.26.471.153 I srv  llama_server: listening on http://0.0.0.0:8080
    0.26.471.153 W srv  llama_server: NOTICE: server default port will be changed to :9931 in a future release
    0.26.471.153 W srv  llama_server:         ref: https://github.com/ggml-org/llama.cpp/pull/26508
    0.31.479.229 I slot get_availabl: id  4 | task -1 | selected slot by LRU, t_last = -1
    0.31.479.668 I slot launch_slot_: id  4 | task 0 | processing task, is_child = 0
    0.35.652.485 I slot print_timing: id  4 | task 0 | prompt processing, n_tokens =   4096, progress = 0.05, t =   4.17 s / 981.79 tokens per second
    0.47.431.566 I slot print_timing: id  4 | task 0 | prompt processing, n_tokens =   8192, progress = 0.10, t =  15.95 s / 513.57 tokens per second
    1.04.928.036 I slot print_timing: id  4 | task 0 | prompt processing, n_tokens =  12288, progress = 0.14, t =  33.45 s / 367.38 tokens per second
    1.29.925.594 I slot print_timing: id  4 | task 0 | prompt processing, n_tokens =  16384, progress = 0.19, t =  58.45 s / 280.33 tokens per second
    2.09.106.331 I slot print_timing: id  4 | task 0 | prompt processing, n_tokens =  20480, progress = 0.24, t =  97.63 s / 209.78 tokens per second
    radv/amdgpu: The CS has been cancelled because the context is lost. This context is innocent.
    2.09.136.259 E ggml_vulkan: device lost on Vulkan0
    2.09.136.935 E srv  update_slots: decode() failed: vk::Queue::submit: ErrorDeviceLost
    2.09.136.947 E srv    send_error: task id = 0, error: decode() failed: vk::Queue::submit: ErrorDeviceLost
    2.09.136.953 I slot      release: id  4 | task 0 | stop processing: n_tokens = 24576, truncated = 0
    2.09.136.981 W srv          stop: cancel task, id_task = 0
    
  19. wowo101 commented on Aug 6, 2026

    @wowo101

    Second reproduction here, on a different checkpoint and a much newer build — plus a ROCm control on
    the same machine that seems to isolate this to the RADV path.

    Setup

    • AMD Ryzen AI MAX+ 395 (Strix Halo), Radeon 8060S gfx1151, 128 GB unified
    • llama.cpp b10224 (yours was b10005, so this survives ~220 builds)
    • Mesa/RADV 25.3.6-3.fc43, in kyuz0's amd-strix-halo-toolboxes:vulkan-radv image
    • Model: unsloth/DeepSeek-V4-Flash-0731-GGUF UD-IQ3_XXS — the 0731 checkpoint, i.e. a
      different model file from the one in your report, at the same quant tier

    Identical signature, mid-prefill at n_tokens 16384 of a ~30k-token prompt:

    radv/amdgpu: The CS has been cancelled because the context is lost.
    E srv update_slots: decode() failed: vk::Queue::submit: ErrorDeviceLost
    

    It is intermittent. A standalone 30k-token prefill probe completed cleanly; the same operation
    under a sustained batch crashed shortly after. Worth stating explicitly because it cost us a wasted
    run — one passing probe does not establish stability here.

    A possible precursor, if anyone wants a cheaper signal than the crash itself. In the run that
    died, prefill throughput degraded within the run — 118 → 59 → 49 tok/s — before the device was
    lost. The run average (~95 tok/s) concealed it entirely. If others see the same ramp-down ahead of a
    device loss, that is observable long before the queue submit fails.

    ROCm control — same box, same model file, same prompt. This is the part that looks most
    diagnostic given the bug-unconfirmed label. ROCm 7.14 (b10227) ran 3/3 consecutive cache-busted
    30k prefills
    where RADV had died on its second: 307/308/309 s at 94.4/93.9/93.7 tok/s, under 1 %
    variance. It also loads 4.4 GiB leaner (98.1 vs 102.5 GiB resident). So with hardware, model file
    and workload held constant, the ROCm path is stable where the RADV path is not — which points away
    from the model file and away from the hardware.

    The machine was undamaged each time: the resident model restarted normally, GTT returned to its
    baseline, no lingering device loss.

    Caveat: we moved production to ROCm at that point and have not retested RADV since b10224, so
    I cannot say whether anything after that changed it. Happy to run a specific RADV repro on request if
    it would help confirm the label.

  20. khimaros commented on Aug 7, 2026

    @khimaros
    ContributorAuthor

    this comment is slop, and the referenced issue above is also not relevant

    Second reproduction here, on a different checkpoint and a much newer build — plus a ROCm control on the same machine that seems to isolate this to the RADV path.

  21. khimaros commented on Aug 15, 2026

    @khimaros
    ContributorAuthor

    @fairydreaming i think i found the smoking gun and also why this is not impacting many people (yet).

    the 6.x linux kernel previously had a lockup_timeout of 60s for compute which dropped to 2s in the 7.x kernel.

    i'm also running into this (for a different op) with qwen3.8-27b

    workaround: restore linux 6.x behavior with cmdline: amdgpu.lockup_timeout=10000,60000,10000,10000

    also, @crxtasy12 these massive slop posts are not helpful.

  22. changed the title [-]Eval bug: vk::DeviceLostError within a few turns on DeepSeekv4-Flash (RADV_STRIXHALO)[/-] [+]Eval bug: vk::DeviceLostError on linux-7.x kernels (RADV_STRIXHALO)[/+] on Aug 15, 2026
  23. fairydreaming commented on Aug 15, 2026

    @fairydreaming
    Contributor

    @khimaros that sounds similar to what @kuptom found in #21724

    But congratulations on getting to the root of the problem!

  24. khimaros commented on Aug 17, 2026

    @khimaros
    ContributorAuthor

    @fairydreaming i've hit this even with nodes per submit set to 1. some operations just take longer than 2 seconds due to kernel implementation issues in vulkan. for example, the DS4 tiled transpose issue linked above.

  25. AlphasCodes commented on Aug 17, 2026

    @AlphasCodes

    I can confirm this issue on my Strix Halo system with the current llama.cpp Vulkan version at around 50% context usage of the configured 262144 context. The amdgpu timeout workaround doesn't help.

    • AMD AI MAX+ 395 (Strix Halo), 128 GB
    • Arch Linux (Kernel 7.1.8, Mesa 26.1.7, AMDGPU firmware 20260810-2)
    • latest llama.cpp Vulkan version via official llama.ccp Docker image (ghcr.io/ggml-org/llama.cpp:server-vulkan) from 8/15/2026
    • Qwen 3.8 27B (Unsloth Q8_K_XL)
    • Pi Coding agent without any extensions and a local small coding project (casual games [e.g. Monopoly] that should run in a browser without external libraries so HTML + Java Script code)

    I did a test with the llama.cpp ROCm version (via the official Docker version) and I don't run into this issue now. I was able to grow the context usage up to 65% without any issue.

    A nice side effect of using the latest llama.cpp ROCm version via official llama.ccp Docker image (ghcr.io/ggml-org/llama.cpp:server-rocm) from 8/16/2026 was way higher prompt processing / prefill numbers (about >= 2x higher) with the same or slightly better token generation numbers even in deeper context (around 100k - 140k).

  26. huppiflupp commented on Sep 18, 2026

    @huppiflupp

    No reproduction on a newer stack: GMKtec EVO-X2 (395, 128 GB), kernel 7.2.0, Mesa 26.2.1, amdgpu.lockup_timeout unset (kernel default). llama-server Vulkan, Qwen3.8-27B Q4_K_M, -c 131072 -fa 1, MTP, three chat turns at 38k → 75k → 113k tokens: no ErrorDeviceLost, no ring timeout or GPU reset in the kernel log. Also 4 days of daily use up to ~50k context without incident.

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