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

Closed
github-bot wants to merge 1 commit from github-bot/gh-3738 into main AGit
Owner

@⁠lambirou on GitHub · 2026-12-01 13:28 UTC · original
lambirou:codex/mesh-scalar-alu → main · +197 −1 · 3 files · 1 commits · closed without merging

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 #3705

**@⁠lambirou** on GitHub · 2026-12-01 13:28 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3738) `lambirou:codex/mesh-scalar-alu` → `main` · +197 −1 · 3 files · 1 commits · closed without merging 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 #3705
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 #3703
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 13:31:41 +00:00
Author
Owner

@⁠mumba17 on GitHub · 2026-12-01 16:38 UTC · original

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

  • #3710: s_not_b32, s_brev_b32 and s_bfe_i32 in the mesh frontend (with SCC and EXEC/VCC-destination controls)
  • #3711: v_rcp_iflag_f32 (plus v_ashrrev_i32) through the same lane ALU list as v_rcp_f32

Both were posted on #3705 when they went up. To save reviewers a second pass over the same lines, could #3740 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 #3710 or #3711.

Your #3760 stack already merges #3731, thanks for picking that up.

AI-assisted.

**@⁠mumba17** on GitHub · 2026-12-01 16:38 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3738#issuecomment-7317936773) Hi @⁠lambirou, heads-up on overlap: these forms are already up in two earlier PRs, both approved by @⁠lukaslw-lab this morning: - #3710: `s_not_b32`, `s_brev_b32` and `s_bfe_i32` in the mesh frontend (with SCC and EXEC/VCC-destination controls) - #3711: `v_rcp_iflag_f32` (plus `v_ashrrev_i32`) through the same lane ALU list as `v_rcp_f32` Both were posted on #3705 when they went up. To save reviewers a second pass over the same lines, could #3740 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 #3710 or #3711. Your #3760 stack already merges #3731, thanks for picking that up. AI-assisted.
Author
Owner

@⁠lambirou on GitHub · 2026-12-01 16:53 UTC · original

Thanks for the pointer — I checked both branches, and there is no behavioral gap: #3710 and #3711 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 #3710 and #3711 land; there is nothing to add to your PRs.\n\nAI-assisted.

**@⁠lambirou** on GitHub · 2026-12-01 16:53 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3738#issuecomment-7318409114) Thanks for the pointer — I checked both branches, and there is no behavioral gap: #3710 and #3711 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 #3710 and #3711 land; there is nothing to add to your PRs.\n\nAI-assisted.
github-bot closed this pull request 2026-12-01 16:59:17 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.