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

Merged
fuzeofficlal merged 1 commit from upstream-pr/2172 into main 2026-11-25 21:55:29 +00:00
fuzeofficlal commented 2026-11-25 06:59:24 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T06:59:24Z.


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.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6599072654 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2172). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T06:59:24Z. --- ### 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.
DenRakEiw commented 2026-11-25 08:06:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T07:03:13Z.

Review: APPROVED


Verified locally merged onto origin/main (940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC):

  • cargo test -p victory-gpu --lib marked_subpage_uav_writes_copy_back_and_keep_neighbor_bytes — passed on RTX 5090
  • cargo clippy -p victory-gpu --all-targets — 0 warnings
  • cargo xtask policy — ok (183 files ok)

Clean whole-64 KiB-page coverage for marked UAV refreshes preserving neighbor bytes on subpage writes. Looks good.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6053208089 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2172#pullrequestreview-6053208089). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-25T07:03:13Z. **Review:** APPROVED --- Verified locally merged onto `origin/main` (`940d32f`, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC): - `cargo test -p victory-gpu --lib marked_subpage_uav_writes_copy_back_and_keep_neighbor_bytes` — passed on RTX 5090 - `cargo clippy -p victory-gpu --all-targets` — 0 warnings - `cargo xtask policy` — ok (`183 files ok`) Clean whole-64 KiB-page coverage for marked UAV refreshes preserving neighbor bytes on subpage writes. Looks good. AI-assisted (Gemini 4 Neon).
catminou4 commented 2026-11-25 08:06:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T07:17:34Z.

Review: COMMENTED


Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.

Marked UAV refreshes cover whole 64 KiB pages — refresh-granularity coarsening; relates to #1986/#1998/#2004's withheld-range cluster (#1976).

<!-- greyfinch-sync:Marvisak/VIctory:review:6053350605 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2172#pullrequestreview-6053350605). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T07:17:34Z. **Review:** COMMENTED --- Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff. Marked UAV refreshes cover whole 64 KiB pages — refresh-granularity coarsening; relates to #1986/#1998/#2004's withheld-range cluster (#1976).
MamaLeVrai commented 2026-11-25 09:06:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by MamaLeVrai on 2026-11-25T08:52:14Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7157574727 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2172#issuecomment-7157574727). Originally posted by [MamaLeVrai](https://github.com/MamaLeVrai) on 2026-11-25T08:52:14Z. --- 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.
Xvania7 commented 2026-11-25 13:02:00 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Xvania7 on 2026-11-25T12:59:32Z.

Review: APPROVED


Hardware verification on real hardware: NVIDIA GeForce RTX 5060, Windows 10 x64, Rust 1.98.1.

Tested a78c1e9 checked out into an isolated tree:

  • cargo clippy -p victory-gpu --target-dir ... -- -D warnings: 0 warnings, clean.
  • cargo run -p xtask -- policy: clean (asset policy: 182 files ok).
  • shadow::tests: 4/4 passed:
    • mark_runs_are_reused_and_joined: ok
    • title_writes_under_a_busy_range_are_copied: ok
    • snapshots_cover_the_declared_ranges_and_writes_go_back_once: ok
    • marked_pages_go_back_by_the_bytes_the_gpu_changed: ok
  • draw::tests marked subpage UAV test suite: 5/5 passed:
    • marked_subpage_uav_and_cpu_disjoint_write_three_way_merge: ok
    • marked_subpage_uavs_after_copy_in_same_list: ok
    • marked_subpage_uav_writes_copy_back_and_keep_neighbor_bytes: ok
    • marked_subpage_uav_unaligned_and_cross_page_shadow_bounds: ok
    • marked_unaligned_root_uav_and_bindless_subpage_refresh: ok

Ensuring marked UAV refreshes align to full 64 KiB page boundaries cleanly prevents partial unaligned copy-backs across subpage chunks while preserving adjacent bytes. LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:review:6058053962 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2172#pullrequestreview-6058053962). Originally posted by [Xvania7](https://github.com/Xvania7) on 2026-11-25T12:59:32Z. **Review:** APPROVED --- Hardware verification on real hardware: NVIDIA GeForce RTX 5060, Windows 10 x64, Rust 1.98.1. Tested `a78c1e9` checked out into an isolated tree: - `cargo clippy -p victory-gpu --target-dir ... -- -D warnings`: 0 warnings, clean. - `cargo run -p xtask -- policy`: clean (`asset policy: 182 files ok`). - `shadow::tests`: 4/4 passed: - `mark_runs_are_reused_and_joined`: ok - `title_writes_under_a_busy_range_are_copied`: ok - `snapshots_cover_the_declared_ranges_and_writes_go_back_once`: ok - `marked_pages_go_back_by_the_bytes_the_gpu_changed`: ok - `draw::tests` marked subpage UAV test suite: 5/5 passed: - `marked_subpage_uav_and_cpu_disjoint_write_three_way_merge`: ok - `marked_subpage_uavs_after_copy_in_same_list`: ok - `marked_subpage_uav_writes_copy_back_and_keep_neighbor_bytes`: ok - `marked_subpage_uav_unaligned_and_cross_page_shadow_bounds`: ok - `marked_unaligned_root_uav_and_bindless_subpage_refresh`: ok Ensuring marked UAV refreshes align to full 64 KiB page boundaries cleanly prevents partial unaligned copy-backs across subpage chunks while preserving adjacent bytes. LGTM.
Marvisak commented 2026-11-25 14:07:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T13:28:38Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7163833261 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2172#issuecomment-7163833261). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T13:28:38Z. --- <!-- 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)_
upstream-sync closed this pull request 2026-11-25 22:03:32 +00:00
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
Marvisak/VIctory!2170
No description provided.