Shaders: ignore pre-loop table loads when proving waterfall offsets #1253
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!1253
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1253"
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?
@mgunes1311-lab on GitHub · 2026-11-24 16:49 UTC · original
mgunes1311-lab:shader-waterfall-scaled-offset→main· +59 −9 · 2 files · 7 commits · openSummary
Fixes
resource::trackso a uniforms_load_dwordx4executed in an earlier basic block with an offset derived fromv_readfirstlane_b32does not get recorded in a later waterfall loop block'soffset_atread set and cause the waterfall proof to fail.Root Cause
In
resource::track, when an instruction inside basic blockbconsumes aSource::Loaded { load, .. }descriptor whose scalar load ran in an earlier block (load.0 != b) and whose dynamic offset came fromv_readfirstlane_b32,trackpushed that pre-loop first-lane read intooffset_at[b].1.Tracker::waterfall(block, accesses, reads)requires every read inreadsto reside insideblock(read.0 == block) and feed that loop'sv_cmp_eq_*waterfall mask, so including a pre-loop first-lane read from block 0 rejected a valid waterfall loop in block 1 (for example, when a shader loads a uniform sampler once before the loop and waterfalls a per-lane texture table offset inside the loop).Changes
crates/victory-shader/src/resource.rs:Source::Loadeddescriptor'sfirst_lane_sourcetooffset_at[b]when the scalar load itself ran earlier in the same block (load.0 == b && load.1 < i).loadsalongsidereadsbefore extendingout.waterfall.loads.pre_loop_first_lane_waterfalland unit testa_first_lane_load_before_a_waterfall_loop_stays_uniform.crates/victory-shader/src/emit/waterfall_tests.rs:lanes_sample_the_entry_their_offset_names_in_the_console_waterfallto executepre_loop_first_lane_waterfallend-to-end on DXIL (wave_ops == true,nonuniform_handles == 1).Verification
cargo test -p victory-shader --locked waterfallcargo clippy -p victory-shader --all-targets --all-features -- -D warningscargo run -p xtask -- policy@pablogonz12 on GitHub · 2026-11-24 17:16 UTC · original
Setup: Linux, RX 9070 XT, RADV (Mesa 26.3.1), dxil-spirv master, spirv-val 1.3. Your head folded onto a base of origin/main
ffe310eplus #1017 (main's host build fails without it:E0425 host_resource), then the four-stage offline check over 768 programs (751-program world dump + 52-program BVH capture, 35 duplicate containers skipped).No program gained or lost and the failure table is identical to the base: nothing in this capture reaches the class, so this is a no-regression result only.
Not tested: in-game.
@Marvisak on GitHub · 2026-11-25 01:27 UTC · original · edited 2026-11-25 18:41 UTC
Automated triage for the maintainers.
Needs work (evidence only). In
track(crates/victory-shader/src/resource.rs), aSource::Loadeddescriptor's first-lane offset now counts toward a block's waterfall proof only if its table load ran earlier in that same block (load.0 == b && load.1 < i).waterfall.loadsis also deduplicated. By my reading this is sound. A table load before the loop, with an offset fromv_readfirstlane_b32, runs once and is uniform. Onmain, its read joins the in-loop proof,Tracker::waterfallrejects it, and the image that is waterfalled in the loop falls back to the first lane's entry.a_first_lane_load_before_a_waterfall_loop_stays_uniformand the extendedlanes_sample_the_entry_their_offset_names_in_the_console_waterfallcover this on the GPU. The description now matches the diff, and the trailing-whitespace nit is fixed. CI: passing (check).What is still open: there is no sign the title has this shape. The fixture is hand-written. The earlier 768-program offline check in this thread found no program that changed. Any of these would move it forward:
victory translate --validate --listcomparison on currentmainshowing which programs change.Without that, the change is a correct-looking fix for a case not seen yet. Whether to take it on code reading alone is for the maintainer.
On your reply: thanks for the cleanup. A tester with a capture can supply the comparison, and that is all this needs.
Generated by Claude Code
@mgunes1311-lab on GitHub · 2026-11-25 17:27 UTC · original
Updated:
offset_reads/WATERFALL_SCALED_INDEX_WAVE32text).pre_loop_first_lane_waterfallincrates/victory-shader/src/resource.rs.On title data: this was found by code inspection while auditing
resource::track+Tracker::waterfall, and I don't have a local title shader capture to runvictory translate --validate --listagainst — if a tester with a capture can check whether--validate --listchanges on it, that would confirm whether any title shader hits this pre-loopv_readfirstlane_b32+ loop waterfall combination today.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.