Skip to content

GPU test: assert the descriptor heap range a capped host can make - #3191

Open
zzm1234560621-prog wants to merge 1 commit into
Marvisak:mainfrom
zzm1234560621-prog:test/heap-range
Open

zzm1234560621-prog wants to merge 1 commit into
Marvisak:mainfrom
zzm1234560621-prog:test/heap-range

Conversation

@zzm1234560621-prog

Copy link
Copy Markdown

What

descriptor::host::tests::dynamic_slots_are_held_until_released asserted

assert!(heap.heap.GetDesc().NumDescriptors >= victory_shader::emit::HEAP_VIEWS);

with HEAP_VIEWS = 1 << 21 (2,097,152) in crates/victory-shader/src/shader.rs
and PORTABLE_VIEWS = 1_000_000 in descriptor/host.rs. HostHeap::new
first tries make((count + DYNAMIC).max(HEAP_VIEWS)); a host that caps
shader-visible view heaps below that — the NVIDIA ones the shortcut comment
in new names — falls back to count + MIN_DYNAMIC. On such a host the
assertion cannot hold, and the test fails on every run of the suite.

It now asserts the range both paths guarantee: the title's slots plus the
dynamic range the heap settled on.

let total = heap.heap.GetDesc().NumDescriptors;
assert!(total >= heap.count + heap.dynamic, …);

The sampler half (>= HEAP_SAMPLERS, 2048) is unchanged: that one is below
the cap on every device.

Why CI is green today

HostHeap::new starts with let host = host()? and returns None without a
D3D12 device, and the test returns early on None. windows-latest has no
GPU, so CI passes the test by never reaching the assertion — which is why
this has been failing only for people running the suite on real hardware.

Measured

Intel Arc iGPU (Xe-LPG, driver 32.0.101.6127), Windows 11, Rust 1.98.1,
main 63bcca4:

before after
dynamic_slots_are_held_until_released FAILED (NumDescriptors >= HEAP_VIEWS) ok
cargo test -p victory-gpu 229 passed, 2 failed, 1 ignored 230 passed, 1 failed, 1 ignored

cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.

Not in this PR

The other failure in that run, memory::tests::lists_share_a_table_and_copies_keep_their_views
(assert!(pairs.0 >= 1 << 18 && pairs.1 >= 1 << 18, "past the dynamic slots")),
is a different expectation: on this machine pair_of returns (2, 4), so the
pair slots are allotted low now and the 1 << 18 is stale in a way that is not
about the heap cap. I have not changed it — what those indices are supposed to
be is a call on the dynamic-slot layout — and reported it with these numbers in
#3178.

Test-only change; no behaviour is affected. Found while running the suite for
#967. Tested with AI assistance (Claude).

`dynamic_slots_are_held_until_released` asserted
`GetDesc().NumDescriptors >= HEAP_VIEWS`, and `HEAP_VIEWS` is 2^21 while
`PORTABLE_VIEWS` is 10^6: a host that caps shader-visible view heaps — the
NVIDIA ones `new` names, and the Intel Arc iGPU this was found on — takes
the shorter `MIN_DYNAMIC` range instead, so the assertion fails on every
such host and would pass only on tier-3 hardware. CI does not see it
because `HostHeap::new` returns `None` without a D3D12 device and the test
returns early there.

It now asserts what `new` guarantees on both paths: the title's slots plus
the dynamic range the heap settled on.

Found while running the suite for Marvisak#967. The other failure in that run,
`memory`'s `lists_share_a_table_and_copies_keep_their_views` (`>= 1 << 18`),
is a separate, older expectation about the pair slots; it is left alone and
reported in Marvisak#3178.

cargo test -p victory-gpu on an Intel Arc iGPU (driver 32.0.101.6127):
230 passed, 1 failed, 1 ignored — the failure is the memory test above,
which fails on `main` too.
cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.

@Dukestar69 Dukestar69 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 on RTX 5090 (1M view-heap cap) & WARP against origin/main (63bcca4):

  • cargo test -p victory-gpu --lib descriptor::host:: -- --test-threads=1: 15/15 passed on RTX 5090 and WARP (including dynamic_slots_are_held_until_released).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Cleanly asserts the descriptor heap range a capped host can actually allocate.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants