GPU test: the pair region is not where a capped heap puts it #3284

Open
zzm1234560621-prog wants to merge 1 commit from upstream-pr/3286 into main
zzm1234560621-prog commented 2026-11-26 15:59:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by zzm1234560621-prog on 2026-11-26T15:59:02Z.


What

memory::tests::lists_share_a_table_and_copies_keep_their_views asserted that the two copies' view slots lie at >= 1 << 18, i.e. past a dynamic region of DYNAMIC. On a host that caps shader-visible heaps at 1,000,000 the heap takes MIN_DYNAMIC (1 << 16) — and its pair region ends below where it starts, so HostHeap::pair never uses it and hands out dynamic slots instead:

pairs (2, 4)   count 0   dynamic 65536   first pair slot 65536

The test then failed on an index assertion while the reads above it — the point of the test, one table shared and each list's own views kept — were all correct.

The layout the test described is not one a capped heap is required to have, so it now asserts what the design does guarantee:

  • the two copies get distinct slots (a pair per copy);
  • and, only where the pair region exists, that the slots come from it — via a #[cfg(test)] has_pair_region() next to first_pair_slot(), both of which name the boundary instead of spelling 1 << 18 out.

The read assertions are untouched.

Measured

Intel Arc (Xe-LPG, driver 32.0.101.6127), 1M cap, main 63bcca4:

before after
lists_share_a_table_and_copies_keep_their_views failed (past the dynamic slots) passes
cargo test -p victory-gpu --lib 229 passed, 2 failed 230 passed, 1 failed

The one remaining failure is descriptor::host::tests::dynamic_slots_are_held_until_released, which #3191 fixes — the two together make the suite green on a capped host.

cargo clippy -p victory-gpu --all-targets --locked -- -D warnings: clean. cargo xtask policy: 191 files ok.

Not in this PR

  • HEAP_VIEWS itself and whether a capped host should offer the larger dynamic range: that is #3178, and it is a design question, not a test one. This PR only stops a test from encoding one particular answer to it.
  • #3191's test, which asks a different thing (how much room the test should request, not where the region sits). They touch adjacent lines but different questions; if you would rather land one patch, say so and I will fold this in.

No game files. AI-assisted (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:issue:5513245204 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3286). Originally posted by [zzm1234560621-prog](https://github.com/zzm1234560621-prog) on 2026-11-26T15:59:02Z. --- ## What `memory::tests::lists_share_a_table_and_copies_keep_their_views` asserted that the two copies' view slots lie at `>= 1 << 18`, i.e. past a dynamic region of `DYNAMIC`. On a host that caps shader-visible heaps at 1,000,000 the heap takes `MIN_DYNAMIC` (1 << 16) — and its pair region ends below where it starts, so `HostHeap::pair` never uses it and hands out dynamic slots instead: ``` pairs (2, 4) count 0 dynamic 65536 first pair slot 65536 ``` The test then failed on an index assertion while the reads above it — the point of the test, one table shared and each list's own views kept — were all correct. The layout the test described is not one a capped heap is required to have, so it now asserts what the design does guarantee: - the two copies get distinct slots (`a pair per copy`); - and, **only where the pair region exists**, that the slots come from it — via a `#[cfg(test)]` `has_pair_region()` next to `first_pair_slot()`, both of which name the boundary instead of spelling `1 << 18` out. The read assertions are untouched. ## Measured Intel Arc (Xe-LPG, driver 32.0.101.6127), 1M cap, `main` `63bcca4`: | | before | after | |---|---|---| | `lists_share_a_table_and_copies_keep_their_views` | failed (`past the dynamic slots`) | **passes** | | `cargo test -p victory-gpu --lib` | 229 passed, 2 failed | **230 passed, 1 failed** | The one remaining failure is `descriptor::host::tests::dynamic_slots_are_held_until_released`, which **#3191** fixes — the two together make the suite green on a capped host. `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings`: clean. `cargo xtask policy`: 191 files ok. ## Not in this PR - `HEAP_VIEWS` itself and whether a capped host should offer the larger dynamic range: that is #3178, and it is a design question, not a test one. This PR only stops a test from encoding one particular answer to it. - #3191's test, which asks a different thing (how much room the test should request, not where the region sits). They touch adjacent lines but different questions; if you would rather land one patch, say so and I will fold this in. _No game files. AI-assisted (Claude)._
Dukestar69 commented 2026-11-26 16:10:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T16:10:15Z.

Review: APPROVED


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

  • Checking views.has_pair_region() and asserting >= views.first_pair_slot() when present (instead of hardcoding 1 << 18) cleanly fixes lists_share_a_table_and_copies_keep_their_views on 1M-capped NVIDIA heaps while keeping the pair-region assertion intact on uncapped heaps.
  • cargo test -p victory-gpu --lib memory::tests::lists_share_a_table_and_copies_keep_their_views -- --test-threads=1 (RTX 5090): 1 passed, 0 failed.
  • VICTORY_FORCE_WARP=1 cargo test -p victory-gpu --lib memory::tests::lists_share_a_table_and_copies_keep_their_views -- --test-threads=1 (WARP): 1 passed, 0 failed.
  • 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:6077305554 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3286#pullrequestreview-6077305554). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T16:10:15Z. **Review:** APPROVED --- Reviewed the diff and verified locally on Windows 11 x64 (RTX 5090 + WARP): - Checking `views.has_pair_region()` and asserting `>= views.first_pair_slot()` when present (instead of hardcoding `1 << 18`) cleanly fixes `lists_share_a_table_and_copies_keep_their_views` on 1M-capped NVIDIA heaps while keeping the pair-region assertion intact on uncapped heaps. - `cargo test -p victory-gpu --lib memory::tests::lists_share_a_table_and_copies_keep_their_views -- --test-threads=1` (RTX 5090): 1 passed, 0 failed. - `VICTORY_FORCE_WARP=1 cargo test -p victory-gpu --lib memory::tests::lists_share_a_table_and_copies_keep_their_views -- --test-threads=1` (WARP): 1 passed, 0 failed. - `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).
oni-swr commented 2026-11-26 16:42:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-26T16:42:42Z.


WARP verification report (test report only, no code changes)

  • PR head: b83c07d5
  • main: 63bcca43 (control); WARP software adapter forced with VICTORY_WARP=1 VICTORY_D3D12_WARP=1, --features diagnostics, d3d10warp.dll 10.0.26100.9818; dxil.dll 1.8.2502.11 (Windows Kit 10.0.26100.0, via VICTORY_DXIL). No physical GPU. Synthetic tests only, no game data.
  • Commands: cargo test -p victory-gpu --lib --features diagnostics --no-run -j 4, then the test binary with --exact memory::tests::lists_share_a_table_and_copies_keep_their_views --test-threads 1, then the whole lib suite (7 runs per side).
  • memory::tests::lists_share_a_table_and_copies_keep_their_views: passes on the PR (1 passed, 0.36 s).
  • Control: unmodified main (the PR changes the test itself, so the control is main's old test). It also passes on main under WARP: WARP's shader-visible heap is not capped to 1,000,000 descriptors, so the pair region exists and the old >= 1 << 18 assertion holds. This PR's capped-heap failure (Intel Arc, 1M cap) is therefore not reproducible here; WARP only shows that the changed test still passes when the pair region exists.
  • victory-gpu lib suite, 7 runs on each side: both have frame::tests::waits_end_on_ticks_and_count_frames failing every run (also alone, on the PR and on main; unrelated).
  • Flakes: PR run 1 had 2 extra failures (descriptor::host::tests::views_bound_while_another_slot_gets_its_texture_do_not_wait, pipeline::placed_uav_tests::placed_uav_dispatch_writes_its_texture), PR run 3 had 1 (views_bound_...); main run 7 had 1 (shadow::tests::partial_refresh_under_marked_range_updates_saved_bytes). Each passes alone on both sides, so these are parallel-run flakes unrelated to the PR.
  • Not tested: physical GPU, a capped-heap host.

AI use: Claude Code (Claude Sonnet 5.5)

<!-- greyfinch-sync:Marvisak/VIctory:comment:7197998305 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3286#issuecomment-7197998305). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-26T16:42:42Z. --- WARP verification report (test report only, no code changes) - PR head: `b83c07d5` - main: `63bcca43` (control); WARP software adapter forced with `VICTORY_WARP=1 VICTORY_D3D12_WARP=1`, `--features diagnostics`, d3d10warp.dll 10.0.26100.9818; dxil.dll 1.8.2502.11 (Windows Kit 10.0.26100.0, via `VICTORY_DXIL`). No physical GPU. Synthetic tests only, no game data. - Commands: `cargo test -p victory-gpu --lib --features diagnostics --no-run -j 4`, then the test binary with `--exact memory::tests::lists_share_a_table_and_copies_keep_their_views --test-threads 1`, then the whole lib suite (7 runs per side). - `memory::tests::lists_share_a_table_and_copies_keep_their_views`: **passes on the PR** (1 passed, 0.36 s). - Control: unmodified main (the PR changes the test itself, so the control is main's old test). It **also passes on main** under WARP: WARP's shader-visible heap is not capped to 1,000,000 descriptors, so the pair region exists and the old `>= 1 << 18` assertion holds. This PR's capped-heap failure (Intel Arc, 1M cap) is therefore **not reproducible here**; WARP only shows that the changed test still passes when the pair region exists. - `victory-gpu` lib suite, 7 runs on each side: both have `frame::tests::waits_end_on_ticks_and_count_frames` failing every run (also alone, on the PR and on main; unrelated). - Flakes: PR run 1 had 2 extra failures (`descriptor::host::tests::views_bound_while_another_slot_gets_its_texture_do_not_wait`, `pipeline::placed_uav_tests::placed_uav_dispatch_writes_its_texture`), PR run 3 had 1 (`views_bound_...`); main run 7 had 1 (`shadow::tests::partial_refresh_under_marked_range_updates_saved_bytes`). Each passes alone on both sides, so these are parallel-run flakes unrelated to the PR. - Not tested: physical GPU, a capped-heap host. AI use: Claude Code (Claude Sonnet 5.5)
andrewpozdnakov7-jpg commented 2026-11-26 23:48:31 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T23:48:31Z.


I tested the two assertion changes together in 67577b5, using exact #3191 78524a7 and #3286 b83c07d. Both Windows WARP runs per configuration used the same synthetic data. In the forced-cap fixture I rejected descriptor allocation requests above 1,000,000 and let D3D12 create the smaller heap through the existing fallback.

Configuration Heap slots in the descriptor test Memory pair slots main Combined
Default 2,097,152 262,146 and 262,148 2/2 2/2
Forced cap 65,540 2 and 4 0/2 2/2

On capped main, the first memory readback succeeded before the old pair-index assertion fired. The combined tests also completed the second submission and retained its readback and view checks. The fork commit contains just the two PRs' test changes. Strict GPU Clippy in both configurations and the asset policy passed.

@zzm1234560621-prog, both exact heads are compatible as proposed. The combined branch is available if the maintainers prefer to take the two test fixes together.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7205878911 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3286#issuecomment-7205878911). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-26T23:48:31Z. --- I tested the two assertion changes together in [`67577b5`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/67577b5550198c9bc6a0dc5dfadad995bb2b56a2), using exact #3191 `78524a7` and #3286 `b83c07d`. Both Windows WARP runs per configuration used the same synthetic data. In the forced-cap fixture I rejected descriptor allocation requests above 1,000,000 and let D3D12 create the smaller heap through the existing fallback. | Configuration | Heap slots in the descriptor test | Memory pair slots | `main` | Combined | | --- | ---: | --- | --- | --- | | Default | 2,097,152 | 262,146 and 262,148 | 2/2 | 2/2 | | Forced cap | 65,540 | 2 and 4 | 0/2 | 2/2 | On capped `main`, the first memory readback succeeded before the old pair-index assertion fired. The combined tests also completed the second submission and retained its readback and view checks. The fork commit contains just the two PRs' test changes. Strict GPU Clippy in both configurations and the asset policy passed. @zzm1234560621-prog, both exact heads are compatible as proposed. The combined branch is available if the maintainers prefer to take the two test fixes together.
zzm1234560621-prog commented 2026-11-27 00:01:21 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by zzm1234560621-prog on 2026-11-27T00:01:21Z.


Cross-checked with #3191 on one branch (preview/heap-caps), on the capped host: cargo test -p victory-gpu --lib is 231 passed, 0 failed, 1 ignored, clippy clean. Each PR fixes its own test independently; together they leave the crate green here. If a single patch is preferred, that branch is the diff and I will fold these two into one.

AI-assisted (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7206102523 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3286#issuecomment-7206102523). Originally posted by [zzm1234560621-prog](https://github.com/zzm1234560621-prog) on 2026-11-27T00:01:21Z. --- Cross-checked with #3191 on one branch (`preview/heap-caps`), on the capped host: `cargo test -p victory-gpu --lib` is **231 passed, 0 failed, 1 ignored**, clippy clean. Each PR fixes its own test independently; together they leave the crate green here. If a single patch is preferred, that branch is the diff and I will fold these two into one. _AI-assisted (Claude)._
kalberts0089-hash commented 2026-11-27 08:15:00 +00:00 (Migrated from github.com)

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


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

  • cargo test -p victory-gpu --lib -- --test-threads=1: 230 passed, 1 failed, 1 ignored (main: 229 / 2 / 1). lists_share_a_table_and_copies_keep_their_views fails on main here ("past the dynamic slots", capped 1M heap) and passes with this PR. The remaining failure is the other known capped-heap one, dynamic_slots_are_held_until_released (>= HEAP_VIEWS), which #3191 fixes.
  • 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. I didn't test the combined #3191 + #3286 branch.

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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7213317599 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3286#issuecomment-7213317599). Originally posted by [kalberts0089-hash](https://github.com/kalberts0089-hash) on 2026-11-27T08:15:00Z. --- NVIDIA test report: RTX 4070 Ti (desktop, driver 621.01), Windows 11 Pro, rustc 1.98.1. Head `b83c07d` (base main `63bcca4`). - `cargo test -p victory-gpu --lib -- --test-threads=1`: 230 passed, 1 failed, 1 ignored (main: 229 / 2 / 1). `lists_share_a_table_and_copies_keep_their_views` fails on main here ("past the dynamic slots", capped 1M heap) and passes with this PR. The remaining failure is the other known capped-heap one, `dynamic_slots_are_held_until_released` (`>= HEAP_VIEWS`), which #3191 fixes. - `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. I didn't test the combined #3191 + #3286 branch. Synthetic tests only, no game files. AI-assisted (Claude Code).
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/3286:upstream-pr/3286'
git switch 'upstream-pr/3286'

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