GPU: size the view heap clamp from what the host takes (NVIDIA 1,000,000 cap) #1777

Open
github-bot wants to merge 4 commits from github-bot/gh-1777 into main AGit
Owner

@⁠antoinerz1 on GitHub · 2026-11-24 22:22 UTC · original
antoinerz1:fix/nvidia-view-heap-cap → main · +280 −66 · 9 files · 4 commits · open

Problem

Translated shaders clamp view heap indices below a fixed HEAP_VIEWS = 1 << 21 (2,097,152) and read the null buffer views at HEAP_VIEWS - 2. NVIDIA refuses shader-visible CBV/SRV/UAV heaps over 1,000,000 descriptors. So on NVIDIA:

  • the host heap falls back to a smaller size, and the clamp lets indices past its end through, which faults the device;
  • the null buffer views at 2,097,150 are never made ("no room for the null buffer views").

This is the in-title failure in #1627 and #1620. It also accounts for 4 of the 5 unit-test failures in #1744.

Change

  • victory_shader::emit::heap_views() replaces the HEAP_VIEWS constant. It is 2^21 (HEAP_VIEWS_MAX) where the default adapter creates a heap that large, else 1,000,000 (HEAP_VIEWS_PORTABLE). The value is fixed for the process at first use. null_buffer_view() follows it.
  • Host view heaps always have at least heap_views() slots. A capped heap keeps the dynamic slots and the null buffer views below the clamped index. As before, the title's slots past them are left out.
  • The shader cache key and the pipeline library tag include the value, so a translation made for one heap size is never served on another.
  • New test a_capped_view_heap_keeps_the_null_buffer_views.

AMD and other hosts that take a 2^21 heap get the same translation and layout as before. Only their cache key changes, so their cached shaders are translated once more.

Testing

RTX 4060 Ti, driver 610.88, Windows 11, Rust 1.98.1. cargo test --workspace --no-fail-fast:

passed failed ignored
main (70564ae) 471 5 7
this branch 475 2 7

Now passing: dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views, a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, plus the new test.

Two failures remain. Both are NVIDIA-only and unrelated to the cap:

  • a_heap_buffer_read_by_element_takes_the_views_stride: #1744 attributed this one to the cap by elimination, but it still fails with the cap fixed. The shader reads a structured SRV (stride 12) through a raw-annotated handle (kind 11), which D3D12 leaves undefined. NVIDIA returns element byte_address / 4 (got 101 + 3l).
  • gathers_at_a_level_match_the_hardware: the gather footprint rounds differently on this GPU.

Clippy is clean. cargo fmt --check already fails on main in files this PR does not touch; the changed lines are formatted. Not tested in title: no game run, and no AMD run on my side.

🤖 Generated with Claude Code

**@⁠antoinerz1** on GitHub · 2026-11-24 22:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/1777) `antoinerz1:fix/nvidia-view-heap-cap` → `main` · +280 −66 · 9 files · 4 commits · open ## Problem Translated shaders clamp view heap indices below a fixed `HEAP_VIEWS = 1 << 21` (2,097,152) and read the null buffer views at `HEAP_VIEWS - 2`. NVIDIA refuses shader-visible CBV/SRV/UAV heaps over 1,000,000 descriptors. So on NVIDIA: - the host heap falls back to a smaller size, and the clamp lets indices past its end through, which faults the device; - the null buffer views at 2,097,150 are never made ("no room for the null buffer views"). This is the in-title failure in #1627 and #1620. It also accounts for 4 of the 5 unit-test failures in #1744. ## Change - `victory_shader::emit::heap_views()` replaces the `HEAP_VIEWS` constant. It is 2^21 (`HEAP_VIEWS_MAX`) where the default adapter creates a heap that large, else 1,000,000 (`HEAP_VIEWS_PORTABLE`). The value is fixed for the process at first use. `null_buffer_view()` follows it. - Host view heaps always have at least `heap_views()` slots. A capped heap keeps the dynamic slots and the null buffer views below the clamped index. As before, the title's slots past them are left out. - The shader cache key and the pipeline library tag include the value, so a translation made for one heap size is never served on another. - New test `a_capped_view_heap_keeps_the_null_buffer_views`. AMD and other hosts that take a 2^21 heap get the same translation and layout as before. Only their cache key changes, so their cached shaders are translated once more. ## Testing RTX 4060 Ti, driver 610.88, Windows 11, Rust 1.98.1. `cargo test --workspace --no-fail-fast`: | | passed | failed | ignored | |---|---|---|---| | `main` (70564ae) | 471 | 5 | 7 | | this branch | 475 | 2 | 7 | Now passing: `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views`, `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`, plus the new test. Two failures remain. Both are NVIDIA-only and unrelated to the cap: - `a_heap_buffer_read_by_element_takes_the_views_stride`: #1744 attributed this one to the cap by elimination, but it still fails with the cap fixed. The shader reads a structured SRV (stride 12) through a raw-annotated handle (kind 11), which D3D12 leaves undefined. NVIDIA returns element `byte_address / 4` (got `101 + 3l`). - `gathers_at_a_level_match_the_hardware`: the gather footprint rounds differently on this GPU. Clippy is clean. `cargo fmt --check` already fails on `main` in files this PR does not touch; the changed lines are formatted. Not tested in title: no game run, and no AMD run on my side. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Translated shaders clamped view heap indices below a fixed 2^21 and read
the null buffer views at 2^21 - 2, but NVIDIA refuses shader-visible view
heaps over 1,000,000 descriptors. On NVIDIA the clamp let indices past the
heap through and the null buffer views were never made (#1627, #1620;
4 of the 5 test failures in #1744).

- `victory_shader::emit::heap_views()` replaces `HEAP_VIEWS`: 2^21
  (`HEAP_VIEWS_MAX`) where the default adapter makes a heap that large,
  else 1,000,000 (`HEAP_VIEWS_PORTABLE`); `null_buffer_view()` follows it.
- Host view heaps are at least `heap_views()` slots. A capped heap keeps
  the dynamic slots and the null buffer views below the clamped index,
  leaving out the title's slots past them, as before.
- The shader cache key and the pipeline library tag include the value,
  so translations made for one heap size are not served on another.
- New test: a capped view heap keeps the null buffer views.

On an RTX 4060 Ti (driver 610.88): 475 passed, 2 failed, 7 ignored
(was 471/5/7). The 2 left are NVIDIA-only and unrelated to the cap:
the raw-annotated read of a structured view
(a_heap_buffer_read_by_element_takes_the_views_stride) and the gather
footprint (gathers_at_a_level_match_the_hardware).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`heap_views()` asked the default adapter whether it takes a 2^21-slot view
heap. With the diagnostics build's `VICTORY_D3D12_WARP=1` on an NVIDIA
machine, the host device is WARP (whose heap holds all 1,245,184 title
slots) while the clamp came from NVIDIA's 1,000,000: shaders could not
reach title slots past 1,000,000, and the null buffer views fell among the
title's ("no room for the null buffer views" in the log).

- `takes_view_heap` probes WARP when told to.
- `victory_shader::emit::heap_views_on_warp()` tells it, before the size is
  fixed; victory-gpu's `host::on_warp()` decides once and calls it from the
  shader cache key and the device creation.

Checked on an RTX 4060 Ti with the title: the WARP run no longer caps the
clamp or warns about the null buffer views; the hardware run still caps it
at 1,000,000. `cargo test -p victory-gpu -p victory-shader --lib`: same
results as before (2 known NVIDIA-only failures, #1744).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A heap of exactly `heap_views()` slots could hold title and dynamic
slots up to its end: with 737,854 to 737,856 or 934,462 to 934,464
title slots on NVIDIA's 1,000,000 cap, `count + DYNAMIC` (or
`MIN_DYNAMIC`) fits the heap but ends among the three slots kept for
the null UAV, the null SRV and the clamped index, so neither null
buffer view was made and their stride entries stayed 0.

Such a heap now trims its title and dynamic range below them, keeping
at least `MIN_DYNAMIC` dynamic slots. Reported, with the fix this
follows, by AlanQiang0418 on an RTX 5080.

New test: for both dynamic ranges, titles ending 0 to 3 slots short of
the heap end leave strides [4, 4, 0] in the last three slots (fails
without the fix on an RTX 4060 Ti).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`emit::heap_views()` probed a device itself, in every process that
translates: offline `victory translate` and the shader tests under
`VICTORY_WARP=1` opened the default hardware adapter, and the clamp
followed that adapter rather than the one the host draws on (r4tedx,
tigre437 on #1777).

- `victory_shader::emit::set_heap_views` takes the size from the host;
  `heap_views()` is that, else 2^21 as before this PR. The translator
  probes nothing outside its own tests, whose probe follows the test
  host (WARP with `VICTORY_WARP=1`). `heap_views_on_warp` goes.
- `victory_gpu::host::heap_views()` decides once, from the adapter the
  host device is made on (WARP under `VICTORY_D3D12_WARP`, else the
  default one), and tells the translator before any translation: the
  shader cache key, `host_shader` (with or without a cache), the
  pipeline library tag and the descriptor heaps all ask there. The
  cache warm-up (`victory translate --cache`) goes through it too, so
  its entries carry the host's key.
- A translation made before the size was known with a larger clamp
  than the host takes is logged.

RTX 4060 Ti: `cargo test --workspace` 778 passed, 2 failed (the two
known NVIDIA-only shader tests), 9 ignored, with the access-violating
`heap_direct_texture_reads_mark_their_heap_index` skipped (it crashes
on `main` too). `VICTORY_WARP=1` stride tests: 8/8.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:44:20 +00:00
Author
Owner

@⁠DesertGamer on GitHub · 2026-11-24 22:24 UTC · original

VIctory V2: community PRs, merged and tested

Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.

Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).

⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.

Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2

Unofficial community fork of Marvisak/VIctory, GPL-3.0.

**@⁠DesertGamer** on GitHub · 2026-11-24 22:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/1777#issuecomment-7146182759) ### VIctory V2: community PRs, merged and tested Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch. **Where it stands today:** launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1). :warning: Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk. Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help: https://DesertGamer/VIctory-V2 *Unofficial community fork of Marvisak/VIctory, GPL-3.0.*
Author
Owner

@⁠upipibi on GitHub · 2026-11-24 22:30 UTC · original

Overlap for the reviewers: two other open PRs change the same capped-heap path (NVIDIA's 1,000,000-descriptor cap, #1744).

  • #1751 (21:59) gives capped heaps the full DYNAMIC range (descriptor/host.rs only); on an RTX 3070 it fixes the two victory-gpu tests that fail on main.
  • #1779 (22:25) also sizes the clamp from the heap the host gives and moves the null buffer views. It covers descriptor/host.rs, draw.rs, shader_cache.rs and the victory-shader clamp (emit/shader.rs, lower.rs), so it overlaps both this PR and #1751.

This PR edits the same emit/shader.rs / shader_cache.rs clamp as #1779. From reading the file lists and descriptions; nothing built here.

AI-assisted (Claude Code).

**@⁠upipibi** on GitHub · 2026-11-24 22:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/1777#issuecomment-7146305931) Overlap for the reviewers: two other open PRs change the same capped-heap path (NVIDIA's 1,000,000-descriptor cap, #1744). - #1751 (21:59) gives capped heaps the full `DYNAMIC` range (`descriptor/host.rs` only); on an RTX 3070 it fixes the two `victory-gpu` tests that fail on `main`. - #1779 (22:25) also sizes the clamp from the heap the host gives and moves the null buffer views. It covers `descriptor/host.rs`, `draw.rs`, `shader_cache.rs` and the `victory-shader` clamp (`emit/shader.rs`, `lower.rs`), so it overlaps both this PR and #1751. This PR edits the same `emit/shader.rs` / `shader_cache.rs` clamp as #1779. From reading the file lists and descriptions; nothing built here. AI-assisted (Claude Code).
Author
Owner

@⁠tdogghockey on GitHub · 2026-11-24 23:17 UTC · original

AMD test report for this PR (the PR body asks for an AMD run).

Hardware: AMD Radeon RX 9070 XT (device id 0x7550), driver 32.0.32015.16001; Windows 11 build 26300; Rust 1.98.1 MSVC.

Branch tested: pull/1777/head at 3635e704e7d7037bc97227d6a196258bb464c8ee.

Command:

cargo test -p victory-shader -p victory-gpu --lib --no-fail-fast -- --test-threads=1

Result: 288 passed, 0 failed, 3 ignored (victory-shader 209 passed / 2 ignored; victory-gpu 79 passed / 1 ignored).

In particular, the new descriptor::host::tests::a_capped_view_heap_keeps_the_null_buffer_views, dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views, a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, gathers_at_a_level_match_the_hardware, and a_heap_buffer_read_by_element_takes_the_views_stride all pass on this RDNA4 host.

No regressions seen on AMD, and no game files were used. This is a test-only confirmation; I have not run the title.

**@⁠tdogghockey** on GitHub · 2026-11-24 23:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/1777#issuecomment-7147230965) AMD test report for this PR (the PR body asks for an AMD run). **Hardware:** AMD Radeon RX 9070 XT (device id 0x7550), driver 32.0.32015.16001; Windows 11 build 26300; Rust 1.98.1 MSVC. **Branch tested:** `pull/1777/head` at `3635e704e7d7037bc97227d6a196258bb464c8ee`. **Command:** ``` cargo test -p victory-shader -p victory-gpu --lib --no-fail-fast -- --test-threads=1 ``` **Result: 288 passed, 0 failed, 3 ignored** (victory-shader 209 passed / 2 ignored; victory-gpu 79 passed / 1 ignored). In particular, the new `descriptor::host::tests::a_capped_view_heap_keeps_the_null_buffer_views`, `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views`, `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`, `gathers_at_a_level_match_the_hardware`, and `a_heap_buffer_read_by_element_takes_the_views_stride` all pass on this RDNA4 host. No regressions seen on AMD, and no game files were used. This is a test-only confirmation; I have not run the title.
Author
Owner

@⁠AlanQiang0418 on GitHub · 2026-11-24 23:48 UTC · original

I found a boundary case on an RTX 5080 (621.14) at 3635e70. A view heap can successfully allocate all 1,000,000 slots while the title and dynamic ranges extend into the three slots reserved for the null UAV, null SRV and clamp index.

Title slots requested Pair allocation limit Final three stride entries
737,854–737,856 or 934,462–934,464 1,000,000 [0, 0, 0]
737,853, 737,857, 934,461 or 934,465 999,997 [4, 4, 0]

The first row also skips creation of both null descriptors. I checked the allocation and mapped stride table directly.

Follow-up commit with the fix and a two-threshold regression. It reserves the final three slots for either successful dynamic allocation size. All ten requests then gave a limit of 999,997 and strides of [4, 4, 0]. The victory-gpu library suite passed (80 passed, 1 ignored), as did the existing shader empty-slot readback test and GPU all-targets Clippy.

**@⁠AlanQiang0418** on GitHub · 2026-11-24 23:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/1777#issuecomment-7147811903) I found a boundary case on an RTX 5080 (621.14) at `3635e70`. A view heap can successfully allocate all 1,000,000 slots while the title and dynamic ranges extend into the three slots reserved for the null UAV, null SRV and clamp index. | Title slots requested | Pair allocation limit | Final three stride entries | | --- | ---: | --- | | 737,854–737,856 or 934,462–934,464 | 1,000,000 | `[0, 0, 0]` | | 737,853, 737,857, 934,461 or 934,465 | 999,997 | `[4, 4, 0]` | The first row also skips creation of both null descriptors. I checked the allocation and mapped stride table directly. [Follow-up commit with the fix and a two-threshold regression](https://github.com/AlanQiang0418/VIctory/commit/067cdfdfba29772cb83063d8810f03c1c048a864). It reserves the final three slots for either successful dynamic allocation size. All ten requests then gave a limit of 999,997 and strides of `[4, 4, 0]`. The `victory-gpu` library suite passed (80 passed, 1 ignored), as did the existing shader empty-slot readback test and GPU all-targets Clippy.
Author
Owner

@⁠tigre437 on GitHub · 2026-11-25 00:40 UTC · original

Tested on Ampere: RTX 3060 Ti, driver 617.42, Windows 11 (build 26300), Rust 1.98.1. cargo test --workspace --locked --no-fail-fast:

passed failed ignored
main (70564ae) 471 5 7
this branch (3635e70) 475 2 7

Same numbers as your RTX 4060 Ti run. a_capped_view_heap_keeps_the_null_buffer_views passes, and so do dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and a_heap_buffer_read_where_no_buffer_view_is_reads_zeros. On main, that last one failed with "dispatch failed: the parameter is incorrect".

The two that remain fail exactly as you describe:

  • a_heap_buffer_read_by_element_takes_the_views_stride: got [101, 104, 107, …, 131, 0, …], expected [200, 201, …], which is 101 + 3l.
  • gathers_at_a_level_match_the_hardware: lane 0 got [0.0, 1.0, 0.0, 0.0], expected all zeros.

So this isn't specific to Ada: Ampere behaves the same. Unit tests only, not tested in title.

**@⁠tigre437** on GitHub · 2026-11-25 00:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/1777#issuecomment-7148751691) Tested on Ampere: RTX 3060 Ti, driver 617.42, Windows 11 (build 26300), Rust 1.98.1. `cargo test --workspace --locked --no-fail-fast`: | | passed | failed | ignored | |---|---|---|---| | `main` (70564ae) | 471 | 5 | 7 | | this branch (3635e70) | 475 | 2 | 7 | Same numbers as your RTX 4060 Ti run. `a_capped_view_heap_keeps_the_null_buffer_views` passes, and so do `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`. On `main`, that last one failed with "dispatch failed: the parameter is incorrect". The two that remain fail exactly as you describe: - `a_heap_buffer_read_by_element_takes_the_views_stride`: got `[101, 104, 107, …, 131, 0, …]`, expected `[200, 201, …]`, which is `101 + 3l`. - `gathers_at_a_level_match_the_hardware`: lane 0 got `[0.0, 1.0, 0.0, 0.0]`, expected all zeros. So this isn't specific to Ada: Ampere behaves the same. Unit tests only, not tested in title.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 02:17 UTC · original · edited 2026-11-26 01:19 UTC

Automated triage for the maintainers.

Merge candidate. The head is rebased and now merges cleanly. It addresses the open point from the previous review: victory-shader no longer opens a device outside its own tests. victory_gpu::host::heap_views probes the adapter that create uses (WARP under VICTORY_D3D12_WARP, otherwise the default adapter) and passes the result to the translator with emit::set_heap_views. shader_cache::host_shader calls it before translating. If a translation ran first, it logs a warning. The shader-cache key and the pipeline-library tag both include the value. In HostHeap::new, a capped heap now has views slots with views - MIN_DYNAMIC - 3 title slots. A heap of exactly views slots keeps its last three for the null UAV, null SRV and clamped index, which covers AlanQiang0418's boundary case. The read-mark bitmaps in shadow.rs stay sized at HEAP_VIEWS_MAX, so they cover every clamped index. CI (check) passes on this head.

Overlap: #1779 changes the same clamp and no longer merges cleanly. #1751 only widens the dynamic range in descriptor/host.rs. This PR is the more complete of the three.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 02:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/1777#issuecomment-7150533786) · edited 2026-11-26 01:19 UTC <!-- victory-triage v1 head=cbb9d78f944e289771a5a30f85659a435fcf3d16 verdict=merge-candidate at=2026-11-26T01:19:32Z --> Automated triage for the maintainers. **Merge candidate.** The head is rebased and now merges cleanly. It addresses the open point from the previous review: `victory-shader` no longer opens a device outside its own tests. `victory_gpu::host::heap_views` probes the adapter that `create` uses (WARP under `VICTORY_D3D12_WARP`, otherwise the default adapter) and passes the result to the translator with `emit::set_heap_views`. `shader_cache::host_shader` calls it before translating. If a translation ran first, it logs a warning. The shader-cache key and the pipeline-library `tag` both include the value. In `HostHeap::new`, a capped heap now has `views` slots with `views - MIN_DYNAMIC - 3` title slots. A heap of exactly `views` slots keeps its last three for the null UAV, null SRV and clamped index, which covers AlanQiang0418's boundary case. The read-mark bitmaps in `shadow.rs` stay sized at `HEAP_VIEWS_MAX`, so they cover every clamped index. CI (`check`) passes on this head. Overlap: #1779 changes the same clamp and no longer merges cleanly. #1751 only widens the dynamic range in `descriptor/host.rs`. This PR is the more complete of the three. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠r4tedx on GitHub · 2026-11-25 07:08 UTC · original

A review note on 3635e70, from reading it (not built or run here), about how the clamp is chosen. The slot-boundary case is already above (AlanQiang0418); this is a different one.

heap_views() (emit/shader.rs) decides the clamp once per process through emit::host::takes_view_heap, which calls D3D12CreateDevice(None, …) and tries a shader-visible heap of HEAP_VIEWS_MAX (2^21) slots on it. Two consequences:

  • The default adapter is opened in every process that translates, whatever adapter the process otherwise uses. Under VICTORY_WARP=1 the shader tests still create a device on the default hardware adapter for this probe, and so does an offline victory translate count, since apps/victory builds victory-shader with its host feature. On machines where testers keep test and offline runs off the hardware GPU (some of us do, after PC shutdowns under load), merging this would bring the GPU back into those runs without anyone noticing.
  • The clamp can disagree with the heap the runtime makes. The runtime's heap comes from the device victory-gpu creates, which is WARP with VICTORY_D3D12_WARP in a diagnostics build, or whatever adapter it selects. The probe always asks the default adapter. If the two differ (WARP runtime on an NVIDIA machine, or a hybrid laptop), the shaders are translated for one heap and run against the other. The shader cache key carries the value, so the cache stays consistent, but the clamp can still be larger than the heap actually made.

A shape that avoids both, if it fits your design: let victory-gpu pass the size of the heap it actually created into translation (it already keys the cache on the value), and keep the probe out of victory-shader entirely; offline translation would then use the portable value or one given on the command line.

Nothing was run for this note. AI-assisted.

**@⁠r4tedx** on GitHub · 2026-11-25 07:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/1777#issuecomment-7155536251) A review note on `3635e70`, from reading it (not built or run here), about how the clamp is chosen. The slot-boundary case is already above (AlanQiang0418); this is a different one. `heap_views()` (`emit/shader.rs`) decides the clamp once per process through `emit::host::takes_view_heap`, which calls `D3D12CreateDevice(None, …)` and tries a shader-visible heap of `HEAP_VIEWS_MAX` (2^21) slots on it. Two consequences: - **The default adapter is opened in every process that translates**, whatever adapter the process otherwise uses. Under `VICTORY_WARP=1` the shader tests still create a device on the default hardware adapter for this probe, and so does an offline `victory translate` count, since `apps/victory` builds `victory-shader` with its `host` feature. On machines where testers keep test and offline runs off the hardware GPU (some of us do, after PC shutdowns under load), merging this would bring the GPU back into those runs without anyone noticing. - **The clamp can disagree with the heap the runtime makes.** The runtime's heap comes from the device `victory-gpu` creates, which is WARP with `VICTORY_D3D12_WARP` in a diagnostics build, or whatever adapter it selects. The probe always asks the default adapter. If the two differ (WARP runtime on an NVIDIA machine, or a hybrid laptop), the shaders are translated for one heap and run against the other. The shader cache key carries the value, so the cache stays consistent, but the clamp can still be larger than the heap actually made. A shape that avoids both, if it fits your design: let `victory-gpu` pass the size of the heap it actually created into translation (it already keys the cache on the value), and keep the probe out of `victory-shader` entirely; offline translation would then use the portable value or one given on the command line. Nothing was run for this note. AI-assisted.
Author
Owner

@⁠CruxRiajuu on GitHub · 2026-11-25 11:42 UTC · original · edited 2026-11-25 17:01 UTC

Reproduced on an NVIDIA card with the integration/play tree - the branch that carries #1751 - so this may be the same failure #1751 addresses, or a different one.

Machine

GPU NVIDIA GeForce RTX 4080 SUPER (Ada, 32-lane subgroups)
Driver 32.0.16.1742
Windows 11 Pro 26100
CPU / RAM AMD Ryzen 9 7950X, 63.1 GB
Tree r4tedx/VIctory integration/play @ 08c1d3541 ("a playable candidate for NVIDIA"), base upstream main at 940d32f
Build cargo build --profile diag -p victory --features diagnostics

Variables: VICTORY_ROOT_SRV_MB=0, VICTORY_PRESENT_1440P=1, VICTORY_SHADER_LOOP_LIMIT=32, VICTORY_D3D12_DRED=1, VICTORY_D3D12_DEBUG=1.

The removal

D3D12: ID3D12Device::RemoveDevice: Device removal has been triggered for the following
reason (DXGI_ERROR_DEVICE_HUNG: The Device took an unreasonable amount of time to execute
its commands, or the hardware crashed/hung. As a result, the TDR (Timeout Detection and
Recovery) mechanism has been triggered.

ERROR victory_gpu::host: host GPU device removed after a submission of 1 lists; breadcrumbs ...
  command 1130 (op 6): dispatch 13x1x1 [compute caa78b8ca62bc3d6]

caa78b8ca62bc3d6 is not one of the programs that fail to translate - it translated, and it hung the GPU. Its descriptor tables reference placed resources across several heaps, which matches the clamp letting an index past the heap's end through.

It is a hang, not a slow frame. TdrDelay=60 and TdrDdiDelay=60 were set under HKLM\SYSTEM\CurrentControlSet\Control\GraphicsDrivers and the device was removed anyway.

The heap-index evidence

The title's own log names the fault directly - title slot past the host heap, which INTEGRATION.md asks reporters for:

WARN victory_gpu::descriptor::host: title slot past the host heap index=1037365 count=934464 for_draw=false

Over the run:

title slot past the host heap warnings 151,990
host heap size actually in use (count=) 934,464
lowest index reported 934,464 (exactly the heap's end)
highest index reported 1,086,453
for_draw false in all of them
a root SRV without a bound view heap 0
a draw or dispatch dropped: no dynamic slots for its tables 0
a root SRV not on 16 bytes reads zeros 0

The host heap fell back to 934,464 descriptors - under NVIDIA's 1,000,000 cap - and the clamp lets indices run from exactly the heap's end (934,464) up to 1,086,453, i.e. past the heap's end and past the cap. That is the failure this issue describes, with the highest index for the report.

The other three log lines INTEGRATION.md asks for do not appear in this run.

Where it happens. After the world loads and renders - the last presented frame before the removal was 86,137 draws and 27,530 dispatches, all of them drawn - and it removed the device four times over the run.

Happy to test a build with #1777 taken on this card if it would help narrow it.

**@⁠CruxRiajuu** on GitHub · 2026-11-25 11:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/1777#issuecomment-7161402031) · edited 2026-11-25 17:01 UTC Reproduced on an NVIDIA card with the `integration/play` tree - the branch that carries #1751 - so this may be the same failure #1751 addresses, or a different one. **Machine** | | | |---|---| | GPU | NVIDIA GeForce RTX 4080 SUPER (Ada, 32-lane subgroups) | | Driver | 32.0.16.1742 | | Windows | 11 Pro 26100 | | CPU / RAM | AMD Ryzen 9 7950X, 63.1 GB | | Tree | `r4tedx/VIctory` `integration/play` @ `08c1d3541` ("a playable candidate for NVIDIA"), base upstream `main` at `940d32f` | | Build | `cargo build --profile diag -p victory --features diagnostics` | Variables: `VICTORY_ROOT_SRV_MB=0`, `VICTORY_PRESENT_1440P=1`, `VICTORY_SHADER_LOOP_LIMIT=32`, `VICTORY_D3D12_DRED=1`, `VICTORY_D3D12_DEBUG=1`. **The removal** ``` D3D12: ID3D12Device::RemoveDevice: Device removal has been triggered for the following reason (DXGI_ERROR_DEVICE_HUNG: The Device took an unreasonable amount of time to execute its commands, or the hardware crashed/hung. As a result, the TDR (Timeout Detection and Recovery) mechanism has been triggered. ERROR victory_gpu::host: host GPU device removed after a submission of 1 lists; breadcrumbs ... command 1130 (op 6): dispatch 13x1x1 [compute caa78b8ca62bc3d6] ``` `caa78b8ca62bc3d6` is **not** one of the programs that fail to translate - it translated, and it hung the GPU. Its descriptor tables reference placed resources across several heaps, which matches the clamp letting an index past the heap's end through. **It is a hang, not a slow frame.** `TdrDelay=60` and `TdrDdiDelay=60` were set under `HKLM\SYSTEM\CurrentControlSet\Control\GraphicsDrivers` and the device was removed anyway. **The heap-index evidence** The title's own log names the fault directly - `title slot past the host heap`, which INTEGRATION.md asks reporters for: ``` WARN victory_gpu::descriptor::host: title slot past the host heap index=1037365 count=934464 for_draw=false ``` Over the run: | | | |---|---| | `title slot past the host heap` warnings | **151,990** | | host heap size actually in use (`count=`) | **934,464** | | lowest index reported | **934,464** (exactly the heap's end) | | highest index reported | **1,086,453** | | `for_draw` | false in all of them | | `a root SRV without a bound view heap` | 0 | | `a draw or dispatch dropped: no dynamic slots for its tables` | 0 | | `a root SRV not on 16 bytes reads zeros` | 0 | The host heap fell back to 934,464 descriptors - under NVIDIA's 1,000,000 cap - and the clamp lets indices run from exactly the heap's end (934,464) up to 1,086,453, i.e. past the heap's end and past the cap. That is the failure this issue describes, with the highest index for the report. The other three log lines INTEGRATION.md asks for do not appear in this run. **Where it happens.** After the world loads and renders - the last presented frame before the removal was 86,137 draws and 27,530 dispatches, all of them drawn - and it removed the device four times over the run. Happy to test a build with #1777 taken on this card if it would help narrow it.
Author
Owner

@⁠CruxRiajuu on GitHub · 2026-11-25 12:04 UTC · original

Follow-up to the report above: the index keeps climbing, so the figure I gave is a floor rather than a ceiling.

A second, longer run on the same tree and card (same integration/play @ 08c1d3541, same variables, warm shader cache) ran on for much longer before the removal and reported:

title slot past the host heap warnings 310,720
highest index reported 1,245,183 (was 1,086,453 in the earlier run)
lowest index reported 934,464 - the host heap's end, unchanged

The clamp is HEAP_VIEWS = 1 << 21 (2,097,152), so the indices are still climbing toward it rather than saturating at any fixed point. The host heap stays at 934,464 in both runs.

For reference, a root SRV without a bound view heap, a draw or dispatch dropped: no dynamic slots for its tables and a root SRV not on 16 bytes reads zeros do not appear in either run.

The second run removed the device 0 times against 4 in the first, with the same tree - the difference was a warm shader cache (4,605 shaders) rather than anything about the fault, so the crash looks timing-dependent and the index above is the reliable signal.

**@⁠CruxRiajuu** on GitHub · 2026-11-25 12:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/1777#issuecomment-7161873678) Follow-up to the report above: the index keeps climbing, so the figure I gave is a floor rather than a ceiling. A second, longer run on the same tree and card (same `integration/play` @ `08c1d3541`, same variables, warm shader cache) ran on for much longer before the removal and reported: | | | |---|---| | `title slot past the host heap` warnings | **310,720** | | highest index reported | **1,245,183** (was 1,086,453 in the earlier run) | | lowest index reported | 934,464 - the host heap's end, unchanged | The clamp is `HEAP_VIEWS = 1 << 21` (2,097,152), so the indices are still climbing toward it rather than saturating at any fixed point. The host heap stays at 934,464 in both runs. For reference, `a root SRV without a bound view heap`, `a draw or dispatch dropped: no dynamic slots for its tables` and `a root SRV not on 16 bytes reads zeros` do not appear in either run. The second run removed the device 0 times against 4 in the first, with the same tree - the difference was a warm shader cache (4,605 shaders) rather than anything about the fault, so the crash looks timing-dependent and the index above is the reliable signal.
Author
Owner

@⁠CruxRiajuu on GitHub · 2026-11-25 12:20 UTC · original · edited 2026-11-25 17:01 UTC

Third note on this one, and the most useful part for anyone else testing integration/play on an NVIDIA card.

The failure presents as an infinite relaunch loop, not a crash.

After the device is removed, the title asks VI to relaunch it (xgame.rs - "Auto VI relaunches itself"), and lifecycle.rs spawns a fresh victory. So on screen this is:

  1. the loading art appears
  2. the world attempt hangs the GPU, the device is removed
  3. the title relaunches itself
  4. back to 1

A tester who does not read the log sees the same loading image over and over and no progress past it. There is no crash dialog and no error on screen. I lost a while to this myself before noticing the victory.exe process changing PID.

VICTORY_SKIP_PIPELINES=caa78b8ca62bc3d6 omits the draws and dispatches whose pipeline contains that hash, so the hanging dispatch is skipped. That is how I get a run that stays in the world instead of cycling.

For the record, on this tree:

tree integration/play @ 08c1d3541
GPU / driver RTX 4080 SUPER (Ada, 32-lane) / 32.0.16.1742
Windows 11 Pro 26100
title the title, the title's build
device removals 4 in one run, 0 in another with a warm shader cache
title slot past the host heap 151,990 then 310,720, indices 934,464 -> 1,245,183, for_draw=false in all of them
a root SRV without a bound view heap 0
a draw or dispatch dropped: no dynamic slots for its tables 0
a root SRV not on 16 bytes reads zeros 0

#1133 is already in this tree and the heap warnings are being clamped to a null slot by it, so the warnings alone do not fault the device - the hang is the dispatch above.

**@⁠CruxRiajuu** on GitHub · 2026-11-25 12:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/1777#issuecomment-7162243176) · edited 2026-11-25 17:01 UTC Third note on this one, and the most useful part for anyone else testing `integration/play` on an NVIDIA card. **The failure presents as an infinite relaunch loop, not a crash.** After the device is removed, the title asks VI to relaunch it (`xgame.rs` - "Auto VI relaunches itself"), and `lifecycle.rs` spawns a fresh `victory`. So on screen this is: 1. the loading art appears 2. the world attempt hangs the GPU, the device is removed 3. the title relaunches itself 4. back to 1 A tester who does not read the log sees the same loading image over and over and no progress past it. There is no crash dialog and no error on screen. I lost a while to this myself before noticing the `victory.exe` process changing PID. `VICTORY_SKIP_PIPELINES=caa78b8ca62bc3d6` omits the draws and dispatches whose pipeline contains that hash, so the hanging dispatch is skipped. That is how I get a run that stays in the world instead of cycling. For the record, on this tree: | | | |---|---| | tree | `integration/play` @ `08c1d3541` | | GPU / driver | RTX 4080 SUPER (Ada, 32-lane) / 32.0.16.1742 | | Windows | 11 Pro 26100 | | title | the title, the title's build | | device removals | 4 in one run, 0 in another with a warm shader cache | | `title slot past the host heap` | 151,990 then 310,720, indices 934,464 -> 1,245,183, `for_draw=false` in all of them | | `a root SRV without a bound view heap` | 0 | | `a draw or dispatch dropped: no dynamic slots for its tables` | 0 | | `a root SRV not on 16 bytes reads zeros` | 0 | `#1133` is already in this tree and the heap warnings are being clamped to a null slot by it, so the warnings alone do not fault the device - the hang is the dispatch above.
Author
Owner

@⁠tigre437 on GitHub · 2026-11-25 13:26 UTC · original

Re-tested after the rebase, on the same RTX 3060 Ti (Ampere, driver 617.42, Windows 11 build 26300, Rust 1.98.1). cargo test --workspace --locked --no-fail-fast:

passed failed ignored
main (940d32f) 695 6 10
this branch (318b877) 700 2 10

This branch fixes dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, and a_capped_view_heap_keeps_the_null_buffer_views passes. The two that remain are the same NVIDIA ones as before, with identical values: a_heap_buffer_read_by_element_takes_the_views_stride (101 + 3l) and gathers_at_a_level_match_the_hardware (lane 0 [0.0, 1.0, 0.0, 0.0]).

The sixth failure on main is unrelated to this PR. modules::dstorage::tests::a_page_list_filled_after_its_request_starts returned -2147024809 (E_INVALIDARG) once, in the full-workspace run. It then passed 10/10 on its own and in 8/8 runs of the whole victory-hle suite, so it looks timing-dependent.

A note from reading 318b877, not from a run: the WARP probe is only reached through victory_gpu::host::on_warp() (VICTORY_D3D12_WARP, diagnostics builds). victory_shader::emit::host::Host::new with VICTORY_WARP=1 doesn't call heap_views_on_warp(), so the shader tests under VICTORY_WARP=1, and an offline translate, still probe the default hardware adapter. That's r4tedx's first point, which looks still open for those paths.

Unit tests only, not tested in title.

**@⁠tigre437** on GitHub · 2026-11-25 13:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/1777#issuecomment-7163778637) Re-tested after the rebase, on the same RTX 3060 Ti (Ampere, driver 617.42, Windows 11 build 26300, Rust 1.98.1). `cargo test --workspace --locked --no-fail-fast`: | | passed | failed | ignored | |---|---|---|---| | `main` (940d32f) | 695 | 6 | 10 | | this branch (318b877) | 700 | 2 | 10 | This branch fixes `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`, and `a_capped_view_heap_keeps_the_null_buffer_views` passes. The two that remain are the same NVIDIA ones as before, with identical values: `a_heap_buffer_read_by_element_takes_the_views_stride` (`101 + 3l`) and `gathers_at_a_level_match_the_hardware` (lane 0 `[0.0, 1.0, 0.0, 0.0]`). The sixth failure on `main` is unrelated to this PR. `modules::dstorage::tests::a_page_list_filled_after_its_request_starts` returned `-2147024809` (E_INVALIDARG) once, in the full-workspace run. It then passed 10/10 on its own and in 8/8 runs of the whole `victory-hle` suite, so it looks timing-dependent. A note from reading 318b877, not from a run: the WARP probe is only reached through `victory_gpu::host::on_warp()` (`VICTORY_D3D12_WARP`, diagnostics builds). `victory_shader::emit::host::Host::new` with `VICTORY_WARP=1` doesn't call `heap_views_on_warp()`, so the shader tests under `VICTORY_WARP=1`, and an offline `translate`, still probe the default hardware adapter. That's r4tedx's first point, which looks still open for those paths. Unit tests only, not tested in title.
Author
Owner

@⁠antoinerz1 on GitHub · 2026-11-25 16:34 UTC · original

Rebased onto current main (bd76752) and added a fix for the boundary case AlanQiang0418 found: a heap of exactly heap_views() slots now trims the title and dynamic range below the last three slots, following their suggested approach (thanks!). New regression test a_range_ending_at_the_heap_end_keeps_the_null_buffer_views covers both dynamic ranges; it fails without the fix.

RTX 4060 Ti: victory-gpu lib 197 passed / 0 failed; victory-shader lib 267 passed / 2 failed (the two known NVIDIA-only ones, vs 3 on main). Note: memory_tests::heap_direct_texture_reads_mark_their_heap_index crashes with an access violation on this card on main too, so it is unrelated to this PR.

**@⁠antoinerz1** on GitHub · 2026-11-25 16:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/1777#issuecomment-7168194874) Rebased onto current `main` (bd76752) and added a fix for the boundary case AlanQiang0418 found: a heap of exactly `heap_views()` slots now trims the title and dynamic range below the last three slots, following their suggested approach (thanks!). New regression test `a_range_ending_at_the_heap_end_keeps_the_null_buffer_views` covers both dynamic ranges; it fails without the fix. RTX 4060 Ti: `victory-gpu` lib 197 passed / 0 failed; `victory-shader` lib 267 passed / 2 failed (the two known NVIDIA-only ones, vs 3 on `main`). Note: `memory_tests::heap_direct_texture_reads_mark_their_heap_index` crashes with an access violation on this card on `main` too, so it is unrelated to this PR.
Author
Owner

@⁠antoinerz1 on GitHub · 2026-11-25 21:21 UTC · original

Follow-up for the open point from r4tedx and tigre437 (a61059f): the translator no longer probes a device. victory-gpu decides the view heap size once, from the adapter its device is made on (WARP under VICTORY_D3D12_WARP, else the default one), and hands it to the translator with emit::set_heap_views before any translation; the shader cache key, host_shader, the pipeline library tag and the descriptor heaps all go through host::heap_views(). Without a host the translator uses 2^21 as before, and its own tests probe their test host's adapter (WARP with VICTORY_WARP=1). The cache warm-up (victory translate --cache) still asks the host's adapter, since its entries must carry the runtime's key; plain offline translation opens no device.

RTX 4060 Ti: cargo test --workspace 778 passed / 2 failed (the two known NVIDIA-only shader tests) / 9 ignored, with heap_direct_texture_reads_mark_their_heap_index skipped (crashes on main too); VICTORY_WARP=1 stride tests 8/8.

**@⁠antoinerz1** on GitHub · 2026-11-25 21:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/1777#issuecomment-7174963330) Follow-up for the open point from r4tedx and tigre437 (a61059f): the translator no longer probes a device. `victory-gpu` decides the view heap size once, from the adapter its device is made on (WARP under `VICTORY_D3D12_WARP`, else the default one), and hands it to the translator with `emit::set_heap_views` before any translation; the shader cache key, `host_shader`, the pipeline library tag and the descriptor heaps all go through `host::heap_views()`. Without a host the translator uses 2^21 as before, and its own tests probe their test host's adapter (WARP with `VICTORY_WARP=1`). The cache warm-up (`victory translate --cache`) still asks the host's adapter, since its entries must carry the runtime's key; plain offline translation opens no device. RTX 4060 Ti: `cargo test --workspace` 778 passed / 2 failed (the two known NVIDIA-only shader tests) / 9 ignored, with `heap_direct_texture_reads_mark_their_heap_index` skipped (crashes on `main` too); `VICTORY_WARP=1` stride tests 8/8.
Author
Owner

@⁠Luqueze on GitHub · 2026-11-26 02:21 UTC · original

Tested in title on Ada: RTX 4070 SUPER (12 GB), driver 617.42 (32.0.16.1742), Windows 11 26300, Ryzen 7 5700X3D, 32 GB RAM, Rust 1.98.1. Series 1.0.2.1 (b99f876b74d4a77f), Series X profile, default TdrDelay.

Unit tests. cargo test -p victory-gpu --lib:

passed failed
main (63bcca4) 229 2
this branch (cbb9d78) 233 0

The two fixed are dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views. victory-shader still dies in heap_direct_texture_reads_mark_their_heap_index (#2571) on both, unrelated.

In title it does not stop the world hang on this card. Each build with its own fresh translate --cache --pipelines (same counts on both: 25,756 programs translated, 23,113 pipelines made, 397 refused by the host, so those are not about the heap).

Build Lasted End
main, release 5.9 min 0x887A0004 / 0x887A0006 after 28 lists, ~1.5 min of world at 0.1-0.3 fps first
main, diag, VICTORY_D3D12_DRED=1 3.9 min device removed after 28 lists
this branch, diag, VICTORY_D3D12_DRED=1 3.4 min device removed after 34 lists, 35 s after world loading started, before a world frame was reported

With this branch the log says the host caps view heaps: shader heap indices clamped below it views=1000000 and host view heap capped at 1000000 ... count=1245184 kept=934461, then still 310,723 title slot past the host heap. The last submission took 5,213 ms, and DRED stops at the same dispatch as on main:

a list stopped at command 143 of 146 (op 6), commands 142..145 between its barriers:
command 143 (op 6): dispatch 16x16x16 [compute 00167d58cc5a78d7]

Everything queued after it had not started. On main (run 2) it was command 8 of 11 of the same shader. So here the clamp keeps out-of-range indices away from the device, but 00167d58cc5a78d7 still runs past the TDR with the title's slots above 934,461 left out (the stall #1760 removed with P = 140, not tried here). This differs from the 35 min RTX 3050 result in #1760; one run per build, so I can't rule out run-to-run variance.

AI-assisted (Claude Code); the runs are mine.

**@⁠Luqueze** on GitHub · 2026-11-26 02:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/1777#issuecomment-7180726458) Tested in title on Ada: RTX 4070 SUPER (12 GB), driver 617.42 (32.0.16.1742), Windows 11 26300, Ryzen 7 5700X3D, 32 GB RAM, Rust 1.98.1. Series 1.0.2.1 (`b99f876b74d4a77f`), Series X profile, default TdrDelay. **Unit tests.** `cargo test -p victory-gpu --lib`: | | passed | failed | |---|---|---| | `main` (63bcca4) | 229 | 2 | | this branch (cbb9d78) | 233 | 0 | The two fixed are `dynamic_slots_are_held_until_released` and `lists_share_a_table_and_copies_keep_their_views`. `victory-shader` still dies in `heap_direct_texture_reads_mark_their_heap_index` (#2571) on both, unrelated. **In title it does not stop the world hang on this card.** Each build with its own fresh `translate --cache --pipelines` (same counts on both: 25,756 programs translated, 23,113 pipelines made, 397 refused by the host, so those are not about the heap). | Build | Lasted | End | |---|---|---| | `main`, release | 5.9 min | `0x887A0004` / `0x887A0006` after 28 lists, ~1.5 min of world at 0.1-0.3 fps first | | `main`, diag, `VICTORY_D3D12_DRED=1` | 3.9 min | device removed after 28 lists | | this branch, diag, `VICTORY_D3D12_DRED=1` | 3.4 min | device removed after 34 lists, **35 s after world loading started**, before a world frame was reported | With this branch the log says `the host caps view heaps: shader heap indices clamped below it views=1000000` and `host view heap capped at 1000000 ... count=1245184 kept=934461`, then still 310,723 `title slot past the host heap`. The last submission took 5,213 ms, and DRED stops at the same dispatch as on `main`: ``` a list stopped at command 143 of 146 (op 6), commands 142..145 between its barriers: command 143 (op 6): dispatch 16x16x16 [compute 00167d58cc5a78d7] ``` Everything queued after it had not started. On `main` (run 2) it was command 8 of 11 of the same shader. So here the clamp keeps out-of-range indices away from the device, but `00167d58cc5a78d7` still runs past the TDR with the title's slots above 934,461 left out (the stall #1760 removed with `P = 140`, not tried here). This differs from the 35 min RTX 3050 result in #1760; one run per build, so I can't rule out run-to-run variance. AI-assisted (Claude Code); the runs are mine.
Author
Owner

@⁠DenRakEiw on GitHub · 2026-11-24 22:26 UTC · original · approved these changes

Verified locally merged onto origin/main (70564ae, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC):

  • cargo test -p victory-gpu — 79 passed, 0 failed (1 ignored) on both RTX 5090 hardware and VICTORY_D3D12_WARP=1 (including a_capped_view_heap_keeps_the_null_buffer_views — directly resolves the 2 NVIDIA HEAP_VIEWS test failures on origin/main 70564ae!)
  • cargo clippy -p victory-gpu -p victory-shader --all-targets — 0 warnings
  • cargo xtask policy — ok

Great fix dynamically sizing the view heap clamp from what the host adapter supports while preserving the null buffer views and shader cache keys. Confirmed green on NVIDIA RTX 5090.

AI-assisted (Gemini 4 Neon).

**@⁠DenRakEiw** on GitHub · 2026-11-24 22:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/1777#pullrequestreview-6048388430) · **approved these changes** Verified locally merged onto `origin/main` (`70564ae`, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC): - `cargo test -p victory-gpu` — **79 passed, 0 failed** (1 ignored) on both RTX 5090 hardware and `VICTORY_D3D12_WARP=1` (including `a_capped_view_heap_keeps_the_null_buffer_views` — directly resolves the 2 NVIDIA `HEAP_VIEWS` test failures on `origin/main` `70564ae`!) - `cargo clippy -p victory-gpu -p victory-shader --all-targets` — 0 warnings - `cargo xtask policy` — ok Great fix dynamically sizing the view heap clamp from what the host adapter supports while preserving the null buffer views and shader cache keys. Confirmed green on NVIDIA RTX 5090. AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠catminou4 on GitHub · 2026-11-24 23:03 UTC · original · reviewed

Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.

View-heap clamp sized from what the host actually takes (NVIDIA 1,000,000-descriptor cap): 21K diff across gpu+shader. The clamp must never reject a title that worked before — worth a Windows run on a title with large descriptor tables.

**@⁠catminou4** on GitHub · 2026-11-24 23:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/1777#pullrequestreview-6048800490) · **reviewed** Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff. View-heap clamp sized from what the host actually takes (NVIDIA 1,000,000-descriptor cap): 21K diff across gpu+shader. The clamp must never reject a title that worked before — worth a Windows run on a title with large descriptor tables.
Author
Owner

@⁠Xvania7 on GitHub · 2026-11-25 11:51 UTC · original · approved these changes

Verified 318b877 on Windows 10 + NVIDIA GeForce RTX 5060 (hardware with 1,000,000 descriptor heap limit):

  • descriptor::host::tests::dynamic_slots_are_held_until_released now passes on NVIDIA hardware (resolves the 1M heap assertion)
  • descriptor::host::tests::a_capped_view_heap_keeps_the_null_buffer_views (passed)
  • All 6 tests in descriptor::host::tests:: passed (6/6)
  • cargo clippy -p victory-gpu --all-targets -- -D warnings & -p victory-shader: 0 warnings
  • cargo xtask policy: 182 files ok

Crucial fix for NVIDIA host heap constraints. Approving.

**@⁠Xvania7** on GitHub · 2026-11-25 11:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/1777#pullrequestreview-6057078660) · **approved these changes** Verified `318b877` on Windows 10 + NVIDIA GeForce RTX 5060 (hardware with 1,000,000 descriptor heap limit): - `descriptor::host::tests::dynamic_slots_are_held_until_released` now passes on NVIDIA hardware (resolves the 1M heap assertion) - `descriptor::host::tests::a_capped_view_heap_keeps_the_null_buffer_views` (passed) - All 6 tests in `descriptor::host::tests::` passed (6/6) - `cargo clippy -p victory-gpu --all-targets -- -D warnings` & `-p victory-shader`: 0 warnings - `cargo xtask policy`: 182 files ok Crucial fix for NVIDIA host heap constraints. Approving.
Author
Owner

@⁠LuvAbyss on GitHub · 2026-11-26 05:27 UTC · original · reviewed

Tested on Ampere: RTX 3080 (10 GB), driver 621.35, Windows 11 26300, Rust 1.98.1. Branch cbb9d78 merged locally onto current main (63bcca4); the merge is clean and builds.

Tests, cargo test --release --workspace --no-fail-fast:

passed failed ignored
main (63bcca4) 567 3 7
this branch on main 570 2 7

dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views pass; both new tests pass. victory-gpu --lib alone: 229/2 on main, 233/0 here, twice each. The remaining failures are the same on both sides and unrelated: victory-shader dies in heap_direct_texture_reads_mark_their_heap_index (#2571), and xtask's policy test caught a stray local file of mine.

One flake to note: shadow::tests::marked_pages_go_back_by_the_bytes_the_gpu_changed failed once in the full workspace run on this branch. It passed 3/3 alone and in two full victory-gpu runs, so I read it as contention, not this change.

Read through the change. Points I checked:

  • The probe and the host device use the same adapter (D3D12CreateDevice(None, …), or WARP in both), so a hybrid laptop can't size the clamp from the wrong GPU.
  • Every translation that feeds run or the cache goes through shader_cache::host_shader, which fixes heap_views() before translating. So the OnceLock can't be set to 2^21 by an earlier translation in those paths.
  • The trimming for a heap of exactly views slots: extra.min(end - count) keeps count + extra <= null - 1, so the null UAV, the null SRV and the clamped slot are always free.
  • The read-mark bitmap stays sized to HEAP_VIEWS_MAX, which covers every index either clamp lets through.

Minor, not a regression: victory translate without --cache (the validator) calls emit::emit_with directly and never asks victory_gpu::host::heap_views(). On NVIDIA it still translates with 2^21, and from reading the code its validation Host would then ask for a 2^21 heap where a shader has View::NullBuffers (I didn't run that path). It was the same before this PR; it could call set_heap_views up front in a follow-up.

In title (Series 1.0.2.1, b99f876b74d4a77f; fresh translate --cache --pipelines on this branch, 17 min, 23,128 pipelines made): the size is detected (the host caps view heaps: shader heap indices clamped below it views=1000000), but the run ends after about 35 s, in the loading screens, exactly as #1808 reports:

title slot past the host heap index=1171238 count=934461 for_draw=false
... (943 of these, through index=1172180, one line each)
VIctory: unhandled exception 0xc0000005 at victory-image-b99f876b74d4a77f.dll+0x258b000 (write 0x0: nothing mapped there)
  #1  victory-image-b99f876b74d4a77f.dll+0x2215c35
  #2  victory-image-b99f876b74d4a77f.dll+0x2215eca

Memory wasn't the limit (the title's own crash report: 16 GB physical and 11.8 GB of paging file free). So on Ampere this PR makes the shaders' clamp and null views correct, but the title still writes its descriptors at about 1.17M, past the 934,461 slots kept, and the +0x258b000 null write remains. That needs the remapping the shortcut: comment mentions (or whatever #1763 does that made it go away on the 4090 in #1808). I'd describe this PR as fixing the tests and the shader side of #1808, not the crash.

**@⁠LuvAbyss** on GitHub · 2026-11-26 05:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/1777#pullrequestreview-6068982329) · **reviewed** Tested on Ampere: RTX 3080 (10 GB), driver 621.35, Windows 11 26300, Rust 1.98.1. Branch `cbb9d78` merged locally onto current `main` (`63bcca4`); the merge is clean and builds. **Tests**, `cargo test --release --workspace --no-fail-fast`: | | passed | failed | ignored | |---|---|---|---| | `main` (63bcca4) | 567 | 3 | 7 | | this branch on `main` | 570 | 2 | 7 | `dynamic_slots_are_held_until_released` and `lists_share_a_table_and_copies_keep_their_views` pass; both new tests pass. `victory-gpu --lib` alone: 229/2 on `main`, 233/0 here, twice each. The remaining failures are the same on both sides and unrelated: `victory-shader` dies in `heap_direct_texture_reads_mark_their_heap_index` (#2571), and `xtask`'s policy test caught a stray local file of mine. One flake to note: `shadow::tests::marked_pages_go_back_by_the_bytes_the_gpu_changed` failed once in the full workspace run on this branch. It passed 3/3 alone and in two full `victory-gpu` runs, so I read it as contention, not this change. **Read through the change.** Points I checked: - The probe and the host device use the same adapter (`D3D12CreateDevice(None, …)`, or WARP in both), so a hybrid laptop can't size the clamp from the wrong GPU. - Every translation that feeds `run` or the cache goes through `shader_cache::host_shader`, which fixes `heap_views()` before translating. So the `OnceLock` can't be set to 2^21 by an earlier translation in those paths. - The trimming for a heap of exactly `views` slots: `extra.min(end - count)` keeps `count + extra <= null - 1`, so the null UAV, the null SRV and the clamped slot are always free. - The read-mark bitmap stays sized to `HEAP_VIEWS_MAX`, which covers every index either clamp lets through. Minor, not a regression: `victory translate` without `--cache` (the validator) calls `emit::emit_with` directly and never asks `victory_gpu::host::heap_views()`. On NVIDIA it still translates with 2^21, and from reading the code its validation `Host` would then ask for a 2^21 heap where a shader has `View::NullBuffers` (I didn't run that path). It was the same before this PR; it could call `set_heap_views` up front in a follow-up. **In title** (Series 1.0.2.1, `b99f876b74d4a77f`; fresh `translate --cache --pipelines` on this branch, 17 min, 23,128 pipelines made): the size is detected (`the host caps view heaps: shader heap indices clamped below it views=1000000`), but the run ends after about 35 s, in the loading screens, exactly as #1808 reports: ``` title slot past the host heap index=1171238 count=934461 for_draw=false ... (943 of these, through index=1172180, one line each) VIctory: unhandled exception 0xc0000005 at victory-image-b99f876b74d4a77f.dll+0x258b000 (write 0x0: nothing mapped there) #1 victory-image-b99f876b74d4a77f.dll+0x2215c35 #2 victory-image-b99f876b74d4a77f.dll+0x2215eca ``` Memory wasn't the limit (the title's own crash report: 16 GB physical and 11.8 GB of paging file free). So on Ampere this PR makes the shaders' clamp and null views correct, but the title still writes its descriptors at about 1.17M, past the 934,461 slots kept, and the `+0x258b000` null write remains. That needs the remapping the `shortcut:` comment mentions (or whatever #1763 does that made it go away on the 4090 in #1808). I'd describe this PR as fixing the tests and the shader side of #1808, not the crash.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 14:53 UTC · original · requested changes

Tested merged onto origin/main (63bcca43) on an RTX 5090 (NVIDIA 1,000,000 shader-visible view heap cap) and on WARP (VICTORY_D3D12_WARP=1, 2,097,152 uncapped) with VICTORY_D3D12_DEBUG=1 and the SDK dxil.dll.

Blocking issue: host::create() latches victory_shader::emit::HEAP_VIEWS to 2_097_152 before host::heap_views() runs

Whenever victory_gpu::host::host() runs before crate::host::heap_views() (or shader_cache::use_shader_cache()), create() executes:

  • crates/victory-gpu/src/host.rs:242: victory_shader::emit::host::Host::from_device(device.clone()).fuses_fmad()
  • crates/victory-shader/src/emit/host.rs:639 -> fmad_probe() (emit/host.rs:772) lowers a synthetic compute shader with a descriptor-table UAV, which calls Shader::handle_from_heap (emit/shader.rs:584) -> victory_shader::emit::heap_views() (emit/shader.rs:52).
  • Because victory-shader is compiled without #[cfg(test)] when linked into victory-gpu, victory_shader::emit::heap_views() permanently initializes its OnceLock to HEAP_VIEWS_MAX (2_097_152).
  • When crate::host::heap_views() (crates/victory-gpu/src/host.rs:302-323) later probes the NVIDIA adapter (takes = 1_000_000), victory_shader::emit::set_heap_views(1_000_000) (host.rs:311) returns the already-latched 2_097_152, and crate::host::heap_views() caches 2_097_152 for the rest of the process.
  • In HostHeap::new() (crates/victory-gpu/src/descriptor/host.rs:152-172), both make((count + DYNAMIC).max(views)) and make((count + MIN_DYNAMIC).max(views)) then request 2_097_152 descriptors and fail on NVIDIA, while the cap branch at descriptor/host.rs:161 (count + MIN_DYNAMIC + 3 > views) is false for every normal heap with count <= 2_031_613, causing HostHeap::new() to return None.

Repro on RTX 5090 (masked on WARP because WARP accepts 2_097_152, and masked in victory run only because apps/victory/src/run.rs:80 happens to call use_shader_cache() first):

  • cargo test -p victory-gpu --lib bindless::tests::heap_views_are_current fails 100% deterministically (panicked at crates ictory-gpu\srcindless.rs:668:43: a host view heap), with takes = 1_000_000 vs latched views = 2_097_152.
  • cargo test -p victory-gpu --lib -- --test-threads=1 fails 20/233 tests (bindless::, descriptor::host::, descriptor::, draw::, host::) with the same a host view heap failure.
  • Default parallel cargo test -p victory-gpu --lib is racy on NVIDIA (failed 20/233 whenever host::create() beat a test that called host::heap_views() directly).

Suggested fix:
Initialize heap_views in host::create() before the fuses_fmad() probe at crates/victory-gpu/src/host.rs:242 (ideally probing the already-created &device so create() does not need a second D3D12CreateDevice call). Verified locally on RTX 5090 that calling heap_views() right before fuses_fmad() flips bindless::tests::heap_views_are_current to passing and brings cargo test -p victory-gpu --lib -- --test-threads=1 from 20 failures to 233/233 passed.

What verified cleanly

  • Clean merge onto origin/main (63bcca43); merged crates/victory-shader/src/emit/lower.rs is 520,567 B (3,721 B under the 512 KiB limit).
  • cargo run -p xtask -- policy (191 files ok) and clippy (default and --all-features) pass cleanly.
  • On RTX 5090, victory-shader emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros flips from failing (E_INVALIDARG on origin/main) to passing (7/8 stride_tests pass on RTX 5090, leaving only the pre-existing NVIDIA structured-SRV failure in a_heap_buffer_read_by_element_takes_the_views_stride; 8/8 pass on WARP).
  • When heap_views() initializes before fuses_fmad(), all new boundary and cache-key tests (a_capped_view_heap_keeps_the_null_buffer_views, a_range_ending_at_the_heap_end_keeps_the_null_buffer_views, dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views, shader_cache::, pipeline::library::) pass (47/47) on both RTX 5090 (1M cap) and WARP (2M uncapped) under VICTORY_D3D12_DEBUG=1, and the full WARP suite passes (248/248).
  • Note for maintainers: this PR coordinates shader clamping, null buffer views, and shader/pipeline cache keys with the host cap, going further than #1751/#2461 and superseding #1779.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 14:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/1777#pullrequestreview-6076224917) · **requested changes** Tested merged onto `origin/main` (`63bcca43`) on an RTX 5090 (NVIDIA 1,000,000 shader-visible view heap cap) and on WARP (`VICTORY_D3D12_WARP=1`, 2,097,152 uncapped) with `VICTORY_D3D12_DEBUG=1` and the SDK `dxil.dll`. ### Blocking issue: `host::create()` latches `victory_shader::emit::HEAP_VIEWS` to `2_097_152` before `host::heap_views()` runs Whenever `victory_gpu::host::host()` runs before `crate::host::heap_views()` (or `shader_cache::use_shader_cache()`), `create()` executes: - `crates/victory-gpu/src/host.rs:242`: `victory_shader::emit::host::Host::from_device(device.clone()).fuses_fmad()` - `crates/victory-shader/src/emit/host.rs:639` -> `fmad_probe()` (`emit/host.rs:772`) lowers a synthetic compute shader with a descriptor-table UAV, which calls `Shader::handle_from_heap` (`emit/shader.rs:584`) -> `victory_shader::emit::heap_views()` (`emit/shader.rs:52`). - Because `victory-shader` is compiled without `#[cfg(test)]` when linked into `victory-gpu`, `victory_shader::emit::heap_views()` permanently initializes its `OnceLock` to `HEAP_VIEWS_MAX` (`2_097_152`). - When `crate::host::heap_views()` (`crates/victory-gpu/src/host.rs:302-323`) later probes the NVIDIA adapter (`takes = 1_000_000`), `victory_shader::emit::set_heap_views(1_000_000)` (`host.rs:311`) returns the already-latched `2_097_152`, and `crate::host::heap_views()` caches `2_097_152` for the rest of the process. - In `HostHeap::new()` (`crates/victory-gpu/src/descriptor/host.rs:152-172`), both `make((count + DYNAMIC).max(views))` and `make((count + MIN_DYNAMIC).max(views))` then request `2_097_152` descriptors and fail on NVIDIA, while the cap branch at `descriptor/host.rs:161` (`count + MIN_DYNAMIC + 3 > views`) is `false` for every normal heap with `count <= 2_031_613`, causing `HostHeap::new()` to return `None`. **Repro on RTX 5090** (masked on WARP because WARP accepts `2_097_152`, and masked in `victory run` only because `apps/victory/src/run.rs:80` happens to call `use_shader_cache()` first): - `cargo test -p victory-gpu --lib bindless::tests::heap_views_are_current` fails 100% deterministically (`panicked at crates ictory-gpu\srcindless.rs:668:43: a host view heap`), with `takes = 1_000_000` vs latched `views = 2_097_152`. - `cargo test -p victory-gpu --lib -- --test-threads=1` fails **20/233** tests (`bindless::`, `descriptor::host::`, `descriptor::`, `draw::`, `host::`) with the same `a host view heap` failure. - Default parallel `cargo test -p victory-gpu --lib` is racy on NVIDIA (failed **20/233** whenever `host::create()` beat a test that called `host::heap_views()` directly). **Suggested fix:** Initialize `heap_views` in `host::create()` **before** the `fuses_fmad()` probe at `crates/victory-gpu/src/host.rs:242` (ideally probing the already-created `&device` so `create()` does not need a second `D3D12CreateDevice` call). Verified locally on RTX 5090 that calling `heap_views()` right before `fuses_fmad()` flips `bindless::tests::heap_views_are_current` to passing and brings `cargo test -p victory-gpu --lib -- --test-threads=1` from 20 failures to **233/233 passed**. ### What verified cleanly - Clean merge onto `origin/main` (`63bcca43`); merged `crates/victory-shader/src/emit/lower.rs` is `520,567 B` (`3,721 B` under the 512 KiB limit). - `cargo run -p xtask -- policy` (191 files ok) and `clippy` (default and `--all-features`) pass cleanly. - On RTX 5090, `victory-shader` `emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros` flips from failing (`E_INVALIDARG` on `origin/main`) to passing (`7/8` `stride_tests` pass on RTX 5090, leaving only the pre-existing NVIDIA structured-SRV failure in `a_heap_buffer_read_by_element_takes_the_views_stride`; `8/8` pass on WARP). - When `heap_views()` initializes before `fuses_fmad()`, all new boundary and cache-key tests (`a_capped_view_heap_keeps_the_null_buffer_views`, `a_range_ending_at_the_heap_end_keeps_the_null_buffer_views`, `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views`, `shader_cache::`, `pipeline::library::`) pass (`47/47`) on both RTX 5090 (1M cap) and WARP (2M uncapped) under `VICTORY_D3D12_DEBUG=1`, and the full WARP suite passes (`248/248`). - Note for maintainers: this PR coordinates shader clamping, null buffer views, and shader/pipeline cache keys with the host cap, going further than `#1751`/`#2461` and superseding `#1779`.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/1777/head:github-bot/gh-1777'
git switch 'github-bot/gh-1777'

Merge

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