GPU tests: assert the heaps and slots a host can make #3244

Open
github-bot wants to merge 2 commits from github-bot/gh-3244 into main AGit
Owner

@⁠HailLucifer666 on GitHub · 2026-11-26 14:23 UTC · original
HailLucifer666:fix/descriptor-test-assertions → main · +37 −3 · 2 files · 2 commits · open

Fixes #3178.

Both tests assert a descriptor-heap layout no D3D12 device can provide, so they fail on every machine with a GPU and pass on CI only because HostHeap::new returns None without a device.

Reproduced on 63bcca43 with a D3D12 adapter — both fail at the assertions named in the issue.

  • dynamic_slots_are_held_until_released: the heap cannot hold HEAP_VIEWS = 1 << 21 against the 1,000,000 shader-visible cap. The test now asserts the design instead: count title slots plus the dynamic range the host took (>= MIN_DYNAMIC), and that the view-stride and view-mark tables have max(count, HEAP_VIEWS) entries each, by reading the mapped buffers' widths.
  • lists_share_a_table_and_copies_keep_their_views: measured here, the host-copy pairs are (2, 4) — inside the dynamic range — because the heap is exactly count + MIN_DYNAMIC and the reserved pair range past it does not fit. The test now asserts one distinct pair per copy and that both are inside the heap, which is what it needs; the slot's range is the host's choice, and asserting >= 1 << 18 encoded a layout a capped heap does not have.

Test-only. No behaviour changes.

Verification on this machine (Windows 11, D3D12 adapter, Rust 1.98.1):

  • before: dynamic_slots_are_held_until_released FAILED at NumDescriptors >= HEAP_VIEWS; lists_share_a_table_and_copies_keep_their_views FAILED at >= 1 << 18.
  • after: both pass; cargo clippy -p victory-gpu --all-targets --locked -- -D warnings clean.

AI-assisted; every run above was executed on this machine.

**@⁠HailLucifer666** on GitHub · 2026-11-26 14:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/3244) `HailLucifer666:fix/descriptor-test-assertions` → `main` · +37 −3 · 2 files · 2 commits · open Fixes #3178. Both tests assert a descriptor-heap layout no D3D12 device can provide, so they fail on every machine with a GPU and pass on CI only because `HostHeap::new` returns `None` without a device. Reproduced on `63bcca43` with a D3D12 adapter — both fail at the assertions named in the issue. - **`dynamic_slots_are_held_until_released`**: the heap cannot hold `HEAP_VIEWS = 1 << 21` against the 1,000,000 shader-visible cap. The test now asserts the design instead: `count` title slots plus the dynamic range the host took (`>= MIN_DYNAMIC`), and that the view-stride and view-mark tables have `max(count, HEAP_VIEWS)` entries each, by reading the mapped buffers' widths. - **`lists_share_a_table_and_copies_keep_their_views`**: measured here, the host-copy pairs are `(2, 4)` — inside the dynamic range — because the heap is exactly `count + MIN_DYNAMIC` and the reserved pair range past it does not fit. The test now asserts one distinct pair per copy and that both are inside the heap, which is what it needs; the slot's range is the host's choice, and asserting `>= 1 << 18` encoded a layout a capped heap does not have. Test-only. No behaviour changes. Verification on this machine (Windows 11, D3D12 adapter, Rust 1.98.1): - before: `dynamic_slots_are_held_until_released` FAILED at `NumDescriptors >= HEAP_VIEWS`; `lists_share_a_table_and_copies_keep_their_views` FAILED at `>= 1 << 18`. - after: both pass; `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings` clean. AI-assisted; every run above was executed on this machine.
THE BUG. Two tests assert a descriptor-heap layout no D3D12 device can
provide, so they fail on every machine with a GPU and pass on CI only by
returning early. `dynamic_slots_are_held_until_released` asks for `HEAP_VIEWS`
(1 << 21) descriptors against the 1,000,000 shader-visible cap;
`lists_share_a_table_and_copies_keep_their_views` expects every host-copy
pair past 1 << 18, which a heap capped at `count + MIN_DYNAMIC` does not
have -- its pairs fall back into the dynamic range.

THE FIX. Test-only; no behaviour changes. The first test asserts what the
design guarantees: the heap holds the title's slots plus the dynamic range
it took, and the view-stride and view-mark tables cover every index a shader
can reach (`max(count, HEAP_VIEWS)` entries). The second asserts one
distinct, in-heap pair per copy, which is what the test needs; the slot's
range is the host's choice.

VERIFICATION. On `63bcca43` with a D3D12 adapter both tests failed at the
assertions above; both pass with this change. `cargo clippy -p victory-gpu
--all-targets -- -D warnings` clean. Reported in #3178.

AI-assisted; every run above was executed on this machine.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 14:27:18 +00:00
Author
Owner

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

Reviewed the diff and verified locally on Windows 11 x64 (RTX 5090 + WARP):

  • Confirmed both previously failing tests on NVIDIA (1M shader-visible descriptor heap cap, #1744) now pass on RTX 5090 while preserving strict assertions on count + dynamic, stride/mark table widths, and distinct in-bounds copy view pairs.
  • cargo test -p victory-gpu --lib descriptor::host::tests:: -- --test-threads=1 (RTX 5090): 15 passed, 0 failed (including dynamic_slots_are_held_until_released).
  • cargo test -p victory-gpu --lib memory::tests:: -- --test-threads=1 (RTX 5090): 8 passed, 0 failed (including lists_share_a_table_and_copies_keep_their_views).
  • VICTORY_FORCE_WARP=1 (WARP): both dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views passed.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

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

**@⁠Dukestar69** on GitHub · 2026-11-26 14:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/3244#pullrequestreview-6075849430) · **approved these changes** Reviewed the diff and verified locally on Windows 11 x64 (RTX 5090 + WARP): - Confirmed both previously failing tests on NVIDIA (1M shader-visible descriptor heap cap, #1744) now pass on RTX 5090 while preserving strict assertions on count + dynamic, stride/mark table widths, and distinct in-bounds copy view pairs. - cargo test -p victory-gpu --lib descriptor::host::tests:: -- --test-threads=1 (RTX 5090): 15 passed, 0 failed (including dynamic_slots_are_held_until_released). - cargo test -p victory-gpu --lib memory::tests:: -- --test-threads=1 (RTX 5090): 8 passed, 0 failed (including lists_share_a_table_and_copies_keep_their_views). - VICTORY_FORCE_WARP=1 (WARP): both dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views passed. - cargo clippy -p victory-gpu --all-targets -- -D warnings: clean. - cargo xtask policy: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
CI ran `dynamic_slots_are_held_until_released` on WARP and it failed my new
equality: WARP accepts a 2,097,152-descriptor heap, so `HostHeap::new` takes the
first branch and builds `max(count + DYNAMIC, HEAP_VIEWS)`, while `count` and
`dynamic` stay 4 and 2^18. A device at the 1,000,000 cap takes the fallback and
gets exactly `count + MIN_DYNAMIC`.

The design guarantee is the lower bound, not the exact size: at least the
title's slots plus the dynamic range it took, with the tables covering
`max(count, HEAP_VIEWS)` either way. Asserting that holds on both classes of
host, which is what the test must do.
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/3244/head:github-bot/gh-3244'
git switch 'github-bot/gh-3244'

Merge

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