Repository navigation
Shaders: handle dead mask dwords at data joins and wave-uniform s_bcnt1 SCC - #1269
Sakura-Byte wants to merge 1 commit into
Conversation
…t1 SCC Allow dead lane-mask dwords reaching a scalar data join (from register reuse after the mask dies) to lower as undef on that incoming edge rather than rejecting the join, while still rejecting mask-only joins. Also track wave-uniform SCC results from s_bcnt1_i32_b32/b64 (matching program wave width) and mask-writing SOP ops when their scalar count is unread or cannot be lowered as numeric data (such as Mesh MaskData::None), lowering SCC via waveActiveBallot != 0 without per-lane Wave32 popcount divergence.
|
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
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. |
catminou4
left a comment
There was a problem hiding this comment.
Dead mask dwords at data joins emit undef instead of a stale ballot, scalar ops writing tracked masks (and s_bcnt1 testing them) get their SCC mapped back to the mask's low dword (saveexec forms map EXEC's new value), so wave-uniform SCC branches on masks translate. Structure tests for the join/undef and s_bcnt1 SCC cases run on macOS. Local verification: macOS arm64, rustc 1.98.1, PR head merged into main ffe310e, cargo test -p victory-shader --locked. Shader execution tests (valu_tests/host) are #[cfg(all(test, windows))], so macOS covers lowering/decode/unit tests only. 98 passed, 0 failed. Note: adds the same #[cfg(test)] op_names/insts helpers as #1275 — the second of the two to land will conflict textually.
|
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.
#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. |
Conflicts kept both sides: the split execute/submit (breadcrumbs cleared at the start of submit), the debug pixel shader and the breadcrumb stage notes, the view-heap-cap and wave keys of the shader cache with the breadcrumb key, and the single-exit block with the breadcrumb loops. Tests added by Marvisak#1084/Marvisak#1130/Marvisak#1269 initialise Parts with crumbs: None. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Automated triage for the maintainers. Closing because this change is already in 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. |
Fixes #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.