perf(graphics): normalize buffer ranges without temporary owners #1345
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1345"
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 TibixDev on 2026-10-07T23:57:08Z.
What
Coalesce overlapping buffer regions in place instead of allocating a second owner vector. A wholly committed memory range no longer allocates a list of partial ranges. Preserve snapshot contents, conflicting-overlap rejection, sparse heaps, and mirror refresh/writeback.
Rebased directly on main
d146ec1b6. Removed the #1330 permission-cache prerequisite and the already-merged #157 copy; this branch now contains only buffer-range normalization and its tests. The newer sparse-mirror callers useCommittedRangeswhen they need an explicit full range. Main'ssparseHeapflag andGuestAllocationsAcquireAllbehavior are preserved.Depends on: none.
Tested
Fedora 44, GCC 16.2.1, Release: built
agc_driver_graphics_testsandguest_memory_tests;agc_driver_graphicsandguest_memorypass (3.33 seconds total). The graphics suite includes the BDA resources and guest-allocation cases.Regression coverage includes reordered overlapping snapshots, disjoint views, inconsistent overlapping bytes, empty/full/partial mappings, clipped bounds, read-only pages, unmapped/decommitted gaps and address reuse. The new commitment test has native Linux and Windows paths; Windows runtime was not run in this pass. Contribution checks and
git diff --checkpass.Isolated measurements on Ryzen 5 5600, CPU 3, same compiler/Release flags and benchmark source. Baseline uses main
d146ec1b6production files; comparison adds only this PR. Three ABBA cycles (six processes per variant), each reporting the median of nine measured batches after one warm-up:DescribeCommitted, 0 bytesDescribeCommitted, fully mapped 4 KiBDescribeCommitted, fully mapped 16 KiBUploadPrepare, 0 snapshot regionsUploadPrepare, 1 snapshot regionUploadPrepare, 8 overlapping/disjoint snapshot regionsUploadPrepare, 64 overlapping/disjoint snapshot regionsAll checksums match. Upload preparation is timed with imports enabled and upload completion outside the measured interval; the harness uses the graphics suite's mock Vulkan functions. These are CPU component measurements, not GPU or title frame times. The 64-region run-median ranges overlap (main 5169–6126 ns, PR 4521–5412 ns); the table reports medians across all six processes, not the best run.
Command for each variant after building the same harness:
For the baseline, use main's
Execution/include/GuestMemory.hpp,Execution/src/GuestMemory.cppandGraphics/src/GuestBufferMemory.cppundercore/libs/prx/libSceAgcDriver, keeping the benchmark source identical. Keep main'stests/GuestAllocations.cppfor that baseline build because the new assertions refer topartialRanges. The benchmark mode does not run those assertions.Checklist
Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-10T10:05:39Z.
Additional platform validation on standalone PR head
7e8c2c1c1ca0bb0c3e1cfb42794288e3c1890ed7:Windows: passed — Windows 11, supported WinLibs GCC 15.2.0 UCRT/POSIX/SEH r7; CMake 4.3.1 / Ninja.
Release /
BUILD_TESTING=ON: built the selected test targets; 2 CTest cases, 0 failures, 0 CTest skips.Tests:
agc_driver_graphics,guest_memory.Reproduce after building the test targets:
ctest --test-dir <build> --verbose --no-tests=error --timeout 30 -R "^(agc_driver_graphics|guest_memory)$".Vulkan: native AMD RX 6900 XT, driver 32.0.21045.5002.
Integration limitation: a local merge against main
948a526c2has source conflicts; these results validate the standalone PR head, not a resolved merge.Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T09:09:16Z.
Hi! This PR currently conflicts with
main, so I rebased its 3 commits onto the latestmain. Beyond the mechanical conflicts, main has evolved the same code since, so the rebased branch adapts a few things:GuestAllocations: main addedGuestAllocationsAcquireAllwhere this PR addsTryDescribeRange/AcquireRange— both kept.Commitment::ranges→partialRanges(this PR's rename) now also applies to main's newerrefreshSparseMirrorand two otherDescribeCommitted(...)call sites.GuestBufferMemory: main's newsparseHeapregion flag is kept alongside the PR'spartialRangesbacking.gpuparameter onMutation::Add/Protect(passedfalsefor the plain test pages).It builds, and
agc_driver_bda_device_tests,agc_driver_graphics_tests,agc_driver_mesh_tests,agc_shader_memory_testsandagc_write_tracking_testsall pass locally.The rebased branch is available to pull:
Feel free to ignore this if you'd rather rebase yourself.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T11:39:52Z.
Review: CHANGES_REQUESTED
Thanks. This is stacked on #1330, and both conflict with
mainnow.mainchanged the same code since (GuestAllocationsAcquireAll, thesparseHeapregion flag,refreshSparseMirror), so the rebase isn't mechanical.mainonce #1330 is in (the #157 commit is already merged, drop its copy). @blawesom mentions a rebased branch; it isn't pushed here, so the head I looked at is still7e8c2c1.agc_driver_graphics/guest_memoryafter the rebase, including the newBdaResourcesandGuestAllocationscases.UploadPrepare/DescribeCommittedpath (same tree, several runs), as in #1330.The change itself reads fine:
storeChangedreturns early onwhole, and every otherpartialRangesuse is guarded by!whole.Imported from boykopovar/AnyPS5. Originally posted by TibixDev on 2026-10-12T03:45:27Z.
@adriadam10 Updated to
d44adcb4e, based directly on maind146ec1b6. The #1330 permission cache and the already-merged #157 copy are no longer included; Depends on: none.Preserved main's
sparseHeapand allocation-lease handling. The newer sparse-mirror refresh/writeback callers now useCommittedRangeswhere they need an explicit full range. Added independent commitment tests for empty/full/partial mappings, clipped bounds, protection changes, holes and address reuse, alongside the overlapping-snapshot regressions.Fedora 44 Release:
agc_driver_graphicsandguest_memorypass, including the BDA/guest-allocation cases; contribution checks pass. Windows runtime was not rerun.Added a reproducible
--benchmark-buffer-rangesmode. Comparing main production code with only this PR, using identical benchmark source and flags, six pinned processes per variant in three ABBA cycles: 4 KiB/16 KiBDescribeCommittedmedians went 669.53/668.13 → 653.14/651.76 ns;UploadPreparefor 1/8/64 snapshot regions went 60.08/769.82/5339.56 → 42.11/627.25/4690.64 ns. Checksums match. The description includes empty-input results, run variability, the command and baseline setup. These are CPU component timings with mock Vulkan, not title frame times.Ready for another review.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T09:01:52Z.
Review: CHANGES_REQUESTED
Thanks for the update.
d44adcb4estill conflicts withmain(GuestBufferMemory.cpp,tests/Graphics.cpp,tests/GuestAllocations.cpp), and it isn't mechanical:GuestBufferMemory::UploadPrepareonmainnow sorts anorderindex vector and walksregions[order[i]](the merge loop starts atGuestBufferMemory.cpp:2759). The in-placemergediterator compaction needs redoing against that loop, with themergeBackedsparse handling kept.addDescriptorRegion(~GuestBufferMemory.cpp:2413) has a newcommitted.rangesuse that has to move topartialRanges.--benchmark-buffer-rangescollides withmain's--sparse-buffer-holesentry intests/Graphics.cpp; keep both.GuestAllocations.cpp:RunGuestAllocationTestsnow callsleaseSnapshotTests(); keep it next tocommittedRangeTests().After the rebase, please re-run
agc_driver_graphicsandguest_memoryand redo the before/after table against the currentmain, since the merge loop you measured has changed. Consider keeping the benchmark harness out of the test binary (a separate target or the PR description), as it is ~50 lines of non-test code inGraphics.cpp.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T05:09:27Z.
Closing for now: no title or measured gain is shown. With the queue this large we're closing stalled perf PRs that don't show a gain in a title; reopen it with before/after numbers from a title scene (the summary lines from the performance report form) if you pick it up again.
Pull request closed