shader: lower gfx1013 v_madak_f32 and v_madmk_f32 in pixel_aot #589
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/595"
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-22T14:49:33Z.
Change
tools/pixel_aot.pynow lowers the VOP2 literal multiply-addsv_madak_f32(S0·S1 + K) andv_madmk_f32(S0·K + S1) in the same branch asv_fmaak_f32/v_fmamk_f32. The operand rules are the same: K must be a 32-bit hex literal, in the last position for madak and the second for madmk; the entry mask applies; and no write may land on an outstanding sample. Unlike the fused forms, these go through the existing non-fusedmad32helper (ALUmad, as forv_mad_f32/v_mac_f32). They therefore round the product before the add and flush binary32 denormals as that helper does.v_madak_f32_e64("e64 variant of this instruction is not supported").v_madak_f32 v5, v1, v2, v3stays unsupported, matchinglower(). The existing fmaak/fmamk scanner pattern is coarser (it allows any K). I left it unchanged because that is outside this change.Fixes #590. AI-assisted (Claude Code).
Verification
Windows 11 (10.0.26200.9974), NVIDIA GeForce RTX 3080 (driver 32.0.16.2124) and WARP 10.0.26100.9818, head rebased on
8ae1377.check_mad_literal_drawin theblend-scalarmode, next tocheck_mad_draw. Channels 0/1 are madak/madmk on 4097·4097 − 16785408, which gives 0.0 non-fused and 1.0 fused. Channels 2/3 are madak/madmk on 2⁻¹²⁷·2¹²⁶ + 0.5, which gives 0.5 with the denormal flush and 1.0 without. A reference expecting the fused or denormal-preserving result in any one channel must reportpixel_mismatch, and it does. A dev-time mutation (not part of CI) that lowered both throughfmamade the draw fail withpixel_mismatch.ctest --preset dev --no-tests=error -R "^(pixel_aot_|rdna2_tools_check$|pso_readiness)"gives 20/20 on the rebased head.pixel_aot_blend_scalar_hardwaretakes about 35 s, under the 60 s timeout.ctest --preset dev --no-tests=error(before the last trivial rebase) gives 278/278, with skipsbvh_wave64_hardware,bvh_wave64_warpandwave_shuffle_warp.tests/pixel_aot_check.py binarywith LLVM 15.0.7, locally: exit 0.pixel_aot_check.py(controls),rdna2_tools_check.py,form_coverage_check.pyanddocs_links_check.pyall pass.Evidence and follow-up
docs/experiments.mdsays so.tools/disasm_rdna2.pydoes not know VOP2 opcodes 0x20/0x21, so binary scanning of madak/madmk showsv_vop2_20/21. That is a separate fix.🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by alexander-src on 2026-11-22T15:11:57Z.
Independent Linux x64 + LLVM 23.1.4 check on
e17124b:v_madak_f32andv_madmk_f32route cleanly through the existing unfused denormal-flushingmad32helper with literal placement validated at operand 2 (ak) or operand 1 (mk), matching the updated regexes intools/scan_unsupported_shaders.py.e17124b: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