shader: lower the 64-bit integer compares in pixel_aot #803
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!803
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/803/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-23 06:00 UTC · original
JB2WIN:shader/cmp64→main· +496 −12 · 7 files · 4 commits · merged 2026-11-23 08:08 UTCChange
tools/pixel_aot.pynow lowers the 64-bit integer comparesv_cmp_{f,lt,eq,le,gt,ne,ge,t}_{i64,u64}in the e32 (VOPC, printed with_e32) and e64 encodings. This is the bounded register-pair slice from #794.Sources. The new
int64_operandhelper returns the raw(lo, hi)words of a source. A source may be:v[a:a+1]with 0 ≤ a ≤ 254. Unaligned pairs are accepted, because LLVM 15 assemblesv[3:4]. Both halves must be tracked.sgpr_pair/scalar_u64.Compare. Signed ordering applies to the high word only, and the low words always compare unsigned. Operands are compared as raw bits (
asuint), so non-normal binary32 patterns keep their bits. The result is the same per-lane condition the 32-bit compares produce.Destinations.
vcc/vcc_loonly.vcc_lo,vcc,sNor an aligneds[a:a+1].Refused.
1.0), hex values, out-of-range decimals,v[255:256],s[45:46], untracked halves, SGPR src1 on e32, an SGPR destination on e32, pending scalar loads and outstanding samples.v_cmpx_*, modifiers,clamp, DPP and SDWA.Scanner.
supports_int64_compare()applies the same operand and destination rules. Six boundary forms the translator refuses are asserted unsupported.Changed expectations, replaced rather than deleted:
v_cmp_lt_i64_e64 s52, s[45:46], v[18:19](odd SGPR pair) andv_cmp_lt_i64_e32 vcc_lo, v[18:19], s[44:45](SGPR src1 on e32). Both are still refused.form_coverage_check.py, the 32 forms move intocompare_forms. The expected count is now derived from the sets. The uncovered neighbours becomev_cmpx_lt_i64/v_cmpx_lt_u64.Refs #794. AI-assisted (Claude Code).
Verification
Environment: Windows 11 10.0.26200.9974, NVIDIA GeForce RTX 3080 (driver 32.0.16.2124) and WARP, at
d998665.Draw
draw-cmp64(pixel_aot_cmp64_{hardware,warp}): eight programs, 13 cases each, withv_cndmask_b32selecting per-predicate words. Readback is full-width and checked against an independent Python reference. The cases include:0x7fffffff_ffffffffagainst0x80000000_00000000;v[18:19]againstv[19:20]);0x00000001,0x7fc00000,0xffffffffand0x80000000, compiled with-denorm preserve.Mutations. Each must mismatch, and each did on both adapters:
ltreplaced withle;v[20:21].Dev-time checks (not committed). Without the new branch the controls fail. Without the scanner validator
rdna2_tools_check.pyfails.Commands.
ctest --preset dev --no-tests=error -R "^pixel_aot_cmp64_": 2/2 passed. It took 21.8 s on the RTX 3080 and about 6 s on WARP.ctest --preset dev --no-tests=error -j4: 371 of 372 passed. The one failure iscompute_store_aot_hardware, which hits its 45 s timeout on this adapter on plainmainas well (#448). Skipped:bvh_wave64_hardware,bvh_wave64_warpandwave_shuffle_warp.llvm-mcruns through a localclang -cc1asshim.form_coverage_check.py,rdna2_tools_check.py,pso_readiness_check.pyanddocs_links_check.pypass.Assumptions and limits
🤖 Generated with Claude Code
v_cmp_{f,lt,eq,le,gt,ne,ge,t}_{i64,u64} (e32 and e64) with VGPR pair sources (unaligned allowed, as LLVM 15 assembles), aligned SGPR pairs and sign-extended inline integers -16..64. Signed ordering applies to the high word only; operands are compared as raw bits. 32-bit literals, floats, modifiers and v_cmpx stay refused; e32 destinations are vcc only and e32 src1 must be a VGPR pair. Adds controls, scanner validation, an LLVM 15 binary fixture, form coverage and a draw with six mutations (pixel_aot_cmp64_*). Refs #794 Co-Authored-By: Claude Opus 5.5 <[email protected]>@JB2WIN on GitHub · 2026-11-23 06:05 UTC · original
Follow-up commit
899366b: without a suffix, the encoding is now chosen as LLVM 15 does. It is e32 when the destination isvcc/vcc_loand src1 is a VGPR pair, and e64 otherwise. Checked with llvm-mc ongfx1013:v_cmp_lt_i64 s52, v[1:2], v[3:4]andv_cmp_lt_i64 vcc_lo, v[1:2], s[4:5]both assemble as_e64. Before this, the translator and scanner treated every suffix-less spelling as e32 and refused those two forms. The controls now assert that the suffix-less forms lower to the same HLSL as their_e64spelling. The controls,rdna2_tools_check.pyanddocs_links_check.pypass. The draws use explicit suffixes and are unaffected.