Skip to content

shader: lower scalar bit ops and v_rcp_iflag in the mesh frontend - #3738

Closed
lambirou wants to merge 1 commit into
R0Y00:mainfrom
lambirou:codex/mesh-scalar-alu
Closed

lambirou wants to merge 1 commit into
R0Y00:mainfrom
lambirou:codex/mesh-scalar-alu

Conversation

@lambirou

@lambirou lambirou commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

The forced slot 86 mesh path refused 2 873 real title requests. The refusal
census ordered the missing forms s_bfe_i32 (458), s_not_b32 (433),
v_rcp_iflag_f32 (145) and s_brev_b32 (107); each one alone kept the
request from reaching a desktop mesh profile.

s_not_b32 and s_bfe_i32 join the mesh scalar branches and reuse the
compute arithmetic() lowering: D = ~S0, and the sign-extended field with
the offset in S1[4:0] and the width in S1[22:16], zero for a zero width
and the arithmetic shift kept at a width of 32 or more. Both write
SCC = (D != 0). s_brev_b32 reverses the 32 bits through the shared
unary.i32 intrinsic and leaves SCC unchanged, as the compute frontend and
the gfx2hlsl.py SOP1 table do. v_rcp_iflag_f32 joins the vector list
that already handles v_rcp_f32, so it takes the same 1.0 / x rule.
All three scalar forms refuse an EXEC or VCC destination.

Validation (Windows, Release; AMD Radeon RX 9060 XT for the hardware run):

  • cmake --build --preset release --target compile_dxil — 17/17 steps.
  • python -B tests/native_direct_mesh_check.py out\\build\\release\\compile_dxil.exe "<DXC dir>"
    — pass, including one source-built program per form and the EXEC/VCC and
    unbound-source controls.
  • ctest --preset release --no-tests=error -R '^native_direct' — 2/2 pass.

Refs #3703

The forced slot 86 mesh path refused 2 873 real title requests. The census
ordered the refusals s_bfe_i32 (458), s_not_b32 (433), v_rcp_iflag_f32 (145)
and s_brev_b32 (107).

- s_not_b32 (SOP1 0x07) and s_bfe_i32 (SOP2 0x28) join the mesh scalar
  branches and reuse the compute arithmetic(): D = ~S0, and the sign-extended
  field with the offset in S1[4:0] and the width in S1[22:16], zero for a zero
  width and the arithmetic shift kept at a width of 32 or more. Both write
  SCC = (D != 0).
- s_brev_b32 (SOP1 0x0B) lowers through the shared unary.i32 reverse and leaves
  SCC unchanged, as the compute frontend and the gfx2hlsl.py SOP1 table do.
- v_rcp_iflag_f32 (VOP1 0x2B) joins the vector list that already handles
  v_rcp_f32, so it takes the same 1.0 / x alu_rules entry.
- All three scalar forms refuse an EXEC or VCC destination.

tests/native_direct_mesh_check.py adds one source-built program per form that
exports the result through POS0.x and, for s_not_b32 and s_bfe_i32, the SCC
through POS0.y; s_brev_b32 is bracketed by a compare in both SCC states to show
the flag survives. Controls reject EXEC/VCC destinations and unbound sources.

Verified:
- cmake --preset release; cmake --build --preset release --target compile_dxil
  (17/17 steps, compile_dxil.exe linked)
- python -B tests/native_direct_mesh_check.py <compile_dxil.exe> <dxc dir>:
  exit 0, "mesh allocation, indexed outputs, group exchange and negative
  controls passed"
- ctest --preset release --no-tests=error -R '^native_direct'
  2/2 passed: native_direct_container 15.04 s, native_direct_mesh 11.75 s

Refs R0Y00#3703
@mumba17

mumba17 commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Hi @lambirou, heads-up on overlap: these forms are already up in two earlier PRs, both approved by @lukaslw-lab this morning:

Both were posted on #3703 when they went up. To save reviewers a second pass over the same lines, could #3738 drop these, or be closed if nothing else is left? If your version handles a case ours misses, tell me and I'll add it to #3708 or #3709.

Your #3758 stack already merges #3729, thanks for picking that up.

AI-assisted.

@lambirou

lambirou commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the pointer — I checked both branches, and there is no behavioral gap: #3708 and #3709 cover all four forms, including the SCC and EXEC/VCC rules. I'll close this one instead of asking for a second review of the same lines.\n\nThe only unique bits here are the census note from the title run (2,873 slot 86 requests; first refusals s_bfe_i32 458, s_not_b32 433, �_rcp_iflag_f32 145, s_brev_b32 107) and a few extra refusal tests for s_bfe_i32 to EXEC/VCC and unproven source/control. I'll keep those on the branch and can send a small tests/docs follow-up after #3708 and #3709 land; there is nothing to add to your PRs.\n\nAI-assisted.

@lambirou lambirou closed this Dec 1, 2026
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