Shaders: a buffer descriptor made raw from first-lane reads needs its waterfall (#2867) #2869
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2869
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2869"
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?
@BastienRodz on GitHub · 2026-11-25 22:46 UTC · original
BastienRodz:shader/made-raw-first-lane-waterfall→main· +70 −10 · 1 files · 1 commits · openWhat'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
@BastienRodz on GitHub · 2026-11-25 22:51 UTC · original
Windows run of this head (
dee92f5, onmain219878a) onwindows-latest, WARP,cargo test --workspace --locked --no-fail-fast -- --test-threads=1: https://github.com/BastienRodz/VIctory/actions/runs/45716155770victory-shaderlib: 303 passed, 0 failed, 3 ignored, includingresource::tests::a_buffer_descriptor_made_raw_after_its_first_lane_read_needs_a_waterfalland everywaterfall_testsGPU test.@fuzeofficlal on GitHub · 2026-11-25 22:54 UTC · original
Reviewed and verified
dee92f59on Windows 11 (RTX 5090 + WARP +dxil.dll) againstmain(842b0cb):Tracer::words(inst, op)cleanly shares themade_rawunwrapping betweenTracer::descriptorandfirst_lane_words, catchings_bfe/s_max/s_and/s_mul/s_or-rebuilt raw descriptors fromv_readfirstlane_b32while keeping!inst.name().contains("format")and all-4-words matching consistent.a_buffer_descriptor_made_raw_after_its_first_lane_read_needs_a_waterfall1/1,resource::tests36/36,emit::waterfall_tests5/5 (RTX 5090 + WARP +dxil.dll),cargo clippy --locked -p victory-shader --all-targets -- -D warnings0 warnings,cargo xtask policy(190 files ok;emit/lower.rsuntouched at520,563bytes).Looks clean and ready to merge.
@cloph-dsp on GitHub · 2026-11-25 23:04 UTC · original
Local verification on Windows / rustc 1.100.0 / MSVC, no game data, no GPU, no clippy/rustup.
cargo test --locked -p victory-shader resource::tests::a_buffer_descriptor_made_raw_after_its_first_lane_read_needs_a_waterfall --quiet-> 1 passed, 305 filtered out.cargo test --locked -p victory-shader resource::tests --quiet-> 36 passed, 0 failed.git diff --checkagainst merge-base219878aclean; the PR changes 1 file, +70/-10 (crates/victory-shader/src/resource.rs).words()helper is exercised with synthetic ISA word arrays only.This is independent local verification, not a formal approval.
AI-assisted (Hy4 flash).
@Marvisak on GitHub · 2026-11-26 04:25 UTC · original
Automated triage for the maintainers.
Merge candidate. This adds
Tracer::wordssodescriptorandfirst_lane_wordsboth see the words a made-raw buffer descriptor is built from; before,tracklooked at thes_and/s_mul/s_orresults, found no first-lane reads and skipped the waterfall proof whileclassifytraced each lane's descriptor.made_rawreturns the originalv_readfirstlane_b32words, so the loop's compares now match whattrackcollects. The fix is backed by the ISA reference and the GPU run in the description, and the test checks both outcomes (looped form proven; without the back edge, refused).CI: passing.
Generated by Claude Code
@kotekompotek on GitHub · 2026-11-25 22:50 UTC · original · reviewed
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.
@Dukestar69 on GitHub · 2026-11-26 09:50 UTC · original · approved these changes
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 on GitHub · 2026-11-26 11:18 UTC · original · approved these changes
Reviewed
dee92f59and verified on RTX 5090 and WARP (git merge-treeagainstorigin/main63bcca43is clean): extractingTracer::wordscleanly keepsfirst_lane_wordsandTracer::descriptoraligned on the samemade_raw-unwrapped dwords, enforcing waterfall validation for raw buffer descriptors built fromv_readfirstlane_b32while 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).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.