shader: lower gfx1013 16-bit integer comparisons in pixel_aot #524
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!524
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/524/head"
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?
@Vonsek on GitHub · 2026-11-22 09:11 UTC · original
Vonsek:pixel-aot-int-compares→main· +204 −0 · 4 files · 1 commits · merged 2026-11-22 09:46 UTCChange
tools/pixel_aot.pynow lowersv_cmp_{eq,ne,lt,le,gt,ge}_{i16,u16}in the VOPC (_e32, writingvcc) and VOP3 (_e64, writing an SGPR or SGPR pair) encodings. The 32-bit integer comparisons are already on main (de229bb); these are the remaining same-width VOPC integer compares the translator refused.asint(x << 16) >> 16, unsigned onesx & 0xffff, wherexis the register's 32-bit pattern. The comparison writes the same tracked lane mask as the otherv_cmp_*forms, sov_cndmask_b32consumes it unchanged under either wavefront-width spelling.0xffff. LLVM prints a float inline constant on a 16-bit integer operand as its binary16 literal (1.0as0x3c00), so float tokens never name a valid operand here and are refused, as are wider literals, source modifiers,clampandop_sel.v_cmpx_*forms (16- and 32-bit),v_cmp_*_{i64,u64},v_cmp_*_f16,v_cmp_class_f16, the nonexistentv_cmp_{f,t}_{i16,u16}, reads of pending constants or samples, and comparisons outside the entry execution mask.tests/form_coverage_check.pyasserts that the controls alone maketools/form_coverage.pycount all 24 16-bit forms and all 32 32-bit integer comparison forms (VOPC for_e32, VOP3 for_e64) in both gfx1013 and rdna2, and that the rejected neighbours are not counted. The controls now translate every 32-bit integer comparison group so those 32 forms are counted too.Verification
tests/pixel_aot_check.pycontrols: expression checks for sign and zero extension, inline constants and the0x8000literal, wave64 spellings, the CPU reference against an independent truth table, and 20 rejections. Passes.tests/pixel_aot_check.py binary ...(LLVM 18): the 8 new programs (24 forms) assemble with-mcpu=gfx1013, disassemble back and lower to the same HLSL. Passes.tests/form_coverage_check.py: passes.tools/pixel_aot.pyreverted, the controls, the binary mode and the form coverage check all fail withUnsupported instruction ... v_cmp_ne_i16_e32.draw-predicate-roundingmode): 8 shaders × 6 word pairs against the exact CPU reference, plus three references that must reportpixel_mismatch: a signed shader against the unsigned reference on0x8000vs 0,eqreplaced byneon equal low halves, andv_cmp_*_u32against the 16-bit reference on words whose low halves are equal but whose whole words are not. Each word is a normal binary32 value so a float move cannot flush or quiet it. Measured on Windows: every draw matches the reference and all three negative references reportpixel_mismatch, on the RTX 5080 and on WARP.ctest --preset dev --no-tests=error -R '^pixel_aot_predicate_rounding_(warp|hardware)$' -Vat94bb90eon Windows 11 build 26200.9974, VS Build Tools 2022 17.14 (MSVC 14.44.35207), Windows SDK 10.0.26100, DXC 1.9.2602.17: 2/2 passed.pixel_aot_predicate_rounding_hardwareon an NVIDIA GeForce RTX 5080 (driver 32.0.16.1692) took 44.7 s and 40.5 s in two runs, andpixel_aot_predicate_rounding_warptook 8.7 s and 8.9 s, both under the 60 s timeout; the hardware time is mostly DXC compiles and device setup per draw. The D3D12 debug layer was not available. The fullctest --preset dev --no-tests=errorpassed 236/236, withbvh_wave64_hardware,bvh_wave64_warpandwave_shuffle_warpskipped.Evidence and follow-up
v_cmpx_*stays rejected: the translator's execution model has only the entry mask and cannot represent per-lane exec writes. 64-bit and f16 comparisons are separate follow-ups.Lower v_cmp_{eq,ne,lt,le,gt,ge}_{i16,u16} in e32 and e64 encodings. Only the low 16 bits of each source are compared, sign-extended or zero-extended, and the result feeds v_cndmask_b32 through the tracked lane mask. Float tokens, wider literals, modifiers, clamp and op_sel are refused; v_cmpx, 64-bit, f16 and f16 class comparisons stay rejected. Binary fixtures cover all 24 forms. The predicate draws evaluate every predicate on six word pairs with three references that must mismatch (signed vs unsigned, eq vs ne, 32-bit vs 16-bit). The form coverage check now asserts that all 16-bit and 32-bit integer comparison forms are counted and that the rejected neighbours are not.@chatgpt-codex-connector[bot] on GitHub · 2026-11-22 09:31 UTC · original · edited 2026-11-22 09:36 UTC
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
94bb90eℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.