Copy-back: skip zero mask bytes a word at a time #1094

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

@⁠gmankab on GitHub · 2026-11-25 19:19 UTC · original
gmankab:contrib/fx-mask-runs → main · +102 −1 · 1 files · 1 commits · draft

back_piece scans the changed-byte mask to find the runs it will write back to title memory. A mask with scattered GPU writes can spend most of that scan stepping through zeros. Rayane’s change skips eight zero bytes at a time and emits the same runs as the original byte scan. The commit carries the original author.

The FX shadow suite passed 30 tests with zero failures. The ignored benchmark also ran separately. On the Xeon E5-2670 v3, the FX build measured the following throughput in its 64 KiB mask scan.

Mask Byte scan Word scan
Every byte 1.70 GB/s 1.75 GB/s
One changed byte per 64 bytes 1.23 GB/s 3.45 GB/s
One changed byte per 4 KiB 1.76 GB/s 8.65 GB/s

The original KLBF branch’s randomized correctness test passed under the same environment. The timings above measure the mask scan, and title frame times still need a paired run.

Based-on: https://github.com/PastiiJay/klbf-lab/pull/26
Tested-on: Xeon E5-2670 v3, Fedora Linux 45 x86_64, Wine in the Victory Flatpak with DRM hidden
Assisted-by: gpt-6.2 sol xhigh

**@⁠gmankab** on GitHub · 2026-11-25 19:19 UTC · [original](https://github.com/fxceless/victory-fork/pull/1094) `gmankab:contrib/fx-mask-runs` → `main` · +102 −1 · 1 files · 1 commits · draft `back_piece` scans the changed-byte mask to find the runs it will write back to title memory. A mask with scattered GPU writes can spend most of that scan stepping through zeros. Rayane’s change skips eight zero bytes at a time and emits the same runs as the original byte scan. The commit carries the original author. The FX shadow suite passed 30 tests with zero failures. The ignored benchmark also ran separately. On the Xeon E5-2670 v3, the FX build measured the following throughput in its 64 KiB mask scan. | Mask | Byte scan | Word scan | | --- | ---: | ---: | | Every byte | 1.70 GB/s | 1.75 GB/s | | One changed byte per 64 bytes | 1.23 GB/s | 3.45 GB/s | | One changed byte per 4 KiB | 1.76 GB/s | 8.65 GB/s | The original KLBF branch’s randomized correctness test passed under the same environment. The timings above measure the mask scan, and title frame times still need a paired run. Based-on: https://github.com/PastiiJay/klbf-lab/pull/26 Tested-on: Xeon E5-2670 v3, Fedora Linux 45 x86_64, Wine in the Victory Flatpak with DRM hidden Assisted-by: gpt-6.2 sol xhigh
back_piece found the runs of changed bytes in a piece's mask one byte at a
time; where a shader wrote here and there in a piece the mask is mostly
zeros, and that search ran at 2-4 GB/s. mask_runs passes over zero words
8 bytes at a time, then finishes byte by byte: 10-27 GB/s on such masks,
the same on dense ones, and the same runs (word_search_finds_the_byte_runs,
against the old search kept as the reference). The merge and the writes
per run are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:57:20 +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/1094/head:github-bot/gh-1094'
git switch 'github-bot/gh-1094'

Merge

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