shader: lower v_rcp_iflag_f32 and v_ashrrev_i32 in the mesh frontend #3709
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3709"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by mumba17 on 2026-12-01T08:06:45Z.
Refs #3641, #3703, #2413. Independent of #3708, but measured on top of it, since most of these programs only reach these instructions after #3708.
Problem
On a native Mesh86 capture with #3708 applied,
v_rcp_iflag_f32is the first refusal for 371 of the 1,569 distinct slot 86 programs, andv_ashrrev_i32for 50. Both refuse withunsupported mesh instruction or EXEC state. The shared ALU already lowers both:v_rcp_iflag_f32takes thev_rcp_f32path:fdiv float 1.0, a. The flag only changes IEEE exception reporting, which DXIL doesn't expose.v_ashrrev_i32isashr src1, src0 & 31.Change
Both join the mesh lane ALU list in
src/gfx1013_direct_mesh.inl. Thefull_exec || exec_skiprule and the partial-write merge apply unchanged. Both havealu_rulesentries, so, as forv_rcp_f32, a result whose sources are all uniform is recorded as uniform.Census
Same capture as #3708 (
main1c634037,X2W_REFUSE_FIXED_MESH=1,X2W_NATIVE_MESH86=1, 600 s, 1,569 distinct.m86). Every request goes throughcompile_dxil … gfx1013-container-ms-texture-heap. Counts only.v_rcp_iflag_f32v_ashrrev_i32v_and_or_b32mesh heap slot lacks masked root constant provenances_cmp_le_u32raw buffer load needs offen with zero scalar offset and no modifiersSo this PR moves 421 programs one wall further. None of them translates fully yet, and their next walls are listed above.
Tests
tests/native_direct_mesh_check.py:v-ashrrev-i32(v_ashrrev_i32 v1, 2, v0): anashrof v0 by2 & 31reaches the exported X position.v-rcp-iflag-f32(v_rcp_iflag_f32 v1, v0):fdiv float 1.0, v0, whose bits reach the exported X.v-ashrrev-i32withunsupported mesh instruction or EXEC state: v_ashrrev_i32.ctest -R "native_|mesh|gfx1013" -E "hardware|_warp": 786/788 pass. The same two local-only failures as in #3708: the SDK 10.0.26100 validator here only supports DXIL 1.7. They don't touch the mesh frontend.Environment: Windows 11 build 26300, RTX 3090, MSVC 14.44, DXC from SDK 10.0.26100.
AI-assisted.
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-01T08:10:00Z.
Review: APPROVED
Reviewed
ecb4a19fby reading the diff; not built or run.Verdict: approve. Both ops join the mesh lane ALU list and reach shared lowerings that already exist.
v_rcp_iflag_f32is the same1.0 / xasv_rcp_f32(gfx1013_compute_alu.inl:48-49,gfx1013_direct_compute.inl:3615).v_ashrrev_i32isashr src1, src0 & 31(gfx1013_compute_alu.inl:10,:5779). No MUST.alu_rulesentries (arity 2 and 1), so the mesh branch takessourcesfrom them (gfx1013_direct_mesh.inl:1935). A result whose sources are all uniform is therefore recorded as uniform, exactly as forv_rcp_f32. That is correct; only the wording differs.v-rcp-iflag-f32checks that thefdivexists, not that it reaches the exported X, asv-ashrrev-i32does withassert_position_x.0x30020082is VOP2 0x18 (v_ashrrev_i32 v1, 2, v0), and0x7e025700is VOP1 0x2b (v_rcp_iflag_f32 v1, v0).ashrpattern excludes anlshr.v_rcp_f32is exception reporting, which DXIL does not expose.Tests:
v-ashrrev-i32proves the signed shift reaches the export, andv-rcp-iflag-f32proves the reciprocal path. The reverted-source mutation in the PR body hits the first. CI is still running at this head.Imported from R0Y00/Xbox2Windows. Originally posted by mumba17 on 2026-12-01T08:34:50Z.
Thanks @lukaslw-lab. Both NITs are fixed:
alu_rulesentries, so a result with all-uniform sources is recorded as uniform, the same asv_rcp_f32.v-rcp-iflag-f32. It now follows thefdivthrough the bitcast to the exported X withassert_position_x(745d65b5).On the overlap with #3704: whichever of the two lands second needs a one-line rebase, so I'll take it if mine is second.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-01T18:08:47Z.
Review: APPROVED
Reviewed
95e4d369by reading the diff; not built or run.Verdict: approve. Both NITs from our earlier review are fixed, and nothing new came up. No MUST.
0x30020082=v_ashrrev_i32 v1, 2, v0(VOP2 op 0x18).0x7e025700=v_rcp_iflag_f32 v1, v0(VOP1 op 0x2b).1c634037, but it merges cleanly with currentmain, including #3704's edits to the same allowlist lines. No rebase is needed.Tests:
v-ashrrev-i32requiresashrby2 & 31.v-rcp-iflag-f32requiresfdiv float 1.0. Both follow their result to the exported X throughassert_position_x.native_direct_meshis in theprpreset filter, and CI ran it green at this head.