graphics: report device loss with VK_EXT_device_fault and opt-in GPU checkpoints #1816
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!1816
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1816/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@ZrDaniel07 on GitHub · 2026-10-22 04:01 UTC · original
ZrDaniel07:diag/device-lost→main· +360 −0 · 9 files · 2 commits · closed without mergingA lost device currently ends with
Not implemented (result != vk::Result::eSuccess) in masterSemaphore.cpp:56and nothing else, so reports like #831, #905 and #1511 can't say which work hung the GPU. This adds a report for that case.What changes
MasterSemaphoreprints the failing call, the result and the GPU tick before the EXIT:MasterSemaphore: vkWaitSemaphores failed: ErrorDeviceLost (-4), tick=310371 gpu_tick=310273 current_tick=310372ErrorDeviceLost(from the semaphore wait, the counter query orvkQueueSubmit), a report prints whatVK_EXT_device_faultreturns: the description, the first 8 address records and a per-type summary. The extension is enabled whenever the device supports it, and only queried after a loss.KYTY_GPU_CHECKPOINTS=1enablesVK_NV_device_diagnostic_checkpoints. EveryCommandBuffer::SetDebugInforecords a checkpoint (dispatches also get their shader hash, draws the PS address), and the report lists the operations between the last bottom-of-pipe and top-of-pipe checkpoints. It is opt-in because it adds a command per draw and dispatch. At startup the console says whether it is on.Example from ASTRO BOT (PPSA21564) with #1365 applied locally, RTX 5090:
That pointed at one compute shader; details in #1511.
Testing
Windows 11, clang-cl 19.1.5, Release, RTX 5090 (driver 617.42, Vulkan 1.4.351):
shader_recompiler_compute_testspasses.HasExtensionchecks, so MoltenVK and drivers without these extensions take the old path. Checkpoints only exist on NVIDIA; AMD'sVK_AMD_buffer_markercould feed the same report later.AI use
Claude Code (Anthropic) wrote the patch with me, at my request, and analysed the outputs with me. I reviewed the diff, ran the game for every test above and checked the reports myself.
🤖 Generated with Claude Code
@coderabbitai[bot] on GitHub · 2026-10-22 04:07 UTC · original · edited 2026-10-23 19:11 UTC
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
c92b6c8a-5e31-4ced-9296-8e4a8068ae49📥 Commits
Reviewing files that changed from the base of the PR and between 37743a3f5191db69885afb6ac6e607f738bd31ac and
5a7b319a05.📒 Files selected for processing: 3
src/graphics/host_gpu/graphicContext.hsrc/graphics/host_gpu/renderer/renderCompute.cppsrc/graphics/presentation/window/vulkanWindow.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
📝 Walkthrough
The change adds Vulkan device-fault reporting and optional GPU command checkpoints. Device creation detects and enables supported diagnostic extensions. Checkpoints record command metadata and shader hashes. Queue submission and semaphore failures pass their Vulkan results to the device-loss reporting path.
Suggested reviewers:
nmzikPriority: ⬇️ Low
Change: Feature
Merge Risk: 🔵 Low · up to
5a7b3The change is mergeable with owner awareness that early dispatch exits can leave misleading opt-in device-loss checkpoints.
Pre-merge checks:
4 ·
1
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.@ -61,0 +65,4 @@op == static_cast<uint32_t>(CommandBufferDebugOp::DrawIndexAuto);const uint64_t pixel_shader =draw && m_shaders != nullptr ? m_shaders->GetPs().ps_regs.data_addr : 0;DeviceLossRecordCheckpoint(m_buffer, op, submit_id, arg0, arg1, arg2, arg3, arg4,@coderabbitai[bot] on GitHub · 2026-10-22 04:08 UTC · original · edited 2026-10-23 18:56 UTC
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 7644
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 12928
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 13397
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 10552
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 4437
Record dispatch checkpoints only for commands that execute.
RenderExecutor::DispatchDirectandRenderExecutor::DispatchIndirectcallSetDebugInfobefore skip checks. With checkpoints enabled, this inserts a Vulkan checkpoint before paths that return without encoding the corresponding dispatch. The device-loss report can therefore identify a skipped dispatch as the relevant operation.Keep the existing debug metadata assignment, but record the dispatch checkpoint only after the dispatch path has passed its skip checks and before the corresponding Vulkan dispatch.
@coderabbitai[bot] on GitHub · 2026-10-22 04:08 UTC · original · edited 2026-10-23 18:55 UTC
On
src/graphics/host_gpu/renderer/deviceLossReport.cppline 191 (outdated):🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 6805
Enable checkpoints only for the documented opt-in value.
KYTY_GPU_CHECKPOINTS=andKYTY_GPU_CHECKPOINTS=falseenable checkpoint extension loading and per-operation checkpoint recording because the function accepts every non-null value except"0". Accept"1"explicitly so an empty or false-valued optional setting does not enable the checkpoint path.✅ Addressed in commit 37743a3
@coderabbitai[bot] on GitHub · 2026-10-22 04:08 UTC · original · reviewed
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
639dc8ab-623d-49e0-b359-7cf2afd4a547📥 Commits
Reviewing files that changed from the base of the PR and between
c5016d9455and e2b2e17c0f8051b09cc637be537c1ea3b7070d9e.📒 Files selected for processing: 9
src/graphics/host_gpu/graphicContext.hsrc/graphics/host_gpu/renderer/commandScheduler.cppsrc/graphics/host_gpu/renderer/context.cppsrc/graphics/host_gpu/renderer/deviceLossReport.cppsrc/graphics/host_gpu/renderer/deviceLossReport.hsrc/graphics/host_gpu/renderer/masterSemaphore.cppsrc/graphics/host_gpu/renderer/masterSemaphore.hsrc/graphics/host_gpu/renderer/renderCompute.cppsrc/graphics/presentation/window/vulkanWindow.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
@ -61,0 +65,4 @@op == static_cast<uint32_t>(CommandBufferDebugOp::DrawIndexAuto);const uint64_t pixel_shader =draw && m_shaders != nullptr ? m_shaders->GetPs().ps_regs.data_addr : 0;DeviceLossRecordCheckpoint(m_buffer, op, submit_id, arg0, arg1, arg2, arg3, arg4,@ZrDaniel07 on GitHub · 2026-10-23 18:44 UTC · original
A skipped dispatch records a checkpoint but no work after it, so it doesn't get blamed: the next checkpoint follows with nothing in between, and it reaches bottom-of-pipe as soon as the earlier work does. The report starts at the bottom-of-pipe checkpoint, so it names the next operation that has work. Where the same checkpoint is the last at both top- and bottom-of-pipe, the operation after it had work. A dispatch replaced by a clear or fill still names the place where that work ran. I've left it as is; moving the checkpoint to every point that emits a dispatch would spread it over many call sites.
@ZrDaniel07 on GitHub · 2026-10-23 18:44 UTC · original
On
src/graphics/host_gpu/renderer/deviceLossReport.cppline 191 (outdated):Fixed in 37743a3: only
KYTY_GPU_CHECKPOINTS=1enables checkpoints now. Trailing spaces are ignored, since cmd keeps the one before&&inset KYTY_GPU_CHECKPOINTS=1 && ....@coderabbitai[bot] on GitHub · 2026-10-23 18:54 UTC · original · reviewed
ℹ️ Review info
⚙️ Run configuration
888e1f20-0eb4-46bb-add4-9a894f7c01c8📥 Commits
Reviewing files that changed from the base of the PR and between e2b2e17c0f8051b09cc637be537c1ea3b7070d9e and 37743a3f5191db69885afb6ac6e607f738bd31ac.
📒 Files selected for processing: 1
src/graphics/host_gpu/renderer/deviceLossReport.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
@coderabbitai[bot] on GitHub · 2026-10-23 18:56 UTC · original
On
src/graphics/host_gpu/renderer/deviceLossReport.cppline 191 (outdated):@ZrDaniel07 Thanks for the fix in
37743a3. Accepting only"1"after trimming trailing spaces addresses the opt-in concern and supports thecmdusage you described.If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!
✅ Review thread resolved.
You are interacting with an AI system.
@ -61,0 +65,4 @@op == static_cast<uint32_t>(CommandBufferDebugOp::DrawIndexAuto);const uint64_t pixel_shader =draw && m_shaders != nullptr ? m_shaders->GetPs().ps_regs.data_addr : 0;DeviceLossRecordCheckpoint(m_buffer, op, submit_id, arg0, arg1, arg2, arg3, arg4,@coderabbitai[bot] on GitHub · 2026-10-23 18:56 UTC · original
🧩 Analysis chain
🏁 Script executed:
Length of output: 21198
@ZrDaniel07You’re right. I checkedReportCheckpoints: it reports a checkpoint range, not a single dispatch identified as the cause. My finding incorrectly treated a skipped dispatch in that range as fault attribution.The existing checkpoint also covers clear or fill work that replaces a dispatch. Moving it immediately before Vulkan dispatch calls would lose that coverage.
I withdraw this finding. No change is needed for this concern.
✅ Review thread resolved.
You are interacting with an AI system.
@Nmzik on GitHub · 2026-10-28 20:36 UTC · original
@ZrDaniel07 In reality it wont help us :) You will still need shader spirv/IR opcodes etc
Pull request closed