UFC 6 profiling: tracking draft (not for merge) #18515
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18515"
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 nicolasabosch on 2026-11-11T19:40:29Z.
What
This is a tracking draft and is not for merge. It collects the changes from profiling UFC 6 (PPSA23566). Each commit is meant to become its own PR against current
main. The findings are in the game bring-up discussion #5996.The commits that change the frame rate:
b900b496ae: wakes a dormant queue worker 0 when an end-of-pipe interrupt completion becomes pending. Before, the interrupt waited out the 50 ms idle quiet period.83c25d94dcand40a1e17983: a storage image's CPU-path upload is recorded into the open batch instead of a privateSubmitAndWait, and reuses the batch's upload scratch.f9be6cfa9c: a block-unit storage image that crosses two registered 8 MiB import windows is detiled per segment from each range's import, instead ofReadCommittedof the whole image. Before, that meant a shadow publish and a fence wait.85c5020032: a buffer range that crosses import windows is joined into one import and bound in place. Before, it was copied on the CPU while holding the GPU mutex, which held the mutex about 96 % of the time in gameplay.APS5_NO_JOIN_STRADDLE=1disables it.de25727963: the fallback for85c5020032when a join is refused: one GPU copy per window segment. On its own it measured slower in gameplay (7 vs 9 presents / 10 s), because the copy crosses PCIe twice on every dispatch.APS5_NO_SEGMENT_BUFFER=1disables it.c87be26205: a compute shader's multi-dword buffer store, or 8-byte typed store, is emitted as oneu64oruvec4store through aliased storage-buffer views when alignment, bounds, swizzle and base checks pass at run time; otherwise it falls back to the per-byte or per-dword path. Before, an 8-byte typed store was 8 byte stores throughbuffers_u8. GPU time per gameplay frame drops from about 330 ms to about 170 ms. NeedsshaderInt64and a 16-byteminStorageBufferOffsetAlignment.APS5_NO_WIDE_BUFFER_STORES=1disables it.8fe0288d40and74814867a4: keep read-only and GPU-written joined ranges resident in VRAM, with write-back bounded to one batch. No gain in gameplay (24–27 vs 27–28). The game records about 130 batches per flip, and VRAM on the 8 GB card is at its budget, so most ranges are refused. Both will be dropped before the split.APS5_NO_BUFFER_RESIDENCY=1andAPS5_NO_WRITTEN_RESIDENCY=1disable them.Error fixes, so the game gets error codes instead of exceptions or silence:
db2ab89042:sceNetConnectreturns ETIMEDOUT on a connect timeout.7bf1e43bec: a failedsceHttpSendRequestis reported through errno and an epoll event.a277e54495: the NP reachability callback receives the unavailable state.3e0a0b139f: VideoRecordingOpenandQueryMemSizereturn an error.bc75cacf31: APR read failures are reported.Smaller changes:
a04dbb15e4,ba8d3b1932,76c57009a5,8bb46325ed: zero-timeout sema and event-flag waits, the QueryPerformanceCounter-to-nanoseconds conversion, clock_gettime and sema signal.08baa1842f,736c4db246,54efb302e3: waits.0b382e3507: draw relocation is learned when the entry is inserted.ecddfb081a: detiler retirement.6c2f59b517: shader cache prefetch.Opt-in switches:
APS5_ALIAS_OVERWRITE(f4e64606f1) no longer gains anything afterf9be6cfa9c.APS5_PRESENT_REPORT(25ecf1a335) is a local measuring aid, becauseAPS5_PROFILE_DRAWdisables the draw finisher.7fea13a510is reverted by7407b9a61fbecause it measured 5 % slower.Tested
All numbers are on Windows 11 with an i9-14900HX and an RTX 4070 Laptop, base
dd7c8de5de,APS5_LAZY_SHADER_PREPARE=1.UFC 6 title screen, presents per 10 s, from the
[present]report over the steady state of 90 s runs:b900b496ae40a1e17983f9be6cfa9ctrace_digestsummaries yet, so they are not valid perf evidence under the Performance report form. Each split PR will carry its own.ctest -j 32 -R "^(agc_|guest_)"passes 3441 of 3441 atb507ecf34a.f9be6cfa9cran withVK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1andANYPS5_REQUIRE_VULKAN=1, with noVUID-errors. That comparison was not run on main.UFC 6 gameplay (practice mode), presents per 10 s from
APS5_PRESENT_REPORT, played by hand up to gameplay:b507ecf34ade25727963(segment copies)85c5020032(joined import in place)8fe0288d40(read-only VRAM residency)74814867a4(GPU-written VRAM residency)c87be26205(wide buffer stores, warm shader cache)85c5020032, about 2,400 straddling ranges (about 40 GiB) per 10 s are served in place, with 0 segment copies and 0 CPU fallbacks. Joined imports stop being created once gameplay starts.APS5_PROFILE_GPU=1in gameplay: about 80 % of GPU time is compute dispatches of about 2 ms each that bind these 20–46 MiB buffers. Copies and barriers are about 1.5 s per 10 s.c87be26205fixes the stores.c87be26205: one at about 26 ms per frame that has an atomic store and a read on the same binding with no barrier, so it cannot take the spanned-wave path; and one at about 18 ms per frame dominated by atomics.c87be26205, so it is not included.85c5020032ended in a device fault ([device-fault] result 5) after about 10 s of gameplay; the other did not. Not reproduced since.c87be26205was checked by hand in gameplay.c87be26205:ctest -j 32passes 3451 of 3453. The 2 failures areguest_raise_short_sleepandguest_raise_short_sleep_without_wake, which time out at 30 s under parallel load and pass alone in 0.2 s.BufferWideStoresadds 43 execution cases.Checklist
main; no other open PR implements the same functions (based ondd7c8de5de, not rebased)NotImplemented_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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T21:23:56Z.
Review: COMMENTED
Reviewed — comments
This tracking draft spans many independent subsystems, and the review is incomplete because multiple changed files were not read in full and no checks were run.
What I ran
Head reviewed:
c87be26205f607ae7ffbb3b5ba2f4bef2caa4fff. I read the prepared description, commits, manifest, and diff; I did not run commands or tests.Results
Findings
Blocking
None identified in the portions reviewed.
Non-blocking
sceHttpWaitRequestnow copies queued events intonbev(core/libs/prx/libSceHttp/Export.cpp:5467), but the changed code shown does not validatenbevwhen events are queued. A null or invalid output pointer could fault; confirm the API's pointer validation contract and guard it as needed.Not verified
No tests, builds, or prechecks were run. Full text was read for
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp,core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp, andcore/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp; changed hunks were read fromreview/diff.patch. The other changed files were not read in full, including files markedincluded: falseinreview/manifest.json(notably shader recompiler, texture, kernel timing, and test files). The description's reported test and performance results were not independently verified.To get this to a good state
Nothing is required. Optional: split the tracking draft into topic-focused PRs and verify
sceHttpWaitRequestoutput-pointer handling against its API contract.Pull request closed