Repository navigation
Conversation
|
I ran an independent synthetic translation check at base
For reproduction, use the synthetic compute setup in |
|
A run on a native wave64 card, to go with the synthetic check above (which forced the host wave size to 64). Setup: Radeon RX 7900 XTX (RDNA3, waves of 32 to 64 lanes), Adrenalin 32.0.32015.7029, i7-13700KF, Windows 10 Pro 22H2 (19045), Rust 1.98.1. Windows 10's in-box D3D12 stops at SM 6.5, so the tree also carries the D3D12 Agility SDK 1.620 (the same approach as #69). The DXIL validator comes from SDK 10.0.26100 ( Base:
The whole workspace with this PR: 507 passed, 0 failed. The base gives 505 passed. |
Problem
On native wave64 hosts (
HOST_MAX_WAVE != 32, e.g. AMD RDNA 3/4), compute shaders that hit aneeds_every_lanerefusal (a wave sum of 16-bit floats where not every lane runsinLower::half_sum, ora lane mask holding lanes elsewhere read as datainLower::mask_dword) fail immediately:Lower::half_sumonly recordedneed(self.cur_ir)whenhalves == true(two-wave32 emulation), skipping native wave64.Lower::mask_dwordonly consideredwhole/need(...)whenself.exchange.is_some(), even though a native wave64 compute shader withthreads % 64 == 0already has all 64 lanes present in everyall_lane_blocksblock.emit::emit()gated its early-out/skip/widen retry path onlower::host_max_wave() == 32, even thoughwiden()already allows native wave64 (!(native.wave64 && lower::host_max_wave() == 32)) and none of these forms adds group barriers on native wave64.As a result,
b22a16a178976e1btranslated cleanly on wave32 hosts (without early-outs) while failing on native wave64 hosts, and926c46bab3b86bd6failed on both.Fix
crates/victory-shader/src/emit/lower.rs:need(self.cur_ir)inhalf_sumon native wave64 as well as wave32 halves.mask_dword, treatall_lane_blocksas whole-wave when lowering native wave64 compute shaders whose thread-group size is a multiple of 64, and recordneed(made)when a mask holding lanes outsideEXECsits in a per-lane region.crates/victory-shader/src/emit/mod.rs:emit_programfails on a native wave64 compute shader withlower::needs_every_lane(what), retrywithout_early_outs,without_skips(false),without_skips(true)(respectingVICTORY_WAVE_DEEP_SKIPS), andwiden()(respectingVICTORY_WAVE_WIDE, no group barriers added).crates/victory-shader/src/emit/wave64_tests.rs:TEST_HOST_WAVE = Some(64)):native_wave64_half_sum_inside_early_out_translates_and_runs_exactnative_wave64_mask_outside_exec_inside_branch_translates_and_runs_exactVerification
cargo test -p victory-shaderon AMD Radeon RX 9070 (RDNA 4): 216 passed, 0 failed (both new tests validated withdxil.dlland executed on hardware GPU).cargo clippy -p victory-shader --all-targets -- -D warnings: pass (0 warnings).cargo xtask policy: pass (169 files ok).VICTORY_HOST_MAX_WAVE=64):a wave sum of 16-bit floats where not every lane runs: 2 → 0 (b22a16a178976e1bvalidates withdxil.dlland creates D3D12 pipeline).a lane mask holding lanes elsewhere read as data: 2 → 0 (926c46bab3b86bd6widens 14 branches with 0 barriers, validates withdxil.dll, and creates D3D12 pipeline).Overlap note
half_sumprograms on native wave64 viahalf_sum_present(without widening early-outs). Themask_dwordwhole-wave fix (926c46bab3b86bd6) and the general native-wave64needs_every_laneretry path inemit/mod.rsare not covered by Shaders: sizes of unused descriptors, paired f16 interpolation halves, 16-bit wave sums with lanes gone (+46 programs) #203 or other open PRs. Happy to rebase/drop thehalf_sumone-liner if Shaders: sizes of unused descriptors, paired f16 interpolation halves, 16-bit wave sums with lanes gone (+46 programs) #203 merges first.AI-assisted (Antigravity); verified locally on AMD Radeon RX 9070. Hashes, counts, and clean-room tests only; no game data.