perf(agc): cut three per-draw costs in ShaderResources #15682
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15682"
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 oneandonlydean on 2026-11-04T04:14:40Z.
What
Three small costs in the per-draw shader resource path, each from a CPU profile of one title's queue-0 worker; behaviour is unchanged, and the first two have an environment switch that restores the old path.
ShaderResources::ReadsOverlapbuilt the wholeInPlaceReadsvector on every call;recordDrawcalls it once per queued store for every draw that is not address-based.GuestBufferMemory::InPlaceReadsOverlapwalks the same regions (the address space's base regions, then the build's own, each when bound in place) and stops at the first overlap. The profile showed about 3% of the worker in the list build.APS5_NO_READS_OVERLAP_WALK=1builds the list as before.std::set(about 3.7% of the worker was allocator time inside builds); the counts are known before the plan is walked, so the vectors are reserved once. A build that binds BDA tables, or a fault buffer whileAPS5_LOOP_GUARDis set, can never be reused (noteReusableandNeverReusablerefuse it), so it no longer copies its data words for a template refresh nor records the proof of its sampled textures; a fault-only build is reusable and keeps both.APS5_KEEP_TEMPLATE_RECORDS=1keeps both for every build.[textures]counters with an atomic add on a line every building thread writes, although they are only printed underAPS5_PROFILE_DRAW(about a tenth ofprecollectImagesin the profile); the adds now run only when the counters are reported. A stage-B fast hit also copied the record's texture pointer (another atomic reference count); the record's reference is now moved out on a hit.Both switches are in
docs/dev/ENVIRONMENT.md. Not included: skipping the zero-fill of overwritten texture snapshots (#9884 and #10845 already cover the large dropped case; the rest is unmeasured).Tested
main1c8c0efc8c. Builtagc_driver_graphics_testsandagc_driver_recorder_tests;tools/check_conventions.pypasses. Passed:agc_driver_graphics_maps_fallback, the four newagc_driver_fault_only_template_records*tests,agc_driver_recorderandagc_recorder_read_list.InPlaceReadsOverlapandReadsOverlapwith the listed reads on seven probes and on every read of a build; the new graphics-test mode builds a fault-buffer stage with a flattened-SRT data binding and compares the data-word hash with and withoutAPS5_KEEP_TEMPLATE_RECORDSandAPS5_LOOP_GUARD.InPlaceReadsOverlapreturn false failsagc_driver_recorder_tests(the in-place read overlap walk disagrees with the listed reads); makingkeepsTemplateRecordsalways true failsagc_driver_fault_only_template_records_loop_guard(the other three variants still pass).3c2bbeaf3d), which also touchesShaderResources.cpp.Checklist
main1c8c0efc8c; no other open PR implements the same functions.mdfiles or images added to the repository