shader: lower 32-bit scalar operations on wave64 lane-mask halves when read as data #423
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sheffy007 on 2026-11-27T17:37:09Z.
Problem
In world runs on
main(#4 refusal table:9 | 9 | 0 | a lane mask holding lanes elsewhere read as data: written by a scalar instruction of the other width), 9 distinct wave64 compute shaders fail inLower::mask_number(crates/victory-shader/src/emit/lower.rs:2819-2824).structuretracks wave64 lane masks whose low and/or high 32-bit halves are written or updated by 32-bit scalar ALU instructions (s_mov_b32,s_movk_i32,s_not_b32,s_and_b32,s_or_b32,s_xor_b32,s_andn2_b32,s_orn2_b32,s_cselect_b32,s_cmov_b32,s_cmovk_i32, etc.). However:Lower::soptreats every scalar write inst.masksorst.highsas a deferred lane mask (Val::Missing("a lane mask read as data")), and when a consumer later reads either half as data (s_bcnt1_i32_b64,s_ff1_i32_b64,v_mov_b32, uniform joins,lockstep, etc.),Lower::mask_numberrequires_b64and refuses 32-bit SOP writers withwritten by a scalar instruction of the other width.st.highsmapshi -> loone-to-one: when a 64-bit write(lo0, hi0)is followed by a partial 32-bit update(lo1, hi0)of only the low half,st.highs[&hi0]is overwritten withlo1, causingmask_dword(hi0)to inspectlo1's 32-bit writer instead ofhi0's own 64-bit writer.Lower::sop,paironly checkedst.masks.contains_key(&lo)when recordingmask_scc, droppingSCCof a 32-bit mask operation on a high half inst.highs.Plan
dwords == 1, non-EXEC-writing) scalar ALU writers of wave64 mask halves directly inmask_dword(mask_half_number/half_ballots), while keepings_*_saveexec_b32/s_*_wrexec_b32in wave64 and_b64in wave32 refused as before.writes[1]) and high-dword phis against their own paired low value before falling back tost.highs, so partial 32-bit updates tolodo not clobberhi's lookup.mask_sccfor 32-bit mask operations on high-half dwords (self.is_mask(Some(lo))).mask_tests.rsand an end-to-end Metal GPU compute test insplit_wave_tests.rs.Refs #4, #258
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sheffy007 on 2026-11-27T17:37:11Z.
/claim
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-27T17:37:20Z.
Claimed by @Sheffy007. Open a draft pull request with
Refs #423in its description within 24 hours, or the claim expires.