Shaders: LDS accesses past the program's allocation read 0 and drop writes #118
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!118
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-118"
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?
@DiosET3RN0 on GitHub · 2026-11-27 18:24 UTC · original
DiosET3RN0:lds-bounds→main· +92 −11 · 3 files · 1 commits · openWhat
dslowering assumes every LDS address is in bounds(
shortcut: LDS addresses are taken as dword-aligned and in bounds). On theconsole an access past the program's LDS reads 0 and drops the write; in DXIL
an out-of-range
groupsharedindex is undefined behaviour.It matters more on 32-lane (NVIDIA) hosts: the translator puts its own dwords
right after the program's LDS (lane exchange, halves, pairs, and the
ticketof #30), so a title overflow lands on exactly the words the wave64-on-32
lowering depends on.
How
Shader::lds_title_dwords: the LDS size the console program declares, setwhere
lds_dwordsis set for CS and MS, before the layer's own dwords are added.ds, each dword access checksindex < lds_title_dwords, uses an indexclamped into range, and: reads give 0 out of range; writes are guarded per
dword; atomics (
ds_add…,cmpst,min/max_f32) do not run and return 0(lanes switched off by EXEC keep their value, as before).
shortcut:.translations are redone on their own.
3 files, +92/−11. Same change as avatarmanz/VIctory-7900XTX#336.
Tests
New GPU test
ds_past_the_program_lds_reads_zero_and_drops_writes(512-byteLDS; addresses 4 and 508 in bounds; 512, 0x10000 and 0xFFFFFFFC out).
On an RTX 4060 8 GB (32-lane waves), Windows 11, driver 621.24, Rust 1.98.1:
cargo test -p victory-shader --locked --no-fail-fast:main288 passed,0 failed; this branch 289 passed, 0 failed (the new test included).
0x200, the first out-of-range access.
cargo clippy -p victory-shader --all-targets --locked -- -D warnings: clean.Not run in the game (no game files on this machine). It should change nothing
for programs that stay inside their LDS.
AI-assisted: yes (Claude Code)
🤖 Generated with Claude Code
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.