Skip to content

vulkan: fix submission batching size, add debug tools for diagnosing causes of DeviceLost drivers errors - #26371

Merged
ggerganov merged 4 commits into
masterfrom
0cc4m/vulkan-device-lost-debug
Aug 6, 2026
Merged

vulkan: fix submission batching size, add debug tools for diagnosing causes of DeviceLost drivers errors#26371
ggerganov merged 4 commits into
masterfrom
0cc4m/vulkan-device-lost-debug

Conversation

@0cc4m

@0cc4m 0cc4m commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Overview

We get a lot of DeviceLost error reports, especially from AMD users on Linux. Most of these are a driver submission timeout. It is currently not easy to figure out what tensor or tensors timed out, to improve that I added two things in this PR:

  • Support for VK_EXT_device_fault extension to get more information about an error from the driver. Sadly this does not provide any information about the timeouts, but it may still be useful for other issues.
  • A new GGML_VK_SERIALIZE_SUBMISSIONS env var that submits all submission sequentially and stores what tensors were last submitted. If the driver then throws a DeviceLost error, it reports what was submitted. That way you can see if too much was submitted at once, or if a specific operator is running too slow.

This already showed an issue with submission batching, currently it only stops a batch once it has exceeded the flops threshold, not before a tensor would push it over the limit. I patched this as well to make submissions smaller where necessary, as was intended. Possibly this already reduces the amount of driver timeouts.

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES, AI was used for writing the code, I manually reviewed and tested.

@0cc4m
0cc4m requested a review from a team as a code owner July 31, 2026 13:35
@github-actions github-actions Bot added Vulkan Issues specific to the Vulkan backend ggml changes relating to the ggml tensor library for machine learning labels Jul 31, 2026
@0cc4m

0cc4m commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

I fixed an issue with the queue owning a device shared pointer. Should be fine now. Can you reapprove if it's fine @jeffbolznv ?

@0cc4m 0cc4m added the merge ready A maintainer can use this label to indicate that they consider the changes final and ready to merge. label Aug 5, 2026
@ggerganov
ggerganov merged commit 803b7fc into master Aug 6, 2026
24 of 28 checks passed
@ggerganov
ggerganov deleted the 0cc4m/vulkan-device-lost-debug branch August 6, 2026 07:24
@characharm

Copy link
Copy Markdown
Contributor

It seems this PR fixed the issue with my AMD cards. For quants above Q5, llama-server would silently crash without any errors, and sometimes the AMD driver would crash too. I just had a long agent session with a Q8 model without any errors.

Maxritz pushed a commit to Maxritz/LLAMA-ALL-INCLUSIVE that referenced this pull request Aug 8, 2026
…causes of DeviceLost drivers errors (ggml-org#26371)

* vulkan: add debug tooling to get more information about a DeviceLost error

* fix submission threshold applied too late

* use logging macros, throw instead of aborting

* clean up circular dependency
Maxritz added a commit to Maxritz/LLAMA-ALL-INCLUSIVE that referenced this pull request Aug 8, 2026
No shared git history exists with upstream (our root commit is
parentless, a fresh source import rather than a real fork/clone), so a
normal merge/rebase isn't possible -- cherry-picked commits individually
instead, each verified independently. Landed 7 of 8 identified commits;
skipped upstream's own Q2_0 (788e07d) since it collides with our
already-verified, benchmarked custom Q2_0 (type 42) implementation --
same feature name, two independently-developed and incompatible kernels.

- e34e9c6 vulkan: Refactor vk_queue to use per-instance mutexes and
  unique handles (ggml-org#23570) -- required updating our custom paged-KV/radix
  Vulkan code (pkv_vulkan_init/pkv_dispatch_init call sites), which
  accessed the old plain vk_queue struct fields directly.
- 27b7fcf vulkan: add iq4_nl support back to FA (ggml-org#24585)
- 29f1212 vulkan: Support quantized concat (ggml-org#25684)
- 3cb4d39 vulkan: add POOL_1D op (ggml-org#25431)
- a329897 vulkan: extend topk_moe fusion to support sqrt(softplus) (ggml-org#26124)
- a72c87f vulkan backend ops: implemented GATED_LINEAR_ATTN (ggml-org#25601)
- 0756c85 vulkan: fix submission batching size, add debug tools for
  diagnosing causes of DeviceLost drivers errors (ggml-org#26371) -- AMD-specific
  driver-timeout workaround, directly relevant to this fork's RDNA4 focus.

Verified: full Release build of build-vulkan-rdna4-fresh (0 errors),
real model load + inference request through the Vulkan backend produced
correct output. docs/ops.md left as the incoming (upstream) version for
now since it's auto-generated (scripts/create_ops_docs.py) from real
test-backend-ops CSV dumps per backend -- needs a proper regeneration
pass, not hand-editing, to reflect our custom ops too.

Backup of pre-sync main state: branch + tag pre-upstream-vulkan-sync
(pushed to origin).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
HarshDaniel pushed a commit to HarshDaniel/koboldcpp-rocm that referenced this pull request Aug 9, 2026
…causes of DeviceLost drivers errors (ggml-org#26371)

* vulkan: add debug tooling to get more information about a DeviceLost error

* fix submission threshold applied too late

* use logging macros, throw instead of aborting

* clean up circular dependency
miltos22 pushed a commit to miltos22/llama.cpp-wackMall-merge-request that referenced this pull request Aug 10, 2026
…causes of DeviceLost drivers errors (ggml-org#26371)

* vulkan: add debug tooling to get more information about a DeviceLost error

* fix submission threshold applied too late

* use logging macros, throw instead of aborting

* clean up circular dependency
satindergrewal pushed a commit to satindergrewal/llama.cpp that referenced this pull request Aug 11, 2026
…causes of DeviceLost drivers errors (ggml-org#26371)

* vulkan: add debug tooling to get more information about a DeviceLost error

* fix submission threshold applied too late

* use logging macros, throw instead of aborting

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

Labels

ggml changes relating to the ggml tensor library for machine learning merge ready A maintainer can use this label to indicate that they consider the changes final and ready to merge. Vulkan Issues specific to the Vulkan backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants