Skip to content

Read joined scalar lane masks across the two halves of a Wave64 group - #15

Open
MichaelSmithAI wants to merge 1 commit into
r4tedx:shader/wave-per-groupfrom
MichaelSmithAI:shader/split-wave-mask-joins
Open

MichaelSmithAI wants to merge 1 commit into
r4tedx:shader/wave-per-groupfrom
MichaelSmithAI:shader/split-wave-mask-joins

Conversation

@MichaelSmithAI

Copy link
Copy Markdown

On a 32-lane host, a Wave64 compute shader can reach a scalar register by two paths. One path writes a lane mask, and the other can keep a constant or write a different mask. At the join, reading either dword as a number currently stops translation with a lane mask read as data.

For a group of at most one console wave, the patch follows scalar phis with a mask incoming and lets a numeric read request the existing split console flow. At a join with no incoming back edge, that lowering takes the chosen predecessor's 64-lane ballot dword. The ordinary per-lane retry remains available. A join in a loop body is covered, while a loop-carried phi uses its existing lowering.

On the RTX 4090 under Wine/GE, two live groups independently checked both dwords when one group took the branch and the other skipped it. The fixtures cover initial values 0 and −1, both arms writing a mask, and a two-pass loop whose high dwords XOR to 0x1f00. The test matrix also checks emitted wave sizes or refusal reasons across Wave32 and Wave64 programs, two group sizes and three host lane ranges. The 128-thread control includes a separate lane read that already selects console flow.

I compared the five 64-thread program shapes on 88b38e8 and the scalar-state #14 head fb45f7f. Both refused them on a 32–32 target. Only those five cells change in the 60-case matrix against the base. This is independent of the ordinary first-lane read change in #12. Native 64-lane hardware and title output remain unmeasured.

AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants