Check live page-table allocations on capped view heaps #2242

Closed
gmankab wants to merge 1 commit from upstream-pr/2244 into main
gmankab commented 2026-11-25 08:38:45 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by gmankab on 2026-11-25T08:38:45Z.


The page-table readback test assumes persistent view pairs start at or above slot 2^18. On a capped heap, the allocator can put those pairs in the smaller dynamic pool.

Keep the readback and pair-stability checks. While both pairs are live, reserve a draw-table allocation and assert that their two-slot ranges neither overlap each other nor the draw-table allocation. Also check that both pairs are outside the title slots.

The readback test passed on the default heap and with a locally forced 2^16-slot heap. FXC rejected the shader flags on this Wine setup, so I compiled the same HLSL with DXC for these runs. The DXC workaround and forced heap are local test changes.

Based-on: github.com/Marvisak/VIctory@6d021fe3df
Tested-on: AMD Radeon RX 6800, Fedora Linux 45 (Wine/vkd3d-proton, DXC test build)
Assisted-by: gpt-6.2 sol xhigh

<!-- greyfinch-sync:Marvisak/VIctory:issue:6600519710 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2244). Originally posted by [gmankab](https://github.com/gmankab) on 2026-11-25T08:38:45Z. --- The page-table readback test assumes persistent view pairs start at or above slot 2^18. On a capped heap, the allocator can put those pairs in the smaller dynamic pool. Keep the readback and pair-stability checks. While both pairs are live, reserve a draw-table allocation and assert that their two-slot ranges neither overlap each other nor the draw-table allocation. Also check that both pairs are outside the title slots. The readback test passed on the default heap and with a locally forced 2^16-slot heap. FXC rejected the shader flags on this Wine setup, so I compiled the same HLSL with DXC for these runs. The DXC workaround and forced heap are local test changes. Based-on: https://github.com/Marvisak/VIctory/commit/6d021fe3df542e5b5c59940a23703735e90ca603 Tested-on: AMD Radeon RX 6800, Fedora Linux 45 (Wine/vkd3d-proton, DXC test build) Assisted-by: gpt-6.2 sol xhigh
DenRakEiw commented 2026-11-25 09:06:01 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T08:42:27Z.

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 memory::tests:: — 3 passed, 0 failed on NVIDIA RTX 5090! Directly fixes lists_share_a_table_and_copies_keep_their_views on capped NVIDIA view heaps!
  • cargo clippy -p victory-gpu --all-targets — 0 warnings
  • cargo xtask policy — ok (183 files ok)

Clean check for live page-table allocations on capped view heaps. Looks great.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6054307107 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2244#pullrequestreview-6054307107). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-25T08:42:27Z. **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 memory::tests::` — **3 passed, 0 failed** on NVIDIA RTX 5090! Directly fixes `lists_share_a_table_and_copies_keep_their_views` on capped NVIDIA view heaps! - `cargo clippy -p victory-gpu --all-targets` — 0 warnings - `cargo xtask policy` — ok (`183 files ok`) Clean check for live page-table allocations on capped view heaps. Looks great. AI-assisted (Gemini 4 Neon).
catminou4 commented 2026-11-25 09:06:01 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Test-only: strengthen lists_share_a_table_and_copies_keep_their_views to verify disjoint live allocations on capped heaps (dynamic-slot assumption removed). 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.

<!-- greyfinch-sync:Marvisak/VIctory:review:6054382225 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2244#pullrequestreview-6054382225). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T08:48:38Z. **Review:** COMMENTED --- Test-only: strengthen lists_share_a_table_and_copies_keep_their_views to verify disjoint live allocations on capped heaps (dynamic-slot assumption removed). 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.
MamaLeVrai commented 2026-11-25 10:07:32 +00:00 (Migrated from github.com)

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


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 646363e2 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: 701 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:7158041161 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2244#issuecomment-7158041161). Originally posted by [MamaLeVrai](https://github.com/MamaLeVrai) on 2026-11-25T09:13:28Z. --- 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 `646363e2` 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`: 701 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.
kotekompotek commented 2026-11-25 10:07:40 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T09:21:19Z.


Heads-up: #2251 touches the same assertion in this test (pairs >= 1 << 18 on a capped heap), so these two will conflict at that hunk. Your version is the better fix for this test — it keeps real invariants (pairs disjoint from each other and from the draw-table allocation, outside title slots) in both layouts, where mine just skips the check when the heap has no persistent range. If this lands first I'll rebase #2251 to drop its hunk here and keep only the draw.rs / descriptor::host changes.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7158217950 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2244#issuecomment-7158217950). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T09:21:19Z. --- Heads-up: #2251 touches the same assertion in this test (`pairs >= 1 << 18` on a capped heap), so these two will conflict at that hunk. Your version is the better fix for this test — it keeps real invariants (pairs disjoint from each other and from the draw-table allocation, outside title slots) in both layouts, where mine just skips the check when the heap has no persistent range. If this lands first I'll rebase #2251 to drop its hunk here and keep only the `draw.rs` / `descriptor::host` changes.
Mericas77 commented 2026-11-25 11:05:06 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Mericas77 on 2026-11-25T10:12:53Z.


NVIDIA test report: RTX 4070, driver 621.01, Windows 11, Rust 1.98.1 MSVC. This host has a real capped view heap (NVIDIA's 1,000,000-descriptor limit), not a forced one. I ran head 646363e against main 940d32f; the head branches from 940d32f and only changes memory.rs.

  • memory::tests::lists_share_a_table_and_copies_keep_their_views
    • main: fails: past the dynamic slots (memory.rs:673)
    • this PR: passes
  • cargo test -p victory-gpu --lib --locked
    • main: 141 passed, 2 failed
    • this PR: 142 passed, 1 failed
  • The one remaining failure, descriptor::host::tests::dynamic_slots_are_held_until_released (heap.heap.GetDesc().NumDescriptors >= victory_shader::emit::HEAP_VIEWS, host.rs:1486), fails the same way on main. It's the same heap-cap issue, and this PR doesn't touch it (#2251 / #2185 / #2177 cover that area).
  • I re-ran the targeted test with VICTORY_D3D12_DEBUG=1 and --features diagnostics and got the same result: it fails on main and passes here.

So the relaxed check holds on a real capped heap as well as the Wine run with a forced 2^16 heap. No game data; the title was not run.

AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7159387525 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2244#issuecomment-7159387525). Originally posted by [Mericas77](https://github.com/Mericas77) on 2026-11-25T10:12:53Z. --- NVIDIA test report: RTX 4070, driver 621.01, Windows 11, Rust 1.98.1 MSVC. This host has a real capped view heap (NVIDIA's 1,000,000-descriptor limit), not a forced one. I ran head `646363e` against `main` `940d32f`; the head branches from `940d32f` and only changes `memory.rs`. - `memory::tests::lists_share_a_table_and_copies_keep_their_views` - `main`: **fails**: `past the dynamic slots` (memory.rs:673) - this PR: **passes** - `cargo test -p victory-gpu --lib --locked` - `main`: 141 passed, 2 failed - this PR: 142 passed, 1 failed - The one remaining failure, `descriptor::host::tests::dynamic_slots_are_held_until_released` (`heap.heap.GetDesc().NumDescriptors >= victory_shader::emit::HEAP_VIEWS`, host.rs:1486), fails the same way on `main`. It's the same heap-cap issue, and this PR doesn't touch it (#2251 / #2185 / #2177 cover that area). - I re-ran the targeted test with `VICTORY_D3D12_DEBUG=1` and `--features diagnostics` and got the same result: it fails on `main` and passes here. So the relaxed check holds on a real capped heap as well as the Wine run with a forced 2^16 heap. No game data; the title was not run. AI-assisted.
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:30:57Z.


Automated triage for the maintainers.

This is a test-only fix in memory::tests::lists_share_a_table_and_copies_keep_their_views (crates/victory-gpu/src/memory.rs). The hard-coded >= 1 << 18 is replaced with checks that hold on any heap layout: pairs are disjoint from each other and from a live draw-table allocation, and lie outside the title slots. The reasoning matches main: HostHeap::pair falls back to dynamic(2) when the pair range is empty, which happens on capped heaps. CI passes, and a tester reports that the test now passes on an NVIDIA card with a real 1,000,000-descriptor cap, where it fails on main. #2251 touches the same assertion, and its author says this version should land first.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7163887904 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2244#issuecomment-7163887904). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T13:30:57Z. --- <!-- victory-triage v1 head=646363e2f2464543f0eff8983ae3e47d67e05e71 verdict=merge-candidate at=2026-11-25T13:41:00Z --> Automated triage for the maintainers. This is a test-only fix in `memory::tests::lists_share_a_table_and_copies_keep_their_views` (`crates/victory-gpu/src/memory.rs`). The hard-coded `>= 1 << 18` is replaced with checks that hold on any heap layout: pairs are disjoint from each other and from a live draw-table allocation, and lie outside the title slots. The reasoning matches main: `HostHeap::pair` falls back to `dynamic(2)` when the pair range is empty, which happens on capped heaps. CI passes, and a tester reports that the test now passes on an NVIDIA card with a real 1,000,000-descriptor cap, where it fails on main. #2251 touches the same assertion, and its author says this version should land first. --- _Generated by [Claude Code](https://claude.ai/code)_
upstream-sync closed this pull request 2026-11-25 23:04:08 +00:00
Marvisak commented 2026-11-25 23:05:58 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:07:25Z.


Automated triage for the maintainers, second look (a review against current main, with builds and tests where they could change the verdict).

Closing in favour of #2251, which changes the same assertion to >= views.pair_start() where the heap has a pair range and skips it only on capped heaps, so the check keeps holding on uncapped hosts. With this version, a pair taken from the per-draw dynamic range would pass on an uncapped heap, and that is the mistake the test exists to catch.

If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7175965313 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2244#issuecomment-7175965313). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T22:07:25Z. --- Automated triage for the maintainers, second look (a review against current `main`, with builds and tests where they could change the verdict). Closing in favour of #2251, which changes the same assertion to `>= views.pair_start()` where the heap has a pair range and skips it only on capped heaps, so the check keeps holding on uncapped hosts. With this version, a pair taken from the per-draw dynamic range would pass on an uncapped heap, and that is the mistake the test exists to catch. If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

Pull request closed

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!2242
No description provided.