Shader tests: an empty root-constant list is set as the one constant it declares (#2571) #2596
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2596
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2596"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Creaa on GitHub · 2026-11-25 16:25 UTC · original
Creaa:shader-tests/root-constants-empty-list→main· +16 −12 · 1 files · 1 commits · openheap_direct_texture_reads_mark_their_heap_indexkilled thevictory-shadertest process on hardware GPUs because the test harness set root constants as 0 values through an emptyVec'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: indispatch(compute) and the graphics dispatch,Root::Constantswith no values is set as[0].fuses_fmadalready sized its constants withmax(1).Tested
main67e8ae1.cargo test -p victory-shader --lib --locked heap_direct_texture_reads_mark_their_heap_index: onmain0xC0000005 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: onmain507 passed, 2 failed, 6 ignored, and thevictory-shadertest 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 onmain(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
AI use
🤖 Generated with Claude Code
@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_indexalone on hardware:main67e8ae10xc0000005); withVICTORY_WARP=1it passes577839acargo test --locked -p victory-shaderat577839a: 267 passed, 3 failed, no crash. The 3 arestride_tests::a_heap_buffer_read_by_element_takes_the_views_stride,stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zerosandsynthetic_tests::gathers_at_a_level_match_the_hardware, which fail the same way on940d32fon this card (the #1744 NVIDIA failures). Onmain67e8ae1the 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.
@oni-swr on GitHub · 2026-11-25 16:49 UTC · original
Verification of
577839a(CPU-only; D3D12 tests deliberately not run)origin/main(67e8ae1).cargo test -p victory-shader --lib --no-run: builds.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.victory-shader's test host does not honorVICTORY_D3D12_WARP(it usesVICTORY_WARP=1or the hardware adapter, so tests callingHost::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.&[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 --checkon 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 twoRoot::Constantsarms ofemit/host.rs. They are duplicates, andgit merge-treeof the two heads reports a conflict in that file. (Edited: when I first reviewed #2587 at8ceeb01it skipped the call instead. Its headdf8ee8enow 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.
@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
main13f91ca+ this PR (577839a).cargo test -p victory-shader:mainaborts with0xc0000005atemit::memory_tests::heap_direct_texture_reads_mark_their_heap_indexand 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 tomain(dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_views). No change from this PR.@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
13f91caon this card: the victory-shader lib run dies withSTATUS_ACCESS_VIOLATION(0xc0000005) atemit::memory_tests::heap_direct_texture_reads_mark_their_heap_index, the same crash as #2571. The test passes on its own withVICTORY_WARP=1, so only the hardware path crashes.With this PR:
cargo test -p victory-shader --lib --locked -- --test-threads=1heap_direct_texture_reads_mark_their_heap_index ... ok, on the hardware adapterstride_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 main940d32fbefore 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).
@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 declaresuser_data_dwords().max(1)constants, butHost::drawandHost::dispatchset an emptyRoot::Constantsas 0 values through an emptyVec'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:
checkpassing. Merges cleanly into currentmain. A recommendation to look at it, not an approval.Generated by Claude Code
@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)
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.