Shaders: request WaveSize(32) when a scalar join reads a lane mask #387

Open
avt0m4t48 wants to merge 1 commit from upstream-pr/387 into main
avt0m4t48 commented 2026-11-25 00:14:27 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by avt0m4t48 on 2026-11-25T00:14:27Z.


Refs #356.

When a Wave32 compute shader joins a lane mask and a scalar number, the incoming mask is materialized as a DXIL ballot while lowering the join. Main can emit that ballot without a fixed wave size or the console's lane ordering. The resulting mask can contain only 16 bits if the shader is scheduled with 16 lanes.

When the join actually materializes a ballot without the native Wave32 layout, run lowering again with that layout. This applies to guest Wave32 compute programs. The case where the two incoming values are ordinary numbers keeps the default wave-size behavior.

The checked-in regression failed on the original emitter. On the branch based on 31714de, the shader suite completed with 172 passed and two ignored. The Windows MSVC all-feature shader test targets type-checked with warnings denied. Microsoft DXIL validation accepted the exact synthetic shader on both revisions. The disassembly had waveActiveBallot without a wave size on main and WaveSize=32 on this branch. The numeric control had neither the ballot nor a wave-size declaration.

The laptop in #356 has not run this branch. Adapter selection remains relevant to diagnosing that report, and the other five failures need their own checks.

AI-assisted using Codex.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6594127076 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/387). Originally posted by [avt0m4t48](https://github.com/avt0m4t48) on 2026-11-25T00:14:27Z. --- Refs #356. When a Wave32 compute shader joins a lane mask and a scalar number, the incoming mask is materialized as a DXIL ballot while lowering the join. Main can emit that ballot without a fixed wave size or the console's lane ordering. The resulting mask can contain only 16 bits if the shader is scheduled with 16 lanes. When the join actually materializes a ballot without the native Wave32 layout, run lowering again with that layout. This applies to guest Wave32 compute programs. The case where the two incoming values are ordinary numbers keeps the default wave-size behavior. The checked-in regression failed on the original emitter. On the branch based on `31714de`, the shader suite completed with 172 passed and two ignored. The Windows MSVC all-feature shader test targets type-checked with warnings denied. Microsoft DXIL validation accepted the exact synthetic shader on both revisions. The disassembly had `waveActiveBallot` without a wave size on main and `WaveSize=32` on this branch. The numeric control had neither the ballot nor a wave-size declaration. The laptop in #356 has not run this branch. Adapter selection remains relevant to diagnosing that report, and the other five failures need their own checks. AI-assisted using Codex.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/387:upstream-pr/387'
git switch 'upstream-pr/387'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/387'
git switch 'upstream-pr/387'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/387'
git switch 'upstream-pr/387'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/387'
git switch 'main'
git merge --squash 'upstream-pr/387'
git switch 'main'
git merge --ff-only 'upstream-pr/387'
git switch 'main'
git merge 'upstream-pr/387'
git push origin 'main'
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
fxceless/victory-fork!387
No description provided.