shader: lower the remaining no-carry 32-bit add and sub forms in pixel_aot #582
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!582
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/582/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?
@JB2WIN on GitHub · 2026-11-22 14:06 UTC · original
JB2WIN:shader/add-sub-nc→main· +180 −17 · 6 files · 3 commits · merged 2026-11-22 15:08 UTCChange
tools/pixel_aot.pynow lowers the remaining 32-bit no-carry add/sub forms. This builds on #495 (VOP2v_add/sub_nc_u32_e32) and #570 (v_subrev_nc_u32_e32):v_add_nc_u32_e64,v_sub_nc_u32_e64,v_subrev_nc_u32_e64v_add_nc_i32andv_sub_nc_i32, in the unsuffixed spelling LLVM 15 prints. These are 32-bit wraparound with no clamp, so they produce the same bits as the u32 forms.The add/sub/subrev lowering is now one table branch (subrev =
b - a) instead of #570's separate subrev branch. #570'scheck_subrev_u32_drawis unchanged.Refused and tested as rejections, each paired with its accepted spelling:
clampon these formsabs/negon an e64 sourcev_add_nc_i32_e64: the explicit suffix is not the printed form, andgfx1013.tsvhas no row for itquad_perm/dpp8, which the existing DPP table already lowersFloat-written inline constants are taken as their binary32 bits, as for the #495 forms. This is now pinned for
1.0and-1.0. The scanner pattern andKNOWN_RDNA2_BASE_OPCODEScover the family. The scanner'sINTEGER_SOURCEclass is coarser than the translator and also acceptsv106, as before.Changed expectation: the e64 rows in the
bad_vop2rejection list (from #495/#570) are removed because e64 is now accepted. The new static group asserts their lowering.Semantics:
subrev= src1 − src0 follows the translator's existing convention. It matches LLVM 15 TableGen (VOP2Instructions.td:V_SUBREV_U32has revOpv_sub_u32, and the REV patterns swap operands; gfx10V_SUBREV_NC_U32encodes that pseudo). The draws check consistency with this convention on desktop GPUs. I could not check it against the RDNA 2 ISA PDF.AI-assisted (Claude Code).
Verification
Head is rebased on
bbebcad. Windows 11 (10.0.26200.9974), NVIDIA GeForce RTX 3080 (driver 32.0.16.2124, debug layer on) and WARP 10.0.26100.9818.draw-integer-ncwith CTestpixel_aot_integer_nc_{hardware,warp}(about 3.3 s / 0.8 s). It uses lossless integer readback and 11 draws: 3 groups × 5 rows (A, B). Every input and result is a normal binary32 pattern or ±0, and the test asserts this. The rows cover unsigned wrap, signed overflow, borrow, sub ≠ subrev, high-bit wrap, inline constants and VGPR-first operands.pixel_mismatchon both adapters. Dev-time mutation (subrev asa - b) fails both tests and was reverted.ctest --preset dev --no-tests=error -R "^(pixel_aot_|rdna2_tools_check$|pso_readiness)": 22/22.ctest --preset dev --no-tests=error(ond4c7656, before the last trivial rebase): 279 tests, 0 failed. Skips:bvh_wave64_hardware,bvh_wave64_warp,wave_shuffle_warp.tests/pixel_aot_check.py binarywith LLVM 15.0.7, locally: exit 0.tests/pixel_aot_check.py(controls),rdna2_tools_check.py,form_coverage_check.pyanddocs_links_check.pyall pass.Evidence and follow-up
KNOWN_RDNA2_BASE_OPCODES).dashboard.svgis not regenerated.🤖 Generated with Claude Code
Lower v_subrev_nc_u32 (e32 and e64), v_add_nc_u32_e64, v_sub_nc_u32_e64 and the VOP3-only v_add_nc_i32 and v_sub_nc_i32 with 32-bit wraparound. Clamp, operand modifiers, DPP, SDWA and the hand-written v_*_nc_i32_e64 spelling stay rejected. The two e64 rows that the previous check refused are now accepted. Three programs draw the forms bit for bit through the integer readback target (11 draws, own CTest entry pixel_aot_integer_nc_{hardware,warp}), with a swapped sub/subrev negative control. The LLVM 15 round trip covers them and the scanner pattern and known-opcode list are extended. Subrev computes src1 - src0, following the translator's float subrev convention; the draws check consistency with it, not the ISA document. Co-Authored-By: Claude Opus 5.5 <[email protected]>