Shaders: a root view read by index drops lanes whose index is out of range #3670
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3670"
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?
Imported from Marvisak/VIctory. Originally posted by ZeOs360 on 2026-11-28T05:10:34Z.
What
A buffer descriptor that a program builds around a root SRV or UAV with
idxen(num_records -1)was translated as root address + index × stride, with no range check. With OOB_SELECT 0 or 1 (V#
dword 3 bits 28-29) the console checks the index against num_records first. An index of -1 is
therefore out of range there:
The ray-tracing builder's pass
5552dac6a2b7a1fdstores through such indices (#3486):idxenstores at 0x14cc, 0x1834, 0x1d3c and 0x213c, stride 4. Here the index wrapped to the record before
the root address instead. In a program that uses title memory, the 32-bit offset (-stride) went onto
the 48-bit root address, so that address is one stride short of 4 GiB past the root
(
off=0xfffffffcin #3486). That region was then marked missed.This PR adds the check in the root-view
idxenarm ofLower::buffer:Not covered:
shortcut:;offenare not affected, such as that pass's atomic at 0x70c, which also reachedoff=0xfffffffcin some runs.Other buffer accesses get no new code, and neither does a constant index in range. The modes follow
Mesa's GFX10 description (
ac_descriptors.c: 0 = index ≥ NUM_RECORDS or offset ≥ STRIDE, 1 = index≥ NUM_RECORDS, 2 = NUM_RECORDS = 0, 3 = offset ≥ NUM_RECORDS).
Tests
emit::memory_tests::root_views_by_index_drop_lanes_out_of_range: 32 lanes, index = lane − 1 (lane 0at -1), a root UAV with stride 16, run through the host's view of a root UAV's copy and as title
memory:
It passes on an RX 7800 XT and on WARP, and failed before the change:
In-game (RX 7800 XT, with ray tracing through the open RT PRs #2098 #2118 #2703 #2841 #2810 #2501 on
top, 10-minute runs, counted with a local diagnostic that logs missed title-memory writes):
off=0xfffffffcfrom those four stores went from 6, 8, 6 and 5 infour runs without this change to 0 with it.
Those come from a wave64 lane mask; #3023 (with #2836's change) fixes the ones that start early.
off=0xfffffffcsites were 0 in three runs (one ended at 5 minutes at a knowntitle fault).
idxenstores of the same pass (0x2e8c, 0x3198),which this check covers, and one at the pass's
offenatomic (offset -4, not an index), which itdoes not.
So the check still matters there, and for any program that accesses index -1.
trustno1-coder/VIctory-NVIDIA#690 (@Machad3x) runs the same check (for OOB_SELECT 1) in their tree.
AI-assisted: written by Claude Code (Claude Opus 5.5) and reviewed by Gemini 4 Neon;
the GPU tests and in-game runs were made on my machine.
Imported from Marvisak/VIctory. Originally posted by ColorMeBoom on 2026-11-28T07:07:13Z.
Hardware run: RX 5700 XT (Navi 10, RDNA1, 32–64 lanes, driver 32.0.21045.29003, Windows 11 26200), head
72d31b7on63bcca4.root_views_by_index_drop_lanes_out_of_rangepasses on the hardware adapter and on WARP; neither was skipped.victory-shader --lib --features host: 303 passed, 0 failed, 3 ignored.AI use: Claude Code (Claude Opus 5.5).
Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-28T08:45:40Z.
NVIDIA row for this PR: it passes on Ampere.
RTX 3070 (desktop), driver 616.56, Windows 11 Pro 10.0.26100, debug. Head
72d31b7on main63bcca4(fast-forward, clean).root_views_by_index_drop_lanes_out_of_range: 1 passed, 0 failed, in 3 of 3 runs. It ran on both the hardware adapter and WARP: no "skipped" line.cargo test --locked -p victory-shader --lib -- --skip heap_direct_texture_reads_mark_their_heap_index:63bcca4: 298 passed, 3 failed, 3 ignored.The 3 failures are the same on both:
stride_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. The skipped test crashes the binary on this card on both trees (0xc0000005, open issue #2571).Not tested: a title run.
AI-assisted (Claude Code, Claude Opus 5.5).
Imported from Marvisak/VIctory. Originally posted by pickles976 on 2026-11-28T14:10:06Z.
Verified on physical RTX 4060 Laptop (8 GiB), NVIDIA 590.48.1, Linux 6.17 / Wine 11, 16 GiB system RAM.
Exact production head
72d31b7f563d9de79cca0e151283c97d27a82f71:root_views_by_index_drop_lanes_out_of_rangepasses 1/1, with both copy-backed and title-memory GPU dispatch/readback paths. Test-only strengthening requires the SDK DXIL validator and an actual NVIDIA adapter; the WARP-requested duplicate was excluded because Wine maps it to hardware here. No optional-device skip. Fresh intended-worktree compilation: 6.18 s; test: 1.38 s.Also ran the same synthetic instructions/assertions on our existing dirty runtime integration (base
3ed7d725f6895fe1a235eb6fa8ff2485261ca151, including updated #2633 and prior disclosed memory/rendering fixes). Before your production change: 0/1 FAIL, copy-backedatomic returns and loadsbegins[4109,4110,...]rather than[0,0,...]. It stops at that first assertion, so this is not a separately observed title-memory-path failure. The test port only adds the current API'shost_wave32: truefield for this actual 32-lane host; it does not force a Wave64 title program to Wave32.After porting only this PR's
lower.rscorrection into that same integration: 3/3 pass (root_viewspluswrites_through_views_mark_their_pages), including both paths of the new regression. Fresh compile 7.36 s, tests 2.21 s. Existing root descriptor addressing and GPU page-write marking remain covered. Peak sampled GPU use 175 MiB, minimum available RAM 10,716 MiB; external guards unchanged.Important limits: these are synthetic shader dispatch/readbacks, not execution of the original BVH shader, a title run, or proof this fixes our NVIDIA Xid109 context-switch timeout. OOB_SELECT=0 offset-vs-stride and ADD_TID_ENABLE limitations remain as documented in the PR. The before/after integration is not a clean main comparison.
All GPU runs use the disclosed diagnostic vkd3d-proton
2576c0b4adfae4a+build (relaxed XCL native-vtable assertions), DXVK NVIDIA masking disabled; not stock-vkd3d certification.Reproduction:
cargo test --locked --target x86_64-pc-windows-msvc -p victory-shader --lib -- root_views writes_through_views_mark_their_pages --nocapture --test-threads=1through our Wine wrapper. Exact-head invocation selected only the new regression.Local evidence:
verify-pr3670-root-index-nvidia-20261128T140605Z/verify-mixed-root-index-control-20261128T140721Z/verify-mixed-pr3670-root-bounds-20261128T140810Z/No title assets or shader dumps attached. AI-assisted verification using OpenAI Codex.
Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-28T21:55:58Z.
AMD Radeon 780M (RDNA3) + WARP, Windows 11, head
72d31b7. Before (main63bcca4+ this PR's test): fails on the hardware adapter, lanes 0-1 return 4109 and 4110 where 0 is expected ("title memory false: atomic returns and loads"), the other 63 lanes match. After: passes, 5 of 5 runs. Full suite: 552 passed. AI-assisted (Claude).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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.