Repository navigation
shader: lower v_rcp_iflag_f32 and v_ashrrev_i32 in the mesh frontend - #3709
Conversation
lukaslw-lab
left a comment
There was a problem hiding this comment.
Reviewed ecb4a19f by 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_f32 is the same 1.0 / x as v_rcp_f32 (gfx1013_compute_alu.inl:48-49, gfx1013_direct_compute.inl:3615). v_ashrrev_i32 is ashr src1, src0 & 31 (gfx1013_compute_alu.inl:10, :5779). No MUST.
- NIT The PR body says neither op "counts as a uniform-proving source". Both have
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. - NIT
v-rcp-iflag-f32checks that thefdivexists, not that it reaches the exported X, asv-ashrrev-i32does withassert_position_x. - Checked, no finding:
0x30020082is VOP2 0x18 (v_ashrrev_i32 v1, 2, v0), and0x7e025700is VOP1 0x2b (v_rcp_iflag_f32 v1, v0).- The
ashrpattern excludes anlshr. - For the iflag form, the only difference from
v_rcp_f32is exception reporting, which DXIL does not expose.
- Note: this changes the same allowlist lines as #3704, so whichever of the two lands second needs a one-line rebase. I'll do it on #3704 if this one lands first.
Tests: v-ashrrev-i32 proves the signed shift reaches the export, and v-rcp-iflag-f32 proves the reciprocal path. The reverted-source mutation in the PR body hits the first. CI is still running at this head.
Review follow-up on R0Y00#3709: v-rcp-iflag-f32 now checks that the reciprocal's bits reach the exported X, as v-ashrrev-i32 already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @lukaslw-lab. Both NITs are fixed:
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. |
Both are already lowered by the shared ALU (the reciprocal as v_rcp_f32, the shift as an arithmetic right shift by src0 & 31). The mesh lane ALU list now admits them, so the full_exec || exec_skip rule and the partial-write merge apply unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-up on R0Y00#3709: v-rcp-iflag-f32 now checks that the reciprocal's bits reach the exported X, as v-ashrrev-i32 already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
745d65b to
95e4d36
Compare
lukaslw-lab
left a comment
There was a problem hiding this comment.
Reviewed 95e4d369 by reading the diff; not built or run.
Verdict: approve. Both NITs from our earlier review are fixed, and nothing new came up. No MUST.
- Encodings checked:
0x30020082=v_ashrrev_i32 v1, 2, v0(VOP2 op 0x18).0x7e025700=v_rcp_iflag_f32 v1, v0(VOP1 op 0x2b). - The branch is based on
1c634037, but it merges cleanly with currentmain, including #3704's edits to the same allowlist lines. No rebase is needed.
Tests: v-ashrrev-i32 requires ashr by 2 & 31. v-rcp-iflag-f32 requires fdiv float 1.0. Both follow their result to the exported X through assert_position_x. native_direct_mesh is in the pr preset filter, and CI ran it green at this head.
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 shader: lower s_not_b32, s_brev_b32 and s_bfe_i32 in the mesh frontend #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