fix(shader): serve ds_ordered_count in wave launch order #12944
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12944"
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 ZSWolt on 2026-10-29T15:42:29Z.
What
Background. On AMD GCN/RDNA GPUs, GDS (global data share) is a small on-chip memory shared by all waves of a dispatch.
ds_ordered_countis a GDS instruction that adds to, or swaps, a counter in GDS and returns the old value. Unlike an ordinary atomic, the hardware serves the waves in wavefront launch order: the first-launched wave gets the first value, the next wave the next, and so on. Shaders use it to give each wave a contiguous, ordered slice of an output buffer (stream compaction, particle lists, culling output). Because the order is guaranteed, the result is deterministic and the slices never overlap.The bug.
ds_ordered_count(ordered append on GDS) ran as a plain device atomic, so the waves of a dispatch added in whatever order the host ran them. The hardware hands the counter out in wavefront launch order. radeonsi'ssi_compute_prim_discard.c(mesa-20.3.0) describes it as "an atomic counter that is incremented in the wavefront launch order", withORDER_MODE 0launching in order. A title that turns the returned values into output offsets therefore got overlapping or shifted ranges, intermittently.In compute shaders the ordered add and swap now run in launch order:
RuntimeAbi::GdsMetadataDwords), the turn and a timeout count (Pm4::GdsBindingBytes). Ordinary GDS accesses stay bounded at 64 KiB; only the ordering code reaches the two dwords. The wait, the add and the release run inside one loop, so guest waves that share a host subgroup (wave32 code in a 64-lane subgroup) do not wait on each other.offset1bit 1 (wave done) is set, compare-exchanges the turn from its own index to the next (0 after the dispatch's last wave). Only the wave that holds the turn moves it.orderedAppend, disk cache format 70). For those programs only, the driver zeroes the turn in the buffer the dispatch binds, before the dispatch and before each chunk of a split one. It uses aCOMPUTE_SHADER→TRANSFERbarrier, a 4-bytevkCmdFillBuffer, thenTRANSFER→COMPUTE_SHADER. A GDS copy the CPU made is created fillable, so it is reset the same way. Each chunk counts its own waves.main), marks the turn abandoned so the rest of the dispatch runs unordered at once, and adds 1 to the timeout count, which the test checks. With one wave that never takes its turn, a 65536-group dispatch takes about 350 ms; without the mark it lost the device after 2 s.The wait relies on waves being launched in workgroup order and on earlier waves running while later ones spin. AMD hardware does this, but Vulkan does not guarantee it. This is recorded in
docs/dev/debt/shader.md, which now describes the new behaviour in place of "not modeled".Tested
Ubuntu 26.04.1 (Linux 7.0.0-38), GCC 15.2.0, Release, RX 9060 XT (RADV GFX1200, Mesa 26.0.8-1ubuntu0.3). Based on
main6d56eb813c(merged into the branch on Oct 30).agc_driver_gds_append_consume, each checking every lane's value, the counter and a timeout count of 0:ds_ordered_count: group 0 gets the start value, groups 2–3 time out and get the remaining values, and exactly 2 timeouts are counted.mainbb04a4f1ea(with only this test file added) it fails: "64 single-wave groups, dispatch 1, ds_ordered_count: group 0 lane 0 returned 1025, expected 1000 (the counter in launch order)".ds_ordered_count), inagc_driver_gds_append_consumeand_copied. The RX 9060 XT on RADV reportsmaxComputeWorkGroupCount[1] = 65535, so the case takes the split path here: 2 chunks, row 0 gets the start value, 65533 waves of the first chunk run unordered, and the second chunk and the dispatch after it are ordered. It passes 3 of 3 in both registrations, with 0VUID-messages.WorkgroupIdorder. For a row 0 served that late, the case skips only the row 0 value and the unordered count, and names the skip in its success line; the skipped row, the second chunk's order after its reset and the final counter are still checked. A row 0 served early but not first still fails. The debt entry names the assumption.ctest -R '^agc_|^shader_|recompiler' -j4on this branch: 1130 of 1132 pass. The 2 failures,agc_idle_publish_waitandagc_driver_native_multisample_depth, also fail onmainon this machine (the second because a host import getsvkAllocateMemory-13 here).ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest -V -R gds_appendon the same machine and GPU, onmainbb04a4f1eaand on this branch.VUID-messages.mainthe test fails only on the new case, as intended.mainstops at startup in this title (sceHttp2SetResolveRetry not implemented), so this ran on my local integration build (mainplus local branches) with and without this PR.0x1038fb8200) intermittently produced overlapping particle records, drawn as long streaks. That was 1–9 corrupted frames per 8-minute run; with the change, 0 in 3 runs (Oct 23, first version of this PR).tools/trace_digest.py,APS5_TRACE_SECONDS=200:60, order without, with, with, without:gpu_busy_ms_per_present148.5 / 128.9 / 128.6 / 151.9. This metric spans each batch from its first to its last command, idle gaps included, so it is not shader time. I have not attributed the change to a phase.main. That was wrong: those were runs of the integration build against a baseline from another day.python3 tools/check_conventions.py --base origin/main: all conventions checks passed.tools/pr_overlap.py --branch fix/recompiler-ordered-append: no open PR changesds_ordered_count. The overlaps are on shared files only:Graphics/src/ShaderResources.cpp,SpirvMemoryInstructions.cpp,SpirvEmitterHelpers.cpp,Execution/src/Pm4.cppanddocs/dev/debt/shader.md(e.g. #10193, #11551, #10846).Progress
PPSA08329 on this machine (RX 9060 XT, RADV), on
mainwith this change and other local, unrelated fixes; this PR depends on none of them. Bring-up thread: #12128.0x1038fb8200writes throughds_ordered_countslots, and serving those slots in launch order removed every streak.gpu_busy_ms_per_present: 148.5 / 151.9 without, 128.9 / 128.6 with.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-29T18:51:11Z.
Review: COMMENTED
The ordering fix is sound, and oneandonlydean's timeout points are addressed. One cost in
recordDispatchis not covered yet and applies to every dispatch that binds the GDS, not just ordered ones.The reset is gated on
bindsGds, not onorderedAppend.bindsGdsis true for any shader with aDescriptorRole::Gdsbinding, which includes plain append/consume and any other GDS user. Those shaders never read the turn dword, but they now get:vkCmdPipelineBarrierALL_COMMANDS→TRANSFERvkCmdFillBufferof 4 bytesvkCmdPipelineBarrierTRANSFER→COMPUTE_SHADERALL_COMMANDSas the source stage drains everything recorded before it: preceding draws, other dispatches and copies. Each such dispatch also becomes a hard sync point, so it can't overlap the work before it. The same is added before each chunk of a split dispatch. A title that issues many small GDS dispatches per frame (particle and culling passes are the typical case) pays a GPU drain for each one.Carry the
orderedAppendrequirement into the compiled program, or the binding info, and reset only for programs that containDataOrderedCountorDataOrderedSwapin a compute stage. Shaders that don't order then get exactly whatmaingives them.The first barrier is wider than it needs to be. The only prior writer of the turn dword is an earlier ordered dispatch. A
COMPUTE_SHADER→TRANSFERbarrier withSHADER_WRITE|SHADER_READ→TRANSFER_WRITEcovers that.ALL_COMMANDS/TRANSFER_WRITEalso orders graphics work against the fill, which nothing needs.Alternative that avoids the fill and both barriers. Have the shader own the reset. The wave holding the last launch index already compare-exchanges the turn to 0. With a launch-epoch dword that the host bumps once per dispatch through push constants, the compare-exchange targets
epoch * stride + launchand no dispatch ever needs a zeroed turn. A timed-out dispatch then can't poison the next one either, and the fill and barriers go away.CPU-copy path (
zeroGuestBytesreturningnullopt). Thememsetruns at record time, while the GPU may still be executing a previously submitted dispatch that uses the same CPU-made GDS copy. Two dispatches recorded back to back into one command buffer also both zero the turn before either runs. Please confirm that case can't happen, or say what guarantees it can't.Wait loop. Each waiting wave does up to 2^20 device-scope acquire loads with no backoff. If one wave never issues the done operation (a divergent path where a whole guest wave skips it), every later wave in that dispatch spends the full budget. The test counts the timeouts (2 here), but nothing records how long a timeout costs on hardware that doesn't schedule groups strictly in order. On a 4090, include the time of the skipped-group case in the numbers; it matters for Windows TDR.
Measurement. The title numbers are the corrupted-frame counts and the present counts (851–857 against about 790). Please add
tools/trace_digest.pysummaries ofmainand of this change from the same machine and scene, with the frame time and thegpu_busy_ms_per_presentof the GoW fireplace scene. Presents going up while a drain is added before every GDS dispatch is surprising, and the digest will show which phase moved.Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:32:14Z.
Review: COMMENTED
Thanks for the gate, the narrower barrier, the timing table and the correction of the present counts. One consequence of the CPU-copy change is not covered in your reply.
An abandoned mark is never cleared when the GDS binding is a CPU-made copy. The first wave that gives up stores
0xffffffffin the turn, and "the next ordering dispatch's reset clears the mark". For a CPU-made copy you no longer record a reset (FillTargetreturns nothing), and you rely on the previous dispatch leaving 0. After a timeout it leaves0xffffffff. The holder's compare-exchange cannot replace the mark, so every later ordering dispatch on that copy sees the mark at its first wait and runs unordered, with every wave counted as a timeout. That ismain's behaviour, but it is permanent, and nothing in the log distinguishes it from a first timeout.Please say which binding the GDS gets by default on the three platforms (import, GPU copy or CPU copy), since that decides how often this path is the one titles take. Then either:
A test that times out once and then runs a normal dispatch on a CPU-made binding would pin it. The existing "dispatch after a timeout" case runs on an import or GPU copy, where the reset covers it.
The frame-time table is what I asked for;
gpu_busy_ms_per_presentgoing from about 150 to about 129 ms with the change is a large move for a GDS-only fix, so it is worth a line saying which phase it comes from.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-02T21:46:39Z.
Review: COMMENTED
Reviewed — comments
The PR merges, builds and passes every test that ran here, and the guest-GDS bound is confirmed by a negative control. The new ordered-append cases skip on lavapipe because its subgroups are only 8 lanes wide, so I could not check the launch-order behaviour on this machine, and I found nothing blocking in the code.
What I ran
Head
5332c91593adf637b534591b5207598c3a8eb369,main9090972b7e91fd266819cbd77a8b058e177b5682, merged tree9a5f6fc6852adaff5353a2dd7fd3f6d4f004e299. Debian 13 VM (Xeon Gold 6136, AVX2/FMA), GCC 14.2.0, Release, Ninja, lavapipe (Mesa 26.1.6, LLVM 19).Results
git diff --checkcheck_conventions.pylibs(script)check_skips.py), 0 new failures, 0 timeouts; the 7 failures also fail onmain(agc_driver_division,agc_driver_f32_denormal_flush,agc_driver_f64_div_scale_denormal_modes,agc_driver_f64_fma_denormal_modes,agc_driver_mullit_f32_denormal_modes,unwrap_self,vector_constant_factor_tininess)VUID-linesagc_driver_gds_append_consume,agc_driver_gds_append_consume_copiedagc_atomic_gds_size,agc_driver_gds_dma_fill,agc_driver_gds_dma_fill_private,agc_guarded_memory_loads,agc_shader_disk_cache*with the validation layerLP_NATIVE_VECTOR_WIDTH=1024)ds_appendcase, before any of the new code (wave32 32 threads, 32 active ds_append: lane 16 returned 1016, its wave's first active lane 1000). That is lavapipe misbehaving at this vector width, not this PR.git status --porcelainemptyNegative control
main'sSpirvBufferAccess.cppback, so ordinary GDS accesses used the full binding length again, and rebuiltagc_guarded_memory_loads_tests. The test failed with "guarded memory loads: a guest load reached a location the guarded program could not". With the merged file back it passes. So thegdsGuestLength = OpArrayLength - GdsMetadataDwordschange is exercised, and the fixture change inGuardedMemoryLoads.cppdoesn't hide it.GdsAppendConsume.cpp. I couldn't run a control for these: they skip here (see above). As JJenkx and jacknieland noted, the test file also doesn't build againstmain's driver, because it usesPm4::GdsOrderedTimeoutsOffset. The author's description reports a red/green onmainbb04a4f1eawith only the test added.Findings
Blocking
None.
Non-blocking
The ordering cases never run on lavapipe CI.
core/libs/prx/libSceAgcDriver/tests/execution/GdsAppendConsume.cpp:461skips when subgroups are narrower than 32 lanes. Lavapipe has 8 lanes here and at most 16 at AVX-512 width, so both registrations skip on every CI runner. Two things follow:vkCmdFillBuffer/barrier sequence either.The hardware runs in the thread are the only coverage. Of those, only TechLevelZero's RX 6300 run is on this head, and its summary doesn't show whether this test ran or skipped. Suggestions:
OrderedGroupCode,SkippedGroupCodeandChunkSkipCodeand checks thatorderedAppendis set and the module passes SPIR-V validation.Chunk-relative launch index (a note, not a defect). The launch index uses the raw
WorkgroupId/NumWorkgroupsinputs (SpirvMemoryInstructions.cpp:1437), not the offset form thatSpirvModuleEmitter.cpp:214-218adds for split dispatches. So each chunk numbers its waves from 0. That matches the per-chunk reset atVulkanDevice.cpp:5458and the description ("Each chunk counts its own waves"), and I found no bug in it. On hardware the order runs across the whole dispatch: with the reset and the barrier between chunks, the overall order is still kept as long as chunk N+1 starts after chunk N finishes, which the barrier atVulkanDevice.cpp:5456(merged tree) ensures. One sentence in the order entry ofdocs/dev/debt/shader.mdsaying the chunks are ordered by the barrier, not by the turn, would make this explicit.Earlier review points I checked against this head:
SpirvMemoryInstructions.cpp:1336-1378,VulkanDevice.cpp:5424-5430).orderedAppendis in place, with the narrowerCOMPUTE_SHADER→TRANSFERbarrier.FillTargetthrows for image mirrors.Not verified
APS5_NO_HOST_IMPORT=1 APS5_NO_SHARED_GDS=1) variant: all skip on lavapipe here. The validation layer therefore never saw the new fill and barriers either.docs/dev/debt/shader.md, as the rules require.To get this to a good state
agc_driver_gds_append_consumeandagc_driver_gds_append_consume_copiedactually ran (not skipped) and passed on this head on at least one hardware GPU, and ideally that the split-dispatch case ran too (it needsmaxComputeWorkGroupCount[1]below 65537).Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-02T22:55:39Z.
Review: COMMENTED
A data point from Windows that the other runs may not have covered: the split-dispatch case fails here.
Windows 11, WinLibs GCC 15.2.0, Release, AMD Radeon RX 9070 XT (vendor
0x1002, device0x7550, AMD's Windows driver, subgroup 64), with this head merged onto currentmain.agc_atomic_gds_size,agc_driver_gds_append_consume_copied,agc_driver_gds_dma_fill,agc_driver_gds_dma_fill_privateandagc_driver_pm4pass, butagc_driver_gds_append_consumefails inCheckChunkedRecovery(tests/execution/GdsAppendConsume.cpp:320-347), 3 runs out of 3:The returned value differs each run (66340, 66278, 66119, 66345) and is never the start value. So the first-launched wave of the first chunk doesn't get the first turn here; about 65,300 values were handed out before it. This device reports
maxComputeWorkGroupCount[1] = 65535(the "chunks of 65535" in the message), so the case takes the split path; with a larger limit it prints "split-dispatch case skipped" instead (GdsAppendConsume.cpp:322-323). Your Tested section lists RADV only, and its case list doesn't include this one. I don't know whether it has run on a device that splits. On plainmainthe same test passes here, butmaindoesn't have this case. I haven't dug into the cause.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-02T23:34:26Z.
Review: DISMISSED
Re-checked — changes still requested
The only new commit is a merge of
main. It resolves the conflicts cleanly, and everything that runs here passes. One problem remains open: since my last review, BunnyFl reported that the new split-dispatch case fails on AMD's Windows driver, and there is still no fix or reply for it.What changed since my last review
No new code. The previously reviewed commit
5332c91593is still in the branch, and the PR's four own commits are unchanged (delta.patch is a no-op range-diff).One new merge commit,
304e19c2a9, frommain. It resolves conflicts withmain's newscratchPoolSlotDwordsin:Recompiler.cppandRecompiler.hpp;SpirvEmitter.hppandSpirvEmitter.cpp;ShaderDiskCache.cpp;OpArrayLengthfixture inGuardedMemoryLoads.cpp;SpirvBufferAccess.cpp, wheregdsGuestLengthis kept next to the scratch-pool branch.I read the combined diff:
orderedAppendis encoded and decoded at the same position.materializeResultfollow the member order ofRecompileResult.FormatVersionis 52 againstmain's 51.New in the thread since my last review: BunnyFl's review on
5332c91593. On an RX 9070 XT with AMD's Windows driver,agc_driver_gds_append_consumefails 3 of 3 runs inCheckChunkedRecovery. The author has not replied, and the description is unchanged.What I ran
Head
304e19c2a9715223ccd0a696ccfbba2560f68be3,main5cb015caaaaf83f8ee431414ee6a457b5b307d49, merged tree0bbee04f7f8c5ec30788a70a8d323136f3d5f908. Debian 13 VM (Xeon Gold 6136), GCC 14.2.0, Release, lavapipe (Mesa 26.1.6, LLVM 19).git diff --checkcheck_conventions.pylibs(script)agc_driver_image_sample_lod_clamp_shader_lane(reported as new)mainafter the baseline commit (fe18496c95,4e2a028e43), and it fails the same way with the PR's production files restored frommain("thread 0 component 1 is 0.000000, expected 0.062500").unwrap_self_..._destination_directory_group(reported as new)mainafter the baseline, and it fails onos.chownwithEINVALin the sandbox. The PR does not touchtools/.VUID-linesagc_driver_gds_append_consume,_copiedgit status --porcelainemptyNo negative control for the ordering cases: they skip here, and the PR's tests have not changed since my last review. The guest-GDS-bound control from my last review still applies, because the merge keeps
gdsGuestLength.Previous findings
GdsAppendConsume.cpp:462still skips below 32 lanes, so CI does not exercise the emitted loop, the reset, the abandon marker or the new fill/barrier sequence.VulkanDevice.cpp:5584-5594still resets per chunk.WorkgroupId(SpirvMemoryInstructions.cpp:1437).docs/dev/debt/shader.md:205still does not say this.5332c91593.main's 51, so it is correct againstmaintoday.New findings
Blocking
The split-dispatch case fails on AMD's Windows driver, with no fix and no reply. BunnyFl ran
5332c91593on an RX 9070 XT (AMD Windows driver, subgroup 64), which reportsmaxComputeWorkGroupCount[1] = 65535.agc_driver_gds_append_consumefailed 3 of 3 runs atcore/libs/prx/libSceAgcDriver/tests/execution/GdsAppendConsume.cpp:347:The value is different each run, and roughly 65,300 values were handed out before row 0. Head
304e19c2a9carries the same code, so the report still applies. I could not reproduce it here, because lavapipe skips the test.Why it matters:
VulkanDevice.cpp:5594), and the turn is zeroed just before it (VulkanDevice.cpp:5557-5563). So row 0 should take the turn at once.gl_WorkGroupIDorder, and early waves make progress) not holding for a 65535-group dispatch on that driver.As merged, the PR would:
Suggested fix:
Non-blocking
None.
Not verified
To get this to a good state
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T07:37:25Z.
Review: COMMENTED
Re-checked — comments
The new commit
f30287c436responds to BunnyFl's split-dispatch failure on AMD's Windows driver. When row 0 is served more than half a chunk late, the test now prints a skip line instead of failing, and the debt entry names the start-order assumption and says chunks are ordered by the barrier between them. The checks pass. Two things keep this at comments: nobody has yet confirmed the late-start explanation on that driver, and the early return also skips the second-chunk checks, which do not depend on row 0.What changed since my last review
f30287c436. It changes onlyGdsAppendConsume.cppanddocs/dev/debt/shader.md. The PR's earlier commits are unchanged (delta.patch).CheckChunkedRecoverynow printssplit-dispatch case skipped: row 0 started late ...and returns when all three of these hold:limit / 2places late;The skip line gives the value, the row that got the first value, and the unordered count. If row 0 is wrong but early, the test still fails.
The debt entry for
ds_ordered_countorder now:WorkgroupIdand that start order is assumed;-V. Also a direct reply to CnRJay on CPU-copy reset and the default binding.maxComputeWorkGroupCount[1] = 65535) and passes there 3 of 3 in both registrations. This is author-reported.What I ran
Head
f30287c43679db1778513d23be025090688db413,maind1ae628bc2f62459cce1e9872ba5632c938c71f2, merged tree0817b9ad9ebd847b841b08c602a10e7560014bec. Debian 13 VM (Xeon Gold 6136), GCC 14.2.0, Release, lavapipe (Mesa 26.1.6, LLVM 19).git diff --checkcheck_conventions.pylibs(script)mainVUID-linesagc_driver_gds_append_consume,_copiedmainNegative control: none. The only changed test is the split case, and it skips on lavapipe before it reaches the new branch.
Previous findings
docs/dev/debt/shader.md:206), and the test detects it and reports it instead of failing (GdsAppendConsume.cpp:348-355). The late-start reading fits the value: row 0 holds index 0 and the turn is zeroed just before the chunk. But it is still a hypothesis until BunnyFl's rerun prints the skip line. The description's Tested section now covers the split case on RADV (author-reported).GdsAppendConsume.cpp:470-472still skips below 32 lanes.main's 51.New findings
Blocking
None.
Non-blocking
core/libs/prx/libSceAgcDriver/tests/execution/GdsAppendConsume.cpp:354).returnskips three checks:GdsAppendConsume.cpp:353-354).check_skips.pyand the CI summaries will not show that the split case was skipped on that driver. The line is visible only with-V.docs/dev/debt/shader.md:206).Not verified
VUID-lines). Author-reported.To get this to a good state
agc_driver_gds_append_consume -Von the RX 9070 XT. The skip line (first-served row, unordered count) should support the late-start reading.-V;Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T08:19:12Z.
Review: COMMENTED
Re-checked — comments
The new commit
c9fe574f89changes how the split-dispatch case handles a late row 0. It now skips only the row 0 check and the unordered-count check. It names the skip in the test's success line, and the debt sentence is now worded as an observation. That resolves my three non-blocking findings from last time. Nothing is blocking. I still can't approve, because every ordering path skips on lavapipe and the late-start reading has not been confirmed on AMD's Windows driver.What changed since my last review
c9fe574f89. It touches onlyGdsAppendConsume.cppanddocs/dev/debt/shader.md. The earlier commits are unchanged (delta.patch).CheckChunkedRecoverynow returns a note string. With a late row 0 (lateStart):rowZero == startcheck and the unordered-count check;gds append consume tests passed (...).ds_ordered_countorder now reads "on AMD's Windows driver (RX 9070 XT) row 0 of the first 65535-row chunk was served about 65,300 places late, read as a late start".What I ran
Head
c9fe574f89eae4765a9db7ab63225b26184943af,maind1ae628bc2f62459cce1e9872ba5632c938c71f2, merged tree8e61f4646df862fd981131230909b2d4df19de2d. Debian 13 VM (Xeon Gold 6136), GCC 14.2.0, Release, lavapipe (Mesa 26.1.6, LLVM 19).git diff --checkcheck_conventions.pylibs(script)main; 1 reported as new:guest_job_manager_worker_spinguest_job_manager_worker_spinrerunVUID-linesagc_driver_gds_append_consume,_copiedmainNegative control: none. The changed test is the split case, and it skips on lavapipe before it is reached.
Previous findings
GdsAppendConsume.cppstill skips below 32 lanes.lateStart. The skipped-row, second-chunk and counter checks run in both cases, and the unordered-count check is guarded at l.359. This also answers oneandonlydean's point.-V(non-blocking): resolved. The note is now part of the success line, for the device-limit skip too. The note buffer (320 bytes) holds the longest possible message (302 characters).docs/dev/debt/shader.md:205).main's 51.New findings
Blocking
None.
Non-blocking
docs/dev/debt/shader.md:205).Not verified
lateStartbranch. They skip on lavapipe (8-lane subgroups), so the validation layer did not see them here.VUID-lines) and the faked-late-row negative control. Both are author-reported.To get this to a good state
agc_driver_gds_append_consume -Von the RX 9070 XT. The new success-line note should show the first-served row and the unordered count, and the second-chunk checks should pass there.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T08:45:59Z.
Review: COMMENTED
Re-checked — comments
Since my last review, two docs-only commits (
b337c54562,ace6406bc7) reword theds_ordered_countorder debt entry, and that resolves my one non-blocking finding. Nothing is blocking. I still can't approve: every ordering path skips on lavapipe, and nobody has yet confirmed the late-start reading on AMD's Windows driver.What changed since my last review
docs/dev/debt/shader.md. The earlier commits are unchanged (delta.patch).check_conventionsaccepts it.What I ran
Head
ace6406bc7b64bc6b37df87dd4b89f44678ffcf2,main4f41f4c375f5abb487dbd184fbc150f31994d762, merged tree4103160086b90619a4fc7ce6b8b7fcb78e6b8121. Debian 13 VM (Xeon Gold 6136), GCC 14.2.0, Release, lavapipe (Mesa 26.1.6, LLVM 19).git diff --checkcheck_conventions.pylibs(script)main.agc_driver_gds_append_consume,_copiedVUID-lines that the baseline lacks:agc_driver_native_depth_uniform_planes. That test is not this PR's (see below).The new VUID comes from `main`
mainadded this test after the validation baselined1ae628bc2, in #14005, so the baseline has no run of it. The VUID comes from the test's ownFetch::Runhelper (core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp:509-513), which callsvkCmdDispatch(commands, groups, 1u, 1u)with an X count it does not clamp. This PR leaves that file andDepthSurface.cppunchanged (thegit diff --quietabove found no difference). The PR's dispatch change inrecordDispatchonly adds the turn-reset barriers and fill, and does not change chunk sizes. So the VUID comes frommain, and I don't count it against this PR.Negative control: none. The new commits change no test or code.
Previous findings
docs/dev/debt/shader.md:205now says "skips its row 0 and unordered-count checks", which matchesCheckChunkedRecovery.New findings
Blocking
None.
Non-blocking
None.
Not verified
lateStartbranch. They skip on lavapipe, so the validation layer did not see them here.To get this to a good state
agc_driver_gds_append_consume -Von the RX 9070 XT. The success-line note should name the first-served row and the unordered count, and the second-chunk checks should pass.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T10:45:38Z.
Review: COMMENTED
Re-checked — comments
The only new commit is oneandonlydean's merge of
main4f41f4c375(818557b1c1). It movesShaderDiskCache::FormatVersionfrom 52 to 53, which settles the cache format collision. Nothing is blocking. I still can't approve, because the ordering cases skip on lavapipe and nobody has confirmed the late-start reading on AMD's Windows driver.What changed since my last review
818557b1c1, by oneandonlydean. It mergesmain4f41f4c375, the samemainmy last review was merged onto. The PR's own commits are unchanged (delta.patch).4103160086) with the current one (36e65e60f9). The only difference iscore/shader/recompiler/ShaderDiskCache.hpp:FormatVersion = 52→53.mainalready uses 52 (#10000). The PR addsorderedAppendtoencodeArtifact/decodeArtifact, so it needs its own number. 53 gives it one.What I ran
Head
818557b1c15a17baf1635e6d6c8b4f36fd7ffc98,main4f41f4c375f5abb487dbd184fbc150f31994d762, merged tree36e65e60f92172345da50815b1f247bae32efd66. Debian 13 VM (Xeon Gold 6136), GCC 14.2.0, Release, lavapipe (Mesa 26.1.6, LLVM 19).ShaderDiskCache.hpponly, 1 line (format 53)git diff --checkcheck_conventions.pylibs(script)main.agc_shader_disk_cache,_pack_ownership,_large_fileagc_driver_gds_append_consume,_copiedagc_driver_native_depth_uniform_planes. That test is not run in the baseline, and the VUID comes frommain, as I explained last time. The tree change since then (the format number) cannot affect it.Negative control: none. No test or production code changed except the format constant.
Previous findings
ShaderDiskCache.hpp:16is now 53 on the head, andmainis at 52. The disk cache tests pass.New findings
Blocking
None.
Non-blocking
None.
Not verified
lateStartbranch. They skip on lavapipe.To get this to a good state
agc_driver_gds_append_consume -Von the RX 9070 XT. The success-line note should name the first-served row and the unordered count, and the second-chunk checks should pass.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T12:03:22Z.
Review: COMMENTED
Re-checked — comments
No new commits since
818557b1c1. What changed is the author's replies at 11:45–11:46 and the description, which now says cache format 53. The author's answer on lavapipe is correct, so I'm withdrawing that point. Nothing is blocking. The split case on AMD's Windows driver still needs BunnyFl's rerun.What changed since my last review
818557b1c1.What I ran
Head
818557b1c15a17baf1635e6d6c8b4f36fd7ffc98,main4f41f4c375f5abb487dbd184fbc150f31994d762, merged tree246a0c121745326fb6f920555cd7a3bec307a38c. Debian 13 VM (Xeon Gold 6136), GCC 14.2.0, Release, lavapipe (Mesa 26.1.6, LLVM 19).git diff --checkcheck_conventions.pylibs(script)main.agc_driver_gds_append_consume,_copiedagc_driver_native_depth_uniform_planes(VUID-vkCmdDispatch-groupCountX-00386). That test was not run in the baseline, and the VUID comes frommain, as I said in an earlier review. This PR's tree has not changed since then.Negative control: none. No test or production code changed since my last review.
Previous findings
subgroupSize < 32skip that fires here is already onmain, at GdsAppendConsume.cpp#L235-L238. It covers the whole executable, includingmain's own ordered add and swap cases.New findings
Blocking
None.
Non-blocking
None.
Not verified
To get this to a good state
agc_driver_gds_append_consume -Von the RX 9070 XT at the current head. The success line should name the first-served row and the unordered count, and the second-chunk checks should pass.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T16:53:10Z.
Review: APPROVED
Re-checked — approved
No code changed since
818557b1c1. What's new is BunnyFl's rerun on the RX 9070 XT at this head, where the split-dispatch case passes in full, and the author's reply to it. That closes the last open item from my previous review.What changed since my last review
818557b1c1.818557b1c1, Windows 11, AMD Radeon RX 9070 XT, AMD driver 32.0.32015.12012, validation layer loaded.agc_driver_gds_append_consumeand_copiedpassed 20 of 20 runs.agc_driver_pm4passed 3 of 3.limit - 2.VUID-lines.What I ran
Head
818557b1c15a17baf1635e6d6c8b4f36fd7ffc98,main4f41f4c375f5abb487dbd184fbc150f31994d762, merged tree88f3e0e71c32fb2d40e6a7d07bd4d45d90963c48. Debian 13 VM (Xeon Gold 6136), GCC 14.2.0, Release, lavapipe (Mesa 26.1.6, LLVM 19).git diff --checkcheck_conventions.pylibs(script)main.VUID-lines.agc_driver_gds_append_consume,_copiedmain.Negative control: none. No test or production code changed since my last review.
Previous findings
…7029as the driver the failure was seen on.New findings
Blocking
None.
Non-blocking
None.
Not verified
The ordering, abandon, split-dispatch and CPU-copy paths. On lavapipe they skip because of the existing wave32 guard. The evidence that they pass at this head comes from others' runs, which I did not reproduce:
The AMD RX 6300 CI run was on
ace6406, which differs from this head only by the merge frommain.The author's local negative controls (1025 vs 1000, 1037 vs 1000, the 30583 bounds read, a forced-late row 0). These are reported by the author only.
PPSA08329 and the frame-time A/B. I did not run a title.
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T19:59:42Z.
Review: APPROVED
Re-checked — approved
The only new commit is
390b05a599, which mergesmain086c0686c8into the branch. The PR's own changes come through it unchanged apart from line offsets, so my approval of818557b1c1still holds.What changed since my last review
390b05a599.git diff 4f41f4c375 818557b1c1withgit diff 086c0686c8 390b05a599. The added and removed lines are the same in both; only hunk offsets and context lines differ.GdsBindingBytesimport check in theVulkanDeviceconstructor now sits aftermain's newoversizedBufferlines. TheresetOrderedTurnlambda and the per-chunk reset inrecordDispatchare unchanged.mainat086c0686c8hasShaderDiskCacheFormatVersion = 52. The merged tree has 53, so the format is still distinct frommain's.main: the 141 filesmainchanged since4f41f4c375add or remove no lines that mentionGdsBytes,GdsAddress,DataOrdered*,OpArrayLengthorgdsLength.What I ran
Head
390b05a599a13176b5b4add8cfc2856ba2eb5519,main086c0686c8adff3ee648fdbe34e0b0b647e1d511, merged tree8ef8ee6a829c5ddb2e120b9437c451ad1e991804. Debian 13 VM (Xeon Gold 6136), GCC 14.2.0, Release, lavapipe (Mesa 26.1.6, LLVM 19).git diff --checkcheck_conventions.pylibs(script)main.agc_atomic_gds_size,agc_driver_gds_dma_fill,_private,agc_guarded_memory_loadsagc_driver_gds_append_consume,_copiedmain.VUID-lines:agc_driver_image_gather_volume(VUID-VkSamplerCreateInfo-addressModeU-01079and others). They come frommain, not this PR: the test's sourcetests/execution/ImageGatherVolume.cppis inmain086c0686c8but not in the baseline1e658521a0, and this PR doesn't touch it.Negative control: none. No test or production code changed since my last review.
Previous findings
My previous review had no open findings: the AMD Windows split-dispatch item was already resolved. Nothing in the merge reopens it, because the PR's diff to the test and the driver paths is unchanged.
New findings
Blocking
None.
Non-blocking
None.
Not verified
390b05a599has been posted yet.Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-06T14:10:22Z.
Review: APPROVED
@ZSWolt approving at
c95587e63b. My only formal review here is the 11-02 comment on5332c91593about the late row 0. The split-dispatch case now reports that case instead of failing, and my 11-06 rerun at this head passed. This adds the gated run with a negative control that I hadn't done.What I ran. This head merged onto
main1ff0fe98aa(merge98ea5d2326, clean), Windows 11 Pro, WinLibs GCC, Release, AMD Radeon RX 9070 XT (vulkaninfo: driverInfo26.10.2 (LLPC), driverVersion2.0.416), withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationandctest -V:agc_atomic_gds_size,agc_driver_gds_append_consume,agc_driver_gds_append_consume_copied,agc_driver_gds_dma_fill,agc_driver_gds_dma_fill_private,agc_driver_pm4andagc_guarded_memory_loads: 7 of 7 pass, none unbuilt or skipped. Both append-consume tests print the plaingds append consume tests passed, the empty-note branch atGdsAppendConsume.cpp:533-534; neither skip note fired.VUID-and noSYNC-HAZARDids.core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvMemoryInstructions.cpptaken frommainfails both append-consume tests, withgroup 0 lane 0 returned 1032, expected 1000 (the counter in launch order)andreturned 1012for the copied registration. The other five still pass.Overlap, checked with
tools/pr_overlap.py --branchat this head:core/shader/recompiler/ShaderDiskCache.hppL16 (the cache format number) is shared with 13 open pull requests; whichever lands later takes the next number, as with your earlier merges.GuestBufferMemory.hppL607 onmain, which this branch also changes. Both are in the review queue; one of you will need to merge after the other lands.VulkanDevice.cppL5904 andShaderResources.hppL265, and #14247 sharesdocs/dev/debt/shader.mdL210-211.mainand could not be compared.Approving.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-06T18:34:42Z.
Review: APPROVED
@ZSWolt re-checked at
3f6d916dd5, and my approval stands.3f6d916dd5mergesmain(cefc546c86) ontoc95587e63b, the head I approved. The PR's own +/- lines are identical at both heads in every file it changes.What I ran
Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0, Release, this head merged onto current
main(mergecefe4daece). The GPU is an AMD Radeon RX 9070 XT (0x1002:0x7550, Vulkan API0x404167, as the test logs report it). Windows reports driver 32.0.32015.12012, read right after the runs; the logs don't print it.ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ctest -V, with the same seven tests as at my approval:agc_atomic_gds_size,agc_driver_gds_append_consume,agc_driver_gds_append_consume_copied,agc_driver_gds_dma_fill,agc_driver_gds_dma_fill_private,agc_driver_pm4andagc_guarded_memory_loads: 7 of 7 pass.main'score/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvMemoryInstructions.cpp.agc_driver_gds_append_consumeandagc_driver_gds_append_consume_copiedfail; 5 of 7 pass.was not found but was requested by env var VK_INSTANCE_LAYERS. Both have noVUID-and noSYNC-HAZARDIDs.tools/check_conventions.py --base upstream/main --headon this head: all checks pass.Overlap
tools/pr_overlap.py --branchon this head:Graphics/include/GuestBufferMemory.hppL607, as at my approval.Execution/src/VulkanDevice.cppL5904 andGraphics/include/ShaderResources.hppL265.core/shader/recompiler/ShaderDiskCache.hpp(L16), the shader cache format number.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-08T11:50:01Z.
Review: COMMENTED
Ran
3f6d916dd5merged onmain302864d48con Windows 11 x64 (WinLibs GCC 15.2), on an NVIDIA laptop GPU (Turing, driver 621) and an Intel iGPU (driver 101.70xx), withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(Khronos validation layer 1.4.368),ctest -R '^(agc_guarded_memory_loads|agc_driver_gds_append_consume)' -V.On the Intel iGPU the change breaks
agc_driver_gds_append_consume, which passes onmain:mainOn Intel, both runs fail the same way:
agc_driver_gds_append_consumestops with "read-write alias of shared guest memory 0x200000000+0x14000: a page extends past the end of its file". Onmain, the same test on the same GPU passes.agc_driver_gds_append_consume_copiedfails with "65538 single-wave groups along y in chunks of 65536, row 1 skips ds_ordered_count: row 65537 in the second chunk returned 0, expected 66536 (the second chunk is ordered after the reset)".On NVIDIA, all three pass both times. The layer was inserted in every test that opens a device (
agc_guarded_memory_loadsdoesn't open one). No log haswas not found but was requested by env var VK_INSTANCE_LAYERS, and no log on either side has aVUID-, so neither Intel failure comes with a validation error.The description's run is on RADV only, so this is the first run on an Intel driver.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T21:58:49Z.
Review: COMMENTED
Reviewed — comments
The inspected code includes launch-order assumptions that the PR documents, but this review did not cover every changed file or run checks, so a formal approval is not justified.
What I ran
Head:
9d2d569f180e22993baeb08004d046c3e2dc1fe8. No commands or tests were run. I read the review description, commit list, manifest and diff, then inspected targeted source ranges.Results
Findings
Blocking
None in the inspected code.
Non-blocking
None.
Not verified
I read
Execution/include/Pm4.hpp,Execution/src/Pm4.cpp, targeted ranges ofExecution/src/VulkanDevice.cpp,Graphics/include/GuestBufferMemory.hpp,Graphics/include/ShaderResources.hpp, targeted ranges ofGraphics/src/GuestBufferMemory.cppandGraphics/src/ShaderResources.cpp,tests/Pm4.cpp,tests/cmake/agc_driver_graphics_tests.cmake,tests/execution/GdsAppendConsume.cpp,shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvMemoryInstructions.cpp,shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp, and the review documents. Other changed files listed in the manifest were not read, including the remaining recompiler changes,GuardedMemoryLoads.cpp, the new CMake test registration, anddocs/dev/debt/shader.md. Runtime behavior, test results, validation output, and performance claims were not independently verified.To get this to a good state
Nothing is required. Optional: complete review of the unread changed files and run the relevant checks before a formal approval.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T19:38:33Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the ordering path, metadata bounds, per-chunk reset, and added coverage are supported by the code inspected.
What I ran
Reviewed head
294347f4dc5e12f6ce0be825679b32e5180a02aausing the prepared diff andrepo_read.pyat the pinned head. No build or tests were run. Read the changed code and its relevant callers for the ordered SPIR-V emission, input declarations, GDS resource preparation and fill target, dispatch reset, and disk cache format; also read the added append/consume test code and GDS range helpers. The entire files at the head were not read.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Did not run a build, tests, validation layers, or console/game checks. Author-reported test and hardware results were not independently verified. Files listed as excluded in
files.jsonwere not read in full; relevant changed hunks inVulkanDevice.cpp,GuestBufferMemory.cpp, andShaderResources.cppwere read through the pinned reader.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T01:55:45Z.
Review: CHANGES_REQUESTED
I re-audited the still-open Intel A78B split-dispatch result on exact head
294347f4dc5e12f6ce0be825679b32e5180a02aabefore repeating it on the updated driver. The fixture itself runs and reads one row beyondChunkOutputwhen the device reports a Y workgroup limit of 65,536, so my earlierrow 65537 returned 0report cannot establish a reset/order defect. Details are inline.I did not run a new build or hardware test after finding this; the fixture needs to be made in-bounds first.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:54:31Z.
Review: COMMENTED
The trial merge conflicts across the device, shader resources, recompiler and shader-cache schema. Please retain a regression that deliberately has wave arrival order differ from launch order and checks the value returned to each wave, alongside a mixed workload that still uses the unordered path. Those controls cover the ordering guarantee and whether the new state leaks across draws or dispatches. Please put the shader debt edit in a fragment. I have no paired GPU result for this conflicted head.
AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.