GPU: initialise new page tables to their null view pair #3119

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

@⁠fuzeofficlal on GitHub · 2026-11-26 08:50 UTC · original
fuzeofficlal:fix/gpu-page-table-null-init → main · +91 −0 · 1 files · 1 commits · open

Summary

Split out from #3106 per triage feedback.

Shared::new allocates the title-memory page table buffer and reserves a null descriptor pair (heap.pair()), but previously left the table buffer zeroed until the first Shared::rewrite. If a command list executes with that table before rewrite has ever run (for example when its view heap is released before its first prepare), every level-1 lookup resolves to block 0 and every block-0 entry has e.x == 0, causing translated shaders to index descriptor slot 0 instead of self.null.

Changes

  • crates/victory-gpu/src/memory.rs:
    • In Shared::new, point every level-1 entry at block 0 and fill all BLOCK entries of block 0 with [null, 0], matching write_table for an empty table.
    • Add memory::tests::new_table_routes_all_lookups_to_null_before_first_rewrite, verifying both the initial table contents and a SOURCE compute dispatch against an un-rewritten table with a non-zero buffer bound at slot 0.

Testing

  • Verified the new test fails on main (63bcca43) before the fix.
  • cargo test -p victory-gpu --locked --lib memory::tests -- --skip lists_share_a_table_and_copies_keep_their_views (RTX 5090): 8 passed, 0 failed.
  • VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --locked --features diagnostics (WARP): 247 passed, 0 failed, 1 ignored.
  • cargo clippy --workspace --all-targets --locked -- -D warnings and --all-features: clean.
  • cargo test -p xtask --locked policy::tests::repository_passes_policy: passed.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 08:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/3119) `fuzeofficlal:fix/gpu-page-table-null-init` → `main` · +91 −0 · 1 files · 1 commits · open ## Summary Split out from #3106 per triage feedback. `Shared::new` allocates the title-memory page table buffer and reserves a `null` descriptor pair (`heap.pair()`), but previously left the table buffer zeroed until the first `Shared::rewrite`. If a command list executes with that table before `rewrite` has ever run (for example when its view heap is released before its first `prepare`), every level-1 lookup resolves to block 0 and every block-0 entry has `e.x == 0`, causing translated shaders to index descriptor slot 0 instead of `self.null`. ## Changes - `crates/victory-gpu/src/memory.rs`: - In `Shared::new`, point every level-1 entry at block 0 and fill all `BLOCK` entries of block 0 with `[null, 0]`, matching `write_table` for an empty table. - Add `memory::tests::new_table_routes_all_lookups_to_null_before_first_rewrite`, verifying both the initial table contents and a `SOURCE` compute dispatch against an un-rewritten table with a non-zero buffer bound at slot 0. ## Testing - Verified the new test fails on `main` (`63bcca43`) before the fix. - `cargo test -p victory-gpu --locked --lib memory::tests -- --skip lists_share_a_table_and_copies_keep_their_views` (RTX 5090): 8 passed, 0 failed. - `VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --locked --features diagnostics` (WARP): 247 passed, 0 failed, 1 ignored. - `cargo clippy --workspace --all-targets --locked -- -D warnings` and `--all-features`: clean. - `cargo test -p xtask --locked policy::tests::repository_passes_policy`: passed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:52:04 +00:00
github-bot force-pushed github-bot/gh-3119 from f0ed7f5931 to fe530463ae 2026-11-26 11:09:42 +00:00 Compare
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 09:09 UTC · original · approved these changes

Verified on RTX 5090 & WARP against origin/main (63bcca4):

  • cargo test -p victory-gpu --lib memory:: -- --test-threads=1 --skip lists_share_a_table_and_copies_keep_their_views: 8/8 passed on RTX 5090 and WARP (including new_table_routes_all_lookups_to_null_before_first_rewrite).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Cleanly initializes new page tables to the null view pair before their first rewrite.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 09:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/3119#pullrequestreview-6071245641) · **approved these changes** Verified on RTX 5090 & WARP against `origin/main` (`63bcca4`): - `cargo test -p victory-gpu --lib memory:: -- --test-threads=1 --skip lists_share_a_table_and_copies_keep_their_views`: 8/8 passed on RTX 5090 and WARP (including `new_table_routes_all_lookups_to_null_before_first_rewrite`). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Cleanly initializes new page tables to the null view pair before their first rewrite. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 09:20 UTC · original

Automated triage for the maintainers.

Merge candidate. Shared::new (crates/victory-gpu/src/memory.rs) now writes level 1 and block 0 of a new page table so that every lookup resolves to the null pair, the same result write_table gives for a table with no copies. The case can happen. Lists keep their host heap alive (list.keep in draw.rs), but memory::release drops the Shared entry when the title heap is dropped. A list recorded before that release then runs with a table prepare never rewrote, and every lookup lands on descriptor slot 0. The fill is 12,288 dwords once per table, so it costs little. new_table_routes_all_lookups_to_null_before_first_rewrite checks both the table contents and a dispatch against the un-rewritten table. It does not overlap #3122, and the two can both land.

CI: check passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 09:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/3119#issuecomment-7187819832) <!-- victory-triage v1 head=fe530463ae293e5b082b516c0506804db31e0e7b verdict=merge-candidate at=2026-11-26T09:22:00Z --> Automated triage for the maintainers. **Merge candidate.** `Shared::new` (`crates/victory-gpu/src/memory.rs`) now writes level 1 and block 0 of a new page table so that every lookup resolves to the null pair, the same result `write_table` gives for a table with no copies. The case can happen. Lists keep their host heap alive (`list.keep` in `draw.rs`), but `memory::release` drops the `Shared` entry when the title heap is dropped. A list recorded before that release then runs with a table `prepare` never rewrote, and every lookup lands on descriptor slot 0. The fill is 12,288 dwords once per table, so it costs little. `new_table_routes_all_lookups_to_null_before_first_rewrite` checks both the table contents and a dispatch against the un-rewritten table. It does not overlap #3122, and the two can both land. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request can be merged automatically.
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/3119/head:github-bot/gh-3119'
git switch 'github-bot/gh-3119'

Merge

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