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

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

@⁠denkencar-sketch on GitHub · 2026-11-25 08:31 UTC · original
denkencar-sketch:fix/view-heap-retry → main · +45 −1 · 1 files · 1 commits · open

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.

**@⁠denkencar-sketch** on GitHub · 2026-11-25 08:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/2235) `denkencar-sketch:fix/view-heap-retry` → `main` · +45 −1 · 1 files · 1 commits · open ## 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.
Shared::rewrite marked the table up to date even when a copy got no view slots (HostHeap::pair returned None), so memory::prepare skipped the rewrite at every later submission until some copy came or went, and the copy kept reading as missing. A rewrite that left a copy out now leaves the generation stale, so the next submission tries again.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:59:23 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 13:31 UTC · original

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

**@⁠Marvisak** on GitHub · 2026-11-25 13:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/2235#issuecomment-7163895777) <!-- 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)_
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 00:52 UTC · original

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** on GitHub · 2026-11-26 00:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/2235#issuecomment-7179192092) 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.
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 08:48 UTC · original · reviewed

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.

**@⁠catminou4** on GitHub · 2026-11-25 08:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/2235#pullrequestreview-6054380792) · **reviewed** 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.
Author
Owner

@⁠DenRakEiw on GitHub · 2026-11-25 09:02 UTC · original · approved these changes

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).

**@⁠DenRakEiw** on GitHub · 2026-11-25 09:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/2235#pullrequestreview-6054566707) · **approved these changes** 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).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 13:18 UTC · original · approved these changes

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.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 13:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/2235#pullrequestreview-6074797956) · **approved these changes** 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 can be merged automatically.
This branch is out-of-date with the base branch
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/2235/head:github-bot/gh-2235'
git switch 'github-bot/gh-2235'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2235'
git switch 'github-bot/gh-2235'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2235'
git switch 'github-bot/gh-2235'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2235'
git switch 'main'
git merge --squash 'github-bot/gh-2235'
git switch 'main'
git merge --ff-only 'github-bot/gh-2235'
git switch 'main'
git merge 'github-bot/gh-2235'
git push origin 'main'
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!2235
No description provided.