perf(agc): keep unfolded indirect draws on the GPU #18319
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18319"
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 edubox on 2026-11-11T07:34:59Z.
What
ClassifyIndirectDrawsent every indirect draw whose program does not read the offset register the packet names to the CPU path (Path::NotFolded), so the driver expanded the record list into one draw per record and ran the full resource build for each.The program never reads that register, so the record's dword never reaches the fetch and the draw starts at the packet's fixed offset, exactly what the CPU path produces (its patch writes a register no program reads). The classifier now tags that dimension as
Constantwith the packet's fixed offset and keeps the draw on the GPU.APS5_NO_GPU_UNFOLDED_INDIRECT=1restores the CPU path.A
Constantdimension is rewritten record by record withvkCmdUpdateBuffer, so the guard that keeps such draws on the CPU goes from 256 to 1024 records: the multi-draw count is a small field and the scratch stays at most 20 KiB. Without it the real multi-draw counts of the title (366, 460, 576 records) still fell back to one draw per record.Tested
Linux (CachyOS, GCC 16.2.1, Release, NVIDIA RTX 4080 SUPER, driver 620.70.06).
Planet Zoo (PPSA18026, 01.009.002). Same build otherwise,
APS5_PROFILE_DRAW=1, vpad pressing Cross every 6 s. Before, everyDRAW_INDEX_INDIRECT_MULTIclassified tocpu (patched SGPR not folded); during theScenario_01load a 3-record packet took 15.7 s of a 10 s window and the guest watchdog aborted with SIGILL after the 110 s deadline. After, all of them classify togpu vertex=const 0 instance=const 0:DRAW_INDEX_INDIRECT_MULTI: 15.7 s of 10 s → 2.0-2.1 s.Focused AGC tests on the same machine with
ANYPS5_REQUIRE_VULKAN=1:agc_driver_draw_offset_indices,agc_driver_rect_list_indirect, theagc_driver_draw_*andagc_driver_draw_cache_reuse*variants andagc_driver_graphics/_maps_fallback(51/51 pass).agc_driver_draw_offset_indicesnow classifies a record whose program reads no offset register, and a 300-record list, to the GPU with both dimensions constant;agc_driver_draw_cache_reusesets the kill switch so its CPU-path cache cases keep exercising that path.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)