perf(agc): write draw descriptors from retained CPU metadata #1334
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1334"
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 TibixDev on 2026-10-07T23:46:39Z.
What
Keep buffer and image descriptor metadata with each resource. Build each draw's descriptor set from that metadata in one update, with the draw's snapshot buffers substituted. This removes Vulkan descriptor copies from the draw path.
Guest snapshots, resource ownership, and descriptor-set lifetimes stay the same. #639/#1219 change resource ABI handling; #1202 changes snapshot allocation. Neither replaces these descriptor copies.
Tested
Fedora 44, Release: graphics tests. RX 6600 with Vulkan validation: mixed buffer and sampler-array bindings, repeated snapshot overrides, unchanged descriptors, and one update with no descriptor copies. Windows was not tested.
Isolated comparison: upstream
e9846679versus the same revision plus this PR. For eight storage-buffer descriptors, preparing a draw with one changed snapshot took 28.689 → 3.333 µs; with eight snapshots it took 37.294 → 4.935 µs. Six pinned processes per variant in ABBA order, using host RADV. These are draw-binding preparation timings, not title frame time.Checklist
main; no duplicate open PR.Imported from boykopovar/AnyPS5. Originally posted by TibixDev on 2026-10-08T06:09:24Z.
Rebased on
e9846679with no production changes.Measured upstream
e9846679against the same revision plus this PR (cc32a55f). Fedora 44, GCC 16 Release, Ryzen 5 5600, CPU 3, RX 6600. The runner explicitly selects host RADV and its matching host library directory. Supportinglibcandlibkernelbinaries are identical between variants.The same fixture calls production
ShaderResources::PrepareDrawBindingswith eight storage-buffer bindings and either one or eight snapshot overrides. Snapshot data changes on each call. Descriptor allocation, snapshot allocation/copy, and recorder retirement remain in the timing. One warmup and nine batches of 5,120 draws per process, with retirement every 32 draws. Six processes per variant in ABBA × 3 order; validation is off for timing. No game or build ran during measurement.Snapshot checksums match. Both benchmark variants pass separate core and sync validation runs on RADV. The PR's mixed buffer/sampler-array, repeated snapshot override, and descriptor update-count tests pass with validation on RADV and llvmpipe. Graphics and contribution checks pass.
This measures draw-binding preparation only; no title frame time or Windows result is claimed. AI-assisted.
Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-08T09:09:09Z.
Title-level data for this change, from a retail title (Astro Bot, PPSA21567 v01.019.000), in case it helps the review.
Setup: RX 9070 XT (GFX1201), RADV / Mesa 26.2.4, Linux 7.2.9. Base is the
astrobotfork at 88d7bb62 plus #943 (815d2747,00e6d078), because upstreammainstops on this title (#1458). For this test, onlylibSceAgcDriver.prxchanges between runs.Profile before the change:
perf recordran for 40 s on the title screen. The driver thread (Driver::run) was ~100% busy. With DWARF unwinding, 1321 of 3570 samples on that thread (37%) were in glibcmemcpycalled fromlibvulkan_radeon.so, fromShaderResources::PrepareDrawBindings(thevkUpdateDescriptorSetscall with theVkCopyDescriptorSetarray). The hot paths are the 16–31 and 32–63 byte copies, i.e. one copy per descriptor.APS5_PROFILE_DRAWreported ~5.7k draws/s on that scene.Presents per second (
[present]lines,APS5_PROFILE_DRAW=1, 200 s from boot to title screen, no input):APS5_DUMP_FRAMESmatch visually between base and patched runs. The differences are animation timing only.Recorder.cpptest hunk conflicted on the fork, so I dropped it for this build only. I didn't run this PR's tests here.main5d42b82, my own version of the same change passes 428/428cteston this GPU.AI-assisted: the profiling, the measurements and this write-up were done by Claude (Claude Code) on my machine.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T03:35:17Z.
This conflicts with
mainagain (ShaderResources.hpp/.cpp,tests/Recorder.cpp). Could you rebase it?Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T08:41:28Z.
Rebased on current
main(conflicts inShaderResources.hpp/.cppandtests/Recorder.cppafter #1730b29c4, which addedallocationDescriptorsand still copies the whole set). Resolved by dropping that member in favour of the retained descriptor arrays from this PR, and using main's snapshot index lookup for the overrides.Added on top of your commit:
tests/Recorder.cpp: the test's sampler binding used11, which #639's typed heaps reject; it now usesRuntimeAbi::Binding::Samplers.tests/Graphics.cpp(descriptorSnapshotTests): it pinned the old copy-then-overwrite behaviour; it now expects no copies, one write per binding, and an untouched binding keeping its original descriptor.Checked:
agc_driver_graphicspasses, andagc_driver_recorder_tests --draw-descriptors-onlypasses (that target is not registered in ctest onmain; built by hand). Merging once CI is green on the new head.