Skip to content

feat(gpu,hle): share SectionWindow whole-section view and skip redundant remaps - #328

Merged
Androtim merged 1 commit into
mainfrom
feat/shared-section-window-and-view-fastpath
Dec 2, 2026
Merged

Androtim merged 1 commit into
mainfrom
feat/shared-section-window-and-view-fastpath

Conversation

@Androtim

@Androtim Androtim commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Summary

Shares one refcounted whole-section VA mapping between victory-hle::xmem and victory-gpu::inplace, skips unnecessary alias guard scans for non-aliased views, and avoids redundant unmap/remap churn on identical xmem mappings:

  • Shared SectionWindow / Arc<WholeView> (crates/victory-gpu/src/{inplace.rs,lib.rs,land.rs,watch.rs}, crates/victory-hle/src/modules/xmem.rs):
    • Replaces separate whole-section MapViewOfFile mappings in xmem::Section::window and inplace::beside / beside_page with one refcounted SectionWindow(Arc<WholeView>) mapping created via title_memory_section_window.
    • Prevents duplicate multi-GiB address-space mappings and prevents title_memory_section_gone from unmapping out from under an active SectionWindow or beside reader (dropping/unmapping happens cleanly outside the VIEWS lock once all holders finish).
  • Non-aliased views_mapped skip (inplace.rs): title_memory_view only invokes watch::views_mapped when shown.len() >= 2, eliminating redundant shard/protected-bitmap checks for single-view physical pages.
  • Granularity-preserving same-page remap no-op fast path (xmem.rs): Adds Physical::shows_run / Physical::shows_slices to skip unmap/remap/GPU-notification churn in map_pages (!lazy) and alias_as (!lazy) when the destination already maps the exact same physical pages with matching view granularity (while still coalescing fragmented single-page views when
    uns_in_one = true).

Verification

  • Static & Unit Tests: cargo +1.98.1-x86_64-pc-windows-gnu xtask policy (322 files ok), cargo +1.98.1-x86_64-pc-windows-gnu test --locked -p victory-gpu inplace (11 passed), victory-hle xmem -- --test-threads=1 (35 passed, 0 failed, 1 ignored benchmark), victory-gpu land & watch, dual workspace clippy --all-targets --locked -- -D warnings (default & --features diagnostics), objdump -p (standard Windows DLLs only).
  • Paired Same-Path Plain---release A/B vs main (e1130bf, Series X + DLSS quality, RTX 4060 Ti 8 GB, 0 crashes/DRED, no_view_warns=0):
    • 1440p (90s, 20 windows): Median FPS 14.2 -> 14.9 fps (+0.7 fps), Mean FPS 12.39 -> 15.73 fps (+3.34 fps), working_set_mb max 19,669 -> 19,169 MB (-500 MB), private_commit_mb max 21,062 -> 20,784 MB (-278 MB), thin_ms avg 461.1 -> 446.8 ms (-14.4 ms), final_waiting 3,636 -> 2,456.
    • 4K DLSS quality (90s, 18 windows): Median FPS 6.3 -> 6.3 fps, working_set_mb avg 16,888 -> 16,477 MB (-411 MB; max 20,545 -> 20,387 MB), private_commit_mb avg 19,236 -> 18,976 MB (-260 MB), shared_mb avg 4,663 -> 4,481 MB (-182 MB), thin_ms avg 533.0 -> 510.9 ms (-22.1 ms), preparing_core_ms med 31.80 -> 29.60 ms (-2.20 ms).
  • 1440p 90s --features diagnostics Visual Gate (diag-pr-secwin-1440p-90s): PASS (6/6 gates) — world_windows=21, max_draws=13961, crashes=0, used_max=6258 MB / budget_min=6690 MB, final_waiting=1793, mapped_rate=0.8 ms/s, pngs=24 lit=20/24 luma=101.22 near_black=0.07% edge_energy=7.74 magenta=0.0%. Inspected frame-2376.png, frame-2384.png, frame-2390.png — spotless rendering.

@Androtim

Androtim commented Dec 2, 2026

Copy link
Copy Markdown
Owner Author

Autonomous architectural audit PASSED on 1daa6a2f (CI GREEN, allowlisted author Androtim):

  • Code review: Clean refcounted SectionWindow(Arc<WholeView>) sharing one whole-section VA mapping between xmem::Section::window and inplace::beside/beside_page (safe off-lock unmap on drop), non-aliased views_mapped skip (shown.len() >= 2), and granularity-preserving shows_run/shows_slices remap no-op fast path (zero new opt-in switches).
  • Plain --release A/B (0 crashes / 0 DRED):
    • 1440p 90s: 14.2 -> 14.9 fps (+0.7 med / +3.34 mean), working_set max -500 MB, private_commit max -278 MB, thin_ms -14.4 ms, final_waiting 3,636 -> 2,456.
    • 4K 90s: 6.3 -> 6.3 fps, working_set avg -411 MB, private_commit avg -260 MB, shared avg -182 MB, preparing_core med -2.20 ms, thin_ms -22.1 ms.
  • Diagnostics (1440p 90s): All 6 gates PASS (final_waiting=1,793, luma=101.22, near_black=0.07%, edge_energy=7.74, magenta=0.0%); frame-2376.png and frame-2384.png inspected directly — crisp lighting, reflections, and zero visual regressions.

Squash-merging into main.

@Androtim
Androtim merged commit b0842d9 into main Dec 2, 2026
1 check passed
@Androtim
Androtim deleted the feat/shared-section-window-and-view-fastpath branch December 2, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant