AGC: agc_driver_unregistered_label_on_gpu fails now and then: two stores of one label run have no barrier between them #17937
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 adam25136 on 2026-11-10T00:02:58Z.
What happens
agc_driver_unregistered_label_on_gpufailed 10 of 1,000 runs here withunregistered label: the label held 0x00000000 when a later label had landed, 0x5a5a0001 after the device went idle, and 0 of 500 with a local barrier between the stores of a label run.Title, test or build step
ctest
agc_driver_unregistered_label_on_gpu(targetagc_driver_unregistered_label_on_gpu_tests, added by #9898)AnyPS5 commit
mainadce651bbd, no pull requests merged on top (the last batch below had one local, inactive-by-default change, shown at the end)System
Windows 10 Pro 22H2 (19045), Intel Core i9-12900KF, NVIDIA GeForce RTX 5080 (NVIDIA 621.14), WinLibs GCC 15.2.0 r7 (UCRT), CMake 4.3.1, Ninja, Release
Steps to reproduce
One run at a time (Git Bash here), nothing else running; each
ctestcall takes about 0.7 s. The other arms below setAPS5_NO_LABEL_RUNS=1,APS5_LABEL_RUNS_INLINE=1or, with the local change built in,APS5_LOCAL_RUN_ORDER_BARRIER=1in front ofctest. The loop addsANYPS5_REQUIRE_VULKAN=1and--no-tests=errorso that a skip or a missing test does not pass silently; the batches below ran without them and counted a run as passed only when it printedunregistered label tests passed. On Windows the test loads thelibSceAgcDriver.prxcopy inbuild/tests, which a rebuild of the library alone does not refresh (#17895), so after changing only the library, copybuild/core/libs/libs/unpatched/libSceAgcDriver.prxthere before rerunning.Log
All 17 failures below printed this line, with the same two values.
What was checked
Runs. Each run is a separate
ctestof this one test; the arms of a batch alternate run by run.APS5_NO_LABEL_RUNS=1APS5_NO_LABEL_RUNS=1APS5_LABEL_RUNS_INLINE=1Earlier on this PC it failed with the same message in 1 of 150 runs on an older
main(#17850's Tested section).What the test checks. It stores
0x5a5a0001throughWriteLabelOnGpuinto host memory that is not registered as a guest allocation (line 125), then0x5a5a0004into a registered block (line 138); both are stored on the GPU (reason 0). After the submit it polls the second label from the CPU and requires the first to hold its value once the second has landed (lines 141-149). In the failing runs the first label held 0 at that point and0x5a5a0001afterWaitIdle: late, not lost.Where the order is lost. Both stores go through
Recorder::RecordStore(VulkanDevice.cppline 3087) into the batch's queued run (Recorder.cpplines 2021-2040).closeStoreRunrecords the run's stores back to back and puts a barrier between two of them only when the later one overlaps an earlier one in the same buffer, or between groups after queued sample-count dumps (lines 2159-2177). So any two stores of a run that do not overlap, these two labels included, have nothing ordering them. The comment inRecorder.hppfirst says such a store is "ordered after everything recorded before it" (lines 301-303), then that within a run a store overlapping an earlier one gets a transfer-to-transfer barrier first, and names none for the others (lines 311-314); and the comment atVulkanDevice.cpplines 3081-3085 saysRecordStore"orders the stores of a run against each other".The batch 3 arms narrow down the cause.
APS5_LABEL_RUNS_INLINE=1records the stores in place instead of queuing them forSubmit, still with no barrier between them, and still fails.APS5_NO_LABEL_RUNS=1changes several things at once (each store gets its own barrier pair and is recorded at once), so batch 1 and 2 alone do not say which part matters. The local change adds only one transfer-to-transfer barrier before every store of a per-batch run after the first, and keeps the run; with it, 0 of 500 failed. That it was enough for the host here is a measurement on this GPU; the debt entry below notes that Vulkan makes device writes visible to the host through a fence or event wait. Its cost for label-heavy batches was not measured.Related. The debt entry "A label stored on the GPU is ordered behind the batch's earlier writes, for a host that polls it, only by driver behavior" in
docs/dev/debt/libSceAgcDriver.mdapplies, but inside one run these stores have no barrier at all. #10318 named the same missing barrier for #10199's test and was closed: in that test no store run was open or queued when its label was recorded, and a flush before every label would give one barrier pair per label; #11886 fixed #10199 instead. The local change keeps one run per batch and adds one barrier per later store; whether that cost is acceptable is for whoever fixes it.The same test also failed in #17573 (AMD Radeon RX 7900 GRE, Windows 11) and #16420 (NVIDIA GeForce RTX 5090, Windows 11), with no error text there.
Not checked: Linux; other GPUs; whether a title polls one label and then reads an earlier one of the same batch. Whether two labels of one queue land in order on a PS5 was not measured here; the test assumes it.
The local change of batch 3 (not proposed as is; active only with APS5_LOCAL_RUN_ORDER_BARRIER=1)
AI-assisted: yes. Claude Code wrote the loop script and the local change, ran the loops, read the code and drafted this issue; Claude Code review agents checked it.