perf(agc): do not store a compute fill a multisampled target takes as its clear #5313
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5313"
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 Raghav314 on 2026-10-13T17:01:29Z.
What
A multisampled color target keeps its samples only in its host image, and the driver refuses every guest read of its color memory that it checks (
RequireNoMultisampleTarget: CPU reads, texture and storage image reads, DMA copies). Since #2132 a uniform fill over that memory is noted as the target's clear (NoteColorMetadataFill).BufferFillstill stored the fill into the host import as well, so the GPU wrote bytes over PCIe that only reads the guard does not check could see.MultisampledColorFillAbsorbs(address, bytes, pattern): whether a live (not retired, #4474) multisampled target takes the fill as its clear: it starts at the target's address, is exactly its color footprint (MultisampledColorBytes), and the value has an exact clear color in the format (MultisampledFillClearColor).BufferFilldoes not store such a fill (and skips the pre-store flush for it) when it is uniform and no storage image or DCC keys cover the range. Every other fill is stored as before, including a fill over part of the color memory, one reaching past it, and one with no exact clear value. The clear is noted as before.APS5_PROFILE_DRAW) counts the fills not stored.docs/dev/debt/libSceAgcDriver.mdnotes what is not covered: a target is retired only when its whole range is unmapped or its allocation removed, so a title that reuses a target's memory for other data while it stays mapped and reads it through a path the guard does not check (a V# buffer or a pointer) sees the bytes from before the fill.PPSA36082
Hades II clears its two 4x targets with compute fills (0x2400000 bytes over a 1536x1536 sRGB 8_8_8_8 target and 0xff0000 bytes over a 960x540 16_16_16_16 float target, as in #2132), the smaller one about 7 times a frame. Standing in the hub, that was 10 fills and ~134 MiB per frame written into the import at ~25 GB/s, 5.5 ms of GPU time per frame. With this change the GPU is busy 2.9 ms per frame instead of 9.1. On
mainthe queue worker is the limit in the hub, so the frame time barely moves there; on a local stack whose worker is faster the same change took the hub from about 75 to about 80 fps, with the GPU idle for most of the frame. The picture in the hub is unchanged.Tested
Linux (CachyOS), x86-64, GCC, 7800X3D / RTX 4090, NVIDIA 615.78.08.
agc_driver_multisample_fill_host_only, through the driver's compute fill path on a 4x 64x64 target: a fill of 0 over the whole color memory leaves the guest bytes as they were, a fill over half of it is stored, a fill over plain memory is stored before and after the target exists, on an sRGB target a fill with no exact clear value (0x80808080) is stored, and once the target's allocation is removed (retired) a fill over its old color memory is stored. It also checks the footprint match (half, offset, reaching past). Reports a skip when the device has no 4x color targets or does not store compute fills. Fails with the absorb disabled, with>=instead of an exact footprint, with the clear value check dropped, and with the retired check dropped.build.ymlrun locally on this head (main016db923): configure with SPIRV tools on, test registration check, build, libs, ctest 1092/1093,check_skips.pyclean (7 expected skips). The one failure,agc_driver_bc_block_copy(BC7 through 32x4 uint blocks), fails the same way with this change's files reverted to main's, on this NVIDIA driver.tools/pr_overlap.py --branch: no overlap with open pull requests.APS5_HOST_IMPORT_MIB=6784, timing log off (traces attached). The main line is from main91ed4ce62built this morning (dirty because it was built from a local branch with its one commit reverted):{"commit": "b9d3c9268562", "dirty": true, "window": {"spec": "seconds 75:15"}, "presents": 485, "frame_ms": {"p50": 31.468, "p90": 32.506, "p99": 33.869, "max": 38.167}, "gpu_busy_ms_per_present": 9.146, "worker_busy_pct": {"queue worker 0x0": 98.915}}{"commit": "5d0a4b219d48", "dirty": false, "window": {"spec": "seconds 120:15"}, "presents": 510, "frame_ms": {"p50": 29.537, "p90": 31.009, "p99": 32.247, "max": 33.134}, "gpu_busy_ms_per_present": 2.868, "worker_busy_pct": {"queue worker 0x0": 99.069}}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)Imported from boykopovar/AnyPS5. Originally posted by Raghav314 on 2026-10-13T17:06:13Z.
Traces for the two summary lines in the description, hub standing still on an RTX 4090 (open in ui.perfetto.dev). The main one is
91ed4ce62with the timing log off; the PR one is the head before the rebase (5d0a4b219), same code.pr-5313-hub.json.gz
main-91ed4ce62-hub.json.gz
LLM assistance used.