victory-shader: fix NVIDIA access violation in heap_direct_texture_reads_mark_their_heap_index #3465

Closed
github-bot wants to merge 1 commit from github-bot/gh-3465 into main AGit
Owner

@⁠kalberts0089-hash on GitHub · 2026-11-27 04:00 UTC · original
kalberts0089-hash:fix/empty-root-constants → main · +1 −1 · 1 files · 1 commits · closed without merging

Fixes the access violation reported in #3445.

The test's shader has no user data, so it built an empty Vec and passed its dangling pointer (0x4) to SetComputeRoot32BitConstants with a count of 0. NVIDIA's driver reads the pointer anyway and crashes (STATUS_ACCESS_VIOLATION in nvwgf2umx.dll); WARP doesn't.

This adds .max(1) at memory_tests.rs:731, matching the root signature (emit/host.rs:229) and emit/host.rs:610. I kept it to this one line rather than skipping the call in Host::dispatch, since that would leave a declared root parameter unset.

Tested on an RTX 4060 (driver 610.88):

  • the test now passes on its own
  • cargo test -p victory-shader --no-fail-fast: 299 passed, 3 failed (the 3 failures are the unrelated ones in #3445)

Done with Claude Code's help.

**@⁠kalberts0089-hash** on GitHub · 2026-11-27 04:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/3465) `kalberts0089-hash:fix/empty-root-constants` → `main` · +1 −1 · 1 files · 1 commits · closed without merging Fixes the access violation reported in #3445. The test's shader has no user data, so it built an empty `Vec` and passed its dangling pointer (`0x4`) to `SetComputeRoot32BitConstants` with a count of 0. NVIDIA's driver reads the pointer anyway and crashes (`STATUS_ACCESS_VIOLATION` in `nvwgf2umx.dll`); WARP doesn't. This adds `.max(1)` at `memory_tests.rs:731`, matching the root signature (`emit/host.rs:229`) and `emit/host.rs:610`. I kept it to this one line rather than skipping the call in `Host::dispatch`, since that would leave a declared root parameter unset. Tested on an RTX 4060 (driver 610.88): - the test now passes on its own - `cargo test -p victory-shader --no-fail-fast`: 299 passed, 3 failed (the 3 failures are the unrelated ones in #3445) Done with Claude Code's help.
The test's shader has no user data, so it passed an empty Vec to
SetComputeRoot32BitConstants: a count of 0 with Rust's dangling
placeholder pointer (0x4). NVIDIA's driver reads the pointer even with
a count of 0 and faults (STATUS_ACCESS_VIOLATION in nvwgf2umx.dll on an
RTX 4060); WARP doesn't. Size the buffer with .max(1), as the root
signature (emit/host.rs) already declares at least one constant.

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

@⁠oni-swr on GitHub · 2026-11-27 04:27 UTC · original

WARP test report (victory-shader, --lib --locked --no-fail-fast -- --test-threads=1)

OS: Windows 11 Pro 10.0.26200 (build 26200.9974), x64
Host adapter: WARP only (VICTORY_WARP=1 and VICTORY_D3D12_WARP=1; d3d10warp.dll 10.0.26100.9818); no physical GPU used
dxil.dll: Windows SDK 10.0.26100.0, version 1.8.2502.11 (via VICTORY_DXIL)
rustc/cargo: 1.98.1 (48a229cea 2026-09-01)
Base: main 63bcca43c6
Head: 4beefa7c09 (merged onto main, no conflicts, 1 line changed)

pass fail ignored
main 298 4 3
main + PR 298 4 3
  • emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index runs and passes under WARP on both main and the PR (not skipped, not ignored). As the description says, WARP never faulted on the empty-slice pointer, so this run confirms there is no regression on WARP; it cannot reproduce the NVIDIA access violation.
  • The 4 failures are identical on main and on the PR (the synthetic wave-lane tests: a_mask_joined_with_data_at_a_uniform_loop_is_its_number, gathers_at_a_level_match_the_hardware, permutes_mask_high_address_bits_and_divergent_branches, permutes_read_the_lane_named_and_zero_from_lanes_left_out). They are not touched by this change.

Review note: the one-line change .max(1) is consistent with the root-signature constant count the description cites; the only effect is a one-dword all-zero buffer when a shader has no user data. No concerns.

AI-assisted (Claude). Aggregate counts only; no game files used.

**@⁠oni-swr** on GitHub · 2026-11-27 04:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/3465#issuecomment-7209818402) **WARP test report** (`victory-shader`, `--lib --locked --no-fail-fast -- --test-threads=1`) OS: Windows 11 Pro 10.0.26200 (build 26200.9974), x64 Host adapter: WARP only (VICTORY_WARP=1 and VICTORY_D3D12_WARP=1; d3d10warp.dll 10.0.26100.9818); no physical GPU used dxil.dll: Windows SDK 10.0.26100.0, version 1.8.2502.11 (via VICTORY_DXIL) rustc/cargo: 1.98.1 (48a229cea 2026-09-01) Base: main 63bcca43c6a0 Head: 4beefa7c09d6 (merged onto main, no conflicts, 1 line changed) | | pass | fail | ignored | |---|---|---|---| | main | 298 | 4 | 3 | | main + PR | 298 | 4 | 3 | - `emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index` runs and passes under WARP on both main and the PR (not skipped, not ignored). As the description says, WARP never faulted on the empty-slice pointer, so this run confirms there is no regression on WARP; it cannot reproduce the NVIDIA access violation. - The 4 failures are identical on main and on the PR (the synthetic wave-lane tests: `a_mask_joined_with_data_at_a_uniform_loop_is_its_number`, `gathers_at_a_level_match_the_hardware`, `permutes_mask_high_address_bits_and_divergent_branches`, `permutes_read_the_lane_named_and_zero_from_lanes_left_out`). They are not touched by this change. Review note: the one-line change `.max(1)` is consistent with the root-signature constant count the description cites; the only effect is a one-dword all-zero buffer when a shader has no user data. No concerns. AI-assisted (Claude). Aggregate counts only; no game files used.
Author
Owner

@⁠upipibi on GitHub · 2026-11-27 04:29 UTC · original

Confirmed on an RTX 3070 8 GB (Ampere), driver 616.56, Windows 11. This is the crash we have been skipping in every VIctory run (#2571).

cargo test --locked -p victory-shader --lib emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index -- --exact --test-threads=1, each tree in its own target dir:

  • main 63bcca4: the process dies with 0xc0000005.
  • this PR 4beefa7: 1 passed, 0 failed in 3 of 3 runs, with no skip line, so both the hardware and the WARP pass ran.

Full cargo test --locked -p victory-shader --lib -- --test-threads=1 on this PR, with nothing skipped: 299 passed, 3 failed, 3 ignored. The 3 failures are the ones already on main here: a_heap_buffer_read_by_element_takes_the_views_stride and a_heap_buffer_read_where_no_buffer_view_is_reads_zeros (#1835), and gathers_at_a_level_match_the_hardware (#2323). On main the suite cannot finish without skipping this test.

I checked the cited lines: the root signature declares user_data_dwords().max(1) constants (emit/host.rs:229), and the FMad probe pads its user data the same way (:610).

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

**@⁠upipibi** on GitHub · 2026-11-27 04:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/3465#issuecomment-7209845953) Confirmed on an RTX 3070 8 GB (Ampere), driver 616.56, Windows 11. This is the crash we have been skipping in every VIctory run (#2571). `cargo test --locked -p victory-shader --lib emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index -- --exact --test-threads=1`, each tree in its own target dir: - `main` `63bcca4`: the process dies with `0xc0000005`. - this PR `4beefa7`: 1 passed, 0 failed in 3 of 3 runs, with no skip line, so both the hardware and the WARP pass ran. Full `cargo test --locked -p victory-shader --lib -- --test-threads=1` on this PR, with nothing skipped: 299 passed, 3 failed, 3 ignored. The 3 failures are the ones already on `main` here: `a_heap_buffer_read_by_element_takes_the_views_stride` and `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros` (#1835), and `gathers_at_a_level_match_the_hardware` (#2323). On `main` the suite cannot finish without skipping this test. I checked the cited lines: the root signature declares `user_data_dwords().max(1)` constants (`emit/host.rs:229`), and the FMad probe pads its user data the same way (`:610`). AI-assisted (Claude Code, Claude Opus 5.5).
Author
Owner

@⁠kalberts0089-hash on GitHub · 2026-11-27 04:50 UTC · original

Heads-up: I've since found this overlaps with #2739 (same .max(1) at line 731, plus 269/461/597) and the host-level fixes in #2587, #2596 and #3226, which cover all callers. Happy for this to be closed in favour of whichever approach you prefer. The diagnosis and the RTX 3070 confirmation above should apply to all of them.

**@⁠kalberts0089-hash** on GitHub · 2026-11-27 04:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/3465#issuecomment-7210143356) Heads-up: I've since found this overlaps with #2739 (same `.max(1)` at line 731, plus 269/461/597) and the host-level fixes in #2587, #2596 and #3226, which cover all callers. Happy for this to be closed in favour of whichever approach you prefer. The diagnosis and the RTX 3070 confirmation above should apply to all of them.
github-bot closed this pull request 2026-11-27 11:20:39 +00:00
Author
Owner

@⁠kalberts0089-hash on GitHub · 2026-11-27 11:15 UTC · original

Closing in favour of the host-level fixes (#2587, #2596, #3000), which cover every caller; this one only covered one. Thanks upipibi and oni-swr for testing it.

**@⁠kalberts0089-hash** on GitHub · 2026-11-27 11:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/3465#issuecomment-7216855505) Closing in favour of the host-level fixes (#2587, #2596, #3000), which cover every caller; this one only covered one. Thanks upipibi and oni-swr for testing it.

Pull request closed

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!3465
No description provided.