Repository navigation
shader: lower v_and_or_b32 and v_cvt_f16_f32 in the mesh frontend - #3743
Merged
Merged
Conversation
lambirou
force-pushed
the
codex/mesh-vector-alu
branch
2 times, most recently
from
December 1, 2026 14:39
8bb4b06 to
baa4078
Compare
lukaslw-lab
approved these changes
Dec 1, 2026
lukaslw-lab
left a comment
Contributor
There was a problem hiding this comment.
Reviewed baa40780 by reading the diff; not built or run.
Verdict: approve. Both ops join the mesh VALU list and lower through the shared ALU, with uniformity handled correctly. No MUST.
- Overlap with #3666. #3666 (Kawiu, open) also adds
v_cvt_f16_f32to this list. It goes through the same shared narrowing (gfx1013_direct_compute.inl:2102), so the behaviour is identical and only the list entry is duplicated. Whichever lands second can drop its entry on rebase.v_and_or_b32here, andv_cvt_f32_f16plus the two CMPX forms in #3666, are not duplicated. For context: onmain+ #3760, six slot 86 programs from our own capture now stop first atv_cvt_f16_f32, so either PR clears that wall for them. - Rebase. The branch is on
e1161e43, and onlytests/native_direct_mesh_check.pyconflicts withmain158ef794, where both sides appended cases. The source hunk merges cleanly. - Checked, no finding:
- Source counts.
v_and_or_b32has analu_rulesentry of arity 3, so a result is uniform only when all three sources are.v_cvt_f16_f32has no rule and is not in the hard-coded arity lists, sosourcesis 0 and the merged word is never declared uniform. That matches the new comment, since the high half comes from the destination. - Modifiers. Abs, neg, clamp and omod still go through the shared operand gate, so they refuse as before.
- Source counts.
Tests:
v-and-or-b32traces(S0 & S1) | S2to the export, and-unprovenrefuses an unbound source.- The
v_cvt_f16_f32cases match the NaN/infinity select chain of the narrowing and export the low half. -unproven-sourceand-unproven-destinationpin both refusals. The second covers the kept high half.
CI ran native_direct_mesh (pr preset filter) green at this head, on the old base.
After the scalar bit operations, the forced slot 86 mesh path refused v_cvt_f16_f32 in 357 requests and v_and_or_b32 in 331, ahead of the control-flow, heap-provenance and pixel blocks. - v_and_or_b32 (VOP3 0x371) joins the mesh vector list that already handles v_or3_b32 and v_add3_u32, so it takes the three-source alu_rules entry and lowers to (S0 & S1) | S2. The shared operand gate still refuses abs, neg, clamp and omod. - v_cvt_f16_f32 (VOP1 0x0A) joins the same list and reuses the compute frontend's integer round-to-nearest-even narrowing: the sign comes from bit 31, binary32 subnormals become signed zeros, binary16 subnormals are kept, overflow including the 65520 tie gives 0x7c00, and a NaN keeps its quiet bit. The encoding goes into the low half and the reaching destination value keeps the high half, as the compute frontend does, so an unproven destination still refuses and the merged word is not treated as uniform. tests/native_direct_mesh_check.py adds source-built programs with the run helper: v_and_or_b32 with s20 = 0x0000ffff and s21 = 0x00ff0000 exports (and v0, 65535) | 0x00ff0000, and v_cvt_f16_f32 exports the narrowed word for 1.0f, 0.0f and -2.0f. Controls reject an unbound third source and an unproven conversion source or destination. Observed IR: - %t8 = and i32 %v0, 65535 ; %t9 = or i32 %t8, 16711680 - v_cvt_f16_f32: lshr <bits>, 16 / and ... 32768 for the sign, and <bits>, 2147483647, lshr ... 23, and ... 8388607, the nearest-even narrowing with icmp ugt %exp, 142 -> 31744 and icmp ugt %mag, 2139095040 -> 32256 | quiet bits, then or %narrow, %sign, and %destination, -65536 and the final or. Verified: - cmake --build --preset release --target compile_dxil (7/7 steps, compile_dxil.exe linked) - python -B tests/native_direct_mesh_check.py <compile_dxil.exe> <dxc dir>: exit 0, "mesh allocation, indexed outputs, group exchange and negative controls passed" - ctest --preset release --no-tests=error -R '^native_direct' 2/2 passed: native_direct_container 15.04 s, native_direct_mesh 13.78 s - python -B tests/docs_links_check.py: 210 files, 807 links Refs R0Y00#3703
lambirou
force-pushed
the
codex/mesh-vector-alu
branch
from
December 1, 2026 23:02
baa4078 to
816ab82
Compare
Contributor
Author
|
Rebased onto Head
AI-assisted. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After the scalar bit operations, the forced slot 86 mesh path still refused
v_cvt_f16_f32in 357 requests andv_and_or_b32in 331, ahead of thecontrol-flow, heap-provenance and pixel blocks.
v_and_or_b32(VOP3 0x371) joins the mesh vector list that already handlesv_or3_b32andv_add3_u32, so it takes the three-sourcealu_rulesentry and lowers to(S0 & S1) | S2. The shared operand gatestill refuses abs, neg, clamp and omod.
v_cvt_f16_f32(VOP1 0x0A) joinsthe same list and reuses the compute frontend's integer round-to-nearest-even
narrowing: the sign comes from bit 31, binary32 subnormals become signed
zeros, binary16 subnormals are kept, overflow including the 65520 tie gives
0x7c00, and a NaN keeps its quiet bit. The encoding goes into the low halfand the reaching destination value keeps the high half, so an unproven
destination still refuses and the merged word is not declared uniform.
Validation (Windows, Release; AMD Radeon RX 9060 XT for the hardware run):
cmake --build --preset release --target compile_dxil— 7/7 steps.python -B tests/native_direct_mesh_check.py out\\build\\release\\compile_dxil.exe "<DXC dir>"— pass, including the
v_and_or_b32andv_cvt_f16_f32programs and theunbound/unproven-source controls.
ctest --preset release --no-tests=error -R '^native_direct'— 2/2 pass.Refs #3703