shader: join wave64 lane masks with data by each lane's bit #120

Merged
Olima34 merged 1 commit from upstream-pr/120 into main 2026-11-26 18:09:23 +00:00
Olima34 commented 2026-11-26 17:30:42 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-26T17:30:42Z.


One of the #4 shapes, "a lane-mask join of an untracked mask" (14 refusals in your latest run). This is a lowering for wave64 programs. What it still refuses now names its cause.

Why. At a uniform join with console lanes, a lane mask joined with data (Val::I32) became each lane's bit of the number, as Atom::Opaque already does. That only worked in wave32 programs (number required !wave64), so wave64 ones were refused.

What.

  • RDNA2 rule: bit i of a 64-bit mask (EXEC/VCC pair) is lane i.
  • A wave64 lane now takes its bit of the pair. Below lane 32 it reads the low dword; from lane 32 it reads the high dword.
  • The high dword is the high register's join on the same edge: pair_high gives the phi of the next SGPR in the same block, so the edge index matches.
  • This still applies only at a uniform join and with console lanes, as before. If the high dword is not known, the join is refused.
  • What stays refused now names its cause after the old text: data on the host's lanes, data at a join of several edges, data whose high dword is not known, a value the translation could not make, an SCC or lane bit, or no value on that edge.

Tests.

  • mask_tests::a_wave64_mask_joined_with_data_at_a_uniform_loop_is_its_number (a wave64 uniform loop, lowered with wave32_host false and true). On main it fails with exactly "a lane-mask join of an untracked mask" at 0x20.
  • addr_tests::a_wave64_mask_joined_with_data_takes_each_lanes_bit_on_the_gpu (victory-gpu, runs on Metal with the host's options: one console wave as two host waves). The mask starts as lanes below 40, then each back edge shifts it right by 4 and passes it through VGPRs as data. Every lane stores its bit of the last pass's number, and the test checks all 64 lanes: 1 below lane 36, 0 above. Lanes 32 to 35 take their bit from the high dword. It fails on main (the shader is refused).

The #110 Series S log has this refusal in three compute programs (2e4e36ee0ffdebee @0xcf8, 7a06a5d322dce725 @0x2270, c5f6d57e0092dc99 @0x8b0). Whether they take the wave64 form is not known; if not, the new messages will say which form they do take.

victory-shader (242) and victory-gpu (arm64) tests, Windows clippy and cargo xtask policy pass.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6631998966 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/120). Originally posted by [Olima34](https://github.com/Olima34) on 2026-11-26T17:30:42Z. --- One of the #4 shapes, "a lane-mask join of an untracked mask" (14 refusals in your latest run). This is a lowering for wave64 programs. What it still refuses now names its cause. **Why.** At a uniform join with console lanes, a lane mask joined with data (`Val::I32`) became each lane's bit of the number, as `Atom::Opaque` already does. That only worked in wave32 programs (`number` required `!wave64`), so wave64 ones were refused. **What.** - RDNA2 rule: bit i of a 64-bit mask (EXEC/VCC pair) is lane i. - A wave64 lane now takes its bit of the pair. Below lane 32 it reads the low dword; from lane 32 it reads the high dword. - The high dword is the high register's join on the same edge: `pair_high` gives the phi of the next SGPR in the same block, so the edge index matches. - This still applies only at a uniform join and with console lanes, as before. If the high dword is not known, the join is refused. - What stays refused now names its cause after the old text: data on the host's lanes, data at a join of several edges, data whose high dword is not known, a value the translation could not make, an SCC or lane bit, or no value on that edge. **Tests.** - `mask_tests::a_wave64_mask_joined_with_data_at_a_uniform_loop_is_its_number` (a wave64 uniform loop, lowered with `wave32_host` false and true). On main it fails with exactly "a lane-mask join of an untracked mask" at 0x20. - `addr_tests::a_wave64_mask_joined_with_data_takes_each_lanes_bit_on_the_gpu` (victory-gpu, runs on Metal with the host's options: one console wave as two host waves). The mask starts as lanes below 40, then each back edge shifts it right by 4 and passes it through VGPRs as data. Every lane stores its bit of the last pass's number, and the test checks all 64 lanes: 1 below lane 36, 0 above. Lanes 32 to 35 take their bit from the high dword. It fails on main (the shader is refused). The #110 Series S log has this refusal in three compute programs (2e4e36ee0ffdebee @0xcf8, 7a06a5d322dce725 @0x2270, c5f6d57e0092dc99 @0x8b0). Whether they take the wave64 form is not known; if not, the new messages will say which form they do take. victory-shader (242) and victory-gpu (arm64) tests, Windows clippy and `cargo xtask policy` pass.
LakshanSivakumar commented 2026-11-26 18:09:52 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T18:09:52Z.


Merged, thanks. Wave64 mask/data joins now take each lane's bit, and the GPU test passes.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7200127068 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/120#issuecomment-7200127068). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T18:09:52Z. --- Merged, thanks. Wave64 mask/data joins now take each lane's bit, and the GPU test passes.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
LakshanSivakumar/Native-Victory-macOS!120
No description provided.