perf: batch contiguous GPU page mappings and physical aliases #1122

Open
draggygaggy-maker wants to merge 1 commit from upstream-pr/1125 into main
draggygaggy-maker commented 2026-11-25 20:43:57 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by draggygaggy-maker on 2026-11-25T20:43:57Z.


Summary

Experimental page-mapping optimisation targeting CPU overhead during asset streaming.

Changes

  • Batch compatible contiguous GPU page-mapping requests into bounded runs.
  • Group contiguous physical aliases backed by the same memory section.
  • Coalesce fragmented Windows memory placeholders.
  • Retain per-page fallback for unsuccessful batched physical mappings.
  • Add checked address arithmetic and overflow protection.
  • Improve unmapping and failed-commit cleanup handling.
  • Add eight regression tests covering batching, repeated remapping, overlapping ranges, placeholder boundaries and memory content preservation.

Activation

Batching is disabled by default. To enable:

$env:VICTORY_PAGE_BATCHING = "1"

To disable batching for comparison:

$env:VICTORY_PAGE_BATCHING = "0"

Mapping hardening changes remain active independently of the batching switch.

Validation

Based on fxceless/victory-fork commit 085ee7c.

Tested on Windows with a Ryzen 7 5800X, RTX 4060 Ti 8 GB and 32 GB RAM.

  • GPU: 186 passed, 1 failed, 5 ignored.
  • HLE: 105 passed, 0 failed.
  • Security integration test: passed.
  • All eight new regression tests passed.
  • Diagnostics release build succeeded.
  • Repository asset-policy and diff checks passed.

Total: 292 tests passed.

The sole GPU failure was:

indirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fields

This failure was also reproduced on our earlier baseline before the batching changes, but has not been independently reproduced on the latest unmodified 085ee7c baseline.

Benchmarking requested

Gameplay performance has not yet been measured. The optimisation is intentionally experimental and opt-in.

I would appreciate comparative gameplay testing with batching enabled and disabled, particularly regarding:

  • Page-mapping CPU overhead.
  • Asset-streaming latency.
  • Frame times and stuttering.
  • Memory consumption.
  • Rendering correctness and stability.

No verified FPS improvement is claimed pending benchmark results.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6613380674 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1125). Originally posted by [draggygaggy-maker](https://github.com/draggygaggy-maker) on 2026-11-25T20:43:57Z. --- ## Summary Experimental page-mapping optimisation targeting CPU overhead during asset streaming. ## Changes - Batch compatible contiguous GPU page-mapping requests into bounded runs. - Group contiguous physical aliases backed by the same memory section. - Coalesce fragmented Windows memory placeholders. - Retain per-page fallback for unsuccessful batched physical mappings. - Add checked address arithmetic and overflow protection. - Improve unmapping and failed-commit cleanup handling. - Add eight regression tests covering batching, repeated remapping, overlapping ranges, placeholder boundaries and memory content preservation. ## Activation Batching is disabled by default. To enable: ```powershell $env:VICTORY_PAGE_BATCHING = "1" ``` To disable batching for comparison: ```powershell $env:VICTORY_PAGE_BATCHING = "0" ``` Mapping hardening changes remain active independently of the batching switch. ## Validation Based on fxceless/victory-fork commit `085ee7c`. Tested on Windows with a Ryzen 7 5800X, RTX 4060 Ti 8 GB and 32 GB RAM. - GPU: 186 passed, 1 failed, 5 ignored. - HLE: 105 passed, 0 failed. - Security integration test: passed. - All eight new regression tests passed. - Diagnostics release build succeeded. - Repository asset-policy and diff checks passed. **Total: 292 tests passed.** The sole GPU failure was: `indirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fields` This failure was also reproduced on our earlier baseline before the batching changes, but has not been independently reproduced on the latest unmodified `085ee7c` baseline. ## Benchmarking requested Gameplay performance has not yet been measured. The optimisation is intentionally experimental and opt-in. I would appreciate comparative gameplay testing with batching enabled and disabled, particularly regarding: - Page-mapping CPU overhead. - Asset-streaming latency. - Frame times and stuttering. - Memory consumption. - Rendering correctness and stability. No verified FPS improvement is claimed pending benchmark results.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1125:upstream-pr/1125'
git switch 'upstream-pr/1125'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/1125'
git switch 'upstream-pr/1125'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1125'
git switch 'upstream-pr/1125'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1125'
git switch 'main'
git merge --squash 'upstream-pr/1125'
git switch 'main'
git merge --ff-only 'upstream-pr/1125'
git switch 'main'
git merge 'upstream-pr/1125'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
fxceless/victory-fork!1122
No description provided.