shader: lower s_nand_b64, s_nor_b64 and s_xnor_b64 in pixel_aot #394
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/400"
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 denn0x on 2026-11-22T00:21:23Z.
Change
This advances
pixel_aotscalar ALU coverage with three gfx1013 SOP2 forms:s_nand_b64,s_nor_b64ands_xnor_b64. They join the merged 64-bitSALU_BIT64table next tos_andn2_b64ands_orn2_b64, which is the shared interface. No open PR lists these forms (#257 is the 32-bit scalar ALU), and no prerequisite PR is needed. Until nowcheck_controlsrejected them only as forms that were not lowered yet.SALU_BIT64operations. Operand handling (pairs, inline constants, literals, pending loads) is the existingscalar_u64path.Tests
scalar64()draw: for each form, the register-pair result goes into the hash, and an SCC probe is observed throughs_cmov_b64of a distinct literal. That is needed because channel 3 exports only SCC bits 0–9. Each probe is tested in both SCC states:s_nand_b64 -1, -1is zero;s_nor_b64with -1 is zero;s_xnor_b64of the alternate pair with -1 is zero only in Set 2.scalar64_referencemodels the three forms independently with Python integers.pixel_mismatch:nandtoand,nortoor,xnortoxor, and thenorprobe's -1 operand replaced with 0.tests/form_coverage_check.pymoves the three forms fromrejected_formstoscalar64_formsfor gfx1013 and RDNA 2. Other rejected neighbors (s_cselect_b64,s_bfe_u64,s_bfe_i64,saveexec) stay rejected.Fixture fix this needed
The final fold of the 64-bit accumulator repeated
x ^= x >> 30. That equalsx ^ (x >> 60), so accumulator bits 30–59 never reached a pixel, although the comment said all 64 bits were folded. I checked this by flipping each input bit: the old fold ignores exactly bits 30–59, and the new one ignores none.With the new mixing steps, the existing signed-right-shift mutation landed in those bits and escaped detection. The fold now computes
acc ^ (acc >> 30) ^ (acc >> 60), with both shifts taken from the original value. All four existing mutations still report a mismatch.Verification
Windows 11 build 26200, Windows SDK 10.0.26100.0, DXC 1.8.2502.11, D3D12 debug layer enabled. Hardware: AMD Radeon RX 9070 XT (vendor 1002, device 7550), driver 32.0.32015.7029. WARP: Microsoft Basic Render Driver 10.0.26100.9818. Commit
3f17959on4f6c39d.Mutation check (local, reverted): removing the low-half inversion from the
nandlowering intools/pixel_aot.pyfails the WARP draw withpixel_mismatch x=0 y=0.Not run locally:
tests/pixel_aot_check.py binary, because this machine has no LLVM with gfx1013.scalar64()is already incheck_binary, so Ubuntu CI assembles and round-trips the new lines.Checklist
docs/experiments.mdis updated.AI-assisted (Claude Code).