perf(memory): write tracked direct memory through backing views #1309
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1309"
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:07:36Z.
What
Write tracked Linux direct memory through a retained backing view. Keep access checks, write versions, and GPU ordering. Use the same path for completion labels.
The writer validates the full range before it changes any bytes. Unsupported mappings use the existing copy path.
Related: #1152 reduces GPU import count; this change reduces CPU write faults. Both change
PhysicalBackingand need integration. #637 changes Windows tracking.Tested
Fedora 44, Release build:
Isolated comparison: upstream
e9846679versus the same revision plus this PR. Six pinned processes per variant in ABBA order. A 1 MiB write took 285.954 → 68.110 µs (76% less time); process medians ranged from 274.610–365.925 µs before and 64.895–79.676 µs after. Write faults fell from 589,824 to zero over 2,304 measured writes. Smaller writes and labels had overlapping timing ranges. This is a component result, not title frame time. Windows was not tested.Checklist
main; related PRs and integration needs are described above.Imported from boykopovar/AnyPS5. Originally posted by TibixDev on 2026-10-08T06:05:02Z.
Rebased on
e9846679. The test-list conflict is resolved; the production change is unchanged.Measured upstream
e9846679against that revision plus this PR (349781da). Fedora 44, GCC 16 Release, Ryzen 5 5600, pinned to CPU 3. Six processes per variant, ABBA × 3; each has one warmup and nine batches of 256 writes. No game or build ran during timing.The 1 MiB case uses 76% less time. Faults per 2,304 writes fell from 2,304 / 36,864 / 589,824 to zero for the three sizes. Both builds check the output bytes.
For 4/8/16-byte completion stores, medians were 49.860/49.247/40.664 → 40.406/39.346/42.053 µs. All ranges overlap, so this does not establish a small-store speedup; the 16-byte median regressed. The label fixture invokes the same access-check and store sequence as each revision's completion callback. Faults fell from 2,304 to zero in each case.
Shared-write, write-tracking, and graphics tests pass. Shared writes also pass with watching disabled. Completion storage and ordering pass with core and sync validation on RX 6600 RADV and llvmpipe. Contribution checks pass. No title frame time or Windows result is claimed. AI-assisted.
Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-08T06:31:00Z.
Tested on Windows, since the description says it wasn't: Windows 10 (19045), RTX 3060 Laptop (driver 616.92), MinGW-w64 GCC 15.2.0, Release. I tested
main7a178e22merged with 349781da.agc_shared_writepasses, andagc_driver_recorder_tests(not in ctest) passes 3 of 3 runs.mainwithout this PR too.agc_driver_srgb8_color_targetfails 7 of 10 runs there, andguest_raise_exceptiontimes out intermittently, which #1421 fixes.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-08T06:37:22Z.
PhysicalBacking::HostWriteData(DirectMemory.cpp) returnsnullptrwhen themmapof the write view fails, andStoreOwnBytesthen writes withmemcpyinstead. Failures stay explicit here (#182); please throw when thatmmapfails, and keepfalseonly for ranges that aren't direct-memory backed.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T23:00:51Z.
Rebased onto current
main(conflicts in theagcTestlist inlibSceAgcDriver/CMakeLists.txtand inmainoftests/Recorder.cpp) and added one commit:PhysicalBacking::HostWriteData(DirectMemory.cpp) now throwsstd::system_errorwhen themmapof the write view fails, as requested in the review. It still returnsnullptronly for ranges that aren't backed by direct memory.Rebuilt the AgcDriver, libc and libkernel targets;
agc_shared_writepasses, and the new test no longer builds without the non-test changes. Windows results from @popcoder565 above still apply (production code for Windows is unchanged).Note: #1152 also changes
PhysicalBackinginDirectMemory.cppand conflicts with this PR; whichever lands second needs a rebase.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T23:14:46Z.
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.
main)core/libs/prx/libSceAgcDriver/CMakeLists.txtL673core/libs/prx/libkernel/DirectMemory/DirectMemory.cppL226-227, L255, L261-262, L282core/libs/prx/libSceAgcDriver/CMakeLists.txtL673core/libs/prx/libSceAgcDriver/CMakeLists.txtL673core/libs/prx/libSceAgcDriver/CMakeLists.txtL673core/libs/prx/libSceAgcDriver/CMakeLists.txtL673