victory-gpu: the capped-heap (NVIDIA) path leaves shader indices and NULL_BUFFER_VIEW past the heap — 5 failing tests on an RTX 3060 #3344

Open
opened 2026-11-26 19:37:55 +00:00 by github-bot · 1 comment
Owner

@⁠BudgetGLaDOS on GitHub · 2026-11-26 19:21 UTC · original

Summary

cargo test --workspace is green everywhere except victory-gpu: 5 of 232
tests fail, deterministically, on an NVIDIA RTX 3060. Tracing them, four are
consistent with one structural gap: HostHeap::new falls back to a heap of
count + MIN_DYNAMIC slots on hosts that refuse HEAP_VIEWS, but the
shader-side clamp, the null buffer view, and the pair band all still assume the
full HEAP_VIEWS heap.

Environment

  • Windows 10 Pro 22H2 (19045)
  • Ryzen 7 9700X, 31 GB RAM
  • NVIDIA GeForce RTX 3060, 12 GB, driver 596.49
  • rustc 1.98.1 (repo pin), LLVM 22.1.8, MSVC 14.44.35207, Windows SDK 10.0.26100
  • main @ 63bcca4 ("update readme"), 26 Nov 2026

Result

test result: FAILED. 226 passed; 5 failed; 1 ignored

Re-ran serially (--test-threads=1): identical five, 226 pass, 61.5 s. Not
flaky, not parallel-test contention.

The numbers on this host

Constant Value
HEAP_VIEWS 2^21 = 2,097,152
NULL_BUFFER_VIEW HEAP_VIEWS - 2 = 2,097,150
PORTABLE_VIEWS 1,000,000
DYNAMIC / MIN_DYNAMIC 2^18 / 2^16

HostHeap::new ladder for a view heap:

  1. make((count + DYNAMIC).max(HEAP_VIEWS)) = make(2_097_152) → fails
    (the device will not give a shader-visible heap that large)
  2. make(count + MIN_DYNAMIC) = make(65_540) → succeeds
  3. (the PORTABLE_VIEWS rung is not reached)

So on this card: NumDescriptors = 65_540, count = 4, dynamic = 65_536,
address_slots() = 65_540.

Finding A — shader indices clamp to the constant, not the heap

crates/victory-shader/src/emit/lower.rs:545 and :5552 clamp a heap index to
HEAP_VIEWS - 1 (2,097,151). buffer_guard then substitutes
NULL_BUFFER_VIEW (2,097,150) when the stride table says the slot holds no
buffer view. Neither index exists in a 65,540-slot heap.

HostHeap::address_slots() (count + dynamic) is the accessor that would give
the real ceiling, and it is referenced nowhere outside its own definition —
so nothing on the GPU side clamps to the heap it actually has.

Failing test 1 (descriptor/host.rs:2226) asserts exactly this requirement:

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

That assertion failing is the bug report, not a stale assumption.

Finding B — the pair band collapses into the dynamic range

crates/victory-gpu/src/descriptor/host.rs:201:

pairs_end: match victory_shader::emit::NULL_BUFFER_VIEW {
    null if !sampler && null > count + extra && null < total => null - 1,
    _ => total,
},

Here null < total is 2_097_150 < 65_540 → false, so pairs_end = total = 65_540.
The cursor starts at count + extra = 65_540 too, so pair()'s
pairs.0 + 2 <= self.pairs_end is false on the first call and it falls through
to self.dynamic(2).

Consequence: on a capped host, host-copy views (crate::memory) live in
dynamic slots, which are recycled per list, rather than in the persistent
band above them. Failing test 2 (memory.rs:1030, "past the dynamic slots") is
detecting precisely that.

Findings C — unresolved, possibly independent

  • draw.rs:2856: placed_texture(&view) returns None for round 0.
  • draw.rs:3413: HostPipeline::new(...).expect("compute host pipeline") — PSO creation fails.
  • pipeline/depth_bounds_test.rs:88: the adapter prints
    vertex depth bounds on NVIDIA GeForce RTX 3060: true, then the PSO is never
    made within made()'s 60 s budget.

These may be the same heap gap surfacing in the draw path, or unrelated driver
behaviour. They are listed separately because I can't currently distinguish them.

What I tried, for the record

I first assumed tests 1 and 2 encoded the AMD layout and relaxed them to
per-path invariants (>= address_slots()):

  • test 1 then passed — the heap does expose exactly address_slots()
  • test 2 still failed — the pairs are below count + dynamic, which
    confirmed Finding B rather than a test assumption

On reading buffer_guard and the NULL_BUFFER_VIEW construction, the original
assertions turned out to encode real requirements, so I reverted the change
rather than land a weaker test. Recording it here so nobody repeats the
experiment.

Suggested direction

  1. Decide the ceiling policy: either allocate the view heap in several heaps each
    under the device cap, or lower HEAP_VIEWS to PORTABLE_VIEWS so that every
    clamp, the null view, and the pair band are valid on every host.
  2. Until then, clamp shader indices and the null view against address_slots()
    rather than the compile-time constant.
  3. Give the pair band a home on capped hosts, or make host-copy views explicitly
    dynamic-slot-resident and update the test's invariant to match.

Evidence

Happy to attach the full cargo test --workspace log and the serial
(--test-threads=1) reproduction on request.

**@⁠BudgetGLaDOS** on GitHub · 2026-11-26 19:21 UTC · [original](https://github.com/Marvisak/VIctory/issues/3344) ## Summary `cargo test --workspace` is green everywhere except `victory-gpu`: 5 of 232 tests fail, deterministically, on an NVIDIA RTX 3060. Tracing them, four are consistent with one structural gap: `HostHeap::new` falls back to a heap of `count + MIN_DYNAMIC` slots on hosts that refuse `HEAP_VIEWS`, but the shader-side clamp, the null buffer view, and the pair band all still assume the full `HEAP_VIEWS` heap. ## Environment - Windows 10 Pro 22H2 (19045) - Ryzen 7 9700X, 31 GB RAM - **NVIDIA GeForce RTX 3060, 12 GB, driver 596.49** - rustc 1.98.1 (repo pin), LLVM 22.1.8, MSVC 14.44.35207, Windows SDK 10.0.26100 - `main` @ `63bcca4` ("update readme"), 26 Nov 2026 ## Result test result: FAILED. 226 passed; 5 failed; 1 ignored Re-ran serially (`--test-threads=1`): identical five, 226 pass, 61.5 s. Not flaky, not parallel-test contention. ## The numbers on this host | Constant | Value | |---|---| | `HEAP_VIEWS` | 2^21 = 2,097,152 | | `NULL_BUFFER_VIEW` | `HEAP_VIEWS - 2` = 2,097,150 | | `PORTABLE_VIEWS` | 1,000,000 | | `DYNAMIC` / `MIN_DYNAMIC` | 2^18 / 2^16 | `HostHeap::new` ladder for a view heap: 1. `make((count + DYNAMIC).max(HEAP_VIEWS))` = `make(2_097_152)` → **fails** (the device will not give a shader-visible heap that large) 2. `make(count + MIN_DYNAMIC)` = `make(65_540)` → **succeeds** 3. (the `PORTABLE_VIEWS` rung is not reached) So on this card: `NumDescriptors = 65_540`, `count = 4`, `dynamic = 65_536`, `address_slots() = 65_540`. ## Finding A — shader indices clamp to the constant, not the heap `crates/victory-shader/src/emit/lower.rs:545` and `:5552` clamp a heap index to `HEAP_VIEWS - 1` (2,097,151). `buffer_guard` then substitutes `NULL_BUFFER_VIEW` (2,097,150) when the stride table says the slot holds no buffer view. Neither index exists in a 65,540-slot heap. `HostHeap::address_slots()` (`count + dynamic`) is the accessor that would give the real ceiling, and it is **referenced nowhere outside its own definition** — so nothing on the GPU side clamps to the heap it actually has. Failing test 1 (`descriptor/host.rs:2226`) asserts exactly this requirement: assert!(heap.heap.GetDesc().NumDescriptors >= victory_shader::emit::HEAP_VIEWS); That assertion failing is the bug report, not a stale assumption. ## Finding B — the pair band collapses into the dynamic range `crates/victory-gpu/src/descriptor/host.rs:201`: pairs_end: match victory_shader::emit::NULL_BUFFER_VIEW { null if !sampler && null > count + extra && null < total => null - 1, _ => total, }, Here `null < total` is `2_097_150 < 65_540` → false, so `pairs_end = total = 65_540`. The cursor starts at `count + extra = 65_540` too, so `pair()`'s `pairs.0 + 2 <= self.pairs_end` is false on the first call and it falls through to `self.dynamic(2)`. Consequence: on a capped host, host-copy views (`crate::memory`) live in **dynamic slots**, which are recycled per list, rather than in the persistent band above them. Failing test 2 (`memory.rs:1030`, "past the dynamic slots") is detecting precisely that. ## Findings C — unresolved, possibly independent - `draw.rs:2856`: `placed_texture(&view)` returns `None` for round 0. - `draw.rs:3413`: `HostPipeline::new(...).expect("compute host pipeline")` — PSO creation fails. - `pipeline/depth_bounds_test.rs:88`: the adapter prints `vertex depth bounds on NVIDIA GeForce RTX 3060: true`, then the PSO is never made within `made()`'s 60 s budget. These may be the same heap gap surfacing in the draw path, or unrelated driver behaviour. They are listed separately because I can't currently distinguish them. ## What I tried, for the record I first assumed tests 1 and 2 encoded the AMD layout and relaxed them to per-path invariants (`>= address_slots()`): - test 1 then **passed** — the heap does expose exactly `address_slots()` - test 2 **still failed** — the pairs are below `count + dynamic`, which confirmed Finding B rather than a test assumption On reading `buffer_guard` and the `NULL_BUFFER_VIEW` construction, the original assertions turned out to encode real requirements, so I reverted the change rather than land a weaker test. Recording it here so nobody repeats the experiment. ## Suggested direction 1. Decide the ceiling policy: either allocate the view heap in several heaps each under the device cap, or lower `HEAP_VIEWS` to `PORTABLE_VIEWS` so that every clamp, the null view, and the pair band are valid on every host. 2. Until then, clamp shader indices and the null view against `address_slots()` rather than the compile-time constant. 3. Give the pair band a home on capped hosts, or make host-copy views explicitly dynamic-slot-resident and update the test's invariant to match. ## Evidence Happy to attach the full `cargo test --workspace` log and the serial (`--test-threads=1`) reproduction on request.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:37:55 +00:00
Author
Owner

@⁠upipibi on GitHub · 2026-11-26 21:10 UTC · original

Pointers for these five, from reading the open PRs (no run):

  • dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views fail on NVIDIA's 1,000,000-view heap cap (#1744, #3178). #2461 sizes the heap from the probed limit and fixes both; fyernald's review there reproduced your setup (Ampere, Windows 10 19045, 63bcca4) and saw both pass.
  • a_texture_written_in_one_format_reads_in_another_through_a_placed_view, compute_view_marks_rebind_after_depth_twin_conversion and depth_bounds_control_a_title_draw are not heap-cap failures: on Windows 10's in-box D3D12 runtime they need shader model 6.6 root-signature flags or CreateCommittedResource3. #3283 skips them there; #2878 runs them with a staged Agility runtime.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠upipibi** on GitHub · 2026-11-26 21:10 UTC · [original](https://github.com/Marvisak/VIctory/issues/3344#issuecomment-7203458889) Pointers for these five, from reading the open PRs (no run): - `dynamic_slots_are_held_until_released` and `lists_share_a_table_and_copies_keep_their_views` fail on NVIDIA's 1,000,000-view heap cap (#1744, #3178). #2461 sizes the heap from the probed limit and fixes both; fyernald's review there reproduced your setup (Ampere, Windows 10 19045, `63bcca4`) and saw both pass. - `a_texture_written_in_one_format_reads_in_another_through_a_placed_view`, `compute_view_marks_rebind_after_depth_twin_conversion` and `depth_bounds_control_a_title_draw` are not heap-cap failures: on Windows 10's in-box D3D12 runtime they need shader model 6.6 root-signature flags or `CreateCommittedResource3`. #3283 skips them there; #2878 runs them with a staged Agility runtime. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
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#3344
No description provided.