[CLAIM] VSP-03: split large lazy title-memory sections to remove mapping stalls #4
Labels
No labels
accessibility
benchmark
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
task-claim
telemetry
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/monte-alt--vesper#4
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@FeelsGoodMan2 on GitHub · 2026-11-30 00:13 UTC · original
Roadmap Task ID
VSP-03
Technical Plan & File Scope
This covers one part of VSP-03: title-memory sections in
xmem.rs. It does not attempt the "promote the ~62 refused multi-stretch regions" criterion, so please say if you would rather track it under a separate ID.Files
crates/vesper-hle/src/modules/xmem.rsonly (including its unit tests)Problem
Every large lazily committed allocation of title pages is one shared-memory section (
CreateFileMappingWwithout a file). In my run the largest is 6,236 MB. A comment in the source puts the 64 KB single-page views at about 100,000; I have not counted them myself.A CPU and context-switch trace (24 s of switch data, normal unmodified mapping code) has three gaps longer than 60 ms in the submit thread. An unrelated process of mine used about one core during the recording, and the gaps lie in its first seconds, so I will repeat it.
The waiting thread is in
copy_page_mappings->map_aliases->map_alias->MapViewOfFile3/UnmapViewOfFile2, 1-4 ms per page, one page at a time. The system thread mostly uses 55-100 % of a core during seconds 0-4.7, when all three gaps occur, and about 1 % afterwards, when there are none.Its stack reads as large-page rebuilding (
MiRebuildLargePages->MiTradePage->MiTrimSharedPage->MiTrimSection->MiViewMayContainPage). I named these frames by comparing code with a neighbouring kernel build whose symbols I have: some match exactly, the last ones at about 0.6-0.7 similarity. My reading is that it walks all views of a section under the section's lock, while mapping calls wait for that lock.Plan
VESPER_SECTION_MB(0 = one section per allocation, as today).VESPER_INPLACE_HOT_MB), because buffers in place need one stretch of one section. Lazy sections cannot be opened as a host heap today, so no in-place candidate is lost.Relation to the VSP-03 goal: a pool that should later become one heap must be made committed, and so stays whole. Cutting applies only to lazy ones.
State
xmem.rschange:clippy --workspace --all-targets -- -D warningsclean;cargo test -p xtask9 passed; workspace 1236 passed, 3 failed, 47 ignored. The 3 failures are invesper-shader(first_half_values_render_on_hardware_and_warp,rectangles_are_drawn_whole,the_rectangle_stage_is_a_geometry_shader) and fail the same way on an untouched checkout here.Verification planned
VESPER_SECTION_MB=0against 64: Avg / Med / Settled FPS, Med / p95 ms, GPU busy, peak private RAM, number of slow windows.Hardware: i5-13600KF, 32 GB RAM, RX 7800 XT 16 GB, 1440p, Windows 11 build 26300.
Possibly related: #3 (stutter on the same GPU and Windows build). I have not checked whether the cause is the same.
Contributor Rules
@thefafu on GitHub · 2026-11-30 00:22 UTC · original
Hi, I filed #8 for VSP-03 without seeing this claim (it was not in the search yet) and have closed it as a duplicate. Two data points that may help your verification, both from an RX 9060 XT 16 GB / 7800X3D / 32 GB on the same Windows build 26300 (details in #5):
VESPER_TIMELINEtrace (diagnostics build, 5 frames at 120/180/240 s, Series X, 4K out + HW RT) showed the title'sCopyPageMappingson the frames' chain: 1.7 ms a frame at 120 s and 8.4 ms at 180 s. At 240 s the chain was 77 ms a frame behind a thread of ours that held the views' lock (see 2), which is how we found it.xmem.rsonly, discards dead streaming-pool pages from the section's lasting view (Section::window): pages shown by no view but the whole-section one are MEM_RESET under the views' lock and VirtualUnlocked after it while free RAM is low. It lets 11-28 GB go per drive with under 0.5 % needed again (working set peak 25.5 GB down to 18-23 GB). In 4 MiB pieces under the lock, spikes over 200 ms went 14 -> 7 a minute and over 500 ms 1.3 -> 0.4.It adds bits to
Sectionand hooks inwindow(),change()andunmap(), so it would conflict with your split; I am happy to rebase it on top of yours once it lands and propose it separately. If you share your branch, I can also run it here (same restored save and route,VESPER_SECTION_MB=0against 64, with the per-frame spike counts) and post the numbers as an independent check.@FeelsGoodMan2 on GitHub · 2026-11-30 00:45 UTC · original
Thanks for the data. The
CopyPageMappings/ views-lock trace lines up with what I'm seeing. I'll publish the branch on my fork a bit later and ping you here when it's up.@monte-alt on GitHub · 2026-11-30 02:49 UTC · original
claim looks good, go for it. killing that
MiRebuildLargePages/MiTrimSection367ms kernel lock stall is definitely worth doing and we arent touching section splitting in our next pass (we're focused onshadow/host/watchright now).keeping
VSP-03scoped just to splitting lazy sections is totally fine, no need to cram the multi-stretch promotion into the same pr — smaller focused prs are way easier to review and verify. just rebase onto the newmainwe just pushed (sincexmem.rsgot contiguous coalescing in phase 1b/1c) and drop your before/after numbers +xtask/clippyresults when the pr is up.@FeelsGoodMan2 on GitHub · 2026-11-30 10:03 UTC · original
@thefafu the branch is up:
section-spliton https://github.com/FeelsGoodMan2/vesper (draft PR #17). If you still want to run it,VESPER_SECTION_MB=0against64on the same save and route is the comparison I need. My own numbers are one run each on the same route, but with different free RAM and draws per frame, so an independent check would help a lot.@thefafu on GitHub · 2026-11-30 18:38 UTC · original · edited 2026-11-30 18:49 UTC
@FeelsGoodMan2 I ran your branch here. One run each, back to back, so not a benchmark, but the difference is large.
Setup: same PC as #5: 7800X3D, 32 GB DDR5-4800, RX 9060 XT 16 GB (driver 32.0.32029.2010), Windows 11 build 26300, inbox D3D12.
section-splitat5e5b56c, release, unchanged.scripts\launch.cmd[1] Series X 1440p native with telemetry, otherwise stock. OnlyVESPER_SECTION_MBwas passed through.VESPER_SECTION_MBmeans 64, not 0. The 0 run therefore sets 0 explicitly, unlike the claim's "0 = as today, default".With 64 the log shows
mb=6236 sections=98andmb=710 sections=12, as in your run. With 0 that line does not appear.summary.txt)VESPER_SECTION_MB=0VESPER_SECTION_MB=64Per minute, from
drive_frames.csv(frames with more than 50 draws, so in play). The draws per frame show the load was comparable:Frames over 500 ms are 4 in each run, almost all in the first minute while the world loads.
The gain is not from more free RAM: physical free RAM was lower in the 64 run (minutes 2-4 averaged ~0.7-0.9 GB against ~1.9 GB) and private peak is about the same.
Caveats:
Telemetry reports (cleaned):
VESPER_SECTION_MB=0: vesper_report_20261130-212504_5e5b56c_clean.zip,VESPER_SECTION_MB=64: vesper_report_20261130-213150_5e5b56c_clean.zip. The launcher's own bundles still carry local paths and names indrive_telemetry.log(details in #23). In these copies every file was scrubbed of paths, machine and user names, the title's folder, executable, id and file names, 64-bit hashes and user ids. Nothing else was changed.Looks like a clear win on this machine, in the same direction as your numbers.