Repository navigation
shader: accept v_sub_co_u32, v_subrev_co_u32 and v_and_or_b32 in the mesh frontend (Part of #2413) - #3659
shader: accept v_sub_co_u32, v_subrev_co_u32 and v_and_or_b32 in the mesh frontend (Part of #2413)#3659SimSalabimse wants to merge 1 commit into
Conversation
…mesh frontend The native mesh path already accepts v_sub_nc_u32 and v_subrev_nc_u32 (R0Y00#3537). This adds the carry-out subtract forms and v_and_or_b32 through the existing ALU lowering, plus a check that decodes synthetic words for all five ops and evaluates the lowered result. AI-assisted (Cursor)
|
Tested on the Windows test PC at head 3df4c9d, dev preset, with It merges cleanly with current main AI-Assisted |
lukaslw-lab
left a comment
There was a problem hiding this comment.
Reviewed 3df4c9d8 by reading the diff; not built or run.
Verdict: comment. The one-line allowlist change is right. The three ops reach lowerings that already exist: v_and_or_b32 is ({0} & {1}) | {2} (gfx1013_compute_alu.inl:8), and the two carry-out subtracts go through carry_destination (gfx1013_compute_native.cpp:577), whose lowering refuses clamp, neg, DPP and scale. But the PR's only test never runs that code, so nothing pins it. No MUST. I'd approve once a translator case is in.
- SHOULD
tests/mesh57_integer_alu_check.cppdecodes the words with the repo decoder. It then checks them against its ownlower()(a C++ copy of the expected arithmetic) and against a text search ofgfx1013_direct_mesh.inlfor the names. It never callslower_mesh, so the DXIL for the three new ops, and the borrow write to VCC or an SDST pair, are untested.mesh57_integer_aluis also not in theprpreset filter, so CI did not run it. A few cases intests/native_direct_mesh_check.pywould cover this, in the style of the other mesh allowlist PRs on #3703 (#3704, #3709). Each would follow the result to the exported X withassert_position_x:v_and_or_b32,v_sub_co_u32with its borrow in VCC feeding av_cndmask_b32, andv_subrev_co_u32with operands swapped. - NIT The description starts with "Draft." but the PR is ready for review.
- Checked, no finding:
- VCC as the carry-out.
carry_destinationwrites the lane bit to 106, and the meshafter_graphics_write(106)clears the numeric VCC words. So a later SALU or SAVEEXEC use of VCC refuses instead of reading a stale compare mask. - Explicit SDST pair. The numeric dwords are cleared and the bit goes to the per-pc pseudo register, as for
v_add_co_ci_u32, which is already accepted.
- VCC as the carry-out.
Tests: mesh57_integer_alu proves the decoder names and widths for the five ops, and that the names appear in the mesh source. It does not reach the translator. CI is green, but it did not include this test.
Draft. Part of #2413.
The native mesh frontend already accepts
v_sub_nc_u32andv_subrev_nc_u32since #3537. This adds the three integer ops next to them that it still refuses:v_sub_co_u32(VOP3)v_subrev_co_u32(VOP3)v_and_or_b32(VOP3)All three go through the existing
arithmetic()lowering, so the change insrc/gfx1013_direct_mesh.inlis one whitelist line.tests/mesh57_integer_alu_check.cpp(registered asmesh57_integer_alu) decodes synthetic gfx1013 words for the five ops with the repo decoder and checks the expected result of each form:v_sub_nc_u32/v_subrev_nc_u32: VOP2, VOP3, VOP3 with clamp, SDWA dword and DPP forms, including0 - 1 == 0xFFFFFFFFwrap and the unsigned clamp to 0.v_sub_co_u32/v_subrev_co_u32: VOP3 result plus borrow bit.v_and_or_b32: VOP3(a & b) | c.Left out:
v_sub_co_ci_u32,v_subrev_co_ci_u32).Checks:
-std=c++17 -Wall -Werror=narrowing) and passes.mesh57_*12/12.Why: on the Windows test PC, the derived slot 57 mesh walk (fork branch, see the draft linked from #3541) got through translation further than before and was refused in native compute translation at an unsupported
v_sub_nc_u32. That branch was older than #3537. This PR keeps the subtract coverage in the test and adds the remaining siblings, so the next run does not stop one instruction later.AI-assisted (Cursor)