fix(shader): avoid spinning in the spilled LDS lock #3015
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3015"
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?
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T20:34:46Z.
What
LockedLdsUpdateretries an elected lane's 64-bit LDS compare-exchange in an inner loop. On Intel Arc / Mesa ANV, when LDS spills into a storage buffer and 64-bit shared atomics are unavailable, that inner spin can stop making progress and lose the Vulkan device. The change makes one compare-exchange attempt per outer election round; an unsuccessful lane remains pending and can be elected again. The lock update and result are unchanged.Carries ThatsLeo’s tested fix from issue #2805, preserving the original commit author. The issue also records independent Intel Windows validation.
Tested
agc_driver_lds_beyond_device_limit_testssuccessfully.agc_driver_lds_beyond_device_limitfails with the same incorrect counter result both with the patch and with the source file restored from currentmain; this software Vulkan implementation does not validate the reported Intel driver failure.agc_driver_lds*tests passing on Intel Arc 3/3, and independent Windows testing on Intel Arc and NVIDIA.python3 tools/check_conventions.py --base upstream/mainandgit diff upstream/main...HEAD --checkpassed.Checklist
main; no open PR implements this fixImported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-10T23:53:32Z.
Review: COMMENTED
A lost Vulkan device is the most serious thing a shader recompiler can cause, so trading an unbounded inner spin for one attempt per outer election round deserves reading closely — and the reason it is safe is the part worth stating.
The equivalence claim is what makes it reviewable. "The lock update and the result are unchanged" is the right sentence to write, and the structure supports it: the compare-exchange still happens on an elected lane, a failed attempt now leaves that lane pending rather than re-spinning, and the
OpPhionattemptedcarries whether the lane has served. The only behaviour that changed is what happens after a failed attempt.And the progress guarantee is worth stating, because it does not come from the election.
OpGroupNonUniformElectre-runs every round and does not itself exclude lanes that have already served — but a served lane cannot be re-elected, becauseservedis a uniform scalarOpPhi, sodoneNextis uniform, the not-doneNextballot comes back empty, and the outer loop exits the moment any lane is served. That is the sentence a reader will want beside this change: the attempt-per-round shape is safe because of what is uniform, not because of who the election picks.And the testing note is the best thing here. Failing the same test both with the patch and with the source restored from
main— on a software Vulkan implementation that cannot reproduce an Intel driver failure — is exactly the right thing to report: it says plainly which device can validate this and which cannot. What carries the rest is the issue's independent Intel Windows run, which is worth having named.Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T23:58:42Z.
LockedLdsUpdatewas refactored on main (typeparameter for u32/u64), which conflicted with this change. Rebased onto currentmain: the two result phis now usetypeinstead ofTypeU64; the rest is unchanged.Checked: scoped build + ctest (433 tests, all
agc_driver_lds*andpixel_ldspass on RADV); the Intel failure itself isn't reproducible here, relying on the Intel Arc and Windows runs in #2805. Merging on green CI.