Perf/memory guard batching #1882
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1884"
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 Marvisak/VIctory. Originally posted by VlREX on 2026-11-25T00:04:03Z.
Optimize GPU memory guard batching by sorting and deduplicating alias pages and replacing repeated active-writer scans with a sorted sweep. Synthetic stress model: 4,063,488 linear comparisons reduced to 8,688 sweep checks, excluding sorting. Two independent reference implementations verified 421,875 cases with zero disagreements. Six Rust regression tests included. Native Windows/Rust validation and FPS benchmarking pending. AI-assisted (ChatGPT).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T00:32:43Z.
Review: COMMENTED
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Memory guard batching (docs+gpu): perf rework of the guard path, pairs with #1885's loop-header work.
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-25T02:58:23Z.
Review: APPROVED
Tested
a175ffffon Windows 11, RTX 5070, MSVC:cargo test -p victory-gpupasses on the head, including the new sweep tests andoverlapping_kernel_writers_keep_pages_open_until_both_finish. The 2 other failures there (dynamic heap slots, memory table) also fail on main on this host.The sweep is right. With pages and spans sorted, a page is dropped exactly when some span that starts at or before it ends past it, which is what the max-end prefix gives. Skipping empty spans and keeping the linear check for small inputs is sensible.
One behavior change to note: the result is now sorted and deduplicated, where the old filter kept the caller's order. Its one caller only builds a set of pages from it, so this is fine today.
AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T08:17:08Z.
Automated triage for the maintainers.
Needs work. The verdict is unchanged.
Since the last review (
a175fff→c14ab1d):docs/memory-guard-batching.mdis gone.page_batch.rsis wrapped.check) now runs on this head and passes.The code itself is unchanged:
page_batch::eligiblesorts and dedups the pages beforeprotectincrates/victory-gpu/src/watch.rsand sweeps sorted writer ranges. It still reads as correct to me.The benefit is still not shown. @CocoBeans64's native run (RX 6800 XT,
13f91ca) found no regressions and no crashes, but it measured the PR together with #2358. Over two runs per side, frame time and fps did not change beyond the ~6 % noise between identical baseline runs. So no gain is visible at frame level.What would change the verdict: the guard counters this code affects, before and after, from one session of this PR alone. The
diagnosticscopystat line already prints them: "protecting … ms" in the watch-time section and "guards: … ms in the handler, … protect calls for … pages". If those show a real cut in protect time or calls, the module earns its place. If they don't, it adds 120 lines for nothing measurable. The PR title is also still the branch name ("Perf/memory guard batching"); please make it descriptive.CI: passing.
Generated by Claude Code
upstream-sync referenced this pull request2026-11-25 10:07:34 +00:00
Imported from Marvisak/VIctory. Originally posted by CocoBeans64 on 2026-11-25T19:29:55Z.
Native Windows run as asked, on Windows 10 22H2 (19045), RX 6800 XT (driver 32.0.21045.5002), Ryzen 7 7800X3D. The PR is merged with #2358 on
13f91ca, plus an Agility SDK runtime (#84), diag build.cargo test -p victory-gpu: 201 passed, 1 failed. The failure,a_texture_written_in_one_format_reads_in_another_through_a_placed_view, fails the same way on13f91cawithout the PR (#1999).Benchmark: the same saved game in the prologue, menus by hand, then a scripted camera loop. The figures cover the 300 s after the world shows. Two runs per side:
13f91caTwo identical baseline runs differ by about 6 % in mean frame time.
No regression and no crash; no fps change beyond that noise.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.