Coalesce changed buffer bytes directly for the 64-byte merge gap #1158

Open
github-bot wants to merge 1 commit from github-bot/gh-1158 into main AGit
Owner

@⁠BradRoland on GitHub · 2026-11-25 22:02 UTC · original
BradRoland:codex/coalesce-shadow-merge-gaps → main · +147 −3 · 1 files · 1 commits · open

The run 219 notes describe about 38,000 changed byte ranges across roughly 100 pages per frame. With VICTORY_MERGE_GAP=64, the card-buffer path built a vector of every exact range and then walked it again to join nearby ranges. This patch joins them as the SIMD comparison produces each 64-byte difference mask. Any two set bits in one mask are at most 62 equal bytes apart, so its first and last set bits suffice. The existing gap rule applies across masks and to the tail.

The fast path runs on x86-64 when the wide comparison is active and the gap is 64. The default gap, the scalar comparison, and the existing run budget keep their behavior.

Synthetic benchmark on an i9-12900K, 4 MiB in 64 KiB pages. Times are median microseconds across seven release processes. Each process measured 15 alternating before/after pairs after warm-up. The benchmark checks the returned ranges before timing.

Changes per page Before After
380 single-byte changes spaced 8 bytes apart (one joined range) 284.4 163.4
0.6% random 581.7 389.0
10% random 2,247.3 241.1
No changes 167.8 159.9
Every byte changed 160.1 193.6

The clustered case took 43% less time. The all-changed case took 21% more. These timings cover the changed-range scan. Gameplay frame time remains unmeasured.

  • Reproduce with cargo test --release --locked -p victory-gpu --lib joined_page_runs_bench -- --ignored --nocapture.
  • Differential coverage includes unequal lengths, tails, boundaries on either side of the 64-byte gap, and random byte patterns. The focused release tests passed under VICTORY_CHANGED_RUNS=0, 1, and alt.
  • The release WARP GPU suite passed all 202 enabled tests on rerun. An earlier run hit the existing intermittent indirect-draw assertion in #1118.
**@⁠BradRoland** on GitHub · 2026-11-25 22:02 UTC · [original](https://github.com/fxceless/victory-fork/pull/1158) `BradRoland:codex/coalesce-shadow-merge-gaps` → `main` · +147 −3 · 1 files · 1 commits · open The run 219 notes describe about 38,000 changed byte ranges across roughly 100 pages per frame. With `VICTORY_MERGE_GAP=64`, the card-buffer path built a vector of every exact range and then walked it again to join nearby ranges. This patch joins them as the SIMD comparison produces each 64-byte difference mask. Any two set bits in one mask are at most 62 equal bytes apart, so its first and last set bits suffice. The existing gap rule applies across masks and to the tail. The fast path runs on x86-64 when the wide comparison is active and the gap is 64. The default gap, the scalar comparison, and the existing run budget keep their behavior. **Synthetic benchmark** on an i9-12900K, 4 MiB in 64 KiB pages. Times are median microseconds across seven release processes. Each process measured 15 alternating before/after pairs after warm-up. The benchmark checks the returned ranges before timing. | Changes per page | Before | After | | --- | ---: | ---: | | 380 single-byte changes spaced 8 bytes apart (one joined range) | 284.4 | 163.4 | | 0.6% random | 581.7 | 389.0 | | 10% random | 2,247.3 | 241.1 | | No changes | 167.8 | 159.9 | | Every byte changed | 160.1 | 193.6 | The clustered case took 43% less time. The all-changed case took 21% more. These timings cover the changed-range scan. Gameplay frame time remains unmeasured. - Reproduce with `cargo test --release --locked -p victory-gpu --lib joined_page_runs_bench -- --ignored --nocapture`. - Differential coverage includes unequal lengths, tails, boundaries on either side of the 64-byte gap, and random byte patterns. The focused release tests passed under `VICTORY_CHANGED_RUNS=0`, `1`, and `alt`. - The release WARP GPU suite passed all 202 enabled tests on rerun. An earlier run hit the existing intermittent indirect-draw assertion in #1118.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:58:38 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1158/head:github-bot/gh-1158'
git switch 'github-bot/gh-1158'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1158'
git switch 'github-bot/gh-1158'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1158'
git switch 'github-bot/gh-1158'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1158'
git switch 'main'
git merge --squash 'github-bot/gh-1158'
git switch 'main'
git merge --ff-only 'github-bot/gh-1158'
git switch 'main'
git merge 'github-bot/gh-1158'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.