Shader tests: an empty root-constant list is set as the one constant it declares (#2571) #2596

Open
github-bot wants to merge 1 commit from github-bot/gh-2596 into main AGit
Owner

@⁠Creaa on GitHub · 2026-11-25 16:25 UTC · original
Creaa:shader-tests/root-constants-empty-list → main · +16 −12 · 1 files · 1 commits · open

heap_direct_texture_reads_mark_their_heap_index killed the victory-shader test process on hardware GPUs because the test harness set root constants as 0 values through an empty Vec's dangling pointer, while the root signature it builds declares at least one constant (user_data_dwords().max(1)). WARP ignores the 0-value call; the hardware driver reads through the pointer and the process ends with 0xC0000005. An empty constant list is now set as the one zero constant the signature declares. Fixes #2571.

What is in it

  • crates/victory-shader/src/emit/host.rs: in dispatch (compute) and the graphics dispatch, Root::Constants with no values is set as [0]. fuses_fmad already sized its constants with max(1).

Tested

  • RTX 4070 12 GB (driver 617.14), i7-13700F, 32 GB RAM, Windows 11 build 26300, Rust 1.100.0; on main 67e8ae1.
  • cargo test -p victory-shader --lib --locked heap_direct_texture_reads_mark_their_heap_index: on main 0xC0000005 in every run, in the hardware pass's dispatch (the pipeline is built; the warp pass is never reached); with this change 3 of 3 runs pass, hardware and WARP.
  • cargo test --workspace --locked --no-fail-fast: on main 507 passed, 2 failed, 6 ignored, and the victory-shader test binary ends with 0xC0000005, so none of its results are counted; with this change 774 passed, 5 failed, 9 ignored. The 5 fail the same way on main (940d32f, when the shader binary still ran) and are outside this change: dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views, 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 (the five in #1744).
  • cargo clippy --workspace --all-targets --locked -- -D warnings: clean. cargo xtask policy: 184 files ok.

Not tested

  • AMD: #2547 reports the same access violation in this test on an RX 6700 XT; I could not run it there.
  • The other hardware-only failures the issue lists ("no pipeline for a wave of 32", the gather lane): separate, not changed here.

AI use

  • Claude Code (Claude Opus 5.5) found the cause, wrote the change, ran the tests, and drafted this description; I checked it.

🤖 Generated with Claude Code

**@⁠Creaa** on GitHub · 2026-11-25 16:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/2596) `Creaa:shader-tests/root-constants-empty-list` → `main` · +16 −12 · 1 files · 1 commits · open `heap_direct_texture_reads_mark_their_heap_index` killed the `victory-shader` test process on hardware GPUs because the test harness set root constants as 0 values through an empty `Vec`'s dangling pointer, while the root signature it builds declares at least one constant (`user_data_dwords().max(1)`). WARP ignores the 0-value call; the hardware driver reads through the pointer and the process ends with 0xC0000005. An empty constant list is now set as the one zero constant the signature declares. Fixes #2571. **What is in it** - `crates/victory-shader/src/emit/host.rs`: in `dispatch` (compute) and the graphics dispatch, `Root::Constants` with no values is set as `[0]`. `fuses_fmad` already sized its constants with `max(1)`. **Tested** - RTX 4070 12 GB (driver 617.14), i7-13700F, 32 GB RAM, Windows 11 build 26300, Rust 1.100.0; on `main` `67e8ae1`. - `cargo test -p victory-shader --lib --locked heap_direct_texture_reads_mark_their_heap_index`: on `main` 0xC0000005 in every run, in the hardware pass's dispatch (the pipeline is built; the warp pass is never reached); with this change 3 of 3 runs pass, hardware and WARP. - `cargo test --workspace --locked --no-fail-fast`: on `main` 507 passed, 2 failed, 6 ignored, and the `victory-shader` test binary ends with 0xC0000005, so none of its results are counted; with this change 774 passed, 5 failed, 9 ignored. The 5 fail the same way on `main` (`940d32f`, when the shader binary still ran) and are outside this change: `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views`, `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` (the five in #1744). - `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean. `cargo xtask policy`: 184 files ok. **Not tested** - AMD: #2547 reports the same access violation in this test on an RX 6700 XT; I could not run it there. - The other hardware-only failures the issue lists ("no pipeline for a wave of 32", the gather lane): separate, not changed here. **AI use** - Claude Code (Claude Opus 5.5) found the cause, wrote the change, ran the tests, and drafted this description; I checked it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The test harness declares every program's root constants with
`user_data_dwords().max(1)` values, but `dispatch` passed a test's
`Root::Constants(vec![])` as 0 values through the empty Vec's dangling
pointer. WARP ignores that; a hardware driver reads through it, and the test
process ends with 0xC0000005 (heap_direct_texture_reads_mark_their_heap_index
on an RTX 5070 and an RTX 4070, and on AMD per #2547), which also stops every
later victory-shader test in that run. An empty list is now set as one zero,
in the compute and the graphics path; `fuses_fmad` already did this.

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

@⁠upipibi on GitHub · 2026-11-25 16:48 UTC · original

Fixes it on Ampere too. RTX 3070 (driver 616.56), Windows 11, debug, emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index alone on hardware:

tree runs result
main 67e8ae1 3 3 of 3 kill the test process (0xc0000005); with VICTORY_WARP=1 it passes
this PR 577839a 3 3 of 3 pass

cargo test --locked -p victory-shader at 577839a: 267 passed, 3 failed, no crash. The 3 are stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride, stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros and synthetic_tests::gathers_at_a_level_match_the_hardware, which fail the same way on 940d32f on this card (the #1744 NVIDIA failures). On main 67e8ae1 the whole suite aborts at this test, so there is no full count to compare.

AI-assisted (Claude Code, Claude Opus 5.5). Synthetic tests only.

**@⁠upipibi** on GitHub · 2026-11-25 16:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/2596#issuecomment-7168556596) Fixes it on Ampere too. RTX 3070 (driver 616.56), Windows 11, debug, `emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index` alone on hardware: | tree | runs | result | |---|---|---| | `main` `67e8ae1` | 3 | 3 of 3 kill the test process (`0xc0000005`); with `VICTORY_WARP=1` it passes | | this PR `577839a` | 3 | 3 of 3 pass | `cargo test --locked -p victory-shader` at `577839a`: 267 passed, 3 failed, no crash. The 3 are `stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride`, `stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros` and `synthetic_tests::gathers_at_a_level_match_the_hardware`, which fail the same way on `940d32f` on this card (the #1744 NVIDIA failures). On `main` `67e8ae1` the whole suite aborts at this test, so there is no full count to compare. AI-assisted (Claude Code, Claude Opus 5.5). Synthetic tests only.
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 16:49 UTC · original

Verification of 577839a (CPU-only; D3D12 tests deliberately not run)

  • Merges cleanly onto origin/main (67e8ae1).
  • cargo test -p victory-shader --lib --no-run: builds. cargo clippy -p victory-shader --all-targets -- -D warnings: clean.
  • Not run: any D3D12-touching test. victory-shader's test host does not honor VICTORY_D3D12_WARP (it uses VICTORY_WARP=1 or the hardware adapter, so tests calling Host::new(false) would open the physical GPU), so I kept this to build and lint plus diff review. This PR adds no new test, so I have nothing to report on WARP or hardware.
  • Diff review: the &[0] fallback matches the root signature, which always declares at least one 32-bit constant (user_data_dwords().max(1), host.rs ~L162). It also sets every root parameter. The new comment lines are longer than rustfmt's width; rustfmt --check on the file only reports a hunk at ~L363, which this diff does not touch.

Overlap with #2587 (same issue, #2571): the two PRs make the same code change, setting [0] in the same two Root::Constants arms of emit/host.rs. They are duplicates, and git merge-tree of the two heads reports a conflict in that file. (Edited: when I first reviewed #2587 at 8ceeb01 it skipped the call instead. Its head df8ee8e now binds [0] like this PR.) #2587 also adds a regression test, which is unrun here for the reason above. This PR is the fix alone. A maintainer should land one and close or rebase the other.

Independent verification by Claude Code (Claude Sonnet 5.5), an AI assistant, run for oni-swr. No game files, dumps, or shader names were used.

**@⁠oni-swr** on GitHub · 2026-11-25 16:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/2596#issuecomment-7168593671) **Verification of `577839a` (CPU-only; D3D12 tests deliberately not run)** - Merges cleanly onto `origin/main` (`67e8ae1`). - `cargo test -p victory-shader --lib --no-run`: builds. `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. - **Not run:** any D3D12-touching test. `victory-shader`'s test host does not honor `VICTORY_D3D12_WARP` (it uses `VICTORY_WARP=1` or the hardware adapter, so tests calling `Host::new(false)` would open the physical GPU), so I kept this to build and lint plus diff review. This PR adds no new test, so I have nothing to report on WARP or hardware. - Diff review: the `&[0]` fallback matches the root signature, which always declares at least one 32-bit constant (`user_data_dwords().max(1)`, `host.rs` ~L162). It also sets every root parameter. The new comment lines are longer than rustfmt's width; `rustfmt --check` on the file only reports a hunk at ~L363, which this diff does not touch. **Overlap with #2587 (same issue, #2571):** the two PRs make the same code change, setting `[0]` in the same two `Root::Constants` arms of `emit/host.rs`. They are duplicates, and `git merge-tree` of the two heads reports a conflict in that file. (Edited: when I first reviewed #2587 at `8ceeb01` it skipped the call instead. Its head `df8ee8e` now binds `[0]` like this PR.) #2587 also adds a regression test, which is unrun here for the reason above. This PR is the fix alone. A maintainer should land one and close or rebase the other. _Independent verification by Claude Code (Claude Sonnet 5.5), an AI assistant, run for oni-swr. No game files, dumps, or shader names were used._
Author
Owner

@⁠Vedoxdev123 on GitHub · 2026-11-25 18:33 UTC · original

RTX 4060 test (AI-assisted)
Windows 64-bit, Ryzen 5 5600X, GeForce RTX 4060 (8 GB), on main 13f91ca + this PR (577839a).

  • cargo test -p victory-shader: main aborts with 0xc0000005 at emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index and prints no summary. With this PR the run completes: 267 passed, 3 failed, 3 ignored. The 3 failures are the known NVIDIA ones from #1835 (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).
  • cargo test -p victory-gpu --lib: 193 passed, 2 failed, 1 ignored, identical to main (dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views). No change from this PR.
**@⁠Vedoxdev123** on GitHub · 2026-11-25 18:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/2596#issuecomment-7171066143) **RTX 4060 test (AI-assisted)** Windows 64-bit, Ryzen 5 5600X, GeForce RTX 4060 (8 GB), on `main` `13f91ca` + this PR (`577839a`). - `cargo test -p victory-shader`: `main` aborts with `0xc0000005` at `emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index` and prints no summary. With this PR the run completes: **267 passed, 3 failed, 3 ignored**. The 3 failures are the known NVIDIA ones from #1835 (`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`). - `cargo test -p victory-gpu --lib`: **193 passed, 2 failed, 1 ignored**, identical to `main` (`dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views`). No change from this PR.
Author
Owner

@⁠qtLkz on GitHub · 2026-11-25 20:23 UTC · original

Tested on NVIDIA Ada, a different generation from the RTX 5070 in #2571: RTX 4070 Ti, driver 621.01, Windows 11 Pro build 26300, Rust 1.98.1 pinned, this PR merged onto main 13f91ca (clean merge).

Plain main 13f91ca on this card: the victory-shader lib run dies with STATUS_ACCESS_VIOLATION (0xc0000005) at emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index, the same crash as #2571. The test passes on its own with VICTORY_WARP=1, so only the hardware path crashes.

With this PR: cargo test -p victory-shader --lib --locked -- --test-threads=1

  • heap_direct_texture_reads_mark_their_heap_index ... ok, on the hardware adapter
  • The suite runs to the end: 267 passed, 3 failed, 3 ignored. The 3 failures (stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride, stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, synthetic_tests::gathers_at_a_level_match_the_hardware) are the known NVIDIA ones, the same as on main 940d32f before the crash appeared (#2317, fixed by #2315 + #2322). None of them comes from this PR.

#2587 fixes the same crash on this card too (I'm commenting there separately).

AI-assisted (Claude).

**@⁠qtLkz** on GitHub · 2026-11-25 20:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/2596#issuecomment-7173595224) Tested on NVIDIA Ada, a different generation from the RTX 5070 in #2571: RTX 4070 Ti, driver 621.01, Windows 11 Pro build 26300, Rust 1.98.1 pinned, this PR merged onto main `13f91ca` (clean merge). **Plain main `13f91ca` on this card:** the victory-shader lib run dies with `STATUS_ACCESS_VIOLATION` (0xc0000005) at `emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index`, the same crash as #2571. The test passes on its own with `VICTORY_WARP=1`, so only the hardware path crashes. **With this PR:** `cargo test -p victory-shader --lib --locked -- --test-threads=1` - `heap_direct_texture_reads_mark_their_heap_index ... ok`, on the hardware adapter - The suite runs to the end: 267 passed, 3 failed, 3 ignored. The 3 failures (`stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride`, `stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`, `synthetic_tests::gathers_at_a_level_match_the_hardware`) are the known NVIDIA ones, the same as on main `940d32f` before the crash appeared (#2317, fixed by #2315 + #2322). None of them comes from this PR. #2587 fixes the same crash on this card too (I'm commenting there separately). AI-assisted (Claude).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 22:22 UTC · original

Automated triage for the maintainers.

Merge candidate. This fixes #2571, a test-harness crash on hardware adapters. In victory-shader/src/emit/host.rs, the root signature declares user_data_dwords().max(1) constants, but Host::draw and Host::dispatch set an empty Root::Constants as 0 values through an empty Vec's dangling pointer, which NVIDIA and AMD drivers read. Both arms now set the one declared constant as [0]. That matches the signature and fills every declared root parameter. It is test-host code only, and several independent hardware reports in this thread confirm the crash is gone.

Overlap: #2587 makes the same code change and adds a regression test, but it currently conflicts with main (marked needs-rebase). Only one of the two should land. This one merges cleanly. #2587's test could follow on top.

CI: check passing. Merges cleanly into current main. A recommendation to look at it, not an approval.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 22:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/2596#issuecomment-7176287185) <!-- victory-triage v1 head=577839a0c3b85fa5e69f7059b63d9192a6952beb verdict=merge-candidate at=2026-11-25T22:22:40Z --> Automated triage for the maintainers. **Merge candidate.** This fixes #2571, a test-harness crash on hardware adapters. In `victory-shader/src/emit/host.rs`, the root signature declares `user_data_dwords().max(1)` constants, but `Host::draw` and `Host::dispatch` set an empty `Root::Constants` as 0 values through an empty `Vec`'s dangling pointer, which NVIDIA and AMD drivers read. Both arms now set the one declared constant as `[0]`. That matches the signature and fills every declared root parameter. It is test-host code only, and several independent hardware reports in this thread confirm the crash is gone. Overlap: #2587 makes the same code change and adds a regression test, but it currently conflicts with `main` (marked needs-rebase). Only one of the two should land. This one merges cleanly. #2587's test could follow on top. CI: `check` passing. Merges cleanly into current `main`. A recommendation to look at it, not an approval. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠KainanP on GitHub · 2026-11-25 22:53 UTC · original

Measured against the other #2571 PRs on an RTX 4060, Intel UHD and WARP. This one fixes the crash with no regressions, but it is the same code as #2587, which also has a host-level test, so the comparison suggests one of the two: #2571 (AI-assisted)

**@⁠KainanP** on GitHub · 2026-11-25 22:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/2596#issuecomment-7176913215) Measured against the other #2571 PRs on an RTX 4060, Intel UHD and WARP. This one fixes the crash with no regressions, but it is the same code as #2587, which also has a host-level test, so the comparison suggests one of the two: https://git.gtahub.st/github/Marvisak--VIctory/issues/2571 (AI-assisted)
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/2596/head:github-bot/gh-2596'
git switch 'github-bot/gh-2596'

Merge

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