shader: lower v_cmpx_lg_f32, v_cmpx_gt_f32 and per-lane v_cmpx_gt_u32 in the mesh frontend (Part of #3703) #3729
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3729"
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-01T11:55:27Z.
Part of #3703 (claimed in this comment).
Change
The mesh frontend narrowed EXEC for
v_cmpx_eq_u32,v_cmpx_ne_u32andv_cmpx_lt_u32. It handledv_cmpx_gt_u32only in the lane-linear vertex/primitive count form. Mesh86 programs also use:v_cmpx_lg_f32v_cmpx_gt_f32v_cmpx_gt_u32These three now get the same EXEC-only narrowing through the shared
comparison(), with no VCC ballot and no SGPR write:v_cmpx_lg_f32is an orderedfcmp one.v_cmpx_gt_f32is an orderedfcmp ogt. A lane with a NaN operand fails the compare and leaves EXEC.v_cmpx_gt_u32isicmp ugt.v_cmpx_gt_u32is still matched first and is unchanged.This is a new
else ifafterv_cmpx_lt_u32. It does not touchv_cmpx_eq_i32,v_cmpx_lt_f32orv_cmpx_le_f32from #3666.Tests
Source-built fixtures in
tests/native_direct_mesh_check.py, using the same save / CMPX / EXECZ / restore shape as thev_cmpx_lt_u32cases. Each one follows the predicate to themesh_workbranch and the joined position X:v_cmpx_gt_u32: lane id > 2, unsigned wrap (all-ones > 0), and a self-compare that gives an empty EXEC.v_cmpx_gt_i32stays refused outside its paired-arms form.v_cmpx_gt_f32/v_cmpx_lg_f32:1.0against0.5, and1.0against a quiet NaN. Each case checks forogt/oneand that no unorderedfcmpappears.v_cmpx_lg_f32with|v2|stays refused.Mutation checks:
v_cmpx_lg_f32from the new branch fails the test.!i.absguard fails the test, on the|v2|case.ctest -R native_direct_meshpasses (Windows 11 26300, MSVC 14.44, SDK 10.0.26100 DXC, RTX 3090).Census
On my local Mesh86 capture (1,569 distinct slot 86 programs), with
maine1161e43+ #3708 + #3709 + #3710:v_cmpx_lg_f32/v_cmpx_gt_u32/v_cmpx_gt_f32beforeSo this PR on its own adds no fully translated programs. Most of the 279 now stop at
graphics register undefined on an incoming path. The pattern is a chain of nestedv_cmpx_lg_f32skips that all exit to one EXEC restore, inside the vertex-count skip. The chain accumulates into VGPRs that were first written under the count mask. Those writes are not select-merged, because the old value is itself partial, so the restore to the count mask drops them. That is a change to partial-write tracking, not to compares, so I'll take it as a separate follow-up on #3703.AI-assisted.
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-01T18:54:19Z.
Review: APPROVED
Reviewed
e3253523by reading the diff; not built or run.Verdict: approve. The new branch narrows EXEC exactly as the existing
eq/ne/lt_u32branches do, through the sharedcomparison(). That function mapslgto the orderedfcmp oneandgttoogt(gfx1013_direct_compute.inl:3738), and refuses op_sel (:3648). The new guard adds the refusal of abs/neg that the shared path would otherwise ignore for floats. No MUST.gfx1013_direct_mesh.inl:1333-1368, new branch at:1358). One branch with a name list would keep the guards from drifting apart.v_cmpx_gt_u32count form sits earlier in the chain. An instruction that fails its conditions falls through to per-lane narrowing, which is still the instruction's real meaning; it just lacks the count proof.0x14/0x15/0xD4/0x94arev_cmpx_gt_f32/lg_f32/gt_u32/gt_i32.0xD415026Ais the VOP3v_cmpx_lg_f32with abs on src1.0x7FC00000is a quiet NaN.exec_valueuntouched (cleared) is right.Tests: the three
gt_u32cases pinicmp ugt, including the unsigned wrap and the empty self-compare. The four float cases pin the ordered predicates, and that no unorderedfcmpappears, for both a value and a NaN.v-cmpx-gt-i32-refusedandv-cmpx-lg-f32-abskeep the signed compare and the float modifiers refused.native_direct_meshis in theprpreset filter, and CI ran it green at this head.