Shaders: handle dead mask dwords at data joins and wave-uniform s_bcnt1 SCC #1269
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!1269
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1269/head"
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?
@Sakura-Byte on GitHub · 2026-11-24 16:58 UTC · original
Sakura-Byte:pr/mask-dword-joins-878→main· +744 −7 · 2 files · 1 commits · closed without mergingFixes #878.
Summary
fill_phis): When a scalar register previously held a lane-mask dword before being overwritten on the live data path, the dead mask dword incoming edge at aphithat has at least one live scalar data (Val::I32) predecessor now lowers toundefon the mask edge rather than failing the whole join as a mask read, while mask-only joins continue to be rejected.s_bcnt1and mask SOP ops (mask_sccs,mask_any,mask_any_in):s_bcnt1_i32_b32(Wave32) /s_bcnt1_i32_b64(Wave64) on tracked lane masks,saveexecforms, and mask-writing SOP ops.getor acrossReg::Sccphis infill_phis) asdx.op.waveActiveBallot(...) != 0so SCC stays wave-uniform on Wave32 and Wave64 without per-lane divergence (avoiding the Wave32scc_laneregression noted on the earlier attempt).s_bcnt1's scalar destination rejected inMaskData::Noneand rejects mismatched-widths_bcnt1_i32_b32in Wave64 programs.Files Changed
crates/victory-shader/src/emit/lower.rs:mask_sccs,is_mask_value,mask_scc_source,mask_any,mask_any_in, updatedget/fill_phis, and synthetic DXIL/WARP tests (mask_dword_at_data_join_emits_undef_and_rejects_mask_only_joins,s_bcnt1_scc_only_translates_while_numeric_popcount_still_fails,s_bcnt1_scc_branch_stays_wave_uniform_on_warp).crates/victory-shader/src/emit/bitcode.rs:#[cfg(test)]inspection helpersModule::func_namesandModule::inst_lines.Verification
Ran cleanly on clean
origin/main(ffe310e):cargo xtask policy:asset policy: 154 files okcargo clippy --workspace --all-targets --locked -- -D warnings: passed (0 warnings)cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passed (0 warnings)VICTORY_D3D12_WARP=1 VICTORY_WARP=1 cargo test -p victory-shader --locked -- --test-threads=1:123 passed; 0 failed; 1 ignored(only the existing release-only benchmarkemit::bitcode::tests::bench_writeis ignored;dxil.dllvalidation ran; ins_bcnt1_scc_branch_stays_wave_uniform_on_warp, the Wave32 Mesh shader executes end-to-end on WARP checking[0.75, 0.75, 0.75, 1.0], and the Wave32 Compute shader verifiesdx.op.waveActiveBallot,cmp:33 ... k0(!= 0), anddxil.dllvalidation while skipping fixed[WaveSize(32)]PSO creation on WARP which returnsE_INVALIDARG).AI-assisted; synthetic tests only, zero game assets.
@pablogonz12 on GitHub · 2026-11-24 17:03 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 is broken without it (E0425 host_resourceinvictory-gpu), so the base is that pair. Ran the four-stage offline check (translate, dxil-spirv, spirv-val, RADV pipeline) over 768 programs: the 751-program world dump plus a 52-program BVH capture, 35 duplicate containers skipped.No program gained or lost. The only difference in the failure table: two compute programs that read a lane mask as data now report "a lane mask holding lanes elsewhere read as data" instead of "a lane mask read as data", which is the new distinction working. No new failure, same 10 SPIR-V validation failures as the base.
Not tested: in-game.
@rafaconvaitis on GitHub · 2026-11-24 17:13 UTC · original
I replayed the two mesh-shader containers reported as the largest and packed drops in the recent update-9 run on #293. Both runtime hash prefixes resolved in the local shader archive. Here is the direct comparison on Windows 11 build 26300 with the RTX 4070 selected explicitly.
ffe310e8c3092fc42cbb0ef5409053e14aa82235e56869c1ea883#1269 gets the first program past the lane-mask refusal. Adding #953 makes both reach the remaining descriptor-data case tracked in #798. Both still stop before DXIL validation or D3D12 PSO creation in the tested builds. These are offline translation results, so the in-game dropped-draw counts remain unmeasured for the stack.
AI-assisted test harness and reporting.
@Marvisak on GitHub · 2026-11-25 00:36 UTC · original
Automated triage for the maintainers. Closing because this change is already in
main, ormainhas since replaced the code it patches.Stale mask dwords at data joins and bit counts of masks in mesh programs are both handled in main (dead_on_edge/live_edges/joins_loaded in fill_phis; host-wave bit count for mesh). This version gives the mask edge undef whenever another edge carries data, which is the unsound shortcut main moved away from.
If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed