Reuse changed-byte runs across shadow pages #925

Open
github-bot wants to merge 3 commits from github-bot/gh-925 into main AGit
Owner

@⁠alpz1000 on GitHub · 2026-11-25 13:01 UTC · original
alpz1000:perf/reuse-shadow-change-runs → main · +75 −30 · 1 files · 3 commits · open

Shadow::merge_under_writes builds a new vector of changed-byte runs for every stale page. The optional gap pass can allocate a second vector, and the diagnostic counters take two atomic updates for every run.

This patch reuses one run vector across pages, joins optional gaps in place, and updates the run and byte counters once per page. It preserves both upstream scan implementations, including the newer SIMD path. The default gap of zero still sends the exact changed bytes. The per-submission run cap is checked before modifying the card-backed page.

Validation on Windows with an i5-8400

  • Merged upstream 9c184b3 and ran cargo test --profile diag --locked -p victory-gpu --features diagnostics --lib merge_tests. All seven matching tests passed, including upstream’s byte-by-byte reference test for the SIMD scan and the test that reuses one scratch buffer across joined, exact, and unchanged pages.
  • A synthetic scan-only comparison against upstream’s SIMD scan checked identical output on 1,024 generated 4 KiB pages per pattern. At -C opt-level=2, medians of 17 alternating batches went from 368 to 322 ns per unchanged page, 414 to 365 ns per sparse page, 1,412 to 1,156 ns per fragmented page, and 548 to 475 ns per dense page. Gap was zero. The benchmark covers scanning and allocation.

AI-assisted with OpenAI Codex.

**@⁠alpz1000** on GitHub · 2026-11-25 13:01 UTC · [original](https://github.com/fxceless/victory-fork/pull/925) `alpz1000:perf/reuse-shadow-change-runs` → `main` · +75 −30 · 1 files · 3 commits · open `Shadow::merge_under_writes` builds a new vector of changed-byte runs for every stale page. The optional gap pass can allocate a second vector, and the diagnostic counters take two atomic updates for every run. This patch reuses one run vector across pages, joins optional gaps in place, and updates the run and byte counters once per page. It preserves both upstream scan implementations, including the newer SIMD path. The default gap of zero still sends the exact changed bytes. The per-submission run cap is checked before modifying the card-backed page. Validation on Windows with an i5-8400 - Merged upstream `9c184b3` and ran `cargo test --profile diag --locked -p victory-gpu --features diagnostics --lib merge_tests`. All seven matching tests passed, including upstream’s byte-by-byte reference test for the SIMD scan and the test that reuses one scratch buffer across joined, exact, and unchanged pages. - A synthetic scan-only comparison against upstream’s SIMD scan checked identical output on 1,024 generated 4 KiB pages per pattern. At `-C opt-level=2`, medians of 17 alternating batches went from 368 to 322 ns per unchanged page, 414 to 365 ns per sparse page, 1,412 to 1,156 ns per fragmented page, and 548 to 475 ns per dense page. Gap was zero. The benchmark covers scanning and allocation. AI-assisted with OpenAI Codex.
Keep one scratch buffer for the page scan, fold configured gaps as runs are found, and update diagnostic counters once per page.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:53:56 +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/925/head:github-bot/gh-925'
git switch 'github-bot/gh-925'

Merge

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