shader: admit BufferAtomicIAdd32 on loop-Phi descriptors (Ghost of Yotei) #1939
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!1939
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1939/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?
@iM4x3ll on GitHub · 2026-10-27 15:53 UTC · original
iM4x3ll:shader-loop-phi-buffer-atomic-iadd32→main· +114 −2 · 5 files · 3 commits · closed without mergingSummary
Ghost of Yotei (PPSA26344) compute shaders pick buffer descriptors from loop Phis. After the GPU-thread stack overflow in #1599, testers stop at:
buffer descriptor is not a valid runtime value; GPU-selected access requires a scalar, raw 8/16-bit, raw DWORD x1/x2/x3/x4, or formatted X loadBufferAtomicIAdd32 uses a GetBufferResource whose descriptor dwords are loop Phis.Collectalready treats those descriptors as GPU-selected indirect buffers for raw/formatted loads.SupportsIndirectBufferLoaddid not listBufferAtomicIAdd32, so the same pathFailed.Admitting the atomic without an emit path then crashes:
DefineIndirectBufferLoadswould treat it as a load,EmitAtomic32EXITs onIndirectBuffer, and native SPIR-V validation required every indirectGetBufferResourceuse to be a Read. This PR:BufferAtomicIAdd32to that allow-listPhysicalStorageBuffer) with the existing bounds/present guardsNo title, hash, or address special cases.
Fixes the next official-main stop after #1609. Related: #1599, #108.
Test
resource_trackingcase: loop-PhiGetBufferResourcedwords plusBufferAtomicIAdd32. Failed with the published error before the change; passes after.shader_cfgcase: loop-carried V#BUFFER_ATOMIC_ADDcompiles to valid BDAOpAtomicIAdd(caught the Read-only handle check).resource_tracking_testspassed on Windows (clang-cl, Ninja).I do not have a legal dump on this machine, so this is not in-game proof.
AI disclosure
Cursor (Composer) helped write the tests, the opcode admission, the IndirectBuffer atomic emit, and the handle-validation fix. I reviewed the Collect /
SupportsIndirectBufferLoadpath, the load-helper skip, the BDA emit, and the validator, and ran the focused tests myself.Made with Cursor
@coderabbitai[bot] on GitHub · 2026-10-27 16:03 UTC · original · edited 2026-10-27 16:31 UTC
No actionable comments were generated in the recent review.
8965b7df-0354-4e08-88bb-73b1c954f0ddReviewing files that changed from the base of the PR and between
c4d31f3319anddfc10c16a7.src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpptests/shaderCfgTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.
Walkthrough
SupportsIndirectBufferLoadnow acceptsBufferAtomicIAdd32for 32-bit unformatted data. SPIR-V emission routes indirect-buffer atomics through a helper that checks activity, bounds, and pointer availability. The changes also update indirect-buffer handle validation and skip non-read instructions when defining indirect-buffer loads. New loop-PHI tests check indirect-buffer tracking, DMA use, and emitted SPIR-V.Suggested reviewers:
nmzikPriority:
Normal
Change: Bug fix
Merge Risk:
Minimal · up to
dfc10No actionable merge-blocking issue is established; merge after normal checks.
Pre-merge checks:
4 ·
1
Full details: Title check
Explanation
The title names the primary change: admitting BufferAtomicIAdd32 on loop-Phi buffer descriptors. It is specific, concise, and matches the raw summary and PR objectives. The parenthetical game name adds context but is not the main change.
Full details: Description check
Explanation
The description explains the problem (Ghost of Yotei compute shaders with loop-Phi buffer descriptors failing on BufferAtomicIAdd32), lists the changes (opcode allow-list, skipping non-read load helpers, BDA atomic emit, native SPIR-V validation), and describes the tests added. It is directly related to the changeset.
Full details: Docstring Coverage
Explanation
Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 8 functions across 4 files. (1 skipped: 1 too large.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
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.Pull request closed