Repository navigation
shader: lower s_not_b32, s_brev_b32 and s_bfe_i32 in the mesh frontend - #3708
Conversation
The shared scalar ALU already lowers all three, SCC included. The mesh frontend refused them with "unsupported mesh instruction or EXEC state". They now join s_bfe_u32 and s_min_u32 on the shared path, with the same EXEC and VCC destination refusals. On a native Mesh86 capture (1,569 distinct slot 86 programs), these were the first refusal for 555 of them, and 122 more now translate fully. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lukaslw-lab
left a comment
There was a problem hiding this comment.
Reviewed 9886eb8e by reading the diff; not built or run.
Verdict: approve. The three ops join the branch that already hands s_bfe_u32 and s_min_u32 to the shared scalar ALU, which lowers all three, and the EXEC and VCC destination refusals apply. No MUST.
- SHOULD No case observes SCC, which is where the three ops differ. The shared ALU lists
s_brev_b32as SCC-preserving (gfx1013_direct_compute.inl:3808), and its lowering at:5425does not write SCC.s_not_b32ands_bfe_i32are SCC writers (:3782,:3791, lowered at:5772and:5697). Two cases would pin the behaviour the PR body states:- an
s_cmpbefores_brev_b32, then ans_cselect_b32after it; - an
s_cbranch_scc0afters_not_b32.
- an
- Checked, no finding:
- The test words decode as named: SOP1 op 7 / 11 into s21, and SOP2 op 40 with the literal
0x80004(8 bits from bit 4). - The refusal cases target
exec_lo,vcc_loandvcc_hias their names say. - The
scalar-bfe-i32pattern requires theashrand the shl/ashr sign extension and rejects anlshrof -2, so it separates the signed form froms_bfe_u32. - No conflict with the open mesh-frontend PRs I could check (#3702, #3704, #3705, #3707): each merges cleanly with this head.
- The test words decode as named: SOP1 op 7 / 11 into s21, and SOP2 op 40 with the literal
Tests: scalar-not, scalar-brev and scalar-bfe-i32 prove each op reaches the exported X through v_and_b32. The three refusals pin the destination checks. CI ran native_direct_mesh in the pr preset and passed at this head.
Review follow-up on R0Y00#3708. After s_cmp_eq_u32 s20, 0, an s_cselect_b32 behind s_brev_b32 still selects on the compare's SCC, and behind s_not_b32 on (result != 0). Both selects reach the exported X. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @lukaslw-lab. SHOULD addressed in
AI-assisted. |
lukaslw-lab
left a comment
There was a problem hiding this comment.
Reviewed a6602c75 by reading the diff; not built or run.
Verdict: approve. a6602c75 closes the SCC point from our earlier review. No MUST, no open points.
- Encodings checked:
0xbf068014=s_cmp_eq_u32 s20, 0(SOPC op 6),0x85158081=s_cselect_b32 s21, 1, 0(SOP2 op 10),0xbe960b14/0xbe960714=s_brev_b32/s_not_b32 s22, s20(SOP1 op 11 / 7). scalar-brev-keeps-sccrequires the select to test the zext of the compare's ownicmp eq i32 -2, 0, so a brev that rewrote SCC would fail it.scalar-not-sets-sccrequires the test to come fromicmp ne (xor -2, -1), 0, so a not that kept the compare's SCC would fail it. Both tie the pick to the exported X throughassert_position_x.
Tests: the two new cases reach the SCC handling of the shared scalar ALU through the gfx1013_direct_mesh.inl:1830 branch. native_direct_mesh is in the pr preset filter, and CI ran it green at this head.
Refs #3641, #3703, #2413.
Problem
The C++ mesh frontend (
lower_mesh,src/gfx1013_direct_mesh.inl) refusess_not_b32,s_brev_b32ands_bfe_i32withunsupported mesh instruction or EXEC state. The shared scalar ALU (DirectCompute::arithmetic) already lowers all three. On a native Mesh86 capture they are among the most common first refusals.Change
All three join
s_bfe_u32ands_min_u32on the existing branch that hands scalar ops to the shared ALU. The EXEC and VCC destination refusals in that branch apply unchanged. SCC follows the shared lowering:s_not_b32ands_bfe_i32set it from the result, ands_brev_b32leaves it alone.Census
Capture. A native Mesh86 run on
main1c634037:run_preset.py --console x --gpu nvidia --set translate=false, withX2W_REFUSE_FIXED_MESH=1andX2W_NATIVE_MESH86=1, 600 s from a saved profile. It recorded 2,873.m86requests, 1,569 of them distinct by content.Translation. Each distinct request went through
compile_dxil <dxc> <cache> gfx1013-container-ms-texture-heap req_<key>.m86 <out>.cso. These are counts only; request bytes stay local.main(built with #3706, which changes none of these counts)First refusals that this PR changes:
s_not_b32s_bfe_i32s_brev_b32v_rcp_iflag_f32v_cmpx_ne_u32graphics register undefined on an incoming pathv_ashrrev_i32Most of the 555 programs freed here now stop at
v_rcp_iflag_f32. That is the next wall, and I'll take it as a separate PR.Tests
tests/native_direct_mesh_check.py, ons20 = s_movk_i32 0xfffe(-2), with the result reaching the exported X position throughv_and_b32:scalar-not:xor i32 -2, -1.scalar-brev:dx.op.unary.i32(30, -2).scalar-bfe-i32: anashrof -2 followed by the shl/ashr sign extension, with nolshrof -2.scalar-not-exec:s_not_b32 exec_lo.scalar-brev-vcc:s_brev_b32 vcc_lo.scalar-not-vcc-hi:s_not_b32 vcc_hi.native_direct_meshfails atscalar-notwithunsupported mesh instruction or EXEC state: s_not_b32.ctest -R "native_|mesh|gfx1013" -E "hardware|_warp": 786/788 pass. The two failures,native_compute_implicit_lod_controlsandnative_wave_virtual_derivative_controls, are local only. The SDK 10.0.26100 validator here supports DXIL 1.7, and both tests emit 1.8 metadata. Neither touches 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