Repository navigation
shader: lower v_bfm_b32 and v_bcnt_u32_b32 in the mesh frontend (Part of #2413) - #3655
Merged
Merged
Conversation
The shared ALU already lowers v_bfm_b32 for direct compute (R0Y00#2986): ((1 << (S0 & 31)) - 1) << (S1 & 31). Admit it in the mesh frontend's vector ALU list with two sources, so uniformity proofs see both. The test builds v_bfm_b32 v1, v0, 2 into the position and pins the width, the minus one and the offset operand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 tasks done
Open
4 of 5 tasks
R0Y00
approved these changes
Dec 1, 2026
R0Y00
left a comment
Owner
There was a problem hiding this comment.
Reviewed the mesh ALU admission for v_bfm_b32 and v_bcnt_u32_b32. Both reuse the shared lowering and declare both operands for the uniformity analysis. The tests tie the resulting mask/count to the exported position. ctest --test-dir <build> --no-tests=error -j1 -R '^native_direct_mesh$' --output-on-failure passed on the Windows Release integration.
This was referenced Dec 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #2413.
The shared ALU already lowers both instructions for direct compute:
v_bfm_b32since #2986, andv_bcnt_u32_b32throughunaryBits(popcount) plus the second source. The mesh frontend's vector ALU list did not admit either one, so they were refused asunsupported mesh instruction or EXEC state. This PR adds both to that list as two-source operations, so the uniform-result proof checks both operands.Census (454 cached slot 57 requests, #3416 layout, main plus #3635/#3645/#3646):
v_bfm_b32is the first refusal for 40 requests.v_bfm_b32orv_bcnt_u32_b32. They now stop at later refusals: 19unsupported mesh SAVEEXEC operands, and the rest at several smaller reasons (v_cvt_f16_f32,v_cmpx_*, other SAVEEXEC shapes).v_bfm_b32is no longer a refusal reason.Tests (
tests/native_direct_mesh_check.py):v-bfm-b32:v_bfm_b32 v1, v0, 2feeds the position. The check pinsshl 1, width, the- 1and the& 31offset of 2.v-bcnt-u32-b32:v_bcnt_u32_b32 v1, v0, 5feeds the position. The check pinsunaryBitsop 31 plus 5.Each of these mutations fails
native_direct_mesh:v_bfm_b32not admitted;- 1dropped;v_bcnt_u32_b32not admitted;+ src1dropped.ctest -R "mesh|compile_dxil|bfm": 215/215 with thev_bfm_b32change;native_direct_meshpasses again withv_bcnt_u32_b32added.🤖 Generated with Claude Code