fix(shader): apply returning LDS atomics in lane order on MoltenVK #14218
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14218"
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:13Z.
What
A wave's same-address LDS atomics with a used return value are now applied in ascending lane order on MoltenVK. Programs that rank lanes with the returned value, such as a radix sort that takes each record's position inside its wave from
ds_add_rtn_u32on byte-packed per-wave counters, were unstable on Apple GPUs.Semantics and sources
DS_ADD_RTN_U32istmp = MEM[ADDR]; MEM[ADDR] += DATA; RETURN_DATA = tmp, per lane, and the other returning DS atomics follow the same pattern. Section 10.4.3 (p. 94) says only that atomic operations can return the LDS "pre-op" value. Neither states in which order the lanes of one wave that hit one address are applied. The only place the guide characterises LDS atomic ordering, section 2.3.1 "Local Data Share (LDS)" (printed page 9), calls them "fast, unordered atomic operations".nir_opt_uniform_atomicsreplace same-address atomics with one atomic plus a lane-order exclusive scan, so AMD's compilers treat lane order as an allowed result. That does not say what the hardware does when every lane issues its own atomic.ds_add_rtn_u32with data 1 from every lane on one LDS dword,ds_wrxchg_rtn_b32, and the add under EXEC0x55555555, in wave32 and wave64, with 5 identical runs each: lane i returned i (i/2 under the mask) in every case (comment). Jirka135 ran 12 returning forms (ds_add,sub,rsub,inc,dec,min_u32,max_u32,xor,mskor,wrxchg,cmpst,ds_add_rtn_u64) on an AMD Radeon 8060S (gfx1151, RDNA 3.5), 8,192 lanes per case in wave32 and wave64, all lanes and with about 1 lane in 8 masked off: 0 returns and 0 final LDS values differ from ascending lane order (comment). The console's gfx1013 is not measured; the debt entry now cites both runs and closes on that measurement. A shipped radix sort pass (GT7's BVH build, below) is only stable under this order: each record's rank is "lanes of this wave that hit this address before me".SubgroupLocalInvocationId, so oneOpAtomicIAddper invocation may be applied in any lane order.atomic_fetch_add_explicit(..., memory_order_relaxed)on threadgroup memory. Relaxed atomics give no order between threads, and the M5 Max uses that freedom (measured below).Measured with the new
agc_driver_lds_atomic_lane_ordertest onmain(hand-encoded RDNA; 128 workgroups per case; for the order columns every lane of a wave doesds_add_rtn_u32with data 1 on one LDS dword per wave, with and without an EXEC mask; the forms column uses random operands on up to 8 addresses per wave with about 1 lane in 8 masked off, in workgroup LDS and again with 16,384 LDS dwords, which puts the LDS in a storage buffer on every device):ds_add_rtn_u64, wave32 and wave64, 256 threads, workgroup and device-memory LDS0,1,2,3,8,9,10,11,16,17,18,19,24,25,26,27,4,5,6,7,12,13,14,15,20,21,22,23,28,29,30,31, then the same +32 for lanes 32-63 (lanes 0-31 always before 32-63)ds_add_rtn_u64is in lane order (the 64-bit LDS lock already serializes lanes withOpGroupNonUniformElect)The M5 Max serves each 32-lane SIMD-group in quads 0,4,1,5,2,6,3,7. For
ds_rsub,ds_inc,ds_dec,ds_mskor,ds_wrxchg,ds_wrxchg2,ds_cmpstandds_wrap, the final LDS values differ as well, not just the returns.ds_wrxchg2_rtn_b32andds_wrxchg2st64_rtn_b32lower to twods_wrxchg_rtn_b32halves; the test keeps their two addresses apart, so the order of the halves does not matter.Change
SpirvTarget::laneOrderedLdsAtomics, plumbed likeldsLockFences: SpirvTargetOptions, SpirvEmitterState, the shader cache key,agc_shader_replay --lane-ordered-lds-atomics.tests/cmake/agc_spirv_lds_atomic_lane_order_tests.cmake(written bytools/agc_test_split.py resolveduring the rebase); the new execution test is picked up by thetests/executionglob.VulkanDevice::buildTargetsets it only onVK_DRIVER_ID_MOLTENVK(LdsAtomicLaneOrderRequired). The RTX 4090 on Windows (616.92) was in lane order in every case measured here; domx4q's RTX 4090 run on Linux (620.70.06) was not for wave64 in one-wave 64-thread workgroups (the spanned mode), see Tested. Other drivers keep main's order in this PR.SharedAtomic*) only when:OpAtomic*with the combined operand of the round. Each lane returns the old value combined with an exclusive scan of the lower lanes' operands.OpGroupNonUniformIAddExclusiveScan. The others use a Hillis-Steele scan overOpGroupNonUniformShuffle, with only the totals fromReduce. SPIRV-Cross refuses the other scans for Metal:Metal doesn't support ExclusiveScan for OpGroupNonUniformSMinappeared while testing on MoltenVK.OpControlBarrierwhose execution and memory scopes are both the wave LDS scope (WaveLdsScope: Subgroup when one host subgroup holds the guest wave, Workgroup when the workgroup is one wave, including the spanned mode), withAcquireRelease|WorkgroupMemory, plusUniformMemorywhen the LDS is in device memory. Every invocation of the wave executes it after the leader branch and before the next ballot, so under the Vulkan memory model round k synchronizes with round k+1 and comes first in the address's modification order; the order does not rest on SIMD-group issue order. SPIRV-Cross emits it assimdgroup_barrierorthreadgroup_barrier. The derivation is in this comment.OpControlBarrierundefined unless every invocation of the workgroup executes the same dynamic instance. Guest branches are scalar:s_cbranch_execz,execnz,vcczandvccnzbecome subgroup ballots andsccbranches scalar values, and EXEC-inactive lanes run every round with nothing pending, so the rounds sit in uniform control flow. The emitter checks this on every module with rounds: it runs the barrier uniformity analysis the spanned mode uses, counting a subgroup-scope collective with an invocation-independent result (ballot, broadcast,Reduce, a shuffle from a uniform index) in uniform control flow as uniform, and throws if a control barrier sits in control flow a per-invocation value decides.agc_spirv_lds_atomic_lane_orderchecks the emission.mainvs this PR; the GPU was shared with a running game, so the numbers are noisy):ds_add_rtn_u32, 64 distinct addresses per wave: 4.46-4.65 vs 5.35-5.73 ms (+15-29%).ds_min_rtn_u32, 64 distinct addresses (shuffle scan): 4.58-4.69 vs 6.72-6.85 ms (+43-50%).ds_wrxchg_rtn_b32(serialized), 64 distinct addresses: 4.49-4.78 vs 4.63-4.77 ms (within noise; an earlier pair of runs gave +4-20%).docs/dev/debt/shader.md:ds_rsub_u32,ds_inc_u32,ds_dec_u32,ds_mskor_b32andds_cmpst_b32. Serializing those would cost up to 64 rounds per instruction on a still unmeasured assumption, and no title is known to need it. With one operand for every lane, as a ring counter'sds_inc_u32has, the final value is the same in any order.Tested
Run on 2026-10-31 with this branch at 0700fe6c79, rebased onto
mainb08c539c50. It was then rebased ontomain8a4fc62318(head2053545772) with no conflicts; on the M5 Max the focused set on that head gave the same result as below (41 pass, 6 skip, the same 2 LDS failures; 0VUID-lines). Since then the branch has only gained commits: main merged ate07db72776(11/07, including #10858), then the round barrier (98d69b6cb8) and its execution test (9c36d01079); see the head9c36d01079paragraph after this list. Builds: macOS 27.0.1 on an Apple M5 Max (x86_64 under Rosetta, AppleClang 21, MoltenVK 1.4.2 from LunarG SDK 1.4.363.0), and Windows 11 10.0.26200 on an RTX 4090 (driver 616.92, winlibs GCC 15.2).maindoes not build the AGC driver on macOS by itself, so both Mac trees carry the same local macOS build aids (27 files, not part of this pull request); only this change differs between them. Both machines run the same focused set onmain(b08c539c50plus only the new execution test, in the version without the two forced passes, which need the new flag) and on this branch, with and withoutVK_LAYER_KHRONOS_validation, usingANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -V. The set is 49 tests on the branch and 48 onmain(noagc_spirv_lds_atomic_lane_orderthere):agc_driver_lds_*,pixel_lds*, buffer and global atomics, wave, lane and subgroup tests,agc_spirv_lds_atomic_*,agc_subgroup_barrierandagc_shader_disk_cache. AVK_LOADER_DEBUG=layerprobe showsInsert instance layer "VK_LAYER_KHRONOS_validation"on both sides on both machines. The rebase changed only where the SPIR-V test is registered; the cost figures and the non-returning counts above (a local probe, not part of this pull request) and the GT7 replay below come from the same emission code before the rebase.main,agc_driver_lds_atomic_lane_orderfails (87 cases out of lane order; 0 of 14 same-address configurations in lane order), with and without the validation layer.GroupNonUniformArithmetic(serialized path). Each pass checks every form in workgroup and in device-memory LDS: 228 op lines, 0 differences.agc_driver_lds_subword_store_branchandagc_driver_lds_tree_reductionfail identically onmainand the branch. These are wave-LDS barriers in SIMD-group-divergent code, the issue #10858 addresses; they are not touched here.agc_driver_buffer_atomics,agc_driver_global_atomics64,agc_driver_global_atomics_floatandagc_driver_global_atomics_lanes(noshaderBufferInt64Atomics),agc_driver_mesh_vector_window_waves(noVK_EXT_mesh_shader) andagc_driver_ngg_vertex_wave_reduction(no subgroup arithmetic in vertex shaders). So the branch passes 41 of the 43 tests that run andmain39 of 42.VUID-,SYNC-HAZARDorValidation Errorlines on either side.main: 47 of 48 pass and 1 is skipped, with and without the validation layer. The new execution test's device-target pass is in lane order for every case: 14 of 14 same-address configurations, and 76 op lines with 0 differences, in workgroup and device-memory LDS.agc_driver_vertex_elected_atomic_maxon both sides (the device runs vertex programs in subgroups).tools/check_skips.py --job windowspasses on all four reports.VUID-,SYNC-HAZARDorValidation Errorlines on either side.agc_driver_ds_append_consumedoes, since a wave then spans several host subgroups; whether CI's lavapipe skips it or runs it is not checked.agc_spirv_lds_atomic_lane_orderneeds no GPU.agc_spirv_lds_atomic_lane_order(new, no GPU) checks the emitted SPIR-V:ds_add_rtn_u32emits oneOpAtomicIAddfor both halves, with an exclusive scan and a reduce per half (wave32: one of each).ds_min_rtn_u32reduces withOpGroupNonUniformUMinand never scans with it.ds_inc_rtn_u32gains exactly one lane loop.ds_add_rtn_u32still scans once and adds once;ds_min_rtn_u32in a one-wave workgroup compiles with the atomic, loop and control-barrier counts of the unordered compile; with several waves per workgroupds_wrxchg_rtn_b32andds_min_rtn_u32compile with the atomic, loop and control-barrier counts of the unordered compile.9c36d01079): for each serialized atomic the test walks the control-flow graph and requires that every path from the atomic to the lane loop's latch passes anOpControlBarrierwith execution scope equal to memory scope and to the expected wave scope, with the semantics above, in a block outside the leader branch that dominates the latch. Cases: maskedds_wrxchg_rtn_b32for wave32 with 256 and 32 threads, wave64 on a 32-lane host, wave64 with device-memory LDS, spanned wave64 with workgroup and device-memory LDS, maskedds_cmpst_rtn_b32, and serializedds_add_rtn_u32without subgroup arithmetic. The aggregatedds_add_rtn_u32must have no control barrier in its loop. The same module with its control barriers replaced byOpNopmust fail the check; the emitter before98d69b6cb8fails it.ea559cd2bf):ds_wrxchg_rtn_b32behinds_cbranch_execz,s_cbranch_scc0ands_cbranch_vcczafters_and_saveexec, and inside a loop that drops lanes from EXEC and repeats withs_cbranch_execnz, for wave32 with 256 and 32 threads, wave64 on a 32-lane host with 256 and 64 threads, and spanned wave64: all 20 compile and pass the round barrier check and the uniformity analysis; the 16 non-spanned modules with their ballots turned intoOpGroupNonUniformInverseBallotare all rejected.spanned_uniformityadds 9 cases for the subgroup-collective analysis.ds_add_rtn_u32takes the serialized path.ds_add_u32and programs under the 64-bit lock compile byte-identically with and without the flag.agc_subgroup_barrierchecks that only MoltenVK requires the order.agc_shader_disk_cachechecks that the flag changes the cache key.Head
9c36d01079, on the Apple M5 Max only (MoltenVK 1.4.2, both a locally built MoltenVK ICD and the Vulkan SDK 1.4.363.0 ICD; the RTX 4090 was not rerun on this head). The newCheckSwapChaincase ofagc_driver_lds_atomic_lane_orderruns two back-to-backds_wrxchg_rtn_b32with unique data on one dword under 9 EXEC patterns (wave32) or 13 (wave64), with 256 threads and with a one-wave workgroup, in workgroup and device-memory LDS. The lane-ordered target gave 28,672 of 28,672 chains in lane order on each ICD; the unordered target, as a negative control, gave valid chains in another order (quads 0-3, 16-19, 4-7, 20-23, ...) for about 60% of chains and 0 broken chains. The emitter before the round barrier also passed, so these runs do not show the barrier's effect; the CPU test above is what checks it. The full LDS suites, includingagc_driver_lds_subword_store_branchandagc_driver_lds_tree_reductionnow that #10858 is in the branch, the subgroup barrier, LDS lock, spanned uniformity and shader disk cache tests pass on both ICDs. Details in this comment.Head
ea559cd2bf(main70bb3678d8merged), on the Apple M5 Max only (MoltenVK 1.4.2, the locally built ICD and the SDK 1.4.363.0 ICD,VK_LAYER_KHRONOS_validationloaded; the RTX 4090 was not rerun).agc_driver_lds_atomic_lane_orderadds the swap pair behinds_and_saveexecands_cbranch_execz: 28,672 of 28,672 chains in lane order, 0 reordered, 0 broken on each ICD, with 38 waves per ICD that had no active lane and skipped the block.ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -Vover theagc_driver_lds_*suites, pixel LDS read-modify-write, spanned ballot sequence,agc_spirv_lds_atomic_*,agc_subgroup_barrier,agc_shader_disk_cache, the shader replay tests andspanned_uniformity: 25 of 25 pass on each ICD, 0VUIDlines. The device has no full 32-lane compute subgroups, so the spanned execution modes skip.Head
f9ae674592(mainef7dc4452dmerged inde7cde2ec1, which also puts3rdparty/SDL2back to main's commit; the previous merge124e8bfdefhad left the branch's older pointer). domx4q ran the focused set with the validation layer on an RTX 4090 under Linux (driver 620.70.06; comment): 0VUID-lines, every lane-ordered target case in lane order, but the device-target pass ofagc_driver_lds_atomic_lane_orderfailed in two wave64 cases with one 64-thread wave per workgroup, where the two 32-lane halves of the wave interleave (lane-to-rank map0,1,3,5,...,61for lanes 0-31 and2,4,...,62,63for lanes 32-63). That pass required lane order from targets that do not enablelaneOrderedLdsAtomics, which this PR does not change.f9ae674592makes the device-target pass a failure only when the device target enables the flag (MoltenVK) and otherwise prints the count, as the unordered-target swap chains already do. On the M5 Max with the locally built MoltenVK ICD andVK_LAYER_KHRONOS_validation(ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -Vover the lane order, LDS atomics, 64-bit, mixed width, condxchg, read/write, tree reduction, LDS lock, spanned uniformity, subgroup barrier, shader disk cache and replay tests): 17 of 17 pass, the layer is inserted in all 8 device tests, 0VUID-lines;agc_driver_lds_atomic_lane_orderalso passes with the SDK 1.4.363.0 ICD. The RTX 4090 was not rerun.main) with the wave-LDS barrier fix of #10858waveLdsMemoryBarrierstarget knob in place of #10858mainbefore #10858, or this PR without itIn the game, on the M5 Max: this branch was not run by itself. A local GT7 build with this change, the GLC atomic load change #14217, 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: no cyclic tree in about 1,800 checks of GT7's parent walk. In an earlier run without these fixes, 32 of the 32 trees it checked were cyclic.
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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T01:21:36Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The new path imposes ascending guest-lane order for returning LDS atomics without RDNA2 evidence that this is the PS5 behavior.
What I ran
Reviewed head
205354577202938a92836de7a3187ae14760ff02, 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 check output
git diff --checkexited 0 and printed no output.Conventions check output:
Stack-check command output:
Findings
Blocking
CONTRIBUTING.mdsays shader semantics that the source does not settle must throw; the new path instead assigns ascending order to same-address lanes for used-return LDS atomics on MoltenVK. The PR states that RDNA2 ISA section 12.13 does not specify this order and that AMD hardware has not been measured. M5 Max measurements establish MoltenVK's host order, not the guest PS5/RDNA2 order. The debt entry records this uncertainty but does not prevent the implementation from selecting one guest behavior. Please either attach an RDNA2 hardware-oracle run for the stated lane-order case and record GPU/driver/OS, or leave the unsettled guest behavior unsupported until that measurement is available.Non-blocking
Sources
Not verified
No local build or C++/Vulkan tests were run. I did not test AMD hardware or a PS5; Linux product CI was skipped. The author-reported hardware results were read but not independently confirmed.
To get this to a good state
Provide the RDNA2 hardware-oracle result for returning LDS atomics, or keep the unsettled guest ordering unsupported. I will rerun the same relevant checks on the updated head.
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T08:20:51Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
This pull request does not merge cleanly into
main(4f41f4c375): head2053545772conflicts incore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppPlease 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-10T22:00:30Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The lane-ordered fallback can put a workgroup control barrier inside lane-divergent shader control flow, which makes that generated shader undefined under the SPIR-V rules.
What I ran
Reviewed head
e93b527937fbddb912de19d4b714ae67418c1f3eagainst currentmainbase539e858408186c0b510680a03a5243b761038730; the merge preview was clean. The PR still targetsmain, and the head and base stayed unchanged during the precheck.Environment: Linux 6.1, Python 3.11.2, GCC 12.2.0.
I read all 18 changed files and the full diff. I did not build or run C++ tests. GitHub Actions were read as a status snapshot; I did not run them.
Results
git diff --checkagainst the stated base and head.main.Recorded outputs and hosted status
Conventions output:
Dependency check report output:
Test-registration heuristic output included possible-unregistered-test warnings for
ShaderDiskCache.cpp,SpirvLdsAtomicLaneOrder.cpp,SubgroupBarrier.cpp, andexecution/LdsAtomicLaneOrder.cpp. I checked the CMake test fragment discovery:CMakeLists.txtincludestests/cmake/*.cmake, and the new fragment registers the lane-order tests.GitHub Actions snapshot: Windows pending; conventions, labels, intake, eligibility, report, library portability, relinker, and relinker ASan passed; Linux, edge-watch, pipe-write, register-context, and write-watch were skipped.
Negative control
Not run. No controlled mutation was made to the implementation or test. The new barrier tests do not exercise an atomic beneath a divergent IR branch.
Findings
Blocking
SerializedLdsAtomicemitsOpControlBarrierafter each lane’s atomic operation, at the current atomic call site. The backend also emits conditional branches asOpBranchConditional, preserving that call-site control flow. For a single-wave workgroup,WaveLdsScopeselectsWorkgroup; therefore, if only some guest lanes enter a branch containing a returning LDS atomic, only those invocations execute this workgroup barrier. SPIR-V 1.6 Revision 8 specifies undefined behavior unless every invocation in a Workgroup-or-larger execution scope executes the same dynamicOpControlBarrierinstance. Please make the serialization converge across the barrier’s whole execution scope (for example, have non-participating invocations take part in each round), or use a lowering that does not place a workgroup barrier under divergent control flow. Add a regression test with the atomic under a divergent branch.Non-blocking
The PR description acknowledges that the required AMD hardware ordering has not been measured; the author has marked the PR draft. The hardware behavior remains unverified.
Sources
OpControlBarrierNot verified
To get this to a good state
Ensure all invocations in the selected barrier scope execute the same dynamic barrier instance even when the guest atomic is control-flow divergent, and add a divergent-branch regression test. I’ll rerun the same checks against the updated head.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T07:57:13Z.
Review: COMMENTED
Reviewed — no blocking findings
The partial review of head
124e8bfdef212650e734741bf0e79df9d36b50fffound no verified blocking defect; several changed files and test results remain unverified.What I ran
Results
Negative control
Not run; no tests were run in this review.
Findings
Blocking
None verified in the code inspected.
Non-blocking
None.
Sources
Not verified
This was a partial review, so no conclusion is made about files or changed lines not inspected. Read:
review/README.md,review/description.md,review/commits.md,review/manifest.json(initial range), selected ranges ofreview/diff.patch,core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvMemoryInstructions.cpp,core/shader/recompiler/SpirvBackend/src/SpirvEmitter.cpp,core/shader/recompiler/SpirvBackend/src/SpirvFlowEmitter.cpp,core/shader/recompiler/SpirvBackend/src/SpirvSpannedUniformity.cpp,core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp, andcore/libs/prx/libSceAgcDriver/tests/cmake/agc_spirv_lds_atomic_lane_order_tests.cmake. The full text of these sources was not read. Other changed files were not read;3rdparty/SDL2was excluded as unsupported non-text andVulkanDevice.cppwas too large for the review folder. Build and runtime behavior were not independently confirmed.To get this to a good state
Nothing is required. Optional: complete review of the unread changed files and run the relevant checks before treating this as a complete review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T08:52:10Z.
Review: COMMENTED
Reviewed — comments
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
f9ae674592a8170670541934ce903584ad937926using the prepared diff and pinned repository reader. No build or tests were run. The author-reported test results in the PR description were not independently verified.Results
Findings
Blocking
None.
Non-blocking
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppwas read through the pinned reader at the changed ranges; the device flag is assigned from the MoltenVK driver ID and propagated to the shader target.Not verified
VulkanDevice.cppwas inspected only at the changed ranges. Full texts of the remaining changed files were listed in the manifest but their complete contents were not read. Changed files inspected:SubgroupBarrier.hpp,VulkanDevice.cpp(changed ranges),ShaderDiskCache.cpp(changed line),SpirvLdsAtomicLaneOrder.cpp,SubgroupBarrier.cpp(changed line),agc_spirv_lds_atomic_lane_order_tests.cmake,LdsAtomicLaneOrder.cpp(diff),ShaderReplay.cpp(diff),CacheKey.hpp,Recompiler.cpp,Recompiler.hpp,SpirvEmitter.hpp,SpirvEmitterInstructions.hpp,SpirvEmitterState.hpp,SpirvSpannedUniformity.hpp,SpirvEmitter.cpp,SpirvFlowEmitter.cpp,SpirvMemoryInstructions.cpp,SpirvSpannedUniformity.cpp,SpannedUniformityTests.cpp, anddocs/dev/debt/shader.md(diff). No changed files were excluded by rule;files.jsonwas not available through the reader, so excluded-by-rule entries were not verified.To get this to a good state
Nothing is required. Optional: run the focused test set on CI's lavapipe configuration and confirm whether the new execution test skips or runs there.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-26T15:19:16Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the review supports merging, with the limits below recorded as not verified.
What I ran
Reviewed head
78ac787dfebb84fbfa1b00761f2706f6c4e61bc2. I did not run commands or tests;repo_read.pywas used to read the prepared diff and targeted repository ranges at the pinned head.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Hardware behavior, builds, and test results were not independently verified. The author reports these in the PR description.
VulkanDevice.cppwas read only at the three changed ranges because its full text was excluded as too large; the other 20 changed files listed as reviewed in the manifest were read from the bundle or targeted head ranges. No other changed files were excluded.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-29T05:53:39Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: remove mesh-stage lane ordering or provide a valid wave LDS scope for mesh shaders before emitting serialized round barriers.
What I ran
Reviewed head
c5eb84a11e7d9601612cd20c60fede657f9598feusingrepo_read.pyagainst the prepared diff; no build or tests were run. The description’s hardware and test results are author-reported.Results
Findings
Blocking
core/shader/recompiler/SpirvBackend/src/SpirvEmitter.cpp:54permits Mesh stage through the lane-ordering gate, butWaveLdsScopeat lines 67–68 returns zero for every non-Compute stage. For a used returning LDS atomic that takesSerializedLdsAtomic,core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvMemoryInstructions.cpp:1922-1924emitsOpControlBarrierusingstate.waveLdsScopefor both scope operands. A zero scope is invalid, so a MoltenVK mesh shader using such an atomic can fail SPIR-V validation or compilation. Exclude Mesh fromLaneOrdersLdsAtomicsor establish a valid mesh-stage barrier scope before selecting this path.Non-blocking
None.
Not verified
No build, test, GPU, or console checks were run. Hardware and CI results in the PR description were not independently verified. The complete text of
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppwas read through the pinned reader;files.jsonwas unavailable in the reader, so the excluded-file inventory could not be checked. Other changed files outside the targeted paths were not read in full.To get this to a good state
Exclude Mesh stage from lane-ordered LDS atomics or implement and validate the appropriate mesh-stage barrier scope, then run the relevant SPIR-V and execution checks.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:49:50Z.
Review: COMMENTED
I compiled the exact request serializer and checked a capture round trip with
laneOrderedLdsAtomics=true. It deserializes as false.ShaderReplayhas a manual override, so replay without that flag can exercise host lane order instead of the captured MoltenVK path even though the cache key distinguishes them. Please record the target bit in captures or make the required override explicit in replay diagnostics. The trial merge ontoc1601e56d5was clean. Paired shader validation is pending.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.