fix(shader): synchronize GLC and DLC buffer accesses on MoltenVK with device atomics and the guest's release and acquire #14217
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14217"
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 frankea on 2026-11-01T00:27:00Z.
What
On MoltenVK, GLC and DLC buffer accesses through a bound buffer descriptor now follow a defined synchronization protocol under the Vulkan memory model:
buffer_load_*reads is a relaxed device-scopeOpAtomicLoad, as in the previous revision;buffer_store_*writes is a relaxed device-scopeOpAtomicStore(a sub-dword or misaligned store goes through the existing compare-and-swap of its word instead of plain byte stores);s_waitcnt_vscnt(the GFX10 release before a store) andbuffer_gl0_inv/buffer_gl1_inv(the GFX10 acquire after a load).Relation to #18600.
mainnow has #18600, which addsAPS5_COHERENT_ATOMIC_LOADS: when set, GLC buffer loads on any driver become the same relaxed device-scopeOpAtomicLoad, with no atomic stores and no fences. This PR now reuses that emission.readBufferhas oneOpAtomicLoadline, taken when either the MoltenVK target flag or the switch asks for it. What this PR adds on top: the atomic stores, the release and acquire fences, and turning all of this on by default for MoltenVK. On other drivers nothing changes unless the switch is set, and then they get only #18600's atomic loads.Before, the descriptor path read with a
VolatileOpLoadof theCoherentbuffer array, which MoltenVK turns into a plain Metal load: on an Apple M5 Max a work-group spinning on it saw another work-group's store milliseconds late or not at all within a 100 ms cap, and GT7's BVH radix sort look-back (program 0x14574d800) sat for 20 to 85 s per batch.Semantics and sources
load atomic monotonicat agent scope isbuffer/global/flat_load glc=1 dlc=1,store atomic monotonicisbuffer/global/flat_store(GLC on GFX10 for agent scope),load atomic acquireis that load followed bys_waitcnt vmcnt(0),buffer_gl0_invandbuffer_gl1_inv, andstore atomic releaseiss_waitcnt vmcnt(0) & vscnt(0)(s_waitcnt_vscnt null, 0x0) before the store. So guest code that publishes data behind a flag does so with exactly these instructions, and they are where this change puts the fences.OpMemoryBarrierwithDevicescope andAcquireRelease | UniformMemoryis such a fence for storage buffer memory.OpAtomicLoad/OpAtomicStorebecomeatomic_load_explicit/atomic_store_explicitwithmemory_order_relaxed(L9749-L9757, L11635-L11639). The SDK'sspirv-cross(vulkan-sdk-1.4.357.0-39-gf11ba9f0,--msl --msl-version 30200 --msl-argument-buffers) on the new test's two modules, captured withAPS5_DUMP_COMPUTE_PIPELINES, gives exactly that for the loads and stores andatomic_thread_fence(mem_flags::mem_device, memory_order_seq_cst, thread_scope_device)for the fences;spirv-val --target-env vulkan1.1passes on both. Metal Shading Language Specification 3.2, sections 4.8 and 6.15.2-6.15.3, requires that pairing of device atomics and athread_scope_devicefence for one threadgroup to observe another's writes (Apple in developer forums thread 756663).Change
SpirvTarget::coherentBufferAtomics(renamed fromcoherentBufferAtomicLoads), plumbed likeldsLockFences:SpirvTargetOptions,SpirvEmitterState,Recompiler.cpp, the shader cache key andagc_shader_replay --coherent-buffer-atomics.VulkanDevicesets it only forVK_DRIVER_ID_MOLTENVK(CoherentBufferAtomicsRequired).coherentBufferAtomicsfromrequest.target, and thens_waitcnt_vscnt(SOPK opcode 0x17) emits a newGuestReleaseIR instruction instead ofWaitcnt, andbuffer_gl0_inv/buffer_gl1_invemitGuestAcquireinstead of a control no-op (still markinginvalidatesCaches). Without the flag they decode as onmain(Waitcnt,ControlNop), so dead-code elimination removes the invalidates as before and every later pass seesmain's IR. Both opcodes are appended toIrOpcodeaftermain'sNanPropagateF32and have side effects. Stencil and layer replay (StencilReplaySafe,LayerReplaySafe) and the quad-helper proof of tessellation lowering (NoOp) accept them as they acceptWaitcnt.OpMemoryBarrier(Device, AcquireRelease | UniformMemory), and coherent BDA load grouping (WritesMemory, used byAdjacentBdaLoads/BdaReadSites) stops at them; without the flag they never reach the emitter. With the flag off the SPIR-V is byte-identical tomainon every module compared (see Tested). The only change on other drivers is the new field in the shader cache key, so their cache entries are rebuilt once.readBufferreads coherent dwords withOpAtomicLoadas before, andwriteBufferstores an aligned coherent dword withOpAtomicStore; with the flag a coherent sub-dword store skips the 8-bit buffer view and uses the compare-and-swap path.mainef7dc4452d(3c63ea3016): the conflicts were appends next tomain's newspannedShuffleThroughMemorytarget field (SpirvTarget,SpirvTargetOptions,Recompiler.cpp, the cache key, theShaderDiskCachechanges list andagc_shader_replay); both are kept. This merge also sets3rdparty/SDL2back tomain's 74be4c2836: the earlier merge77a5d1378ahad moved it by mistake, and the PR no longer changes it. On the M5 Max (local MoltenVK build, validation layer inserted), 2ctest -Vruns: 16 of the 18 focused tests pass in every run with 0 VUID, andagc_driver_coherent_atomic_loadsand_enabledskip (main's host-import check).mainc8f72e905c(2a7536b6d1): the only conflict was theWritesMemorycondition inSpirvMemoryInstructions.cpp;main'sStoreSplitStateterm and this PR's flag-gatedGuestAcquire/GuestReleaseterm are both kept. On the M5 Max, 2ctest -Vruns per ICD (SDK MoltenVK and a local build) with the validation layer: 16 of the 18 focused tests pass in every run with 0 VUID, andagc_driver_coherent_atomic_loadsand_enabledskip (main's host-import check,/dev/udmabuf).maine4caa07950(f0458b768d): the only conflict was intests/execution/CoherentAtomicLoads.cpp;main'sSkipWithoutSharedMemoryStores()and this PR'scoherentBufferAtomicsterm are both kept, soagc_driver_coherent_atomic_loadsnow skips on macOS.main0694c4cbd6(2b797e1f69): the only conflict was theIrOpcodeappend;main's opcode numbers are unchanged. Earlier merge withmain70bb3678d8(#18600):readBufferkeepsmain'sOpAtomicLoademission and takes it forcoherentBufferAtomicsorAPS5_COHERENT_ATOMIC_LOADS. The access trace inGuardedMemoryLoads.cpphandlesOpAtomicLoadin one place for both. This PR's "without the flag" checks there follow the switch, so the suite also passes inmain'sagc_guarded_memory_loads_coherent_atomic_loadsregistration.agc_driver_coherent_atomic_loads(from #18600) expects atomic loads when the device target setscoherentBufferAtomicsas well as when the switch is set, so on MoltenVK it now runs its waiting dispatch without the switch. The debt entry points at #18600's "Coherent buffer loads" entry.robustBufferAccess2leaves out-of-bounds atomics undefined.docs/dev/debt/shader.mdthrough the fragmentdocs/dev/debt/changes/fix-moltenvk-coherent-buffer-loads.md(aligned dword stores areOpAtomicStore; misaligned dword and sub-dword stores are compare-and-swap updates), lists what is not covered: the BDA path (V#s known only at run time, FLAT and global), where GLC stores and GLC sub-dword or misaligned loads stayVolatile; GLC scalar loads; a plain store racing a GLC load; guest code that orders data without those instructions.Tested
Apple M5 Max, macOS 27.0.1, x86-64 under Rosetta 2, AppleClang 21, MoltenVK 1.4.2 (LunarG SDK 1.4.363.0), with
ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1.Head
f0458b768d(maine4caa07950merged in), M5 Max, 2ctest -Vruns per ICD (SDK MoltenVK and a local build) with the validation layer: the 13 tests below plusagc_driver_stencil_replay,_no_gpland_unsuppressedpass 16/16 with 0 VUID;agc_driver_cross_workgroup_buffer_flagpasses 8 of 8 runs each time;agc_driver_coherent_atomic_loadsand_enabledskip (main's shared-memory-store check).Head
1b5bc3e243(main0694c4cbd6merged in): default path.agc_shader_replaybuilt frommain0694c4cbd6and from the head, flag off, on the M5 Max (the replay does not read the flag from the request, so these are the modules other drivers get, with the M5 Max's other target fields):s_waitcnt_vscntorbuffer_gl0_inv/gl1_invglobal_load_dword4 bytes apart × {nothing,s_waitcnt,s_waitcnt_vscnt,buffer_gl0_inv,buffer_gl1_inv,s_dcache_inv, all} × {plain, glc} × {wave32, wave64}s_waitcnt_vscnt,buffer_gl0_invandbuffer_gl1_invinserted at the startThe other 10,421 GT7 requests fail the same way in both builds (most were dumped in an older request format). With
--coherent-buffer-atomicsthe head changes all 3,015 modules with a fence and fails none. A replay built with the previous head's behaviour (fences decoded on every target,WritesMemoryungated) differs frommainon 8 synthetic requests (wave32, the three fences and all of them, plain and glc), so the comparison sees the regression the review described. The same comparison on the RTX 4090 was not run (see below).New regression tests, each checked by reverting its fix line:
GuardedMemoryLoads.cppcompiles twoglobal_load_dword4 bytes apart withs_waitcnt_vscnt null, 0x0orbuffer_gl0_inv/gl1_invbetween them (flag off: one BDA read, no fence, module identical tos_waitcntors_dcache_inv; flag on: two reads and one fence), checks the same cut on the IR, and counts the translated opcodes with and without the flag;TessellationLowering.cpplowers a hull whose whole-quad-gated block holdsWaitcnt,ControlNop,GuestReleaseorGuestAcquire;MaskedSelect.cppchecksLayerReplaySafewith each.Head
1b5bc3e243on the M5 Max, 3ctest -Vruns per ICD withVK_LOADER_LAYERS_ENABLE=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer, 13 tests (agc_driver_coherent_atomic_loadsand_enabled,agc_driver_cross_workgroup_buffer_flag,agc_guarded_memory_loadsand_coherent_atomic_loads,agc_shader_disk_cache,_pack_ownershipand_large_file,agc_shader_memoryand_coherent_atomic_loads,agc_subgroup_barrier,agc_tessellation_lowering,agc_masked_select): 13/13 in every run on the SDK's MoltenVK and on a local MoltenVK build, the layer inserted in each GPU test, no VUID.Head
1b5bc3e243andmain0694c4cbd6on an RTX 4090 (driver 621.14, Windows 11 10.0.26200, winlibs GCC 15.2.0),VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer, 3 runs each, no VUID in any run:mainagc_driver_cross_workgroup_buffer_flagmainagc_driver_coherent_atomic_loadsand_enabledagc_driver_stencil_replay,_no_gpl,_unsuppressedagc_masked_select,agc_tessellation_loweringguest_job_manager_worker_spin,_scale_0.1,_scale_10Without the layer, 5 runs per side, main and head taking turns, median:
agc_driver_coherent_atomic_loads0.44 / 0.45 s,agc_tessellation_lowering2.19 / 2.09 s,guest_job_manager_worker_spin20.76 / 20.62 s,_scale_0.120.75 / 20.72 s,_scale_1020.65 / 20.78 s;agc_driver_cross_workgroup_buffer_flag0.43 s on the head. Fullctest -R ^agc_: 1,908 tests on the head and 1,907 onmainfail the same 96 tests (pre-existing failures and tests that could not be built on both), plusagc_guarded_memory_loadsand_coherent_atomic_loadson the head only. On that box Windows Defender deletesagc_shader_replay.exeand 34 to 35 test executables right after linking, on both trees, so the 4090 SPIR-V comparison,agc_guarded_memory_loadson the head, andagc_shader_disk_cache,agc_shader_memory,agc_subgroup_barrieron both did not run there;main0694c4cbd6f'sUploadCacheReadOnlyFlush.cppalso does not compile with MinGW (setenv).The sections below are from earlier heads.
Previous head
beb5d86441(main70bb3678d8merged in), on the M5 Max. Two ICDs, both MoltenVK 1.4.2: the SDK's stocklibMoltenVK.dyliband a local build. 3ctest -Vruns per ICD withVK_LOADER_LAYERS_ENABLE=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer, and 3 without the layer. The loader inserted the layer into each GPU test of every validation run, and no run printed a VUID. No local source patch was needed for these targets. Themainside is the 11/10 build ofmain0aa98c0a07with onlyCrossWorkgroupBufferFlag.cppadded. It is older than the head'smainbecause the contrast could not be rebuilt here.main0aa98c0a07+ test fileagc_driver_cross_workgroup_buffer_flagagc_guarded_memory_loads,agc_guarded_memory_loads_coherent_atomic_loadsagc_driver_coherent_atomic_loads,agc_driver_coherent_atomic_loads_enabledagc_shader_disk_cache,agc_shader_memory,agc_shader_memory_coherent_atomic_loads,agc_subgroup_barrierThe RTX 4090 was not run on
beb5d86441.Earlier head
7f3f4f3ca0, compared withmainon the same GPU (main0aa98c0a07, and the head merged onto it with--no-ff, tree d23a7b8b1a; not pushed). Every run used the documented setupVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -V, 3 runs per side plus 1 withVK_KHRONOS_VALIDATION_VALIDATE_SYNC=true. The layer was inserted in every Vulkan run, and no run printed a VUID, SYNC-HAZARD or other validation message.mainhas noagc_driver_cross_workgroup_buffer_flag, so its side adds only this PR'sCrossWorkgroupBufferFlag.cpp.mainagc_driver_cross_workgroup_buffer_flagagc_guarded_memory_loadsagc_driver_cross_workgroup_buffer_flagmainagc_guarded_memory_loadsThe
7f3f4f3ca0runs on the M5 Max needed a local, uncommitted macOS build patch on both sides. On the RTX 4090 (Windows 11 10.0.26200, GCC 15.2.0)coherentBufferAtomicsis false; at7f3f4f3ca0this PR still changed the grouping of coherent BDA loads there, which1b5bc3e243removes, andmainalready passes the handoff. The PR head was not run by itself.agc_driver_cross_workgroup_buffer_flag(hand-encoded RDNA; the assembly is attached to the PR as a comment)Two one-wave work-groups hand a token back and forth 128 times through a V#, 4 rounds in wave64 and wave32:
buffer_store_dwordx4 glc),s_waitcnt_vscnt null, 0x0, then the token (buffer_store_dword glc);buffer_load_dword glc dlc, thenbuffer_gl0_invandbuffer_gl1_inv, then reads and checks the payload withbuffer_load_dwordx4 glc dlc.A schedule that runs one work-group after the other is valid under the execution rules, so the test no longer counts it as a failure. Each work-group counts itself in with
buffer_atomic_addwhen it starts and out when it ends, and reads the started count before each wait. A work-group that gives up records whether its partner had started before that wait and had not yet ended. A run fails only when a work-group gave up while its partner was running, or read a stale payload. Runs in which neither happened and the token did not arrive count as not concurrent, and when no run was concurrent the test exits 77 (skipped).e822926fdd(merged withmain7383be1a19): 3 test runs, each 8 of 8 runs passed, 191 to 257 spins per work-group for 64 turns, 0 stale payloads; before the merge, on8ab66ce9bc, 8 of 8 with 227 to 256 spins.8ab66ce9bcwithCoherentBufferAtomicsRequiredreturning false: 8 of 8 runs failed, every work-group gave up while the other was running (1,000,000 spins), so the concurrency check does not hide the failure.agc_guarded_memory_loads, new case "coherent buffer publication" (no GPU). It emits a coherent dword store,GuestRelease, a store of the flag, a load of the flag,GuestAcquireand a load of the data, and the same program without the two guest instructions:OpAtomicStore, noVolatileaccess is left, and the guest instructions add exactly twoOpMemoryBarrierwithDevicescope andAcquireRelease | UniformMemory;Volatile.The existing "coherent buffer atomic loads" case still passes. On
7f3f4f3ca0a third case, "coherent loads either side of a guest fence are not read as one vector", checks that two coherent BDA loads give one read with nothing between them and two with aBarrier,GuestAcquireorGuestReleasebetween them.Focused set (the same selection, now 106 tests on
main7383be1a19), on the heade822926fdd: 95 pass, 11 skip (64-bit buffer, image and global atomics, float atomics, mesh shaders and subgroup arithmetic in vertex shaders on MoltenVK), 0 fail. On the pre-merge tree8ab66ce9bcthe same selection (101 tests) gave 88 pass, 11 skip and the 2 failures of the previous revision (agc_driver_lds_subword_store_branchandagc_driver_lds_tree_reduction, the wave-LDS barrier issue #10858 addresses), which pass withmainmerged in.On
e822926fddthe branch mergedmain7383be1a19; the conflicts were appends next tomain's new target fields and replay options, andreadBuffer's robust-load setup, which keepsmain'sboundedEnable. The RTX 4090 focused set on an earlier revision gave 100 pass, 1 skip, 0 VUID lines onmainand the branch; on7f3f4f3ca0the 4090 ran the two tests in the table above.Title, offline only (previous revision, atomic loads only)
In the game, on the M5 Max: this branch was not run by itself. A local GT7 build with this change, the LDS lane-order change #14218, a subgroup-scope variant of the #10858 barrier fix and other unmerged changes went through the Fit presentation, the scene that builds the large ray-tracing BVHs, with no GPU batch over 3.2 s and no cyclic tree in about 1,800 checks of GT7's parent walk. An earlier run of the same build without this change had batches of 20 to 85 s in that scene.
The offline runs below use a local harness that is not part of this PR and that replays GT7's radix sort pass (0x14574d800) from a captured request with its real keys, through this branch's recompiler with the flag forced off or on. These runs were made before the rebase, on
ca073ec3ad. Every submission ran under a 1 s watchdog.Conventions and overlap
tools/check_conventions.py --base origin/main --title ... --bodyon this description: all checks passed.tools/pr_overlap.py --branchagainstmain8a4fc62318: no open PR makes this change. The GPU descriptor heap series (#7642, #9508, #10193, #13928, #13929) changes the same lines ofreadBuffer; it usesOpAtomicLoadonly for its own opt-in physical-pointer path (APS5_GPU_HEAP/APS5_GPU_PATH), and it also treats loads in programs that invalidate caches as coherent and makes them atomic on every driver, so whichever merges second has to reconcile this gate with that predicate, not only the text. All five conflict withmainnow, so the tool could not compare them; the run againstb08c539c50confirmed #9508 on those lines. Other confirmed overlaps are positional appends toSpirvTarget, the cache key, theShaderDiskCachechanges list andagc_shader_replay: #10547, #10846, #11265, #11483 and #12250. 89 PRs that share files with this branch conflict withmainand could not be compared, among them #11351, #12662 and #12980, which earlier runs found appending to the same lists. The LDS lane-order change #14218 adds lines at the same places in 7 files (SubgroupBarrier.hpp,VulkanDevice.cpp,ShaderDiskCache.cpp,ShaderReplay.cpp,SpirvEmitterState.hpp,SpirvEmitter.cppand the shader debt file); whichever of the two merges second needs a rebase.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)f0458b768d,1b5bc3e243,beb5d86441and7f3f4f3ca0); NVIDIA GeForce RTX 4090, driver 621.14 (1b5bc3e243) and 616.92 (7f3f4f3ca0), Windows 11 10.0.26200Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T01:23:48Z.
Review: DISMISSED
Reviewed — changes requested
The new
OpAtomicLoadpath can overlap plainOpStorewrites without a defined synchronization protocol.What I ran
Reviewed head
4424540275b94cef462dafa1fe8c84427348ace2, based on PR basecc26ab44380db3cd7b53715b84f13945227ce28b; its merge preview onto currentmainc763ea56aae3bb60cd6e22064a6a21482a58a980was clean. Environment: Debian Linux x86_64, Python 3.11.2, Git 2.39.5. No compiler or build was used.Results
Unedited local output
Conventions check:
The precheck recorded these helper errors:
Findings
Blocking
readBuffernow emits a device-scopeOpAtomicLoadwithMemorySemanticsMaskNone, while GLC/DLC stores remain ordinaryOpStores and the guest wait/invalidate operations add no fence. When one workgroup publishes a token or payload and another polls/reads it, the accesses overlap without mutually ordered atomic operations or a release/acquire synchronization. The new GPU test demonstrates observed delivery on the M5 Max, but does not make the mixed atomic/non-atomic protocol defined. Please provide a synchronization design valid for this Vulkan/MoltenVK path, including publication and payload visibility, and test that emitted protocol; otherwise keep this path unsupported until that contract is established.Non-blocking
Sources
Not verified
No local build or C++/Vulkan tests were run. I did not test an AMD GPU or PS5. Author-reported GPU results were read but not independently confirmed.
To get this to a good state
Establish defined synchronization for the atomic loads, publishing stores and payload reads on MoltenVK, then add a focused test for the emitted synchronization and rerun the hardware case. I will rerun the same relevant checks on the updated head.
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T08:45:43Z.
Review: DISMISSED
Reviewed — changes requested
This pull request does not merge cleanly into
main(4f41f4c375): head4424540275conflicts incore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/shader/recompiler/CacheKey.hppcore/shader/recompiler/Recompiler.hppPlease rebase it onto current
main. I will review the change once it merges cleanly.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-10T20:56:51Z.
Review: COMMENTED
Re-checked — new head, no blocker found
The earlier mixed atomic/non-atomic publication issue appears addressed by the new atomic stores and guest release/acquire fences; hardware validation on this exact head is not available, so this is a comment rather than an approval.
What I ran
Reviewed head
7f3f4f3ca0cae2005ebb8cf352f28a6ab0be5381against currentmain02c52411e5b4df59e192301818182a228a9d353b; the merge preview is clean. Environment: Debian Linux x86_64, Python 3.11.2, GCC 12.2.0.I also read the changed synchronization, code-generation, tests, cache-key, driver-selection, and debt-entry hunks. No local build or CTest was run.
Results
mainRecorded output
Diff check:
Conventions:
Mergeability:
Hosted checks:
Findings
Blocking
None found in the reviewed head.
Non-blocking
None.
Sources
Not verified
e822926fdd, not this final head.To get this to a good state
Please attach the focused
agc_guarded_memory_loadsresult and theagc_driver_cross_workgroup_buffer_flagresult for this exact head. For the hardware case, comparemainand this head on the same GPU with the documented validation-layer setup. I will re-check the same head and evidence before changing this review status.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-10T22:04:56Z.
Review: COMMENTED
Re-checked — new head, no blocking code defect found
The synchronization changes address the earlier mixed atomic/non-atomic concern; this is a comment because the exact current head lacks a successful run of its cross-workgroup GPU test and the latest Windows workflow is red on unrelated timeout tests.
What I ran
Reviewed head
bddf2c11efb6a8c9435bf09e053a7d20d914e68eagainst currentmainbase539e858408186c0b510680a03a5243b761038730; the merge preview was clean and both stayed unchanged during the precheck. I read all 23 changed files, the full diff, the prior review discussion, and the latest hosted Windows log.Environment: Linux 6.1, Python 3.11.2, GCC 12.2.0. No local build or C++ tests were run.
Results
All conventions checks passed.main.agc_guarded_memory_loadsagc_driver_cross_workgroup_buffer_flagguest_job_manager_worker_spin*tests timed out; none of those test sources is changed by this PR. I cannot attribute the timeouts to this change from the available evidence.Recorded output excerpts
The hosted log ends with:
Negative control
Not run. No implementation or test mutation was made for this review.
Findings
Blocking
None found in the current diff.
Non-blocking
The current exact-head Windows run skips
agc_driver_cross_workgroup_buffer_flag, and the GPU comparison posted in the discussion is for the earlier feature head merged onto an oldermaintip. The synchronization behavior on the exact current merged head is therefore not independently verified here. The Windows timeouts are in unchanged test sources and are not evidence of a defect in this PR.Sources
Not verified
To get this to a good state
No code change is requested from this review. For an approval-level verdict, run the focused cross-workgroup test on the current head on the target GPU path and rerun or compare the Windows timeout tests against
main. I’ll re-check the same evidence on the current head before changing this review status.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T07:03:15Z.
Review: COMMENTED
Reviewed — comments
Nothing blocks this review; the points below are optional.
What I ran
Reviewed head
beb5d86441f3f9cd767107ff8956ea379b70dc43. I inspected the prepared description, commit list, manifest, and patch; no tests were run. The author-reported tests in the description were not independently run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The full text of
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppwas excluded from the review folder and was not read through the pinned reader. Other changed files were included and reviewed through their prepared patch; the relevant shader memory emitter and Vulkan target setup were also checked at the pinned head. Runtime behavior and the author-reported test results were not independently verified.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T23:02:38Z.
Review: COMMENTED
Reviewed — comments
The inspected changes support the stated MoltenVK synchronization path, but I could not run checks or inspect every changed file, so approval is not justified.
What I ran
Reviewed head
f0458b768d75d6cfcde83aa62eab5d7a178f1c5bfrom the prepared diff and targeted source reads viarepo_read.py. No commands or tests were run.Results
Findings
Blocking
None identified in the inspected code.
Non-blocking
None.
Sources
Reviewed
description.md,commits.md,manifest.json, anddiff.patch. Read the changed source ranges inVulkanDevice.cpp,SpirvRuntimeBuffer.cpp,ScalarInstructions.cpp,MemoryInstructionDispatch.cpp,SpirvMemoryInstructions.cpp,IrOpcode.cpp, andSpirvFlowEmitter.cpp. The diff was reviewed for all listed changes;VulkanDevice.cppwas excluded from the prepared full-text bundle and read through targeted source ranges.Not verified
Tests and runtime behavior were not independently run. Full source text for changed files other than the targeted ranges above was not read. The author-reported test results were not independently confirmed.
To get this to a good state
Nothing is required. Optional: independently run the reported focused tests and confirm the MoltenVK behavior at the pinned head.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T03:45:18Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
77a5d1378a. Base: main.ctest, no GPU run.Results
Findings
Blocking
None.
Non-blocking
3rdparty/SDL2:1: the PR moves the SDL2 submodule pointer from 74be4c2836 to 4b69833bc5. This is unrelated to the shader fix, the description does not mention it, and the checklist asks for one topic per PR. Drop the bump from this branch, or say why it is needed.core/libs/prx/libSceAgcDriver/tests/execution/CrossWorkgroupBufferFlag.cpp:102:RunreturnsNotConcurrentwhen the reader gave up after its partner had ended, the token never arrived, and no payload was stale.maincounts that as neither a pass nor a failure. If every run ends this way, the test prints the skip message, so a lost token after the writer finished would not fail. Fail when the partner had already ended and the token is missing.Not verified
ctest, or GPU run in this review. MoltenVK, Metal and console behaviour are not checked.1b5bc3e243and earlier (f0458b768d,beb5d86441,7f3f4f3ca0). The review head77a5d1378ais not named in the Tested sections, so I could not confirm the tests cover it.3rdparty/SDL2: the run lists it as reviewed, but it is a submodule pointer and its content is not plain text. I did not read it.core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp: too large for the review folder. Read only at its three changed ranges through the reader, not in full.core/libs/prx/libSceAgcDriver/tests/execution/CrossWorkgroupBufferFlag.cpp:61: the~GuestBlockdestructor callsRemoveand never frees the 64 KiB block. I could not confirm whetherRemovefrees it, because the header path I searched had no match. Not counted as a finding.To get this to a good state
Nothing is required. Optional: the two non-blocking points above, and a note in the Tested section for
77a5d1378aif its test run differs from1b5bc3e243.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T02:22:00Z.
Review: COMMENTED
Reviewed — no blocking findings
No verified blocking defect was found in the inspected changes; review coverage is incomplete, so approval is not justified.
What I ran
Reviewed head
49e86697421343232964f870929ba3f7d480e746using the prepared diff and pinned repository reader. No tests or build commands were run.Results
Negative control
Not run by this reviewer; the description reports author-run regression checks.
Findings
Blocking
None verified in the inspected changes.
Non-blocking
None.
Sources
Reviewed the prepared diff and head source for
VulkanDevice.cpp,SubgroupBarrier.hpp,CrossWorkgroupBufferFlag.cpp,CoherentAtomicLoads.cpp,MaskedSelect.cpp,TessellationLowering.cpp,CacheKey.hpp,IrOpcode.cpp,QuadHelperProof.cpp,StencilReplay.cpp,TranslationContext.hpp,MemoryInstructionDispatch.cpp,ScalarInstructions.cpp,SpirvRuntimeBuffer.cpp,SpirvFlowEmitter.cpp, andSpirvMemoryInstructions.cpp.Not verified
No tests, build, or hardware checks were run by this reviewer. Direct head-text inspection did not cover every changed file. The
3rdparty/SDL2submodule contents were excluded as unsupported binary text;GuardedMemoryLoads.cppand several other changed files were reviewed through the prepared diff, not read directly at head. Claims about those files beyond their diff are not verified.To get this to a good state
Nothing is required. Optional: complete direct head-text review of the changed files not read at head before requesting a formal approval.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T18:53:40Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
2a7536b6d11a0281a17aea7797aa28c9b3d65e1eagainst the prepared diff. I did not run commands or tests. The author reports tests and measurements in the PR description; these were not performed by me.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I read every repository file listed as included in the manifest, including the large
VulkanDevice.cppviarepo_read.py. The changed SDL2 submodule entry was excluded as unsupported; its target contents were not reviewed. I did not run tests, validate reported SPIR-V output, or independently verify the hardware measurements and author-reported runs. The omitted submodule entry prevents approval under the review completeness criteria.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T09:04:16Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
3c63ea3016d94e5206163251a89c0b7a9e97d68aagainst the prepared diff. I did not run commands or tests; this environment provides no command runner.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No tests were run in this session.
VulkanDevice.cppwas excluded from the review folder because it is too large; its changed regions were read at the pinned head. The author's reported platform and GPU runs were not independently verified. Files read:description.md,commits.md,manifest.json,diff.patch,README.md; all changed files listed in the manifest were inspected through the diff, and targeted repository ranges were read for implementation and context. Excluded by bundle rule: the full text ofVulkanDevice.cpp.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-27T04:31:59Z.
Review: COMMENTED
Actionable comments posted: 8
0fbd850c-5b9c-43b1-ae51-4e9d39fa3f9bReviewing files that changed from the base of the PR and between
9e97e05ba9and3fc9c22d95.core/libs/prx/libSceAgcDriver/Execution/include/SubgroupBarrier.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/GuardedMemoryLoads.cppcore/libs/prx/libSceAgcDriver/tests/MaskedSelect.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/libs/prx/libSceAgcDriver/tests/SubgroupBarrier.cppcore/libs/prx/libSceAgcDriver/tests/TessellationLowering.cppcore/libs/prx/libSceAgcDriver/tests/execution/CoherentAtomicLoads.cppcore/libs/prx/libSceAgcDriver/tests/execution/CrossWorkgroupBufferFlag.cppcore/libs/prx/libSceAgcDriver/tools/ShaderReplay.cppcore/shader/recompiler/CacheKey.hppcore/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrOpcode.hppcore/shader/recompiler/IntermediateRepresentation/src/IrOpcode.cppcore/shader/recompiler/Optimization/src/QuadHelperProof.cppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitter.hppcore/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterInstructions.hppcore/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hppcore/shader/recompiler/SpirvBackend/src/SpirvEmitter.cppcore/shader/recompiler/SpirvBackend/src/SpirvFlowEmitter.cppcore/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvMemoryInstructions.cppcore/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cppcore/shader/recompiler/StencilReplay.cppcore/shader/recompiler/Translation/include/Translation/InstructionTranslator.hppcore/shader/recompiler/Translation/include/Translation/TranslationContext.hppcore/shader/recompiler/Translation/src/InstructionTranslator.cppcore/shader/recompiler/Translation/src/MemoryInstructions/MemoryInstructionDispatch.cppcore/shader/recompiler/Translation/src/ScalarInstructions.cppdocs/dev/debt/shader.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-27T05:11:41Z.
Review: COMMENTED
266e83b6-86bf-4024-91ed-dc24c7546a3cReviewing files that changed from the base of the PR and between
3fc9c22d95and7c0fffda89.core/libs/prx/libSceAgcDriver/tests/GuardedMemoryLoads.cppcore/libs/prx/libSceAgcDriver/tests/TessellationLowering.cppcore/libs/prx/libSceAgcDriver/tests/execution/CrossWorkgroupBufferFlag.cppcore/libs/prx/libSceAgcDriver/tests/execution/StraddlingShortStore.cppcore/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cppdocs/dev/debt/changes/fix-moltenvk-coherent-buffer-loads.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T05:16:58Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change based on the code inspected; the remaining uncertainty is the unreviewed VulkanDevice.cpp and the unrun checks.
What I ran
Reviewed head
7c0fffda8948bde505f319166248f24d56791858. No build or test commands were run. Inspecteddescription.md,commits.md,manifest.json,diff.patch, and the changed files listed below. Used the repository reader to inspect the buffer load/store emitter and Vulkan device initialization.Results
Findings
Blocking
None found in the inspected code.
Non-blocking
None.
Not verified
VulkanDevice.cppwas listed as excluded from the review bundle and was not read. The review bundle also excludes files according to its preparation rules;files.jsonwas not available through the reader. I did not run builds, tests, or hardware checks. Test outcomes in the PR description are author-reported.Files read:
SubgroupBarrier.hpp,GuardedMemoryLoads.cpp,MaskedSelect.cpp,ShaderDiskCache.cpp,SubgroupBarrier.cpp,TessellationLowering.cpp,CoherentAtomicLoads.cpp,CrossWorkgroupBufferFlag.cpp,StraddlingShortStore.cpp,ShaderReplay.cpp,CacheKey.hpp,IrOpcode.hpp,IrOpcode.cpp,Recompiler.cpp,Recompiler.hpp,SpirvEmitter.hpp,SpirvEmitterInstructions.hpp,SpirvEmitterState.hpp,SpirvEmitter.cpp,SpirvFlowEmitter.cpp,SpirvMemoryInstructions.cpp,SpirvRuntimeBuffer.cpp,StencilReplay.cpp,InstructionTranslator.hpp,TranslationContext.hpp,InstructionTranslator.cpp,MemoryInstructionDispatch.cpp,ScalarInstructions.cpp, andfix-moltenvk-coherent-buffer-loads.md, plus targeted ranges fromVulkanDevice.cppandSpirvBufferAccess.cpp.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T05:49:41Z.
Review: COMMENTED
Reviewed — no blocking findings
The change’s stated synchronization design is reflected in the inspected diff, but the review is incomplete because several changed source files were not read in full and no checks were run.
What I ran
Head:
84ce5bbd552fc62bf70ee84ced343c2337a5dd07. No commands or tests were run. I readreview/description.md,review/commits.md,review/manifest.json,review/diff.patch, and the changed-file listing. I inspected portions of the diff; I did not read every changed source file at the pinned head.VulkanDevice.cppwas excluded from the review folder as too large and was not read through the reader.Results
Negative control
Not run. The description reports reverted-line checks, but those were not run by me on this head.
Findings
Blocking
None verified in the portions inspected.
Non-blocking
None.
Sources
The inspected diff adds MoltenVK-gated coherent buffer atomics, guest acquire and release IR operations, and corresponding SPIR-V emission. The description reports targeted validation runs, but these are author-reported and were not independently verified.
Not verified
The full contents and behavior of changed files were not verified. In particular,
VulkanDevice.cppwas excluded from the review folder and not read through the reader. The remaining uninspected changed files and diff ranges are also not verified. The changed-file listing includesSubgroupBarrier.hpp,VulkanDevice.cpp,GuardedMemoryLoads.cpp,MaskedSelect.cpp,ShaderDiskCache.cpp,SubgroupBarrier.cpp,TessellationLowering.cpp,CoherentAtomicLoads.cpp,CrossWorkgroupBufferFlag.cpp,StraddlingShortStore.cpp,ShaderReplay.cpp,CacheKey.hpp,IrOpcode.hpp,IrOpcode.cpp,Recompiler.cpp,Recompiler.hpp,SpirvEmitter.hpp,SpirvEmitterInstructions.hpp,SpirvEmitterState.hpp,SpirvEmitter.cpp,SpirvFlowEmitter.cpp,SpirvMemoryInstructions.cpp,SpirvRuntimeBuffer.cpp,StencilReplay.cpp,InstructionTranslator.hpp,TranslationContext.hpp,InstructionTranslator.cpp,MemoryInstructionDispatch.cpp,ScalarInstructions.cpp, and the debt fragment. The full text of the files marked included in the manifest was not all read;VulkanDevice.cppwas excluded as too large.To get this to a good state
Nothing is required. Optional: complete inspection of the changed files and run the targeted checks on this exact head before making a formal approval decision.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-29T05:21:12Z.
Review: COMMENTED
Actionable comments posted: 3
d7151948-9322-473e-9348-baf2d2eb66b2Reviewing files that changed from the base of the PR and between
84ce5bbd55andbc33ba35a1.core/libs/prx/libSceAgcDriver/Execution/include/SubgroupBarrier.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/GuardedMemoryLoads.cppcore/libs/prx/libSceAgcDriver/tests/MaskedSelect.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/libs/prx/libSceAgcDriver/tests/SubgroupBarrier.cppcore/libs/prx/libSceAgcDriver/tests/TessellationLowering.cppcore/libs/prx/libSceAgcDriver/tools/ShaderReplay.cppcore/shader/recompiler/CacheKey.hppcore/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrOpcode.hppcore/shader/recompiler/IntermediateRepresentation/src/IrOpcode.cppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitter.hppcore/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterInstructions.hppcore/shader/recompiler/SpirvBackend/src/SpirvFlowEmitter.cppcore/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvMemoryInstructions.cppcore/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cppcore/shader/recompiler/Translation/include/Translation/InstructionTranslator.hppcore/shader/recompiler/Translation/include/Translation/TranslationContext.hppcore/shader/recompiler/Translation/src/InstructionTranslator.cppcore/shader/recompiler/Translation/src/ScalarInstructions.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-29T05:51:27Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
bc33ba35a1d695830b4edb043588ab99e8c7d5de. No tests or build commands were run. The description reports author-run tests; those are not results from this review.Results
Findings
Blocking
None identified in the code inspected.
Non-blocking
None.
Not verified
The full text of
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppwas excluded from the review folder; I read its three changed ranges through the reader. I did not read every changed file or run the reported tests, so this is not a complete review supporting approval. The description reports test runs on an Apple M5 Max and an RTX 4090; I did not independently verify those results.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-29T06:22:01Z.
Review: COMMENTED
Reviewed — no blocking findings
The examined changes show no verified blocking defect, but the review is incomplete because several changed files were not read.
What I ran
Reviewed head
98b083ca9950fec8f4059e5971b37e8670bc77db. No build or tests were run. Read the prepared description, commits, manifest, and diff, plus the changedVulkanDevice.cppexcerpts through the pinned reader.Results
Findings
Blocking
None identified in the portions examined.
Non-blocking
None.
Not verified
Full text was read for
SubgroupBarrier.hpp,GuardedMemoryLoads.cpp,MaskedSelect.cpp,ShaderDiskCache.cpp,SubgroupBarrier.cpp,TessellationLowering.cpp,CoherentAtomicLoads.cpp,CrossWorkgroupBufferFlag.cpp,StraddlingShortStore.cpp,ShaderReplay.cpp,CacheKey.hpp,IrOpcode.hpp,IrOpcode.cpp,Recompiler.cpp,Recompiler.hpp,SpirvEmitter.hpp,SpirvEmitterInstructions.hpp,SpirvEmitterState.hpp,SpirvEmitter.cpp,SpirvFlowEmitter.cpp,SpirvMemoryInstructions.cpp,SpirvRuntimeBuffer.cpp,StencilReplay.cpp, the translation headers and sources, and the debt fragment: not verified. TheVulkanDevice.cppexcerpts around its changed assignments were read, but its full text was not. No tests or build checks were run. The description's reported test results were not independently verified.To get this to a good state
Nothing is required. Optional: complete the source review of the changed files not read and run the relevant checks on this head.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:49:51Z.
Review: COMMENTED
I compiled the exact request serializer and verified that
coherentBufferAtomics=truecomes back as false after a capture round trip. The manualShaderReplayoption can restore it, but a normal replay can otherwise compile different memory semantics from the captured target. Please preserve this target bit or explicitly report the replay requirement. The trial merge ontoc1601e56d5was clean. The Apple GPU evidence is from the author.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.