GPU: marked UAV refreshes cover whole 64 KiB pages #2172

Manually merged
github merged 1 commit from gh-pr/2172/head into gh-pr/2172/base 2026-11-26 04:57:19 +00:00
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 06:59 UTC · original
fuzeofficlal:fix/gpu-marked-uav-subpage-copyback → main · +473 −66 · 3 files · 1 commits · merged 2026-11-25 21:55 UTC

Problem

A marked UAV view that is shorter than 64 KiB, or not page-aligned, inside a tracked buffer copy refreshed only its own byte range, and Shadow::update split tracked refreshes at the ranges earlier lists' shaders write. Either way Tracked::take saw only part of the enclosing 64 KiB page, so the page was neither guarded nor taken. It stayed changed, and after the submission Shadow::copy_back_marked hit saved.is_none() && t.changed(page) and kept the title's bytes, dropping every GPU write to that page.

Changes

  • Shadow::page_range widens a range to the 64 KiB pages it touches, cut to the copy.
  • Marked UAV refreshes use it: table views (readable), root UAVs (State::root_view) and heap hulls (bindless::refresh). The range declared as written (gpu_writes) stays exact.
  • Tracked copies take the whole refreshed range in one Tracked::take, still updating the snapshots under ranges shaders write. Only pages the title changed are copied, and no shader of the submission has run yet at that point, so the wider refresh overwrites no GPU writes. Untracked copies are unchanged.
  • Tests: sub-page and unaligned marked UAVs, a CPU copy to the same page before and during the write (three-way merge), copies smaller than or straddling a 64 KiB page, an unaligned root UAV, and bindless hull widening.

Verification

  • cargo test -p victory-gpu --locked on hardware and with VICTORY_D3D12_WARP=1: all pass except dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views, which fail the same way on main (HEAP_VIEWS limit).
  • The new tests pass with VICTORY_D3D12_DEBUG=1 and no debug-layer messages. All 5 new tests fail without the page widening.
  • cargo clippy --workspace --all-targets [--all-features] --locked -- -D warnings and cargo xtask policy pass.
**@⁠fuzeofficlal** on GitHub · 2026-11-25 06:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/2172) `fuzeofficlal:fix/gpu-marked-uav-subpage-copyback` → `main` · +473 −66 · 3 files · 1 commits · merged 2026-11-25 21:55 UTC ### Problem A marked UAV view that is shorter than 64 KiB, or not page-aligned, inside a tracked buffer copy refreshed only its own byte range, and `Shadow::update` split tracked refreshes at the ranges earlier lists' shaders write. Either way `Tracked::take` saw only part of the enclosing 64 KiB page, so the page was neither guarded nor taken. It stayed changed, and after the submission `Shadow::copy_back_marked` hit `saved.is_none() && t.changed(page)` and kept the title's bytes, dropping every GPU write to that page. ### Changes - `Shadow::page_range` widens a range to the 64 KiB pages it touches, cut to the copy. - Marked UAV refreshes use it: table views (`readable`), root UAVs (`State::root_view`) and heap hulls (`bindless::refresh`). The range declared as written (`gpu_writes`) stays exact. - Tracked copies take the whole refreshed range in one `Tracked::take`, still updating the snapshots under ranges shaders write. Only pages the title changed are copied, and no shader of the submission has run yet at that point, so the wider refresh overwrites no GPU writes. Untracked copies are unchanged. - Tests: sub-page and unaligned marked UAVs, a CPU copy to the same page before and during the write (three-way merge), copies smaller than or straddling a 64 KiB page, an unaligned root UAV, and bindless hull widening. ### Verification - `cargo test -p victory-gpu --locked` on hardware and with `VICTORY_D3D12_WARP=1`: all pass except `dynamic_slots_are_held_until_released` and `lists_share_a_table_and_copies_keep_their_views`, which fail the same way on main (HEAP_VIEWS limit). - The new tests pass with `VICTORY_D3D12_DEBUG=1` and no debug-layer messages. All 5 new tests fail without the page widening. - `cargo clippy --workspace --all-targets [--all-features] --locked -- -D warnings` and `cargo xtask policy` pass.
A marked UAV view shorter than 64 KiB, or not page-aligned, refreshed only
its own range, and Shadow::update split tracked refreshes at the ranges
earlier lists' shaders write. Either way Tracked::take saw only part of
the enclosing 64 KiB page, so the page was neither guarded nor taken: it
stayed changed, and copy_back_marked kept the title's bytes, dropping
every GPU write to the page.

Marked UAV refreshes (table views, root UAVs, heap hulls) now widen to
the 64 KiB pages they touch, cut to the copy (Shadow::page_range); the
range declared as written stays exact. Tracked copies take the refreshed
range in one call, still updating the snapshots under ranges shaders
write. Only pages the title changed are copied, and no shader of the
submission has run yet, so the wider refresh overwrites no GPU writes.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:57:17 +00:00
github manually merged commit d813e3377b into gh-pr/2172/base 2026-11-26 04:57:19 +00:00
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-25 08:52 UTC · original

Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present, so the hardware-only shader checks run. I merged this PR's head a78c1e93 into main 940d32f in a throwaway tree (no conflict). cargo clippy --workspace --all-targets --locked -- -D warnings: clean; the same with --all-features: clean. cargo test --workspace --locked: 706 passed, 0 failed, 10 ignored, two runs (main alone on the same machine: 701 passed, 0 failed, 10 ignored). The title was not run, so this says nothing about in-game effect. No game data.

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-25 08:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/2172#issuecomment-7157574727) Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present, so the hardware-only shader checks run. I merged this PR's head `a78c1e93` into `main` `940d32f` in a throwaway tree (no conflict). `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean; the same with `--all-features`: clean. `cargo test --workspace --locked`: 706 passed, 0 failed, 10 ignored, two runs (`main` alone on the same machine: 701 passed, 0 failed, 10 ignored). The title was not run, so this says nothing about in-game effect. No game data. AI-assisted (Claude Code); no game data.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 13:28 UTC · original · edited 2026-11-25 16:19 UTC

Automated triage for the maintainers.

Recommended for a maintainer's look (re-reviewed after the rebase). Marked UAV refreshes (readable and State::root_view in draw.rs, bindless::refresh) now widen to whole 64 KiB pages via Shadow::page_range, and Shadow::update takes a tracked range in one Tracked::take (update_tracked) instead of splitting it at busy ranges, so copy_back_marked no longer finds a partly taken page still changed and keeps the title's bytes over the shader's. I checked page_range against the copy's bounds, that the declared written range (gpu_writes) stays exact, and that the before snapshot is still synced for bytes copied under ranges earlier lists write. One behaviour change to be aware of: under such busy ranges the untracked and unmapped parts of a tracked copy are now refreshed as well (before, only taken runs were), with the snapshot synced; by my reading that is consistent with the existing reasoning that no shader of the submission has run yet.

CI: check passing on this head.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 13:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/2172#issuecomment-7163833261) · edited 2026-11-25 16:19 UTC <!-- victory-triage v1 head=d813e3377beb74171f7266ff87eba13c557467d1 verdict=merge-candidate at=2026-11-25T16:19:00Z --> Automated triage for the maintainers. Recommended for a maintainer's look (re-reviewed after the rebase). Marked UAV refreshes (`readable` and `State::root_view` in `draw.rs`, `bindless::refresh`) now widen to whole 64 KiB pages via `Shadow::page_range`, and `Shadow::update` takes a tracked range in one `Tracked::take` (`update_tracked`) instead of splitting it at busy ranges, so `copy_back_marked` no longer finds a partly taken page still changed and keeps the title's bytes over the shader's. I checked `page_range` against the copy's bounds, that the declared written range (`gpu_writes`) stays exact, and that the `before` snapshot is still synced for bytes copied under ranges earlier lists write. One behaviour change to be aware of: under such busy ranges the untracked and unmapped parts of a tracked copy are now refreshed as well (before, only taken runs were), with the snapshot synced; by my reading that is consistent with the existing reasoning that no shader of the submission has run yet. CI: `check` passing on this head. --- _Generated by [Claude Code](https://claude.ai/code)_
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2172
No description provided.