fix(agc): note what a raw-pointer store can reach as pending writes #16375
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16375"
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 muhmuhkuh on 2026-11-06T13:17:40Z.
What
A dispatch or draw whose shaders store through raw pointers noted no pending write over what it can reach, so a CPU read or a capture right after it read the descriptor table the work was about to rewrite. A build that uses buffer addresses and writes through them now notes the guest ranges the device can read as pending writes, as it already does for the elements it writes by descriptor, so the next reader waits for the work.
agc_driver_raw_pointer_store_pendingcovers a compute dispatch and a draw whose V# table a dispatch rewrites through a raw pointer, in the same submission, each with a control where an earlier submission did the store.Changed:
Graphics/src/ShaderResources.cpp(5 lines), newtests/execution/RawPointerStorePending.cppand its CMake registration.Tested
Windows 11 Pro 10.0.26200, MinGW GCC (DevTools mingw64), Release, one build directory for
main(5eff724cde) and for each branch, built incrementally. Vulkan runs withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ctest -R <names> -V; every log shows the validation layer inserted (instance and device) and has 0was not found but was requested by env var VK_INSTANCE_LAYERS, 0VUID-, 0SYNC-HAZARD, 0 device-lost lines. Same 16 focused tests onmainand on the branch plus the two new tests: 18/18 passed on the branch, 16/16 onmain. With the five lines ofShaderResources.cpptaken frommain,agc_driver_raw_pointer_store_pending_inlineand_itemsfail 2/2: both same-submission cases WRONG (compute lane 0 holds 0x1001 instead of 0x2001, draw brightest byte 0 instead of 255) while both controls stay correct; with the change all four cases are correct. The change builds and passes without any other branch applied. The Vulkan runs above usedmain5eff724cde. The branch was then rebased onto921621976c(188 commits later, none of them change the files of this PR) and the same CPU tests rerun with no Vulkan device (VK_LOADER_DRIVERS_DISABLE=*): 13 passed, 6 skipped onmainand 8 on the branch (the two new tests need a device), 0 failed.mainhas moved on toe8b1bd3d7fsince; a merge of the branch into it has no conflict.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 milescoviello on 2026-11-06T17:19:03Z.
Review: COMMENTED
One cost question about the five lines in
MarkGpuWrites. For an address-based build,GuestBufferMemory::DeviceReadsreturns everyspace->baseregion that has a direct or mirror buffer, not just the ranges the program stores through. For a BDA program that can be whole guest pools. Noting all of that as pending writes means any CPU read, capture or label poll that overlaps those pools afterwards waits for the work, until it retires, including reads of memory the program never touches. In titles where most compute is address-based (Ghost of Tsushima's heavy programs are), that could serialize a lot of unrelated readers behind each dispatch.Two things might bound it: note only the regions the build actually marks writable or stores into (if the BDA analysis knows them), or keep the wide note only while the dispatch is in the same submission as the reader, which is the case the test covers. I'm going to run Metal Gear Solid 4 (PPSA18194, about 6,000 address-based builds per 10 s at its title screen) with and without this change on Linux / RTX 4070 Ti and will post the worker-wait numbers here.
AI-assisted: yes (Claude Code)