perf(agc): prove sampled depth surfaces in the fast resource proof #1430
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1430"
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 fisherjoey on 2026-10-08T05:25:14Z.
What
This is the fix from #1132. Sets that sample a depth surface now pass the fast resource proof instead of taking the full walk on every reuse.
cachedTexturereturnedDepthSurfaceTexture's object before callinglogLookup, so the element had no lookup record andfastRevalidatefailed withno recordevery time. The walk then succeeded, because the depth surface hands out the same object each time. The only cost was one full walk per dispatch.ValidatedSurfacecarries the flag.fastRevalidateandfastRevalidateEachprove a depth element with the newDepthSurfaceHolds(context, address, texture): the newest surface at that address still hands out that object, which is what the walk'sDepthSurfaceTexturelookup would return. The memory, key and pending checks are skipped for that element.depth surface, covers a surface that no longer hands the object out.New test:
depthSurfaceProofTestsintests/Recorder.cpp(agc_driver_recorder_tests, a separate commit). It registers a D32 depth surface on a real device, builds a compute set whose only binding samples it, and requiresRevalidateto take the fast path on the second and third use. The test needs a real device with the driver'sContext, which the mock harness intests/Graphics.cppdoesn't have, so it sits with the other cache tests in the recorder suite. It builds onmainunchanged and fails there on behaviour:With
APS5_PROFILE_DRAW=1, the[rescache]line onmainshows the reason:On this branch it passes, and the same line reads:
The idea for a dedicated test came from @emirplus in #1199, which implements the same change. Thanks to them, and to @oneandonlydean for spelling out what the test has to show.
Demon's Souls (PPSA01341 v1.07), PS Studios movie, per 10 s:
The frame rate did not change: queue 0's wait for the GPU mutex took up the time saved.
#425 and #454 change the same lookup (per-use depth copies, retired surfaces). If one of them lands first, a depth record has to skip per-use copies and
DepthSurfaceHoldshas to treat a retired surface as not holding. I'll rebase onto whichever lands.Closes #1132.
Tested
Linux 7.2 (Nobara 44), GCC 16.2, RTX 5070 Ti, driver 595.91.07.
agc_driver_recorder_tests(run directly; it isn't registered with ctest): fails onmainwith the message above and passes here. If you want it under ctest, I can register the suite here or in a follow-up.maina29ef592. Since the typed descriptor heaps landed, a sampled image has to sit in an image heap and the heaps neednullDescriptor, so the test binds atRuntimeAbi::FirstImageBindingand the recorder suite's device now enablesVK_EXT_robustness2nullDescriptorwhen the GPU has it, as the driver's own device does (the test reports "not tested" without it). The new test passes. The suite then stops later at "guest allocation ... is still pinned", the same as on unmodifiedmain.ctest -R agc_ -j1ona29ef592: 321 of 322. The one failure,agc_driver_dcc_keys_first_write, also fails onmain.ctest -R "agc_driver|guest_agc_driver": 164 of 164 pass.agc_driver_lds_atomics64andagc_driver_scalar_sop1are excluded; they fail on unmodifiedmainon this GPU too.APS5_WRITE_WATCH_IMPORTS=watch. On currentmain, this NVIDIA driver refuses the new dma-buf import probe (vkAllocateMemory-2), and after that every allocation on the device fails, so most GPU tests fail on unmodifiedmainwithout the variable. The recorder suite also stops at its own dma-buf probe test for the same reason, so the new test runs before that point. #1380 and #1329 turn that probe off on NVIDIA's proprietary driver.Checklist
main; no other open PR implements the same functions (#1199 does; see above)NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-08T08:34:56Z.
This now conflicts with main in
ShaderResources.cpp, please rebase. It also replaces #1199, which was closed in its favour.Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-08T14:38:47Z.
Rebased onto
main9f4bd71c(head is now 965f0180).The conflict was in
cachedTexture: #1113 added theRecorder::BoundKeptBytes()call right above the depth-surface return. I kept that call and put the lookup record after it.ctest (
-j1 --timeout 60, Nobara 44 / Linux 7.2, GCC 16.2.1, RTX 5070 Ti, driver 595.91.07):agc_driver+guest_agc_driver183/183. Full run 462/463. The one failure isguest_dynamic_loader, which also fails on a build of #1133's branch on the samemainand is not related to this change.Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-08T17:42:43Z.
Rebased on main
29e533ac(head 33bcbf07). The depth fast path now only covers plain 2D depth lookups (2D dimension, base array 0), so it composes with #1368's slice refresh: array and layered views take the full walk throughDepthSurfaceTexture.depthSurfaceProofTestsalso checks that the same lookup as a 2D array, or with a nonzero base array, is not fast-provable.agc_driver_recorder_testspasses the depth cases here but stops later inimportWindowTests(Recorder.cpp:2138, "a cache over the pages the import reported sees no change"). Main does the same on this NVIDIA setup.Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T19:41:39Z.
Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head
33bcbf07, merged ontomain8b393b6ein one build with 31 other PRs that had no Windows run.agc_driver_recorder_testsnow stops in the newdepthSurfaceProofTests:The test's
DescriptorBindingsetsbinding = 0for a sampled image. On currentmain, binding 0 isBinding::Buffers, and sampled images start atFirstImageBinding(1). SoHeapCapacitythrows. That doesn't depend on Windows, but the recorder test isn't in ctest, so CI won't show it. I ran it with #2248 and #2299 merged, sincemainfails it earlier for other reasons (#2155).The exception then unwinds through
~Recorder, whoseSync→Submitcrashes in the driver and hides the message. I had to catch it insidemain's scope to see it.The full ctest passes apart from one unrelated failure from #2359 (520 of 521).
🤖 Addressed by Claude Code
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T23:28:16Z.
Review: CHANGES_REQUESTED
Thanks for the fix and the numbers. One blocker:
depthSurfaceProofTestssetsbinding.binding = 0(tests/Recorder.cpp:2630). On currentmainbinding 0 isBinding::Buffers, and sampled images start atRuntimeAbi::FirstImageBinding, soHeapCapacitythrowsShader runtime ABI: binding is not a typed heap(RuntimeAbi.hpp:73). @popcoder565 hit exactly this on Windows with this head. Please useShaderRecompiler::RuntimeAbi::FirstImageBinding(astests/Graphics.cppdoes) and re-check that the test still fails onmainfor the intended reason (no record), not on this exception.agc_driver_recorder_testsisn't registered in ctest, so CI never runs the new test and didn't catch the above. Please register the suite (or move the test to a registered target) so it is covered.The change itself in
ShaderResources.cpp/DepthSurface.cpplooks fine.Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-10T17:24:52Z.
@popcoder565 thanks, that was right. The rebase onto
a29ef592(f1e4838d) binds the test's sampled image atFirstImageBinding, passes the newgpuargument toMutation::Add, and enablesnullDescriptoron the recorder suite's device when the GPU has it (the driver's own device already requires it); without that the depth cases print "not tested". The depth proof cases pass there on the RTX 5070 Ti. The PR conflicts withmainagain, so it gets another rebase next.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T22:58:18Z.
Review: APPROVED
Rebased onto current
main(the only conflict was intests/Recorder.cpp).mainnow enablesnullDescriptoron the recorder suite's device and exposesDevice::NullDescriptors(), so I dropped the duplicate robustness block;depthSurfaceProofTestschecksdevice.NullDescriptors()and setscontext.nullDescriptors = trueon its context copy, like the neighbouring test.agc_driver_recorder_testson RADV:depthSurfaceProofTestspasses (fast 1, full 0). With the four non-test files reverted tomainit fails withleft the fast proof for the full walk on use 2/no record 1. The suite still stops later at(s) results pending when their memory left the watch, as onmainwithout this test.Merging once CI is green.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T23:05:08Z.
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)core/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hppL20core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppL122, L219core/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hppL20-21core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppL122