Repository navigation
Conversation
moong15
marked this pull request as draft
October 12, 2026 05:51
moong15
force-pushed
the
perf/prefault-direct-memory
branch
from
October 12, 2026 13:53
60f0e98 to
1ad61fe
Compare
10 tasks done
Windows materializes the pages of a paging-file section view on first touch, so a guest that streams into freshly mapped direct memory pays one soft page fault per page on its own threads. With APS5_PREFAULT_MEMORY set, a background thread makes each mapped direct-memory range of 2 MiB or more resident with VirtualLock and VirtualUnlock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
moong15
force-pushed
the
perf/prefault-direct-memory
branch
from
October 13, 2026 06:07
1ad61fe to
b2e1166
Compare
|
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.
|
This was referenced Oct 13, 2026
Contributor
|
Tested on Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release: this PR merged onto
Not tested: Linux (Windows-only code), a console, a title run. AI-assisted (Claude Code). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Opt-in background prefaulting of mapped Windows direct memory. With
APS5_PREFAULT_MEMORYset, a worker processes mapped ranges of at least 2 MiB usingVirtualLockfollowed byVirtualUnlockin 2 MiB chunks. It requests soft working-set headroom of at least 64 MiB minimum and 128 MiB maximum. The worker does not write the pages. Linux is unchanged.This aims to move first-touch page residency work away from guest loading threads. It is separate from the write-protection exception tracking fixed by #4535, which is now merged. The option can increase memory residency and remains disabled by default. A successful lock is followed immediately by an unlock, so residency is not guaranteed afterward.
Reopened after #4535 merged and rebased without conflicts onto
mainea2bbef. Current head: b2e1166. The diff remains one file, 56 added lines. The earlier adjacent #4281 change is already in main. An open-PR search for prefault/VirtualLock found no competing implementation; automated overlap review remains pending.Tested
Reopening validation:
git diff --checkpassed. No build, runtime test or game comparison has been rerun on the rebased b2e1166 head. This remains a draft while that validation and the current repository's performance-report evidence are pending.Historical evidence, not validation of the rebased head: Windows 11 Pro 26200, Ryzen 7 9800X3D, 47 GB RAM, Radeon RX 9070 XT (driver 32.0.32015.2008), WinLibs GCC 15.2, Release.
guest_memorypreviously passed with the option unset and set.Earlier Hades II PPSA36082 v01.006 warm-cache runs used a local d146ec1 build with this branch's DirectMemory.cpp, unpublished diagnostics, two cache options,
APS5_HOST_IMPORT_MIB=16384andAPS5_NO_WRITE_WATCH=1in both arms. Without prefault, 4/4 runs crashed with a LoadTaskScheduler null write around 7.4-7.5 seconds; with prefault, 5/5 survived their observation windows (three 69-77 seconds and two 40 seconds) and the longer runs opened menu audio banks. Those results do not establish performance or correctness with normal write tracking on current main, nor prove the crash's cause.Subsequent combined-fix investigation and its limitations are recorded in #4535. Fresh matched main-versus-prefault measurements with write tracking enabled are needed here. No current-head speed, cold-cache, rendered-menu or gameplay claim is made. Before making a speed claim, collect the same-machine/same-scene summary lines and attach traces as required by the Performance report issue form. Full upstream CI requires a maintainer's manual workflow run.
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)