Repository navigation
Shaders: a buffer descriptor made raw from first-lane reads needs its waterfall (#2867) - #2869
BastienRodz wants to merge 1 commit into
Conversation
… waterfall `descriptor` traces a buffer descriptor made raw before a byte access (stride cleared, records times stride, bounds in bytes) to the words it was made from. When those are `v_readfirstlane_b32` results, `classify` takes them as each lane's own. But `track` looked for first-lane reads in the access's own SGPRs, where dwords 1-3 are the s_and/s_mul/s_or results, so it found none and proved no waterfall loop. With no loop the console uses the first lane's buffer in every lane, yet each lane read its own. `first_lane_words` now reads the same words as `descriptor` (the new `words`). With no loop the access is refused, as other first-lane reads are. Inside a waterfall loop the proof now holds and the loop runs in one pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kotekompotek
left a comment
There was a problem hiding this comment.
Consistent with #2831's model: a buffer descriptor made raw is traced through the RAW words everywhere else, so first_lane_words using words() (which applies made_raw) keeps the waterfall analysis on the same terms the classify path sees. Clean refactor. LGTM.
|
Windows run of this head (
|
|
Reviewed and verified
Looks clean and ready to merge. |
|
Local verification on Windows / rustc 1.100.0 / MSVC, no game data, no GPU, no clippy/rustup.
This is independent local verification, not a formal approval. AI-assisted (Hy4 flash). |
|
Automated triage for the maintainers. Merge candidate. This adds CI: passing. Generated by Claude Code |
…-lane reads needs its waterfall (Marvisak#2867)
Dukestar69
left a comment
There was a problem hiding this comment.
Verified on RTX 5090 & WARP against origin/main (63bcca4):
cargo test -p victory-shader --lib resource::tests:: -- --test-threads=1: passed.cargo test -p victory-shader --lib emit::waterfall_tests:: -- --test-threads=1: 5/5 passed on RTX 5090 and WARP.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.
Cleanly keeps waterfall resolution for raw buffer descriptors built from first-lane reads (#2867).
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
fuzeofficlal
left a comment
There was a problem hiding this comment.
Reviewed dee92f59 and verified on RTX 5090 and WARP (git merge-tree against origin/main 63bcca43 is clean): extracting Tracer::words cleanly keeps first_lane_words and Tracer::descriptor aligned on the same made_raw-unwrapped dwords, enforcing waterfall validation for raw buffer descriptors built from v_readfirstlane_b32 while preserving !inst.name().contains("format") and existing loop checks.
Verified locally on Windows 11 x64 (dee92f59):
cargo run --locked -p xtask -- policy(190 files ok) andcargo clippy --workspace --all-targets -- -D warnings(default and--all-features): clean.resource::tests(36/36),emit::lower::tests(33/33), andemit::waterfall_tests(5/5 on both RTX 5090 andVICTORY_WARP=1): all passed.
One tiny comment note: at resource.rs:3546, removing only the back edge keeps the compare and EXEC narrowing in place, so the first matching lanes access the buffer while the remaining lanes lose their retry (NO_LOOP).
What's wrong
Tracer::descriptortraces a buffer descriptor made raw before a byte access (made_raw, the FidelityFX compiler's pattern) through the words it was made from. When those words arev_readfirstlane_b32results,classify→per_lanetraces them as each lane's own descriptor (Source::Fetched).first_lane_words, which decides whethertrackmust prove a waterfall loop, looked at the access's own SGPRs instead. There, dwords 1-3 are the results ofs_and_b32,s_mul_i32ands_or_b32. It found no first-lane reads, so no proof ran and a first-lane read outside any loop went through as per-lane.In a GPU run of such a program under vkd3d-proton (each lane loads the V# of entry
(lane & 1)), odd lanes read the second buffer:[100, 201, 102, 203, ...]. The console gives lane 0's buffer to every lane:[100, 101, 102, ...].RDNA2 ISA:
What the fix does
The new
Tracer::wordsgives the descriptor words that tracing follows, the made-raw swap included.descriptorandfirst_lane_wordsboth use it, sotracksees the first-lane reads the source is traced to.The results:
a_first_lane_read_outside_a_loop_is_no_waterfall).Tests
New
resource::tests::a_buffer_descriptor_made_raw_after_its_first_lane_read_needs_a_waterfall:left: 0, right: 2.Fetched.Results, under Wine with vkd3d-proton:
resource::tests(36),emit::waterfall_tests(5, GPU) andemit::lower::tests(33) pass.victory-shaderlib was run one test per process, with the fix and with onlyresource.rsreverted. The results are identical except for this test: 255 ok, 14 failed, 2 crashed and 3 ignored with the fix. The failures and crashes are the same host quirks on both builds.cargo clippy --workspace --all-targets --locked -- -D warningsis clean.It touches the same file as #2831 (first-lane reads reaching
classifythrough a select, a phi or a copy back), and the two merge cleanly.Not tested
Fixes #2867
No game data. Found and written with AI assistance (Claude Code), reviewed and run locally.
🤖 Generated with Claude Code