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

Open
HailLucifer666 wants to merge 2 commits from upstream-pr/3244 into main
HailLucifer666 commented 2026-11-26 14:23:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by HailLucifer666 on 2026-11-26T14:23:28Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5511760055 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3244). Originally posted by [HailLucifer666](https://github.com/HailLucifer666) on 2026-11-26T14:23:28Z. --- 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.
Dukestar69 commented 2026-11-26 14:30:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T14:30:07Z.

Review: APPROVED


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

<!-- greyfinch-sync:Marvisak/VIctory:review:6075849430 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3244#pullrequestreview-6075849430). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T14:30:07Z. **Review:** APPROVED --- 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).
Jackster commented 2026-11-26 22:34:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Jackster on 2026-11-26T22:34:14Z.


Windows 11, 63bcca4 + this PR, Radeon RX 7900 XTX:

  • cargo test -p victory-gpu --lib: 231 passed / 0 failed / 1 ignored.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.

Worth knowing when reading the result: this host does not cap the view heap (HEAP_VIEWS fits: 24 GB card), so the tests take the uncapped branch; the capped branch the PR asserts is the one CI's WARP path and an NVIDIA host would exercise. Synthetic only. AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7204795968 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3244#issuecomment-7204795968). Originally posted by [Jackster](https://github.com/Jackster) on 2026-11-26T22:34:14Z. --- Windows 11, `63bcca4` + this PR, Radeon RX 7900 XTX: - `cargo test -p victory-gpu --lib`: 231 passed / 0 failed / 1 ignored. - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. Worth knowing when reading the result: this host does not cap the view heap (`HEAP_VIEWS` fits: 24 GB card), so the tests take the uncapped branch; the capped branch the PR asserts is the one CI's WARP path and an NVIDIA host would exercise. Synthetic only. AI-assisted.
fuzeofficlal commented 2026-11-27 01:21:26 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-27T01:21:26Z.

Review: APPROVED


Looks great. Both assertions now test the real cross-vendor invariants (heap holds count + dynamic with dynamic >= MIN_DYNAMIC, strides and marks cover count.max(HEAP_VIEWS), and each copy receives a distinct pair within the heap's capacity) instead of assuming an uncapped 2M shader-visible descriptor heap.

Verified on e493332a0443f9a1b2930fc607f89f58df92b36c:

  • cargo xtask policy and cargo clippy --lib / --tests (default and --features diagnostics, -D warnings) pass cleanly.
  • On RTX 5090 (1M-capped shader-visible view heap, VICTORY_D3D12_DEBUG=1): all 15/15 descriptor::host::tests and all 8/8 memory::tests pass with zero skips.
  • On WARP (uncapped 2M heap, VICTORY_D3D12_DEBUG=1): all 15/15 descriptor::host::tests and all 8/8 memory::tests pass.
<!-- greyfinch-sync:Marvisak/VIctory:review:6082243387 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3244#pullrequestreview-6082243387). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-27T01:21:26Z. **Review:** APPROVED --- Looks great. Both assertions now test the real cross-vendor invariants (heap holds `count + dynamic` with `dynamic >= MIN_DYNAMIC`, `strides` and `marks` cover `count.max(HEAP_VIEWS)`, and each copy receives a distinct pair within the heap's capacity) instead of assuming an uncapped 2M shader-visible descriptor heap. Verified on `e493332a0443f9a1b2930fc607f89f58df92b36c`: - `cargo xtask policy` and `cargo clippy --lib` / `--tests` (default and `--features diagnostics`, `-D warnings`) pass cleanly. - On RTX 5090 (1M-capped shader-visible view heap, `VICTORY_D3D12_DEBUG=1`): all 15/15 `descriptor::host::tests` and all 8/8 `memory::tests` pass with zero skips. - On WARP (uncapped 2M heap, `VICTORY_D3D12_DEBUG=1`): all 15/15 `descriptor::host::tests` and all 8/8 `memory::tests` pass.
kalberts0089-hash commented 2026-11-27 08:14:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kalberts0089-hash on 2026-11-27T08:14:41Z.


NVIDIA test report: RTX 4070 Ti (desktop, driver 621.01), Windows 11 Pro, rustc 1.98.1. Head e493332 (base main 63bcca4).

  • cargo test -p victory-gpu --lib -- --test-threads=1: 231 passed, 0 failed, 1 ignored (main: 229 / 2 / 1). Both known capped-heap failures on main here, dynamic_slots_are_held_until_released (>= HEAP_VIEWS) and lists_share_a_table_and_copies_keep_their_views ("past the dynamic slots"), pass with this PR, including the new stride/mark table width checks.
  • cargo test -p victory-shader --lib --no-fail-fast, skipping heap_direct_texture_reads_mark_their_heap_index (#2571): 298 passed, 3 failed, 3 ignored, same as main. The 3 are the known NVIDIA failures (a_heap_buffer_read_by_element_takes_the_views_stride, a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, gathers_at_a_level_match_the_hardware), unrelated to this PR.
  • Not tested: nothing game-side; this is a test-only change.

Synthetic tests only, no game files. AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7213311386 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3244#issuecomment-7213311386). Originally posted by [kalberts0089-hash](https://github.com/kalberts0089-hash) on 2026-11-27T08:14:41Z. --- NVIDIA test report: RTX 4070 Ti (desktop, driver 621.01), Windows 11 Pro, rustc 1.98.1. Head `e493332` (base main `63bcca4`). - `cargo test -p victory-gpu --lib -- --test-threads=1`: 231 passed, 0 failed, 1 ignored (main: 229 / 2 / 1). Both known capped-heap failures on main here, `dynamic_slots_are_held_until_released` (`>= HEAP_VIEWS`) and `lists_share_a_table_and_copies_keep_their_views` ("past the dynamic slots"), pass with this PR, including the new stride/mark table width checks. - `cargo test -p victory-shader --lib --no-fail-fast`, skipping `heap_direct_texture_reads_mark_their_heap_index` (#2571): 298 passed, 3 failed, 3 ignored, same as main. The 3 are the known NVIDIA failures (`a_heap_buffer_read_by_element_takes_the_views_stride`, `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`, `gathers_at_a_level_match_the_hardware`), unrelated to this PR. - Not tested: nothing game-side; this is a test-only change. Synthetic tests only, no game files. AI-assisted (Claude Code).
HamsterHyper187 commented 2026-11-27 17:34:36 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by HamsterHyper187 on 2026-11-27T17:34:36Z.


Test report: NVIDIA RTX 3060 12 GB (Ampere), native Windows

OS: Windows 11 x64
GPU: NVIDIA GeForce RTX 3060 12 GB, driver 621.40
rustc/cargo: 1.98.1 (48a229cea 2026-09-01)
Base: main 63bcca4
Head: e493332 (based on current main, no rebase needed)

Command: cargo test -p victory-gpu --lib --locked -- --test-threads=1

pass fail ignored
main 229 2 1
this PR (3 of 3 runs) 231 0 1

On main, the two failures are the ones from #3178:

  • descriptor::host::tests::dynamic_slots_are_held_until_released (host.rs:2226)
  • memory::tests::lists_share_a_table_and_copies_keep_their_views (memory.rs:1030)

On this PR, both pass, also when run alone with --exact. No other test changed.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7224558709 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3244#issuecomment-7224558709). Originally posted by [HamsterHyper187](https://github.com/HamsterHyper187) on 2026-11-27T17:34:36Z. --- **Test report: NVIDIA RTX 3060 12 GB (Ampere), native Windows** OS: Windows 11 x64 GPU: NVIDIA GeForce RTX 3060 12 GB, driver 621.40 rustc/cargo: 1.98.1 (48a229cea 2026-09-01) Base: main `63bcca4` Head: `e493332` (based on current main, no rebase needed) Command: `cargo test -p victory-gpu --lib --locked -- --test-threads=1` | | pass | fail | ignored | |---|---|---|---| | main | 229 | 2 | 1 | | this PR (3 of 3 runs) | 231 | 0 | 1 | On `main`, the two failures are the ones from #3178: - `descriptor::host::tests::dynamic_slots_are_held_until_released` (host.rs:2226) - `memory::tests::lists_share_a_table_and_copies_keep_their_views` (memory.rs:1030) On this PR, both pass, also when run alone with `--exact`. No other test changed.
andrewpozdnakov7-jpg commented 2026-11-27 17:43:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T17:43:41Z.


I ran the two tests on the same app-local WARP 1.0.22 device with Agility 1.620.2, comparing main 63bcca4 with this head e493332. To exercise fallback on that same adapter, a temporary test-only guard in HostHeap::new returned E_INVALIDARG for view heap creation requests above 1,000,000. WARP performed the fallback allocations. Each case ran in a fresh process.

WARP configuration Dynamic-slot test: allocated slots Copy-pair test: allocated slots and pair starts main e493332
Normal 2,097,152 2,097,152; (262146, 262148) 2/2 pass 2/2 pass
Forced 1,000,000 cap 65,540 65,536; (2, 4) 0/2 pass 2/2 pass

In the capped control, main failed at NumDescriptors >= HEAP_VIEWS and past the dynamic slots, respectively. The PR completed both submissions and checked their readbacks in the copy-pair test. The guard and measurement prints were removed after building the test binaries.

One wording suggestion for the PR description and test comment: say that a capped host may reject HEAP_VIEWS. The normal WARP run allocated exactly 2,097,152 shader-visible views. The same PR assertions passed on both allocation paths.

Synthetic tests only. AI-assisted with Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7224721910 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3244#issuecomment-7224721910). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-27T17:43:41Z. --- I ran the two tests on the same app-local WARP 1.0.22 device with Agility 1.620.2, comparing `main` `63bcca4` with this head `e493332`. To exercise fallback on that same adapter, a temporary test-only guard in `HostHeap::new` returned `E_INVALIDARG` for view heap creation requests above 1,000,000. WARP performed the fallback allocations. Each case ran in a fresh process. | WARP configuration | Dynamic-slot test: allocated slots | Copy-pair test: allocated slots and pair starts | `main` | `e493332` | | --- | ---: | --- | --- | --- | | Normal | 2,097,152 | 2,097,152; `(262146, 262148)` | 2/2 pass | 2/2 pass | | Forced 1,000,000 cap | 65,540 | 65,536; `(2, 4)` | 0/2 pass | 2/2 pass | In the capped control, `main` failed at `NumDescriptors >= HEAP_VIEWS` and `past the dynamic slots`, respectively. The PR completed both submissions and checked their readbacks in the copy-pair test. The guard and measurement prints were removed after building the test binaries. One wording suggestion for the PR description and test comment: say that a capped host may reject `HEAP_VIEWS`. The normal WARP run allocated exactly 2,097,152 shader-visible views. The same PR assertions passed on both allocation paths. Synthetic tests only. AI-assisted with Codex.
artor410 commented 2026-11-28 08:19:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by artor410 on 2026-11-28T08:19:20Z.


NVIDIA Ampere check of e493332, merged cleanly onto main 63bcca4 (tree e493332). RTX 3070 Ti 8 GB (Ampere, view heap capped at 1,000,000), driver 610.88, Windows 11, rustc 1.98.1, hardware adapter. Synthetic tests only.

Command: cargo test -p victory-gpu --lib, then the two #3178 tests with --nocapture --test-threads=1.

  • main: 229 pass / 2 fail (dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views).
  • this PR: 231 pass / 0 fail. Both tests pass.

This is the only PR that still asserts something on the capped path. It checks the title slots plus the dynamic range, and that the stride and mark tables cover HEAP_VIEWS. For the pairs, it checks they are distinct and inside the heap, where the others skip the check.

Side by side with #1770, #2251, #2937, #3191 and #3244 in #3178.

(Claude Code, Claude Opus 5.5.)

<!-- greyfinch-sync:Marvisak/VIctory:comment:7236507248 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3244#issuecomment-7236507248). Originally posted by [artor410](https://github.com/artor410) on 2026-11-28T08:19:20Z. --- NVIDIA Ampere check of `e493332`, merged cleanly onto `main` `63bcca4` (tree `e493332`). RTX 3070 Ti 8 GB (Ampere, view heap capped at 1,000,000), driver 610.88, Windows 11, rustc 1.98.1, hardware adapter. Synthetic tests only. Command: `cargo test -p victory-gpu --lib`, then the two #3178 tests with `--nocapture --test-threads=1`. - `main`: 229 pass / 2 fail (`dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views`). - this PR: 231 pass / 0 fail. Both tests pass. This is the only PR that still asserts something on the capped path. It checks the title slots plus the dynamic range, and that the stride and mark tables cover `HEAP_VIEWS`. For the pairs, it checks they are distinct and inside the heap, where the others skip the check. Side by side with #1770, #2251, #2937, #3191 and #3244 in #3178. (Claude Code, Claude Opus 5.5.)
andrewpozdnakov7-jpg commented 2026-11-28 08:26:39 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T08:26:39Z.


The RTX 3070 Ti comparison narrows the capped-host test fix to this PR. I also checked that it combines with fyernald's parallel test-hook fix #2585 on the current main. Combined commit e9febc4 preserves both exact heads.

On signed app-local WARP, all 15 descriptor-host tests passed at eight threads, as did the shared-table and copy-pair test. I then used a local test-only shim to simulate the reported 65,540-descriptor ceiling before calling D3D12. The first test used 65,540 descriptors with 65,536 dynamic slots. The shared-table test requests no title slots, so it used 65,536 descriptors and kept both distinct copy pairs at indices 2 and 4. Both capped runs executed their existing assertions and passed. The published branch contains the two PRs' test changes. Strict GPU Clippy and the asset policy passed.

The next step is maintainer review. Please retain HailLucifer666's and fyernald's Git authorship if applying either change directly.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7236586333 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3244#issuecomment-7236586333). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T08:26:39Z. --- The [RTX 3070 Ti comparison](https://github.com/Marvisak/VIctory/issues/3178#issuecomment-7236507717) narrows the capped-host test fix to this PR. I also checked that it combines with fyernald's parallel test-hook fix #2585 on the current main. [Combined commit e9febc4](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/e9febc4db32d14ba90396c2c7142c576de6b0ccb) preserves both exact heads. On signed app-local WARP, all 15 descriptor-host tests passed at eight threads, as did the shared-table and copy-pair test. I then used a local test-only shim to simulate the reported 65,540-descriptor ceiling before calling D3D12. The first test used 65,540 descriptors with 65,536 dynamic slots. The shared-table test requests no title slots, so it used 65,536 descriptors and kept both distinct copy pairs at indices 2 and 4. Both capped runs executed their existing assertions and passed. The published branch contains the two PRs' test changes. Strict GPU Clippy and the asset policy passed. The next step is maintainer review. Please retain HailLucifer666's and fyernald's Git authorship if applying either change directly. AI-assisted with OpenAI Codex.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3244:upstream-pr/3244'
git switch 'upstream-pr/3244'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3244'
git switch 'upstream-pr/3244'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3244'
git switch 'upstream-pr/3244'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3244'
git switch 'main'
git merge --squash 'upstream-pr/3244'
git switch 'main'
git merge --ff-only 'upstream-pr/3244'
git switch 'main'
git merge 'upstream-pr/3244'
git push origin 'main'
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!3242
No description provided.