pixel_aot: lower 32-bit vector bitwise logic and shifts #341
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!341
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/341/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?
@Holastor on GitHub · 2026-11-21 22:45 UTC · original
Holastor:shader/vector-bitwise-and-shifts→main· +121 −0 · 6 files · 1 commits · closed without mergingChange
Lower 32-bit vector bitwise logic and shift operations in
tools/pixel_aot.py:v_and_b32v_or_b32v_xor_b32v_lshlrev_b32v_lshrrev_b32v_ashrrev_i32This advances milestone #1 / offline pixel shader recompilation, isolating the 32-bit vector bitwise and shift portion independently from the overlapping, unmerged work in #232 (
Refs #232).Vector registers remain
precise floatin the emitted HLSL. Operands are bit-cast to unsigned 32-bit integers viaasuint, and the result is stored withasfloat. The reverse shift forms mask the shift count insrc0to 5 bits (& 31u) matching RDNA2 hardware semantics (S1.u << (S0.u & 31),S1.u >> (S0.u & 31),S1.i >> (S0.u & 31)).v_ashrrev_i32performs arithmetic right shift onasint, sign-extending negative values before casting back touint.Operand checking (
vgpr_name,u32_operand) validates register ranges (v0..v255), rejects uninitialized or non-numeric vector registers, and checks against collisions with outstanding texture samples befores_waitcnt vmcnt(0)as well as pending scalar constant loads befores_waitcnt lgkmcnt(0).tools/scan_unsupported_shaders.pytracks supported forms directly frompixel_aot.VECTOR_BITWISE_32, preventing drift between the scanner and lowerer.Verification
Commit under test:
68df671(branched cleanly from currentmainat1292d15).Environment: Windows 11 build 26100, MSVC 19.51.36263.0, Windows SDK 10.0.26100.0, DXC 10.0.26100.0, D3D12 debug layer enabled on both backends.
vendor=1002 device=73ff), driver32.0.21045.11001vendor=1414 device=008c), driver10.0.26100.9818D3D12 hardware, WARP and tool tests
Test logs:
pixel_aot_hardware:pixel_aot_warp:Pure-Python test suite
All 9 test suites passed (27/27 tests in
rdna2_tools_checkOK with 1 capability skip).Evidence and follow-up
BITWISE_BODYintests/pixel_aot_check.pyusingwith_constants(s44:s47) and sample registers (v12:v15), producing exact half-float outputs[1.5, 3.0, 2.0, 1.0].check_vector_bitwise_drawverify that each distinct operation is enforced:v_ashrrev_i32tov_lshrrev_b32(proves arithmetic vs logical right shift;0xf0000000 >> 4sign-extends to0xff000000rather than zero-filling to0x0f000000).v_xor_b32tov_and_b32(proves XOR vs AND; zeroing the channel).v_and_b32tov_or_b32(proves AND vs OR; altering red to 1.75).v_lshrrev_b32tov_ashrrev_i32(proves logical right shift of0x80000000 >> 1does not sign extend, distinguishing+2.0from-2.0).Each mutation independently asserts
result.returncode == 1and"pixel_mismatch" in result.stderr.check_controls: Reject writes overlapping outstanding samples befores_waitcnt vmcnt(0), uninitialized VGPR reads (v50), non-numeric vector register reads (v0holdingbary_i), out-of-range registers (v256), and execution in quad mode.0207021a,0207021c,0207021e,02070220,02070222,02070224) totests/rdna2_tools_check.py.BITWISE_BODYtofixturesincheck_binaryforllvm-mcassembly andlibLLVMdisassembly.Checklist
@Holastor on GitHub · 2026-11-22 08:29 UTC · original
@R0Y00 Closing as superseded by #232 (
5a16ee9), which landed 32-bit vector bitwise logic, shifts (v_and_b32,v_or_b32,v_xor_b32,v_not_b32,v_bfi_b32,v_lshlrev_b32,v_lshrrev_b32,v_ashrrev_i32) and integer conversions intomain.Opened a follow-up PR #505 to register the
pixel_aot.INTEGERinstructions intools/scan_unsupported_shaders.pyand verify tracking inpso_readiness_check.py.Pull request closed