Repository navigation
Conversation
…ontend v_cvt_f16_f32 and v_cvt_f32_f16 reuse the shared ALU (RNE rounding into the low word with the high word kept, and legacyF16ToF32). v_cmpx_eq_i32 and v_cmpx_lt_f32 narrow the lane mask like v_cmpx_eq_u32: EQ is the same bit test signed or unsigned, and LT_F32 is ordered. Part of R0Y00#2413. Co-authored-by: OpenBot <335604065+openbotgit[bot]@users.noreply.github.com>
lukaslw-lab
left a comment
There was a problem hiding this comment.
Reviewed bd95dc4c by reading the diff; not built or run.
Verdict: approve. Both conversions and the two compares go through the existing shared lowerings, and the new names inherit the existing modifier refusals. No MUST. It needs a rebase: it conflicts with main a3bfd019 in src/gfx1013_direct_mesh.inl and the test file, on the allow-list line #3635/#3655 also changed, as the PR body says.
- NIT The
v-cmpx-lt-f32check acceptsfcmp olt float %a, %bin either operand order (tests/native_direct_mesh_check.py, thenarrowedloop). LT is the only asymmetric form here. If the lowering swapped src0 and vsrc1, the check would still pass. Pinning the first operand to the value built from the inline 0 would catch that. - Checked, no finding:
- Compares:
alu.comparison(i)(src/gfx1013_direct_compute.inl:3336) reads src0 then src1 and givesfcmp oltforlt_f32. The mesh branch still refuses DPP, SDWA, abs, neg, omod and clamp, and inside a diamond.v_cmpx_eq_i32gives the sameicmp eqaseq_u32. - Conversions: in the lane-ALU list, so partial-EXEC writes merge as before. Keeping v1's high word in
v_cvt_f16_f32matches gfx10, where 16-bit VALU results do not zero bits 31:16. - Test words decode as named: VOPC 0x11
v_cmpx_lt_f32, 0x13le_f32, 0x92eq_i32, 0xd2eq_u32(src0 = inline 0, vsrc1 = v1); VOP1 0x0a / 0x0b with v1 ← v2.
- Compares:
Tests: the new checks reach both changed lines: the CMPX name test (three compares, with the select and phi on the narrowed lane) and the two conversions in the ALU list. v_cmpx_le_f32 is the negative control. The CI run at this head (22:24 UTC) came before #3644 put native_direct_mesh into the pr filter, so only your local run covers them so far. The rebase will rerun CI with it.
|
Friendly note: this is approved, but it currently conflicts with |
Change
The native mesh frontend (
lower_mesh,src/gfx1013_direct_mesh.inl) now accepts four more forms:v_cvt_f16_f32,v_cvt_f32_f16. Both go through the sharedDirectCompute::arithmeticpath, the samefloat_alulowering the compute and graphics paths use. The narrowing form rounds to nearest even into the low word and keeps the destination's high word. The widening form useslegacyF16ToF32. Both join the existing lane-ALU list, so thefull_exec || exec_skiprule and the partial-write merge apply unchanged. They are not counted as uniform-proving sources.v_cmpx_eq_i32,v_cmpx_lt_f32. Both narrow the lane mask the same wayv_cmpx_eq_u32already does: the new lane-active predicate is the parent mask AND the lane's own compare. EQ is the same bit test signed or unsigned. LT_F32 is the ordered compare (fcmp olt), false on NaN. The existing modifier refusals stay: no DPP, SDWA, abs, neg, omod or clamp.Other compare forms are still refused by name.
Part of #2413. This change does not overlap #3635, #3645 or #3655: they touch the same allow-list line but different instructions. Merging all four locally needed a one-line conflict resolution on that list and in the test file.
Verification
Build at this branch (base
d5970858), Windows 11 26300, MSVC 19.44, dev preset.Passed.
New checks in
tests/native_direct_mesh_check.py, on the existing source-built triangle:v_cvt_f16_f32 v1, v2: checks the RNE exponent rebias (sub i32 …, 939524096) and that the exported X isorof the half withand v1, -65536, so the high word is kept.v_cvt_f32_f16 v1, v2: the exported X is the bitcast ofdx.op.legacyF16ToF32(131, …).v_cmpx_eq_u32(existing behaviour, now covered),v_cmpx_eq_i32andv_cmpx_lt_f32, the sequence iss_mov_b64 s[22:23], exec; the compare;s_cbranch_execzoverv_mov_b32 v1, 2;s_mov_b64 exec, s[22:23]. The test checks three things:icmp eq i32 0, …orfcmp olt float …) is thebrcondition of the work block;select i1 <predicate>, i32 2, i32 <old v1>;phitakes the old value from the empty edge and feeds the exported X.v_cmpx_le_f32in the same sequence is still refused withunsupported mesh instruction or EXEC state: v_cmpx_le_f32.native_direct_meshfails at the first new case withunsupported mesh instruction or EXEC state: v_cvt_f16_f32. With the change restored, it passes again.Broader run, WARP only:
116 of 119 passed.
mesh_two_exits_warpis a capability skip. Three tests did not run because their executables were not built:meshlet_builderandstartup_pipeline_state_mesh_shift_controlpassed after buildingmeshlet_builder_checkandstartup_pipeline_state_check;xmem_section_lease_mesh_warp(xmem shim, not touched here) was not run.Hardware variants were not run. No draw test exercises the new forms; the checks are on DXIL text.
Local note. On this host, the dev-preset link of
offscreen_checkfails withLNK1104: cannot open file 'offscreen_check.exe', also under another output name. It links with/INCREMENTAL:NO. I linked it that way locally to run the draw tests above. That is a separate issue and not part of this change.Evidence and follow-up
Local capture census, counts only.
compile_dxil --refusals <dir> --mesh-layout <generic layout>, with the layoutmesh1 128 128 128 2 128 64+validate_uint_heap_reads+guest_root.v_cvt_f16_f327,v_cmpx_eq_i324,v_cmpx_lt_f322X2W_MESH57_PARTIAL_ZERO=1With this change the moved requests stop later. The most common next refusals are:
unsupported mesh instruction or EXEC state: s_mov_b64(10):s_mov_b64 vcc, execcopies the narrowed mask before an if/else, which re-narrows withs_and_b64 exec, vcc, execafter the else arm;mesh SAVEEXEC else arm lacks the saved-mask inverse(7).That if/else shape is next to the SAVEEXEC diamond work in #3645/#3646, so I have not started on it.
Fixtures. The fixtures are hand-encoded gfx1013 words, written in this PR from the RDNA2 encoding. The VOP1 and VOPC opcodes were cross-checked with the project's decoder (
gfx2hlsl.decode).Checklist
AI-assisted.