perf(agc): bind moved read-only words from the draw upload chunk #11451
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11451"
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 johandavidcm on 2026-10-26T14:07:39Z.
What
A draw that hits a resource-cache template whose read-only guest buffers moved (
MovedReadOnlyBuffers) binds the moved words through an override buffer:PrepareDrawBindingscreated a VulkanBufferfor them on every such draw, kept at most eight inmovedWordBuffers, and otherwise created another. In Yakuza 0 Director's Cut (PPSA31327) 80,000 of 390,000 draws per 10 s take that path, so the committer created a buffer per draw for a fifth of its draws:Buffer::Bufferand the driver's allocation under it were about 4 % of the committer in a sampled profile.APS5_DRAW_UPLOAD_MAXbytes (4 KiB by default) now takes a slice of the recorder's draw upload chunk (Recorder::DrawUpload), the same 1 MiB chunk the small snapshot uploads use: the words and the data patches are copied into the slice, and the descriptor points at the chunk with the slice's offset. Larger overrides keep the buffer per draw and the eight-slot cache as before.APS5_NO_MOVED_WORD_UPLOAD=1keeps every override in a buffer of its own.docs/dev/ENVIRONMENT.mdgets the row.Tested
Windows 11 Pro 26200, WinLibs GCC 15.2.0, Release,
BUILD_TESTING=ON, headd4b86f8a6onmainf95acfc94.New test
agc_moved_word_upload(tests/Recorder.cpp,--moved-word-upload-only): two draws of one template with different moved words must share one buffer, the chunk, at different offsets, each slice must hold its draw's words, and the descriptor written for the second draw must point at the chunk with that slice's offset.two draws with moved words got a buffer each instead of slices of the recorder's draw upload chunk.--repeat until-fail:20.agc_draw_descriptors(drawDescriptorWriteTests) and the snapshot descriptor check inagc_driver_graphicsexpect the moved binding's descriptor at the slice's offset now instead of offset zero, and read the words there.Pass with the change:
agc_draw_descriptors,agc_draw_snapshot_cap,agc_draw_snapshot_epoch,agc_draw_inputs_in_place,agc_draw_inputs_copied,agc_queued_write_groups,agc_recorder_read_list,agc_descriptor_pool_recycling,agc_driver_draw_cache_reuseand its_draw_pipeline,_entry_verify,_inline,_offand_verifyvariants,agc_driver_graphics,agc_driver_address_passes,agc_driver_address_passes_targets_split.With
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(VK_LOADER_DEBUG=layershowing the layer inserted),ctest -R <those tests> -Vpasses onmainf95acfc94(17 of 17) and on this head (18 of 18, with the new test); both logs show the layer inserted, neither containswas not found but was requested by env var VK_INSTANCE_LAYERS, and neither contains aVUID-line (0 onmain, 0 on the head).PPSA31327 01.015.000, gameplay in Kamurocho, scripted boot through the first dialogue, 1920x1080,
APS5_DRAW_PIPELINE=1 APS5_DRAW_INPUTS_IN_PLACE=1,APS5_TRACE_SECONDS=140:60, runs alternated, two builds from the same tree and machine:mainf616a1397+ #8098 (commit b5e8d63b2; #8098 is the title's audio fix, without which it does not run, and it toucheslibSceAudioOutonly).Between
f616a1397andf95acfc94,mainchangeslibSceAgcDriveronly inCMakeLists.txt, the newtests/ShaderMemory.cpp, two lines ofExecution/src/Driver/Packets/PacketExecution.cpp,tests/MaskedSelect.cppandtests/Pm4.cpp, none on the moved-word path, so the captures stand for this head.performance_comparelistswindow.first_presentas the only configuration difference between the records.Graphics.Drawper frame moves by -7.6 %, -14.1 %, -3.9 % and -8.0 %; the GPU busy per present follows the frame.Summary lines (pair 2: base, then this change)
The traces of pair 2 and the output of
tools/trace_digest.pyon each are in the comment below the review.Earlier, on
main9f386f3a2+ #8098 with one build and the switch (APS5_NO_MOVED_WORD_UPLOAD=1as the base arm), four alternated pairs gave 198.6 / 203.9, 205.6 / 199.8, 211.3 / 194.4 and 206.7 / 189.8 ms (mean -4.2 %), and a sampled committer profile of each arm (APS5_SAMPLE_COMMITTER, gameplay only, one run per arm) showed the mechanism:APS5_NO_MOVED_WORD_UPLOAD=1PrepareDrawBindings(inclusive)Buffer::BufferAllocate+Recorder::KeepBytes+ shared-pointer releaserecordPreparedDraw(inclusive)prepareDraw(inclusive, untouched by the change)Frame dumps at the same points of the scene (intro, title, two street frames) match between this change and the base build.
tools/check_conventions.py --base origin/mainpasses.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 MarcZX10 on 2026-10-26T14:10:52Z.
Review: CHANGES_REQUESTED
The
perfevidence is not yet reviewable under the repository rule. Both pastedaps5-summary.jsonlrecords identify commitef5836d37150; only the environment differs (APS5_NO_MOVED_WORD_UPLOAD=1versus unset), so the first record does not identify a capture onmainand the second does not identify this PR head. Please provide a same-title, same-scene, same-machine capture on currentmainand on the changed head, paste the two actual summary records, attach both trace files, and include the output oftools/trace_digest.py. The branch is also based on3ead2d7251whilemainhas advanced to51f5c57dd9; please sync it and rerun the required checks.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T14:40:01Z.
Review: CHANGES_REQUESTED
Re-reviewed exact head
1941801408e7eeddc39326643ae2bf1f4695c2e9. The code patch is unchanged from the previously reviewed commit, but the required performance evidence is still not present: both pasted summary lines identify the same commitef5836d37150and differ only byAPS5_NO_MOVED_WORD_UPLOAD. That is a useful configuration comparison, but it is not a capture onmainand one on this PR head as required byCONTRIBUTING.md.The head is based on
f616a1397f9b618036ac7c89f461f0bd46fbd6d6; the livemainhead is2dbe9b99f577f5fad8ee675932a0603439e5eb2a. Please provide a same-title, same-scene, same-machine pair captured on those exact revisions, attach both traces, and include the actualtools/trace_digest.pyoutput. Until those artifacts identify a main-vs-change comparison, theperf numbers missinglabel is accurate.Local checks I ran against current
mainand this exact head:python3 tools/check_conventions.py --base upstream/main --head upstream/pr-11451passed;git diff --check upstream/main...upstream/pr-11451passed; the merge-tree preview is clean. Hosted eligibility, conventions, labels and report checks pass; relinker and product jobs were skipped. I did not run the Windows/GPU tests locally.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T15:38:55Z.
Review: CHANGES_REQUESTED
I reviewed exact head
29c9624db5ee20768914e4011865299466cf504dand the new performance evidence. I withdraw my earlier request for missing capture data. I downloaded both attached pair-2 traces and independently rantools/trace_digest.pywith their posted summary lines. The base trace reports 280 presents and p50 209.978 ms; the change trace reports 315 presents and p50 190.032 ms. Both digests match the posted capture windows and exposetrace_dropped: true; the full-window summary metrics remain available, while event-level details are incomplete as the report discloses. The four alternating pairs and same-machine/title/scene controls are documented. I found no implementation defect in the moved-word upload change.The remaining repository-rule update is branch freshness: the tested base/head are on
7903201bb426, while currentmainisb0f1183ca12b. The merge-tree preview is clean, andmainhas made no AGC runtime or test changes since the tested base. Please sync to currentmainand let the required checks rerun; the captured comparison remains relevant because those intervening commits do not touch the changed AGC paths.Pull request closed