land, inplace, watch: batch landing notes across jobs and add lock-free view bounds #3480

Manually merged
github merged 1 commit from github-bot/gh-3480 into main 2026-11-30 14:15:01 +00:00 AGit
Owner

@⁠Maverick0351a on GitHub · 2026-11-29 23:47 UTC · original
Maverick0351a:perf/batch-landing-notes-and-view-bounds → main · +122 −24 · 4 files · 1 commits · merged 2026-11-30 14:12 UTC

Summary

In open-world city gameplay (8,775 draws/frame, 63 landing jobs/frame across ~400 64 KiB pieces), landing per frame spent 27.19–46.75 ms of worker thread time in opening or noting guards (stat::NOTES):
1.
otes.flush() was called inside land::each(jobs.len(), &|j| ...) once per job (63 times/frame concurrently across worker threads), with each call acquiring VIEWS.read(), JOURNAL.write(), and REMAPPED.lock().
2. For the ~205 direct (non-view private heap) pieces per frame (eside.is_none()), piece_at called crate:⌚:landing(from, to - from) per piece across worker threads, which acquired VIEWS.read() (elsewhere) and REMAPPED.lock() (descriptor::host::remapped) 205 times per frame even when PROTECTED.any(...) was false.
3. inplace::beside and inplace::shown_elsewhere_in acquired VIEWS.read() even for addresses outside the mapped view range [VIEWS_MIN, VIEWS_MAX) or when pages_twice == 0, contending with streaming threads holding VIEWS.write().

Fix

  1. crates/victory-gpu/src/inplace.rs:
    • Maintain lock-free VIEWS_MIN, VIEWS_MAX, and PAGES_TWICE atomics updated under iews_mut() in itle_memory_view and iews_gone.
    • Fast-path eside, eside_page, shown_elsewhere_in, and liased_section_pages without locking VIEWS.read() when outside [VIEWS_MIN, VIEWS_MAX) or when PAGES_TWICE == 0.
  2. crates/victory-gpu/src/watch.rs, crates/victory-gpu/src/land.rs, crates/victory-gpu/src/host.rs:
    • Split watch::landing into watch::landing_open_guards (called before safecopy::merge when !light() || PROTECTED.any(...)) and batched watch::landed_direct(spans).
    • Collect per-job land::Notes into per-job slots and call land::Notes::flush_all once after land::each returns (Drop for Notes still flushes any standalone Notes instance automatically).

Testing

  • cargo test -p victory-gpu --lib land (17 passed; 0 failed)
  • cargo test -p victory-gpu --lib inplace::tests::remapped_memory_forgets_its_views (1 passed; 0 failed)
**@⁠Maverick0351a** on GitHub · 2026-11-29 23:47 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3480) `Maverick0351a:perf/batch-landing-notes-and-view-bounds` → `main` · +122 −24 · 4 files · 1 commits · merged 2026-11-30 14:12 UTC ### Summary In open-world city gameplay (8,775 draws/frame, 63 landing jobs/frame across ~400 64 KiB pieces), landing per frame spent **27.19–46.75 ms of worker thread time** in opening or noting guards (stat::NOTES): 1. otes.flush() was called inside land::each(jobs.len(), &|j| ...) once per job (63 times/frame concurrently across worker threads), with each call acquiring VIEWS.read(), JOURNAL.write(), and REMAPPED.lock(). 2. For the ~205 direct (non-view private heap) pieces per frame (eside.is_none()), piece_at called crate::watch::landing(from, to - from) per piece across worker threads, which acquired VIEWS.read() (elsewhere) and REMAPPED.lock() (descriptor::host::remapped) 205 times per frame even when PROTECTED.any(...) was false. 3. inplace::beside and inplace::shown_elsewhere_in acquired VIEWS.read() even for addresses outside the mapped view range [VIEWS_MIN, VIEWS_MAX) or when pages_twice == 0, contending with streaming threads holding VIEWS.write(). ### Fix 1. **crates/victory-gpu/src/inplace.rs**: - Maintain lock-free VIEWS_MIN, VIEWS_MAX, and PAGES_TWICE atomics updated under iews_mut() in itle_memory_view and iews_gone. - Fast-path eside, eside_page, shown_elsewhere_in, and liased_section_pages without locking VIEWS.read() when outside [VIEWS_MIN, VIEWS_MAX) or when PAGES_TWICE == 0. 2. **crates/victory-gpu/src/watch.rs, crates/victory-gpu/src/land.rs, crates/victory-gpu/src/host.rs**: - Split watch::landing into watch::landing_open_guards (called before safecopy::merge when !light() || PROTECTED.any(...)) and batched watch::landed_direct(spans). - Collect per-job land::Notes into per-job slots and call land::Notes::flush_all **once** after land::each returns (Drop for Notes still flushes any standalone Notes instance automatically). ### Testing - cargo test -p victory-gpu --lib land (17 passed; 0 failed) - cargo test -p victory-gpu --lib inplace::tests::remapped_memory_forgets_its_views (1 passed; 0 failed)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 23:49:16 +00:00
Author
Owner

@⁠Kitrae on GitHub · 2026-11-30 00:05 UTC · original

I tested 499474ef on an RTX 4090 at 3840×1080 with DLSS Performance and 2× frame generation. Both builds used the same local ultrawide and scene-entry changes on top of 41adb551, and the process-memory scan was enabled throughout. I replayed the same post-prologue save twice per build, reversing the build order for the second comparison.

The six one-second reporting intervals from 1–7 seconds after the first frame with at least 500 draws had a similar workload across runs, at roughly 16,000–16,500 draws per frame in the FPS log and a median of 62–63 landing jobs per frame.

Metric Baseline runs Patched runs
Rendered frames 87, 91 74, 69
Frames over 100 ms 6, 5 7, 11
Median guard CPU time per frame, summed across threads 8.93, 8.22 ms 3.14, 3.12 ms
Median wall time per frame merging fetched results 5.15, 4.77 ms 5.11, 5.48 ms

The guard CPU savings repeated in both runs. In this scene-entry workload, the merge took about as long and the game rendered fewer frames with the patch. Later in the replay, draw counts diverged between runs, which makes the later FPS samples hard to compare. The frame counts above come from the frame-time log.

Both patched replays reached the world and ran for 36 seconds without a GPU failure. The targeted landing, mapped-memory, relay, and write-watch tests finished with 62 passed and one ignored.

**@⁠Kitrae** on GitHub · 2026-11-30 00:05 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3480#issuecomment-7264954234) I tested `499474ef` on an RTX 4090 at 3840×1080 with DLSS Performance and 2× frame generation. Both builds used the same local ultrawide and scene-entry changes on top of `41adb551`, and the process-memory scan was enabled throughout. I replayed the same post-prologue save twice per build, reversing the build order for the second comparison. The six one-second reporting intervals from 1–7 seconds after the first frame with at least 500 draws had a similar workload across runs, at roughly 16,000–16,500 draws per frame in the FPS log and a median of 62–63 landing jobs per frame. | Metric | Baseline runs | Patched runs | | --- | ---: | ---: | | Rendered frames | 87, 91 | 74, 69 | | Frames over 100 ms | 6, 5 | 7, 11 | | Median guard CPU time per frame, summed across threads | 8.93, 8.22 ms | 3.14, 3.12 ms | | Median wall time per frame merging fetched results | 5.15, 4.77 ms | 5.11, 5.48 ms | The guard CPU savings repeated in both runs. In this scene-entry workload, the merge took about as long and the game rendered fewer frames with the patch. Later in the replay, draw counts diverged between runs, which makes the later FPS samples hard to compare. The frame counts above come from the frame-time log. Both patched replays reached the world and ran for 36 seconds without a GPU failure. The targeted landing, mapped-memory, relay, and write-watch tests finished with 62 passed and one ignored.
github manually merged commit d89279fbe1 into main 2026-11-30 14:15:01 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!3480
No description provided.