Shaders: DS ops in a program without LDS read 0 and drop writes #1500
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1501"
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 ruvenesh on 2026-11-24T18:33:11Z.
When a compute or mesh program allocates no LDS, its
ds_read*,ds_write*and modelledds_*atomics now translate instead of failing the whole shader.Why: on the console an out-of-bounds LDS access reads 0 and drops its write (the rule the in-bounds path's comment already states). A program that allocates no LDS has every access out of bounds, so refusing it was stricter than the hardware.
Tests:
emit::ds_without_lds_tests(any host): lowers ds_write/ds_read, read2_b32, read_b128, add_rtn_u32 and add_u32 with and without LDS. Checks that ds_read_u8 and ds_add_f32 still refuse with their usual reasons.valu_tests::ds_ops_without_lds_read_zero_and_drop_writes(Windows, needs an SM 6.6 device or WARP): sets a nonzero address, writes a value there and reads it back, then asserts 0. It passed under vkd3d-proton on an RTX 3060.cargo clippy --workspace --all-targets --locked -- -D warnings(with and without--all-features) andcargo xtask policypass.Note: #292 also edits
Lower::ds.lower.rsmerges cleanly with it; only the appended tests invalu_tests.rswould need both kept.Note: with #189 (Wave64 emulation),
s.lds_dwordsalso counts emulation scratch, so the check here must test the title's own allocation (title_lds_dwords). Whichever lands second needs that one-word change. I've run that combination in the title and can rebase either way.🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by marquezinii on 2026-11-24T18:48:08Z.
Ran on an RTX 5070 (desktop, driver 621.40, the only adapter), Windows 11 26300, Rust 1.98.1 at
5b390ef.cargo test -p victory-shader --lib -- --test-threads=1 --nocapturegives 123 passed, 0 failed, 1 ignored. The newds_without_lds_testspass, and no hardware test was skipped; the only skips are the fourdiff_teststhat need the console compiler. Limiting this to compute and mesh, which size their own LDS, and keeping the refusal for stages whose LDS carries ring data seems the right scope.Imported from Marvisak/VIctory. Originally posted by sinan-cmyk on 2026-11-24T20:13:12Z.
Offline measurement on a retail dump, and the shader tests on Ada
Result: no count change against
main.Offline. I merged head
5b390efontomainffe310e(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 21,724 onmain, 21,724 with this PR.One program moves from "LDS the program does not allocate" to "an LDS operation".
Tests: with the same merge,
cargo test --locked -p victory-shader --libpassed 123, failed 0. The bitcode benchmark is ignored, as onmain, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, withVICTORY_WARPunset.No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by ruvenesh on 2026-11-25T01:28:25Z.
Closing this. The one program in the title it unblocked (a compute shader refused at a single DS instruction) turns out to stop at a
ds_bpermute_b32, which uses the DS crossbar and not LDS memory. #573 lowers that instruction before the LDS-size check, so #573 alone translates it and this change adds nothing for the title. That matches @sinan-cmyk's measurement (no count change). Thanks to @marquezinii and @sinan-cmyk for testing.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:29:53Z.
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:crates/victory-shader/src/emit/lower.rs,crates/victory-shader/src/emit/valu_tests.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
upstream-sync referenced this pull request2026-11-25 10:07:41 +00:00
Pull request closed