Skip to content

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

Closed
gmankab wants to merge 1 commit into
Marvisak:mainfrom
gmankab:contrib/check-live-page-pairs
Closed

gmankab wants to merge 1 commit into
Marvisak:mainfrom
gmankab:contrib/check-live-page-pairs

Conversation

@gmankab

@gmankab gmankab commented Nov 25, 2026

Copy link
Copy Markdown

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: 6d021fe
Tested-on: AMD Radeon RX 6800, Fedora Linux 45 (Wine/vkd3d-proton, DXC test build)
Assisted-by: gpt-6.2 sol xhigh

The page-table readback test assumes every persistent descriptor pair
starts at or above slot 2^18. A capped view heap can reserve only 2^16
dynamic slots, and its persistent pairs can come from that same pool.

Check the allocator's invariant by reserving a draw-table allocation
alongside the two live pairs, then check that all three spans are
disjoint and the pairs are outside the title slots. The existing
readbacks still check that the pairs remain stable across submissions.

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

@DenRakEiw DenRakEiw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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.

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.

Copy link
Copy Markdown
Owner

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

@Marvisak

Copy link
Copy Markdown
Owner

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.

@Marvisak Marvisak closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants