Repository navigation
perf(agc): bind the changed copy-back's buffers through push descriptors - #15792
oneandonlydean merged 11 commits into
Conversation
✅ NVIDIA GPU test: passedPR head
Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Validated but not compared (1, not in the main baseline's validation pass)Validation IDs already present on main (13 IDs in 549 tests)Skipped (49)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
|
This pull request is labeled |
|
Hi Thanks for the split by variant; it makes the cost easy to follow. I checked this head on Linux with an NVIDIA RTX card and the Khronos validation layer. The 15 copy-back tests pass with no validation messages. A shader broken on purpose (dropping One request, and one small point:
|
|
Independent Linux/AMD run of head Paired focused run (
The 15th is the new Coverage experiment closing @oneandonlydean's first point With one line in the shared harness — Not run: the MoltenVK performance claim is outside this machine, and I did not produce Linux AI-assisted: yes |
✅ AMD GPU test: passedPR head
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (8, not counted against this PR)Validated but not compared (1, not in the main baseline's validation pass)Validation IDs already present on main (8 IDs in 549 tests)Skipped (60)ReproduceAutomated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
…ound Apply review request from 2026-11-04: on a device with VK_KHR_push_descriptor, GuestBufferMemory::RecordCopyBacks now takes the bound copy-back, which no existing test reached because the shared test context keeps push descriptors off. agc_bda_staging_bound runs the agc_bda_staging case with the device's push descriptors enabled in the test context, so the copy-back goes through RecordBoundChangedCopy and StagingCopyBackBound.comp. It exits 77 on a device without push descriptors, as agc_bound_changed_copy now does too instead of passing.
|
Hi imellag, Thank you for the push-descriptor copy-back and for the detailed Stray numbers. So it can land without another round trip, we added one test-only commit to your branch (
No production code changed. On Linux with an NVIDIA RTX 4090 and the Khronos validation layer, the six copy-back tests pass with no validation messages. Feel free to revert or adjust it. |
✅ NVIDIA GPU test: passedPR head
Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Validated but not compared (2, not in the main baseline's validation pass)Validation IDs already present on main (13 IDs in 548 tests)Skipped (49)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
|
@oneandonlydean thanks for adding @blawesom thanks for the paired RADV run and the mutation check through the production path. The AI-assisted: yes |
…py-back-descriptors # Conflicts: # core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
|
Rerun on macOS (Apple M4 Pro, MoltenVK 1.4.2, x86-64 Release under Rosetta 2) on a local support tree of
I also added the two AI-assisted: yes |
|
Linux/RADV run of head Setup. CachyOS x86-64, kernel 7.3.1, AMD Radeon RX 9070 XT (RADV GFX1201), Mesa 26.2.5, Vulkan 1.4.363 loader with Khronos validation layer 1.4.363, GCC 16.2.1, Ninja, Release, Results.
That leaves the cancelled AI-assisted: yes |
✅ NVIDIA GPU test: passedPR head
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Validation IDs already present on main (9 IDs in 602 tests)Skipped (55)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
agc_bound_changed_copy was the only agc_driver_recorder_tests case missing from the Windows list that prepends libc's directory to PATH, so on the GPU-less runner it died at load with 0xc0000135 while every other case skipped. Add it to that list. Credited fix-up on imellag's PR boykopovar#15792.
|
Hi @imellag, thanks for the changed copy-back work. The Windows run failed on the new |
# Conflicts: # core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
|
Test report for af2eb9a, from GT7 (PPSA01317) on an M5 Max under Rosetta + MoltenVK and from the RTX 4090 box. I found the same root cause independently while chasing a GT7 title-screen FPS regression, so here are the numbers in case they help the review. GT7 on macOS (M5 Max, MoltenVK). Title screen, fresh boot each run,
The draw/commit/barrier counts per frame are the same in every run; only the GPU time of the draw passes changes, which matches the per-encoder RTX 4090 (Windows 11 10.0.26200.9711, NVIDIA driver 616.92, Vulkan SDK / validation layer 1.4.363.0, winlibs GCC 15.2.0). PR head merged locally onto main 5c26d4f, compared with main 5c26d4f on the same machine.
macOS tests (M5 Max, MoltenVK). The PR's commits cherry-picked onto the integration branch: One coverage note. AI-assisted: yes (Claude Code) |
|
@frankea, thanks for the GT7 numbers and the 4090 run. Your coverage note was right: with real limits the loop ran once.
Each run checks every word, the guard words on both sides and the counter summed over all dispatches. All three pass on MoltenVK (M4 Pro, AI-assisted: yes |
|
Independent Linux AMD validation of head Linux 7.2.14, GCC 16.2.1 Release, Ryzen 9 7950X, physical Radeon RX 6650 XT / RADV (Mesa 26.2.6).
45 executions passed, zero skips, zero VUIDs, no missing-layer or copy-back fallback messages. Frozen SDK/fixture hashes were checked before and after. The complete suite held the shared GPU FIFO; its infrastructure reservation was released. No game performance or full-title rendering result is claimed here. Exact generated CTest commands, JUnit, full logs, linkage proofs, probe source/build commands and source pins: downloadable evidence. SHA-256: AI-assisted: yes. Additional initial native pair, Fobia: St. Dinfna Hotel (PPSA05626), same AMD machine, 3840x2160, fresh original save/settings plus identical warmed private shader/Mesa caches and scripted 300-second route. Baseline
No speedup demonstrated in this pair (-3.57% initial FPS difference); this is not a confirmed regression. The resource paths differed substantially: cumulative staging-shadow refusals42705 versus140, and staged copy-in60947070 versus127016338 KiB. Both logs report heap-budget pressure. I have not isolated that difference, so these numbers do not isolate descriptor dispatch cost. No reverse pair or default change follows from this result. Both native exits0 (~303.4/303.5 s), complete traces with zero dropped events, matching source inputs/common seed/route/4K and no configuration differences in Official trace summaries/digests, full traces/logs, cleanup receipts, exact harness and final paired captures, SHA-256 AI-assisted: yes. |
|
@JJenkx, thanks for the RADV runs; the 45 passing executions with all three dispatch-limit variants are the coverage this needed on a non-Apple device. On the Fobia pair: no speedup is expected on RADV. The cost this PR removes is MoltenVK's: it calls AI-assisted: yes |
…py-back-descriptors # Conflicts: # core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
What
#6185 copies a staged region back through
StagingCopyBack.comp, which reaches its three buffers through buffer device addresses. To have those addresses, every staging buffer and every shadow copy is now created withVK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT(gpuCopyUsage).On MoltenVK both halves of that cost time. MoltenVK keeps every buffer created with that usage in one device-wide list (
MVKDevice::_gpuAddressableBuffers). In every encoder whose pipeline uses physical storage buffer addresses, it callsuseResourceon every buffer in that list (MVKCommandEncoderState.mm,encodeGPUAddressableBuffers). So the staging buffers make the list longer, and the kernel adds one more such encoder after each staged dispatch.Stray (PPSA02100) stages about 2 GB per 10 s through these regions. It went from 11.4 to 9.7 fps between
maina4eca2a056and1e658521a0.APS5_NO_CHANGED_COPY_BACK=1alone restores 11.3 fps. With the variable set, though, 2 of 5 runs stopped at about 33 s on a queue 0x20WAIT_REG_MEMthat timed out, which is the rollback #6185 fixes. Local variants (not in this PR) split the cost:main)APS5_CHANGED_COPY_ALWAYS=1(kernel without its read of the import)The kernel is the larger half, and the bytes it reads aren't what costs; the address flag is the rest.
This PR binds the kernel's buffers as descriptors where the device has
VK_KHR_push_descriptor, as #12120's depth pass does:StagingCopyBackBound.compapplies the same per-byte rule tostd430storage buffers. Each buffer is bound at its offset rounded down tominStorageBufferOffsetAlignment, and the dwords before the range are skipped through a base index in the push constants.Recorder::RecordBoundChangedCopypushes the four descriptors and dispatches. It splits a range onmaxComputeWorkGroupCountas before, and onmaxStorageBufferRangetoo.APS5_TRACE_COPY_BACKis bound the same way.main. A device with push descriptors but without buffer device addresses now gets the changed copy-back too; onmainit copied whole ranges.APS5_NO_CHANGED_COPY_BACKandAPS5_CHANGED_COPY_ALWAYSkeep their meaning.Tested
macOS 27.2, Apple M4 Pro, MoltenVK 1.4.2 (Vulkan SDK 1.4.363.0), x86-64 Release under Rosetta 2.
maindoesn't build on macOS on its own, so both sides use the support branchsupport/macos-boot-1103merged withmainb11c7bf84f, plus #15700, #15755 and #15756 for the build. The change side is that tree + these two commits.New
agc_bound_changed_copy(agc_driver_recorder_tests --bound-changed-copy-only): 70001 dwords at buffer offsets 4, 0x1008 and 0x10c, so every binding needs a base index. It checks every stored word against the per-byte rule, the count of words where both sides changed the same byte, and guard words before and after the target range. It passes. Its device enablesVK_KHR_push_descriptorwhen the device has it; the context of the other recorder tests keepspushDescriptorsoff as before.The test runs the same check three times, on copies of the device's context (
b004620164, after @frankea's review): with the device's limits (one dispatch), withmaxComputeWorkGroupCount[0]set to 16 (1024 dwords per dispatch, 69 dispatches, a short last one), and withmaxStorageBufferRangeset to the offset alignment plus 1001 dwords (1001 dwords per dispatch, so each chunk's aligned binding and first dword differ from the previous one). Every word, the guards and the counter summed over all dispatches match in all three. Onmainmerged atb30dcca60e, withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation:agc_bound_changed_copy,agc_changed_copy,agc_bda_stagingandagc_bda_staging_boundpass, noVUID-lines, nowas not found but was requested by env var VK_INSTANCE_LAYERS. That tree needs #16591, #17767 and theBasicString.cppstd::mintype to build on macOS; they are not part of this PR.ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ctest -R '^(agc_changed_copy|agc_bound_changed_copy|agc_bda_staging|agc_read_written_staging|agc_copied_write_back|agc_copied_direct_ordering|agc_sparse_run_import_copied|agc_adaptive_staging|agc_draw_inputs_copied|agc_driver_copied_writer_.*|agc_driver_storage_flush_ordering|agc_driver_vertex_target_range_copied)$' -V:VUID-VkDeviceCreateInfo-pProperties-04451only (the device created withoutVK_KHR_portability_subset, test(agc): enable the portability subset with its features in the recorder tests' device #13942), once per test. Neither haswas not found but was requested by env var VK_INSTANCE_LAYERS.Stray,
main1e658521a0+ the support branch + #11551 + #9356 (needed to reach gameplay on MoltenVK), 3840x2160,APS5_PROFILE_DRAW=1, the same scene, the two sides alternated. The copy-back code is the same at1e658521a0andb11c7bf84f.tools/trace_digest.pyof the summaries, gameplay intervals only:Base (
1b81580dc875):This change (
4e408effcaba):WAIT_REG_MEMtimeout; no sample was taken, and the read trap deadlocks of fix(libc): give a read-trapped page back to a GPU mutex holder instead of waiting for the resolver #15729 and macOS: a read trap resolved on the importing thread deadlocks ImportWatched #15742 stop the game the same way). This change: 11.25 and 11.30 fps.The
aps5-summary.jsonllines of interval 13 above, base (cbd-B-1) then this change (cbd-C-2):{"commit":"1b81580dc875","dirty":false,"env":{"APS5_ASYNC_PIPELINES":"1","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"installed","APS5_PROFILE_DRAW":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"Apple M4 Pro","driver":"MoltenVK 1.4.2","os":"Darwin 27.2.0","cpu":"VirtualApple @ 2.50GHz","cpu_threads":12,"memory_mib":24576,"title_id":"PPSA02100","title":"Stray","content_version":"01.002.000","resolution":"3840x2160","window":{"spec":"summary_every 10","first_present":1292,"ms":10055.045},"interval_start_s":123.986,"interval_end_s":134.041,"presents":100,"frame_ms":{"p50":96.995,"p90":115.367,"p99":161.439,"max":161.439},"gpu_busy_ms_per_present":54.590,"worker_busy_pct":{"queue worker 0x0":98.938,"queue worker 0x20":100.026},"top_phases_ms_per_frame":{"Driver.Packet":199.071,"Driver.Packet.memory_wait":84.902,"Driver.Packet.dispatch":43.533,"Driver.Packet.draw":30.892,"Driver.Draw":30.622,"Driver.Packet.prepare_memory":27.348,"Graphics.Draw":23.313,"Graphics.Draw.draw_and_resource_release":20.347},"trace_dropped":false,"trace":""}{"commit":"4e408effcaba","dirty":false,"env":{"APS5_ASYNC_PIPELINES":"1","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"installed","APS5_PROFILE_DRAW":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"Apple M4 Pro","driver":"MoltenVK 1.4.2","os":"Darwin 27.2.0","cpu":"VirtualApple @ 2.50GHz","cpu_threads":12,"memory_mib":24576,"title_id":"PPSA02100","title":"Stray","content_version":"01.002.000","resolution":"3840x2160","window":{"spec":"summary_every 10","first_present":1520,"ms":10002.984},"interval_start_s":120.688,"interval_end_s":130.691,"presents":117,"frame_ms":{"p50":83.435,"p90":101.533,"p99":109.074,"max":115.191},"gpu_busy_ms_per_present":71.320,"worker_busy_pct":{"queue worker 0x0":98.740,"queue worker 0x20":100.050},"top_phases_ms_per_frame":{"Driver.Packet":168.899,"Driver.Packet.memory_wait":70.370,"Driver.Packet.dispatch":32.397,"Driver.Packet.draw":29.831,"Driver.Draw":29.561,"Driver.Packet.prepare_memory":26.333,"Graphics.Draw":22.742,"Driver.Draw.shader_compile_and_link":19.699},"trace_dropped":false,"trace":""}The summary files of every run above, of the Lana and GoW runs below and of the variants in the table under What are attached as the release
perf-bound-changed-copy-back-20261104, with a README.Lana (PPSA19450) and God of War Ragnarök (PPSA28997) on the same trees, two rounds each: Lana 31.40 and 31.66 fps on the base, 31.67 and 31.53 with this change; GoW 54.23 and 54.49 fps, 54.36 and 53.69.
tools/check_conventions.py --base upstream/mainpasses.tools/pr_overlap.py --branch perf/agc-changed-copy-back-descriptorsfinds no overlapping lines among the PRs it could merge. It could not compare 73 PRs that conflict withmain; of the 54 that shareGuestBufferMemory.cpporRecorder.cpp, two touch the changed copy-back:APS5_GPU_HEAP) givesRecordChangedCopya heap pipeline;RecordBoundChangedCopywould need the same there if both land.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)