GPU: track disjoint refresh spans per shadow in Batch #20

Open
Batushn wants to merge 1 commit from upstream-pr/20 into main
Batushn commented 2026-11-25 18:56:53 +00:00 (Migrated from github.com)

Imported from DexNom/VIctory. Originally posted by Batushn on 2026-11-25T18:56:53Z.


Summary

  • Replace the single per-shadow (min, max)\ bounding span in \Batch\ with \Spans\ (\One((usize, usize))\ / sorted disjoint \Many(Vec<(usize, usize)>)\ bounded at \MAX_BATCH_SPANS = 64\ by merging the smallest gap). Overlapping and touching refresh intervals still coalesce without allocating in the common single-range case, while far-apart refreshes stay separate.
  • Update \stale_under_flights, \Host::submit's \sk_once\ collection, \Batch::flush_one, and \Batch::flush\ (keeping one \wide_refresh\ job per shadow) to operate on those coalesced spans so unrelated middle gaps neither trigger false \WHY_STALE\ flight settles / page-watch walks nor copy unrequested memory on unwatched shadows.
  • Add regression tests \host::batch::coalesced_spans_keep_disjoint_ranges_separate_and_merge_overlaps\ and \host::batch::stale_under_flights_and_batch_flush_ignore_unrequested_gaps\ (using \Shadow::byte_at).

Verification

  • \VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --locked -- host::batch\ (6 passed, 0 failed, 1 ignored benchmark)
  • \cargo test -p victory-gpu --locked -- host::batch\ (6 passed, 0 failed, 1 ignored benchmark on hardware GPU)
  • \cargo clippy -p victory-gpu --all-targets --locked -- -D warnings\ (passed)
  • \cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings\ (passed)
  • \cargo test -p xtask --locked\ (4 passed, 0 failed)
<!-- greyfinch-sync:DexNom/VIctory:issue:5497316464 --> Imported from [DexNom/VIctory](https://github.com/DexNom/VIctory/pull/20). Originally posted by [Batushn](https://github.com/Batushn) on 2026-11-25T18:56:53Z. --- ### Summary - Replace the single per-shadow \(min, max)\ bounding span in \Batch\ with \Spans\ (\One((usize, usize))\ / sorted disjoint \Many(Vec<(usize, usize)>)\ bounded at \MAX_BATCH_SPANS = 64\ by merging the smallest gap). Overlapping and touching refresh intervals still coalesce without allocating in the common single-range case, while far-apart refreshes stay separate. - Update \stale_under_flights\, \Host::submit\'s \sk_once\ collection, \Batch::flush_one\, and \Batch::flush\ (keeping one \wide_refresh\ job per shadow) to operate on those coalesced spans so unrelated middle gaps neither trigger false \WHY_STALE\ flight settles / page-watch walks nor copy unrequested memory on unwatched shadows. - Add regression tests \host::batch::coalesced_spans_keep_disjoint_ranges_separate_and_merge_overlaps\ and \host::batch::stale_under_flights_and_batch_flush_ignore_unrequested_gaps\ (using \Shadow::byte_at\). ### Verification - \VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --locked -- host::batch\ (6 passed, 0 failed, 1 ignored benchmark) - \cargo test -p victory-gpu --locked -- host::batch\ (6 passed, 0 failed, 1 ignored benchmark on hardware GPU) - \cargo clippy -p victory-gpu --all-targets --locked -- -D warnings\ (passed) - \cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings\ (passed) - \cargo test -p xtask --locked\ (4 passed, 0 failed)
FIJI1299 commented 2026-11-25 19:05:16 +00:00 (Migrated from github.com)

Imported from DexNom/VIctory. Originally posted by FIJI1299 on 2026-11-25T19:05:16Z.


Tested commit f0140f4 on Windows:

Environment

  • OS: Windows 11 (Build 26100)
  • CPU: AMD Ryzen 5 9600X 6-Core Processor
  • RAM: 32 GB
  • GPU: NVIDIA GeForce RTX 5070 (12 GB VRAM, driver 621.40, wave32)
  • DXC: 1.8.2502.11 (Windows SDK 10.0.26100.0)

Results

  • victory-gpu test suite (cargo test -p victory-gpu --lib -- --test-threads=1): 190 passed, 0 failed, 3 ignored (4.96s), including the 2 new disjoint refresh span tests in host.rs.
  • victory-pipeline & victory unit tests (cargo test -p victory-pipeline -p victory --lib): 4 passed, 0 failed (0.00s).
<!-- greyfinch-sync:DexNom/VIctory:comment:7171801974 --> Imported from [DexNom/VIctory](https://github.com/DexNom/VIctory/pull/20#issuecomment-7171801974). Originally posted by [FIJI1299](https://github.com/FIJI1299) on 2026-11-25T19:05:16Z. --- Tested commit `f0140f4` on Windows: ### Environment * **OS:** Windows 11 (Build 26100) * **CPU:** AMD Ryzen 5 9600X 6-Core Processor * **RAM:** 32 GB * **GPU:** NVIDIA GeForce RTX 5070 (12 GB VRAM, driver `621.40`, `wave32`) * **DXC:** `1.8.2502.11` (Windows SDK `10.0.26100.0`) ### Results * **`victory-gpu` test suite (`cargo test -p victory-gpu --lib -- --test-threads=1`):** **190 passed, 0 failed, 3 ignored** (`4.96s`), including the 2 new disjoint refresh span tests in `host.rs`. * **`victory-pipeline` & `victory` unit tests (`cargo test -p victory-pipeline -p victory --lib`):** **4 passed, 0 failed** (`0.00s`).
andrewDoing commented 2026-11-26 22:53:59 +00:00 (Migrated from github.com)

Imported from DexNom/VIctory. Originally posted by andrewDoing on 2026-11-26T22:53:59Z.


Independent native RTX 5070 check at f0140f4: separate lists requesting pages 0 and 3 did not falsely stall on page 1's pending writer; adding page 1 triggered stale detection. An additional same-command-list case confirmed both decisions. Flushing pages 0 and 3 copied the expected 0x11 and 0x33 while unrequested page 2 remained zero. The physical adapter identity was asserted (10de:2f04). This verifies the host refresh/stall decision, not gameplay or frame time.

Verification was AI-assisted with GPT-6.2 Astra.

<!-- greyfinch-sync:DexNom/VIctory:comment:7205080495 --> Imported from [DexNom/VIctory](https://github.com/DexNom/VIctory/pull/20#issuecomment-7205080495). Originally posted by [andrewDoing](https://github.com/andrewDoing) on 2026-11-26T22:53:59Z. --- Independent native RTX 5070 check at `f0140f4`: separate lists requesting pages 0 and 3 did not falsely stall on page 1's pending writer; adding page 1 triggered stale detection. An additional same-command-list case confirmed both decisions. Flushing pages 0 and 3 copied the expected `0x11` and `0x33` while unrequested page 2 remained zero. The physical adapter identity was asserted (`10de:2f04`). This verifies the host refresh/stall decision, not gameplay or frame time. Verification was AI-assisted with GPT-6.2 Astra.
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/20:upstream-pr/20'
git switch 'upstream-pr/20'

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/20'
git switch 'upstream-pr/20'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/20'
git switch 'upstream-pr/20'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/20'
git switch 'main'
git merge --squash 'upstream-pr/20'
git switch 'main'
git merge --ff-only 'upstream-pr/20'
git switch 'main'
git merge 'upstream-pr/20'
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
DexNom/VIctory!20
No description provided.