fix(agc): bound the writes of dispatches that cannot store through pointers #20018
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/20018"
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 slopezjur on 2026-11-14T11:57:47Z.
What
DispatchWriteRangesmarked a compute result as unbounded whenever it used the BDA ABI (unless it had a fault buffer), and whenever it bound GDS or the BDA page table. An unbounded queue-0 dispatch always drains the draw pipeline instead of becoming a commit item, so most BDA compute work forced a drain.bdaWrites, or the SPIR-V scan the driver already uses for draws,ShaderStoresThroughAddresses, which is cached per module).e2338d5bd1) becomes part of the general one.agc_driver_draw_write_rangesgains cases for a fault-buffer-only result (bounded, keeps its written image), a result that only reads through its page table (bounded), one that stores through it (unbounded), and a GDS binding (bounded, GDS range present).agc_driver_write_data_written_aheadexpected a dispatch that binds GDS to stay unbounded and stopresolveGroupAheadafter two dispatches. Under the new rule that dispatch is bounded to the GDS range and the one after it is adopted ahead, so the GDS case now expects 3 adopted, and the "an unbounded write stopsresolveGroupAhead" check uses a dispatch that stores through a raw pointer, which stays unbounded, and expects 2. With pointer stores forced bounded, the new case fails withgot 3.Tested
Windows 11, WinLibs GCC 15.2.0 r7, Release, NVIDIA GeForce RTX 4080 SUPER (driver 621.14), Vulkan SDK 1.4.363.0 validation layer.
Focused tests on
main2cebbe43eeand on this branch, same machine, withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layer(ctest -R <pattern> -V): draw write ranges (plain, draw pipeline, plan verify), BDA reads/device/shadowed results, GDS append/consume, DMA fill and 64-bit atomics, dispatch-ahead adopt check, snapshot and write-tracking tests.VUID-mainThat list missed
agc_driver_write_data_written_ahead(plain, draw pipeline, plan verify), which failed with the first head (reported by rth9z). With the test update1619ab9d6e, onmain178944e753and on the change, same machine and environment: those three andagc_driver_draw_write_ranges*pass, andctest -R '^(agc_|shader_)'gives 1793 tests, 18 skipped and 0VUID-on both sides.agc_driver_upload_cache_read_only_flushdoes not compile with MinGW onmainand was not run on either side.Reported by reviewers on this PR:
1d240739b2merged ontomaindcb5aabff0:agc_driver_draw_write_ranges,_draw_pipelineand_plan_verifypass 3 of 3 runs on the GPU withANYPS5_REQUIRE_VULKAN=1, and 3 of 3 on the CPU.1619ab9d6emerged ontomain6dbb02e37e: the threeagc_driver_write_data_written_aheadtests pass,agc_driver_draw_write_rangespasses 3 of 3, andctest -R '^(agc|shader|video_out|guest_video_out)'passes 1854 of 1854 with the same 40 skips asmain.For context only (not
main): on Ghost of Yōtei (PPSA26344) with theyotei/best-based driver ofslopezjur/AnyPS5yotei/next2, where this change was first made (42ea26a7c9), in the tree scene withAPS5_PIPELINE_DISPATCH_MISSES=1, the unbounded fallbacks fell from 103k to 3.4k and dispatch-caused drains from 1,232 to 261 per 10 s. Frame time did not change there, so this PR claims no speed-up.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 MarcZX10 on 2026-11-17T19:56:45Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
Head
1619ab9d6ec3925debb7aeddeb4a975ba4a3c839, basemain. No build, no tests, no hosted-CI inspection. Repository reads with the reader:Results
Findings
Blocking
None verified.
Non-blocking
None verified.
Sources
WrittenBuffers.cpplines 61–62: a dispatch stays unbounded only with a page-table binding that stores through addresses; a GDS binding adds the GDS range.ShaderAddressResources.cpplines 144–146: the store check is cached per SPIR-V module, as the description says.Not verified
files.jsonwas not read. The review covers the changed hunks and their helpers only.WrittenBuffers.cppline 61 calls the store check whenever a page-table binding exists. Whethercompiled.spirvcan be empty there was not checked.PointerStoreCodeinWriteDataWrittenAhead.cppline 87 was not decoded, so the test's pointer store was not confirmed.To get this to a good state
Nothing is required.
Optional: confirm that the hosted checks pass on
1619ab9d6e, and that the pointer-store test fails if the store is removed.