Repository navigation
perf(agc): disambiguate direct GPU writes from copied write-backs in indirect draws - #3471
Conversation
|
Could you add frame times for main against main plus this PR alone, on the scene you measured? The count of It also needs a test that fails on main: a writer in |
fd293be to
112d0a9
Compare
|
Added the unit test and isolated frame times for Unit Test (
|
| Metric | main |
main + #3471 alone |
Delta |
|---|---|---|---|
| Frame Time (p50) | 71.2 ms (14.0 FPS) | 68.8 ms (14.5 FPS) | -2.4 ms |
| Frame Time (p90) | 76.5 ms | 72.1 ms | -4.4 ms |
| Indirect draws on GPU | 142 / 10 s | 200 / 10 s | +58 |
CPU fallbacks (pending_label_or_copy) |
58 / 10 s | 0 / 10 s | -100% |
| Indirect argument reads wait | 1.4 ms / frame | 0.0 ms | -1.4 ms |
| GPU idle gap time | 13.0 ms | 10.5 ms | -2.5 ms |
The +0.5 FPS and ~2.4 ms frame time reduction comes directly from eliminating the ~58 synchronous CPU flush-hook waits and GPU-mutex contentions per 10 s.
112d0a9 to
d906ee2
Compare
|
Prepared a source-only Windows cross-test of your current a057eed + d906ee2 pair, credited unchanged, on our #4017/#1359/007-hull integration: https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-copied-overlap-cross-test head0e981f4e35e641834dd21fdbb36070a4e8055d6f. Applies cleanly; conventions pass. Native build/checks will follow after our ongoing quiet ordering run, so no runtime/FPS result yet. Keeping completion-label #4496 separate initially. AI-assisted: Codex. |
|
Windows cross-test completed for current #3471 pair a057eed + d906ee2, local credited head0e981f4e35e641834dd21fdbb36070a4e8055d6f: https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-copied-overlap-cross-test . Includes #4017 and separately verified #1359 integration. Fresh fixtures pass: graphics, copied_direct_ordering, host_import_retirement, storage_cpu_snapshot, storage_upload_lifetime/failure (6/6,6.19s restored); copied_writer_copy (.33s), prepared_shaders_indirect (.67s). Negative control replaced only CopiedWritesOverlap's implementation with the old broad WritesOverlap query, retaining your mixed-output fixture: graphics fails in.27s with 'CopiedWritesOverlap must return false for direct written region'. Restored HEAD, rebuilt and passes again. This demonstrates region classification; not claiming that control alone verifies every driver call site or a title speedup. Initial prepared test failed replay equality using an old executable; a fresh target rebuild passes without production edits. Now running guarded warm007 with graphics SHA256F422A77770FADFD32771821923B7B53E71DF26D32971B7A0772B8D2AE3F43107 and APS5_PROFILE_DRAW=1 for CPU-copy/wait diagnostics. No GPU profiling, capture or compute-opt bypass. FPS from this diagnostic run will need a later quiet comparison. #4496 remains separate. AI-assisted: Codex. |
What
Building on #2792: a recorded dispatch or draw in
copiedWritersorDrawCopiedWritersforces indirect draws (decideIndirect,Draw), fills (FillBuffer) and buffer copies (CopyBuffer) to treat all its writes as pending CPU write-backs, waiting for its batch or falling back to the CPU (outcome.cpuReason = 2).However, a writer listed in
copiedWriterscan write both copied regions (requiring a CPU write-back) and direct GPU-written or GPU-copied regions (handled entirely on the device). When an indirect draw or buffer copy queries an address range overlapping that writer's direct/device-handled output, checkingWritesOverlap(address, bytes)falsely treats it as a pending CPU write-back.Introduce
GuestBufferMemory::CopiedWritesOverlap(address, bytes): it checks whether the specific region overlapping[address, address + bytes)is a copied buffer requiring a CPU write-back (!region.direct && !(region.gpuCopy && (region.copiedBack || region.deviceLocal))).VulkanDevice::CopiedWriterOverlapsandDraw's indirect draw check now use this instead of whole-writerWritesOverlap. Duplicateany_ofscans acrosscopiedWritersandDrawCopiedWritersinFillBuffer,CopyBufferanddecideIndirectare unified throughCopiedWriterOverlaps.Tested
ctest -R "^agc_driver_": 295 of 295 passed (100%, 46.99 s).copied_writer_copy,prepared_shaders_indirect,draw_cache_reuse_offpassed.ANYPS5_GPU=NVIDIA), compiling and caching >1,280 shaders with 0 GPU deadlocks or assertion failures.cpuReason = 2) on indirect draws in Linux Vulkan just as observed on Windows.ctest -R copied_writer_copy: passed (0.04 s).python3 tools/check_conventions.py: all checks passed.cpuReason = 2) and GPU-mutex waits per 10 s.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)