feat(agc): store pending storage-image results before each GPU label with APS5_STORE_AT_LABEL #5324
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5324"
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 lubaxe on 2026-10-13T17:12:40Z.
What
Pending storage-image results stay on the GPU until something reads their memory through the flush hook. A title's own CPU reads do not go through it. A title that waits for a label the GPU writes after its work (
RELEASE_MEM,WRITE_DATA,DMA_DATA) and then reads the results with the CPU reads stale memory. On the console the results are in memory once the label is.PPSA06694 (Remnant 2, UE5) reads its HZB occlusion results this way (
Remnant2.exe+0x2f8e75d). The CPU read stale zeros and treated every object as occluded, so the title drew its logo mesh on the first frame only, and later the Create Character screen shows no character.APS5_STORE_AT_LABEL=1stores every pending result at the start ofVulkanDevice::WriteLabelOnGpu, throughStorageTexture::FlushAllPending, before the label is recorded or written. It is parsed likeAPS5_STORE_AT_FLIP(#1995): unset is off,1is on, any other value throws. Off by default: it stores every pending image at each label, not only the ones the waited-for work wrote. In PPSA06694 it costs more than half the presents (in 75 s runs dumping every 30th present, 21 frames without it, 9 with it).docs/user/USAGE.mdand the technical debt entry for pending results describe it.Tested
storeAtLabelTestsinagc_driver_graphicschecks the switch: unset is off,1is on, and0, empty,trueand11are rejected. Onmainit does not build (noStoreAtLabelRequested).WriteLabelOnGpuneeds a recorder, so the flush itself is covered only by the title runs.ctestonmaine0d388fawith this change: 1080 of 1081 passed. The failure isagc_driver_pixel_lds, which also fails on unmodifiedmainon this GPU. Rebased ontomain61b8742b; thereagc_driver_graphicspasses.APS5_STORE_AT_LABEL=1, 8 of 8 runs show the character on the Create Character screen; without it, 4 of 4 show none.tools/check_conventions.py --base origin/mainpasses.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-10-13T19:46:40Z.
New issue #5437 reports that the second and third
RELEASE_MEMlabel writes after dispatches stay invisible to followingWAIT_REG_MEMcommands in the same submission;APS5_DRAIN_ALL=1makes the waits advance. Your opt-inAPS5_STORE_AT_LABEL=1flushes pending storage-image results before label writes, so it may be relevant, but the issue has not tested this PR and the failure could still be in deferred-label/submission ordering. I linked it on the issue and asked the reporter to try the PR if possible; sharing here so you can assess whether it needs a targeted test.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T20:42:26Z.
The overlap check with #5460 only reports the
docs/user/USAGE.mdhunk for environment-variable documentation. #5324's label flush and #5460's device-fault reporting do not share implementation files, so they appear independent; no dependency is needed. If either lands first, the second may need to refresh that documentation hunk.Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-13T22:17:04Z.
A data point from High on Life (PPSA15388, UE4) for whoever enables this, since the switch exists for titles that read GPU results on the CPU after a label.
I ran a local version of the same idea: store every pending result before the labels are recorded. Mine hooked
recordDeferredLabelsrather thanWriteLabelOnGpu, so the placement differs slightly. Results:main(3377986a) it helped. High on Life reads its sky-light SH and capture brightness back after a label, and with the store the values were right: theSkyIrradianceEnvironmentMapbuffer held 0.734 in L0, where it had stale zeros before.main18c438b10it does the opposite. With the switch on, the home base renders black, with only emissive surfaces left in banded false colour. Dumps of the scene colour (RGBA16F) after the reflection-environment pass are 0 for every pixel, and the maximum falls from frame to frame (0.0013 … 0.00000026), which looks like a pre-exposure that keeps shrinking. With the switch off on the same build, the scene renders fully lit and matches the PC version. Today's storage write-back changes onmainseem to cover what this title needed.I haven't found which stored image does the damage. My guess is the auto-exposure chain, but that's a guess. So the switch is not a safe general default for UE4 titles. For High on Life on current
mainit should stay off. If someone sees a title regress with it on, this is one shape it takes. Details are on #4736.Tested and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T11:48:31Z.
Checked the diff and rebased onto current
main(only the TechnicalDebt line for pending storage-image results conflicted; kept both its text and the newAPS5_STORE_AT_LABELsentence).StoreAtLabelRequestedparses likeStoreAtFlipRequested: unset is off,1is on, anything else throws.storeAtLabelTestsdoes not build without the change.agc_recorder_kept_bytesandagc_driver_tessellationfail the same way with the change reverted, so they are not from this PR.WriteLabelOnGpu) needs a recorder and is covered only by the title runs reported in the PR.Merging once the full Build is green.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T11:50:59Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)docs/dev/debt/libSceAgcDriver.mdL53-54docs/dev/debt/libSceAgcDriver.mdL53-54