shader: lower RDNA2 scalar shifted additions in pixel_aot #581
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/587"
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 stan495 on 2026-11-22T14:24:22Z.
Change
Translate RDNA2 32-bit scalar shifted addition instructions
s_lshl1_add_u32,s_lshl2_add_u32,s_lshl3_add_u32, ands_lshl4_add_u32intools/pixel_aot.pyas((src0 << K) + src1)with carry-out SCC condition((src0 >> (32 - K) != 0) || (dest < src1)).This advances the offline shader AOT pipeline by completing the RDNA2 SOP2 scaled addition family, complementing the 32-bit scalar ALU scope in #257 (where
s_lshl1_add_u32was previously listed as an unsupported rejection placeholder). Refs #257.0x2e..0x31intools/disasm_rdna2.pyand recognition intools/scan_unsupported_shaders.py.tests/rdna2_tools_check.py.s_lshl1_add_u32rejection intests/pixel_aot_check.pywiths_lshl5_add_u32, addsop2_lshl_add_group()static translation checks, and enforce rejections on out-of-range shift amounts (0,5), wrong arity, vector sources, and vector destination.gfx1013.tsvandrdna2.tsvintests/form_coverage_check.py.check_lshl_add_u32_drawwired intocheck_e64_renderusingR32G32B32A32_UINTlossless readback, verifying small arithmetic values, shift wrap, add wrap, and selective SCC carry conditions against negative mismatch controls.docs/experiments.md.Verification
Commit under test:
97d2ceconshader/sop2-lshl-add, rebased onupstream/main(d4c7656).Environment: Windows 11 (build 10.0.26200), VS 2022 (17.14), Windows SDK 10.0.26100.0, DXC 10.0.26100.0.
Adapter: Microsoft Basic Render Driver (WARP), vendor 1414, device 008c, driver 10.0.26100.9711, debug layer enabled.
Evidence and follow-up
s_lshl0_add_u32,s_lshl5_add_u32,s_lshl1_add_u32 s62, s44,s_lshl3_add_u32 s62, v12, s45,s_lshl4_add_u32 s62, s44, v13, ands_lshl1_add_u32 v12, s44, s45are rejected.53->999) and an inverted SCC carry flag (0->1) each reportpixel_mismatchand fail the batch check.Checklist
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by alexander-src on 2026-11-22T15:11:53Z.
Independent Linux x64 + LLVM 23.1.4 check on
97d2cec:s_lshl1_add_u32,s_lshl2_add_u32,s_lshl3_add_u32, ands_lshl4_add_u32(0x2e..0x31) againstlibLLVM.so(gfx1013); all four matchdisasm_rdna2output bit-for-bit.({0} >> (32-k) != 0u) || ({r} < {1})against RDNA 2's(S0.u64 << k) + S1.u64 >= 2^32rule; both shift-out overflow and 32-bit add wrap are covered accurately.97d2cec:pixel_aot_check.py binary(LLVM 23),rdna2_tools_check.py,pso_readiness_check.py,form_coverage_check.py,docs_links_check.py, andbidi_controls_check.py.Windows DXC/WARP and hardware draws were not run locally on Linux.
AI-assisted: yes