Shaders: a test for LDS accesses outside the program's shared memory #1920
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!1920
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1920"
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-29 02:37 UTC · original
DiosET3RN0:lds-bounds-test→main· +48 −0 · 1 files · 1 commits · openFollows up on #118 (closed for conflicts;
mainhas had its own LDS bounds since64d4931, so this does not resend that change). No issue.What it changes
The LDS bounds in
ds(VICTORY_LDS_BOUNDS, on by default) have no test: nothing in the tree runs an LDS access outside the program's shared memory. This adds one, inemit/valu_tests.rsonly (+48 lines, no change outside the test).ds_outside_the_programs_lds_reads_zero_and_drops_writes: one compute program with 512 bytes of LDS writes, reads back and adds (ds_add_rtn_u32) at an address inside (bytes 4 and 508) and outside (512, 0x10000, 0xFFFFFFFC), and returns what it read plus the first and the last dword. Outside it must read 0, leave out the write and the add, and return 0 from the add.The last dword is in the sum on purpose: a place outside is given as the last dword inside, so a write or an add that was not left out would land there and the first dword would not show it.
The test returns early with
VICTORY_LDS_BOUNDS=0. It covers a plain compute program only, not the face programs that are exempt by default nor the mesh programs of #1816.How it was tested
main(568c5e5) has no test of this.cargo test -p victory-shader --locked --no-fail-fast: 396 passed, 0 failed, 8 ignored, the new test included.insidemade always true inds(so nothing outside is left out), the new test fails at byte 0x200 with 128 instead of 200: the write landed on the last dword.WaveSize(32), which WARP refuses, so hardware only).cargo testpassed for the crates it touches: yes.cargo clippy -p victory-shader --all-targets --locked -- -D warningsstops atmain's ownlower.rs:2356(manual checked division, #1855); nothing invalu_tests.rs.Checked for overlap
limitand add no test; #1623, #1538, #978 and others append tovalu_tests.rselsewhere (this one appends at the end of the file).AI-assisted: yes (Claude Code)
🤖 Generated with Claude Code
@Dukestar69 on GitHub · 2026-11-29 03:34 UTC · original · approved these changes
Tested locally merged onto
main(568c5e5).crates/victory-shader/src/emit/valu_tests.rs.cargo test -p victory-shader --lib emit::valu_tests::ds_outside_the_programs_lds_reads_zero_and_drops_writespassed (1 passed; 0 failedin 0.40s).cargo test -p victory-shader --lib emit::tests::passed (23 passed; 0 failed; 1 ignored).Clean GPU regression test verifying out-of-bounds LDS reads return zero and writes are dropped. LGTM.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@tupacfan04 on GitHub · 2026-11-29 06:25 UTC · original
Ran this on an RTX 5070 12 GB (driver 621.40, 32-lane waves, Windows 11), cherry-picked onto main
e1f2eb6plus #1939:Passes here. The expected values check out when worked by hand (inside the memory, the last dword, and outside it), and guarding the last dword against a clamped write is a good catch.
Same note as on #1928: it prints nothing on success, so "ran on the card" is inferred from the missing "skipped" line. A final "ran on the hardware device" print would make that certain. It is also skipped under
VICTORY_LDS_BOUNDS=0, which is fine but worth a word in the description.🤖 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.