shader: lower the 64-bit integer compares in pixel_aot #797
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/803"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-23T06:00:56Z.
Change
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
Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-23T06:05:07Z.
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.