graphics: add opt-in compute dispatch buffer inspector for persistent-queue hangs #1084
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!1084
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1084/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?
@overlordxrz-source on GitHub · 2026-10-05 22:14 UTC · original
overlordxrz-source:helper/nanite-dispatch-dump→main· +111 −0 · 1 files · 2 commits · closed without mergingDiagnostic tooling for #1072 (Wukong Nanite persistent-culling compute shaders never exit, every group runs to the loop cap).
The issue lists three unverified hypotheses: counters/slot markers never reset before each dispatch,
glcatomic returns not reaching other lanes, or missing forward progress between workgroups. The suggested next step is capturing the state-buffer counters and slot-queue markers GPU-accurately around a dispatch. This implements exactly that recipe:KYTY_DUMP_DISPATCH_BUFFERS=allor comma-separated hex shader hashes (e.g.KYTY_DUMP_DISPATCH_BUFFERS=539ebc039e965dfd); unset = off, zero behavior change.DispatchDirect, logs the first 16 dwords of up to 8 bound buffers twice: a "before" snapshot (FlushAndWait drains prior work, then ReadMemory pulls the ranges to CPU visibility) and an "after" snapshot after recording the dispatch + FlushAndWait.Comparing before/after across dispatches shows whether the 44-byte state-buffer counters and the -1 slot markers move or are stale, which separates a missed reset/reorder (hypothesis 1) from atomics-visibility / forward-progress problems (hypotheses 2-3).
Validation: x86_64 macOS no-Qt Release build of
kyty_emulatorsucceeds;shader_cfgpasses. GPU-harness tests are not runnable in this environment (no Vulkan loader — same pre-existing failure as clean main). Not yet exercised against the actual Wukong dispatch — needs someone with the game + Vulkan timestamps to run with the env var and post the before/after lines.AI disclosure (per repo AI Use policy): AI tooling assisted with code exploration and patch drafting. Human reviewed the full diff, built
kyty_emulator(x86_64) and ranshader_cfgbefore submitting, and remains responsible for correctness.@coderabbitai[bot] on GitHub · 2026-10-05 22:24 UTC · original · edited 2026-10-05 22:52 UTC
📝 Walkthrough
Walkthrough
Adds an opt-in inspector controlled by
KYTY_DUMP_DISPATCH_BUFFERS. It selects all shaders or configured hexadecimal shader hashes. For matching direct dispatches, it logs up to 16 dwords from each of the first eight nonempty bound buffers before and after dispatch. Each dump waits for queued work and reads guest memory. Dump calls are capped at 16.Suggested reviewers:
nmzikPriority: ⬇️ Low
Change: Feature
Merge Risk: 🔵 Low · up to
ff970Copying a logged hash into the opt-in setting produces no snapshots. The change remains mergeable with a bounded diagnostic usability issue; users can enter the hash without its prefix.
Security Architecture Review
Security architecture risk: 🔵 Low · up to
ff970The inspector is disabled by default and limits each diagnostic capture. Enabling it exposes buffer contents in logs and changes execution timing. Live GPU failure and recovery behavior remains unverified.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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.@ -41,0 +136,4 @@words[12], words[13], words[14], words[15]);}}@coderabbitai[bot] on GitHub · 2026-10-05 22:24 UTC · original · edited 2026-10-05 22:53 UTC
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 4346
Move the before dump before
RebindBuffers.FindBuffershas already populatedbindings.buffer_sourcesat that point, so the dump retains its buffer list.RebindBuffersthen marks writable ranges GPU-dirty. After dispatch, the after dump can download those ranges instead of reading stale guest memory.Suggested fix
✅ Addressed in commit
ff97013@coderabbitai[bot] on GitHub · 2026-10-05 22:24 UTC · original · edited 2026-10-05 22:55 UTC
On
src/graphics/host_gpu/renderer/renderCompute.cppline 539 (outdated):🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 1895
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 30037
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 17177
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 9164
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 4303
Record the barrier before the after-dispatch snapshot.
When the after-dispatch snapshot is within
DumpDispatchBuffers’ 16-call limit, it callsFlushAndWait().vk_bufferholds the command-buffer handle captured before dispatch. The flush submits that command buffer and begins another one.ShaderAccessBarrierthen tries to record a barrier on the submitted command buffer, and the new command buffer receives no barrier.🐛 Suggested fix
✅ Addressed in commit
ff97013@coderabbitai[bot] on GitHub · 2026-10-05 22:24 UTC · original · reviewed
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
06fd4634-688a-45da-af5e-d21d312c727c📥 Commits
Reviewing files that changed from the base of the PR and between
cdb64bfd4fand2b8acb4094.📒 Files selected for processing (1)
src/graphics/host_gpu/renderer/renderCompute.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
@ -41,0 +136,4 @@words[12], words[13], words[14], words[15]);}}@overlordxrz-source on GitHub · 2026-10-05 22:41 UTC · original
Good catch on the placement - taken with one nuance. I verified FindBuffers fully populates buffer_sources, so the snapshot now runs immediately after it, before RebindBuffers uploads/synchronizes this dispatch's bindings. (For the record, the staleness mechanism in the suggestion doesn't quite hold - ReadMemory downloads GPU-modified ranges rather than skipping them - but snapshotting before any of this dispatch's sync activity is strictly safer, so the move is right regardless.) Fixed in
ff97013, build + shader_cfg green.@overlordxrz-source on GitHub · 2026-10-05 22:42 UTC · original
On
src/graphics/host_gpu/renderer/renderCompute.cppline 539 (outdated):Confirmed real - FlushAndWait calls Submit() + BeginNext(), and vk_buffer aliases the scheduler's current buffer, so the barrier would indeed have landed on the submitted buffer. Moved ShaderAccessBarrier ahead of the after-dispatch snapshot with a comment explaining why. Fixed in
ff97013, build + shader_cfg green.@coderabbitai[bot] on GitHub · 2026-10-05 22:45 UTC · original · reviewed
ℹ️ Review info
⚙️ Run configuration
8f1ab00d-e6a2-4f8d-8aed-17664170ec00📥 Commits
Reviewing files that changed from the base of the PR and between
2b8acb4094andff9701379f.📒 Files selected for processing (1)
src/graphics/host_gpu/renderer/renderCompute.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.
@ -41,0 +136,4 @@words[12], words[13], words[14], words[15]);}}@coderabbitai[bot] on GitHub · 2026-10-05 22:54 UTC · original
@overlordxrz-sourceThanks for the correction.ReadMemorydownloads GPU-modified ranges; my staleness explanation was incorrect.The supplied code places the before snapshot after
FindBuffersand beforeRebindBuffers, as intended. Thanks for confirming the fix inff97013and the passing checks.✏️ Learnings added
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.
@coderabbitai[bot] on GitHub · 2026-10-05 22:55 UTC · original
On
src/graphics/host_gpu/renderer/renderCompute.cppline 539 (outdated):@overlordxrz-sourceThanks for confirming the fix and explaining the command-buffer transition. The supplied code recordsShaderAccessBarrierbefore the after-dispatch snapshot, which addresses this finding.✏️ Learnings added
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.
@overlordxrz-source on GitHub · 2026-10-06 00:40 UTC · original
Maintainers: the two build workflow runs for this PR are sitting at
action_required(awaiting approval), so there's no CI signal yet. When convenient, please approve a run — in the meantime, local validation (x86_64 macOS no-Qt Release build +shader_cfg) is documented in the description above. Happy to fix anything CI flags.Pull request closed