fix: reuse free space in VIctory window upload slabs #323

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

@⁠mauroalvare on GitHub · 2026-11-26 03:02 UTC · original
mauroalvare:codex/victory-window-upload-tails → main · +182 −24 · 2 files · 1 commits · open

Change

The transient-window upload path enabled by tools/lancer_victory.ps1 uses 16 MiB slabs. A request could switch to a new slab and leave space in the previous one. Further small requests could create dedicated D3D12 upload buffers even when earlier live slabs had free space.

Keep a write cursor for each pooled slab. Try the current slab and then any other slab with room before creating a buffer. An empty slab can rewind, while a live slab can append after its reserved ranges.

Verification

Windows x64 MSVC debug builds on an RTX 5070 Ti with driver 621.40. Base c4c93bdc413191a9dc909998d2d53080a3f0c880 carried just the new test and its module registration.

Run from third_party/victory.

cargo test --locked --offline -j 2 -p victory-gpu --lib windowup::tests::reuses_live_slab_tails -- --exact --nocapture --test-threads=1
Synthetic measurement Base Fix
D3D12 upload buffers created 14 2
Standalone overflow buffers created 12 0
Peak upload-buffer bytes 32.75 MiB 32 MiB
GPU readback verified byte for byte 190.5 MiB 190.5 MiB

Three fresh-process A/B pairs reproduced the base failing the overflow assertion and the fix passing. Both used the 32 MiB pool cap, six rounds of chunks up to 1 MiB, and the same generated byte pattern.

Command Result
baseline-test.exe --test-threads=1 183 passed, 4 failed, 3 ignored
fixed-test.exe --test-threads=1 184 passed, 3 failed, 3 ignored
cargo test --locked --offline -j 2 -p victory-loader --test load_probe 2 passed
cargo xtask policy 199 files passed
cargo test --release --manifest-path rust/Cargo.toml --locked --offline -j 1 12 passed using the matching cached Rust workspace
python -m pytest -ra 1,665 passed with the required runtime and the RTX 5070 Ti
python -m ruff check --select W605,F,E9 PrototypeScarlett tests tools All checks passed
git diff --check Passed

The full victory-gpu runs used the two captured Cargo test binaries. The following assertions reproduced on both builds.

  • descriptor::host::tests::spans_say_the_next_start_and_the_lowest_level_viewed got None where it expected Some(1).
  • indirect::tests::warp_card_fetch_copies_flagged_pieces_to_their_slots got 0 where it expected 1 in the first result slot on WARP.
  • indirect::tests::warp_card_patch_writes_the_masked_bytes_and_no_others reported the first differing offsets at 0 through 7 on WARP.

Oracle and test data

The fixture writes a distinct value into every chunk, holds the chunks until the copy queue's fence completes, then compares the full readback to the generated bytes. D3D12 readback and fence documentation

Codex provided AI assistance with the investigation, implementation, and validation.

**@⁠mauroalvare** on GitHub · 2026-11-26 03:02 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/323) `mauroalvare:codex/victory-window-upload-tails` → `main` · +182 −24 · 2 files · 1 commits · open ## Change The transient-window upload path enabled by `tools/lancer_victory.ps1` uses 16 MiB slabs. A request could switch to a new slab and leave space in the previous one. Further small requests could create dedicated D3D12 upload buffers even when earlier live slabs had free space. Keep a write cursor for each pooled slab. Try the current slab and then any other slab with room before creating a buffer. An empty slab can rewind, while a live slab can append after its reserved ranges. ## Verification Windows x64 MSVC debug builds on an RTX 5070 Ti with driver 621.40. Base `c4c93bdc413191a9dc909998d2d53080a3f0c880` carried just the new test and its module registration. Run from `third_party/victory`. ```powershell cargo test --locked --offline -j 2 -p victory-gpu --lib windowup::tests::reuses_live_slab_tails -- --exact --nocapture --test-threads=1 ``` | Synthetic measurement | Base | Fix | | --- | ---: | ---: | | D3D12 upload buffers created | 14 | 2 | | Standalone overflow buffers created | 12 | 0 | | Peak upload-buffer bytes | 32.75 MiB | 32 MiB | | GPU readback verified byte for byte | 190.5 MiB | 190.5 MiB | Three fresh-process A/B pairs reproduced the base failing the overflow assertion and the fix passing. Both used the 32 MiB pool cap, six rounds of chunks up to 1 MiB, and the same generated byte pattern. | Command | Result | | --- | --- | | `baseline-test.exe --test-threads=1` | 183 passed, 4 failed, 3 ignored | | `fixed-test.exe --test-threads=1` | 184 passed, 3 failed, 3 ignored | | `cargo test --locked --offline -j 2 -p victory-loader --test load_probe` | 2 passed | | `cargo xtask policy` | 199 files passed | | `cargo test --release --manifest-path rust/Cargo.toml --locked --offline -j 1` | 12 passed using the matching cached Rust workspace | | `python -m pytest -ra` | 1,665 passed with the required runtime and the RTX 5070 Ti | | `python -m ruff check --select W605,F,E9 PrototypeScarlett tests tools` | All checks passed | | `git diff --check` | Passed | The full `victory-gpu` runs used the two captured Cargo test binaries. The following assertions reproduced on both builds. - `descriptor::host::tests::spans_say_the_next_start_and_the_lowest_level_viewed` got `None` where it expected `Some(1)`. - `indirect::tests::warp_card_fetch_copies_flagged_pieces_to_their_slots` got `0` where it expected `1` in the first result slot on WARP. - `indirect::tests::warp_card_patch_writes_the_masked_bytes_and_no_others` reported the first differing offsets at 0 through 7 on WARP. ## Oracle and test data The fixture writes a distinct value into every chunk, holds the chunks until the copy queue's fence completes, then compares the full readback to the generated bytes. [D3D12 readback and fence documentation](https://learn.microsoft.com/en-us/windows/win32/direct3d12/readback-data-using-heaps) Codex provided AI assistance with the investigation, implementation, and validation.
Keep a write cursor for each pooled slab so a full current slab can fall back to space available in an earlier one. Exercise six rounds of live chunks and validate all copied bytes using D3D12 readback.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:43:02 +00:00
This pull request can be merged automatically.
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/323/head:github-bot/gh-323'
git switch 'github-bot/gh-323'

Merge

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