GPU: a title memory copy left out of a page table is named when slots come back #2233

Open
denkencar-sketch wants to merge 1 commit from upstream-pr/2235 into main
denkencar-sketch commented 2026-11-25 08:31:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by denkencar-sketch on 2026-11-25T08:31:29Z.


Summary

Shared::rewrite sets generation = now even when some copy got no view slots (HostHeap::pair() returned None: a capped heap, or the dynamic slots all in use for the moment). memory::prepare only rewrites when generation != shadow::generation(), so after one such rewrite it skips the table at every later submission until some copy is created or unregistered. The copy keeps reading as missing, and its misses withhold every shader write of the lists that use it.

Change

rewrite remembers whether it left a copy out and then leaves the generation stale (u64::MAX), so the next submission rewrites again (slots come back as lists reset). Cost: a rewrite per submission while slots stay short, which is the state that needed it.

Testing

memory::tests::a_copy_without_view_slots_is_named_when_slots_come_back takes every slot of a host heap, registers a copy, rewrites (the copy gets no pair and the generation must stay stale: this assertion fails on main), gives the slots back and rewrites again (the copy is named and the generation is current). Run three times in a row with the rest of the suite, no flakes. cargo clippy --workspace --all-targets [--all-features] --locked -- -D warnings is clean.

Not tried: a run in the game, or a capped (NVIDIA) heap; the test forces the slot shortage instead. modules::dstorage::tests::a_page_list_filled_after_its_request_starts fails now and then on main too (5 of 20 runs of cargo test -p victory-hle --lib); it is unrelated.

AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6600406636 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2235). Originally posted by [denkencar-sketch](https://github.com/denkencar-sketch) on 2026-11-25T08:31:29Z. --- ## Summary `Shared::rewrite` sets `generation = now` even when some copy got no view slots (`HostHeap::pair()` returned `None`: a capped heap, or the dynamic slots all in use for the moment). `memory::prepare` only rewrites when `generation != shadow::generation()`, so after one such rewrite it skips the table at every later submission until some copy is created or unregistered. The copy keeps reading as missing, and its misses withhold every shader write of the lists that use it. ## Change `rewrite` remembers whether it left a copy out and then leaves the generation stale (`u64::MAX`), so the next submission rewrites again (slots come back as lists reset). Cost: a rewrite per submission while slots stay short, which is the state that needed it. ## Testing `memory::tests::a_copy_without_view_slots_is_named_when_slots_come_back` takes every slot of a host heap, registers a copy, rewrites (the copy gets no pair and the generation must stay stale: this assertion fails on `main`), gives the slots back and rewrites again (the copy is named and the generation is current). Run three times in a row with the rest of the suite, no flakes. `cargo clippy --workspace --all-targets [--all-features] --locked -- -D warnings` is clean. Not tried: a run in the game, or a capped (NVIDIA) heap; the test forces the slot shortage instead. `modules::dstorage::tests::a_page_list_filled_after_its_request_starts` fails now and then on `main` too (5 of 20 runs of `cargo test -p victory-hle --lib`); it is unrelated. AI-assisted.
catminou4 commented 2026-11-25 09:05:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T08:48:31Z.

Review: COMMENTED


A title memory copy left out of a page table (no descriptor slots) is retried at the next submission via generation=u64::MAX sentinel. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Careful fix for a real hole; the sentinel is documented in the comment.

<!-- greyfinch-sync:Marvisak/VIctory:review:6054380792 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2235#pullrequestreview-6054380792). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T08:48:31Z. **Review:** COMMENTED --- A title memory copy left out of a page table (no descriptor slots) is retried at the next submission via generation=u64::MAX sentinel. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Careful fix for a real hole; the sentinel is documented in the comment.
DenRakEiw commented 2026-11-25 09:05:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T09:02:28Z.

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 a_copy_without_view_slots_is_named_when_slots_come_back — passed on RTX 5090
  • cargo clippy -p victory-gpu --all-targets — 0 warnings
  • cargo xtask policy — ok (183 files ok)

Clean backfill of page-table entries once view slots become available again. Looks good.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6054566707 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2235#pullrequestreview-6054566707). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-25T09:02:28Z. **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 a_copy_without_view_slots_is_named_when_slots_come_back` — passed on RTX 5090 - `cargo clippy -p victory-gpu --all-targets` — 0 warnings - `cargo xtask policy` — ok (`183 files ok`) Clean backfill of page-table entries once view slots become available again. Looks good. AI-assisted (Gemini 4 Neon).
Marvisak commented 2026-11-25 14:07:22 +00:00 (Migrated from github.com)

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


Automated triage for the maintainers.

Merge candidate (worth a look). In crates/victory-gpu/src/memory.rs, Shared::rewrite now leaves generation at the u64::MAX sentinel (the same value Shared::new starts with) when HostHeap::pair() had no slot for a copy. prepare therefore rewrites again at the next submission instead of leaving that copy unnamed until some copy comes or goes. I checked against main: prepare only rewrites on s.generation != now, so the bug is real, and the fix is small, at the cost of one rewrite per submission while slots are short. CI (check) passes on this head; the new test uses its own HostHeap.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7163895777 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2235#issuecomment-7163895777). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T13:31:16Z. --- <!-- victory-triage v1 head=8bd603c052080929dedd2801919f36bbd186b704 verdict=merge-candidate at=2026-11-25T13:43:00Z --> Automated triage for the maintainers. **Merge candidate (worth a look).** In `crates/victory-gpu/src/memory.rs`, `Shared::rewrite` now leaves `generation` at the `u64::MAX` sentinel (the same value `Shared::new` starts with) when `HostHeap::pair()` had no slot for a copy. `prepare` therefore rewrites again at the next submission instead of leaving that copy unnamed until some copy comes or goes. I checked against `main`: `prepare` only rewrites on `s.generation != now`, so the bug is real, and the fix is small, at the cost of one rewrite per submission while slots are short. CI (`check`) passes on this head; the new test uses its own `HostHeap`. --- _Generated by [Claude Code](https://claude.ai/code)_
fuzeofficlal commented 2026-11-26 01:04:16 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T00:52:00Z.


Code review and RTX 5090 + WARP verification at head 8bd603c05208 merged cleanly onto main (63bcca43c6a0):

  • Code review (crates/victory-gpu/src/memory.rs:518-553):
    • When heap.pair() returns None in Shared::rewrite, setting left_out = true and self.generation = u64::MAX forces the next prepare() (s.generation != now) to rebuild the page table without waiting for another shadow::generation() bump, immediately filling the omitted copy once HostList reset frees dynamic slots.
    • Lock ordering (with_heap -> shared()) stays consistent across prepare()/bind(), and any omitted copy remains absent from Layout::copies/owner (null page-table entry), so reads/writes during that submit continue through the miss/withheld path safely.
  • Verified (Windows 11, NVIDIA RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1, Rust 1.98.1):
    • cargo xtask policy: 191 files ok; cargo clippy -p victory-gpu --all-targets -- -D warnings (default + --features diagnostics): 0 warnings
    • WARP (--features diagnostics, memory:: shadow:: draw::tests): 39/39 passed (including a_copy_without_view_slots_is_named_when_slots_come_back)
    • RTX 5090 (memory:: shadow:: draw::tests, skipping pre-existing NVIDIA 1M view-heap cap baseline lists_share_a_table_and_copies_keep_their_views): 38/38 passed.

LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7179192092 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2235#issuecomment-7179192092). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T00:52:00Z. --- Code review and RTX 5090 + WARP verification at head `8bd603c05208` merged cleanly onto `main` (`63bcca43c6a0`): - **Code review (`crates/victory-gpu/src/memory.rs:518-553`)**: - When `heap.pair()` returns `None` in `Shared::rewrite`, setting `left_out = true` and `self.generation = u64::MAX` forces the next `prepare()` (`s.generation != now`) to rebuild the page table without waiting for another `shadow::generation()` bump, immediately filling the omitted copy once `HostList` reset frees dynamic slots. - Lock ordering (`with_heap` -> `shared()`) stays consistent across `prepare()`/`bind()`, and any omitted copy remains absent from `Layout::copies`/`owner` (null page-table entry), so reads/writes during that submit continue through the miss/withheld path safely. - **Verified (Windows 11, NVIDIA RTX 5090 + WARP, `VICTORY_D3D12_DEBUG=1`, Rust 1.98.1)**: - `cargo xtask policy`: `191 files ok`; `cargo clippy -p victory-gpu --all-targets -- -D warnings` (default + `--features diagnostics`): 0 warnings - WARP (`--features diagnostics`, `memory:: shadow:: draw::tests`): **39/39 passed** (including `a_copy_without_view_slots_is_named_when_slots_come_back`) - RTX 5090 (`memory:: shadow:: draw::tests`, skipping pre-existing NVIDIA 1M view-heap cap baseline `lists_share_a_table_and_copies_keep_their_views`): **38/38 passed**. LGTM.
fuzeofficlal commented 2026-11-26 14:01:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T13:18:15Z.

Review: APPROVED


Reviewed and verified 8bd603c0 merged locally onto origin/main (63bcca43) on Windows 11 x64 (NVIDIA GeForce RTX 5090 and WARP, Rust 1.98.1 MSVC, Windows SDK 10.0.26100.0 dxil.dll; synthetic tests only, no game files).

Verification

  • git merge-tree against origin/main (63bcca43): clean.
  • cargo xtask policy (PR head): 182 files ok.
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default and --all-features, PR head and merged): 0 warnings.
  • RTX 5090 (VICTORY_D3D12_DEBUG=1, --features diagnostics, merged): memory::tests, shadow::tests, and draw::tests (skipping the pre-existing NVIDIA 1M view-heap cap baseline lists_share_a_table_and_copies_keep_their_views) — 37 passed, 0 failed, plus 3/3 consecutive focused passes of a_copy_without_view_slots_is_named_when_slots_come_back.
  • WARP (VICTORY_D3D12_WARP=1, VICTORY_D3D12_DEBUG=1, --features diagnostics, merged): full memory::tests, shadow::tests, and draw::tests (no skips) — 38 passed, 0 failed.

Review Notes

  • In Shared::rewrite (crates/victory-gpu/src/memory.rs:279-326), recording left_out = true whenever heap.pair() returns None (:300) and leaving self.generation = u64::MAX (:324, matching Shared::new's sentinel) ensures prepare() retries on the next submission rather than leaving the omitted copy unnamed until an unrelated shadow registration/unregistration bumps shadow::generation().
  • The regression test (crates/victory-gpu/src/memory.rs:598-634) allocates an isolated HostHeap, exercises both the exhausted and recovered states, and unregisters cleanly.

Looks good to merge.

<!-- greyfinch-sync:Marvisak/VIctory:review:6074797956 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2235#pullrequestreview-6074797956). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T13:18:15Z. **Review:** APPROVED --- Reviewed and verified `8bd603c0` merged locally onto `origin/main` (`63bcca43`) on Windows 11 x64 (NVIDIA GeForce RTX 5090 and WARP, Rust `1.98.1` MSVC, Windows SDK `10.0.26100.0` `dxil.dll`; synthetic tests only, no game files). ### Verification - `git merge-tree` against `origin/main` (`63bcca43`): clean. - `cargo xtask policy` (PR head): `182 files ok`. - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` (default and `--all-features`, PR head and merged): 0 warnings. - **RTX 5090 (`VICTORY_D3D12_DEBUG=1`, `--features diagnostics`, merged):** `memory::tests`, `shadow::tests`, and `draw::tests` (skipping the pre-existing NVIDIA 1M view-heap cap baseline `lists_share_a_table_and_copies_keep_their_views`) — **37 passed, 0 failed**, plus 3/3 consecutive focused passes of `a_copy_without_view_slots_is_named_when_slots_come_back`. - **WARP (`VICTORY_D3D12_WARP=1`, `VICTORY_D3D12_DEBUG=1`, `--features diagnostics`, merged):** full `memory::tests`, `shadow::tests`, and `draw::tests` (no skips) — **38 passed, 0 failed**. ### Review Notes - In `Shared::rewrite` (`crates/victory-gpu/src/memory.rs:279-326`), recording `left_out = true` whenever `heap.pair()` returns `None` (`:300`) and leaving `self.generation = u64::MAX` (`:324`, matching `Shared::new`'s sentinel) ensures `prepare()` retries on the next submission rather than leaving the omitted copy unnamed until an unrelated shadow registration/unregistration bumps `shadow::generation()`. - The regression test (`crates/victory-gpu/src/memory.rs:598-634`) allocates an isolated `HostHeap`, exercises both the exhausted and recovered states, and unregisters cleanly. Looks good to merge.
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/2235:upstream-pr/2235'
git switch 'upstream-pr/2235'

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