shader: lower gfx1013 v_mad_legacy_f32 in pixel_aot #352
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/358"
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-21T23:16:19Z.
Change
Advances an independent problem: gfx1013 instruction coverage in
pixel_aot. It adds oneALUtable entry, extends the unary/binary/ternary regex intools/pixel_aot.py, and adds a draw check intests/pixel_aot_check.py. No open PR claimsv_mad_legacy_f32. #288 lowersv_mad_f32andv_mac_f32and does not include the legacy form, and no prerequisite PR is needed.v_mad_legacy_f32computesS0 * S1 + S2with the legacy (DX9) multiply rule that0 * xis 0 for any x, including inf and NaN. It reuses the existingmul_legacyexpression and follows it with an add in the sameprecisestatement, so DXC does not contract it into an FMA.Fixture
legacy_multiply_add(). Four lanes with e64 negation, absolute value andclamp.Draw check
check_legacy_multiply_add_draws.check_binary.Negative control: replacing it with
v_fma_f32must producepixel_mismatch, because 0 * inf is NaN there.Verification
Windows 11 build 26200, MSVC 19.50.35720, Windows SDK 10.0.26100.0, DXC 1.8.2502.11, D3D12 debug layer enabled.
{0} * {1} + {2}makespixel_aot_warpfail withpixel_mismatch x=0 y=0in the new draw.ctest --preset dev --no-tests=errorgives 146 passed, 0 failed, with thebvh_wave64_warpandwave_shuffle_warpcapability skips.Not run locally:
tests/pixel_aot_check.py binary, because this machine has no LLVM with gfx1013. Ubuntu CI covers it.This is independent of #350, #353 and #356. All of them add a fixture next to the ceiling fixture, and #288 edits the same regex, so later merges need a trivial rebase.
Checklist
AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-21T23:22:42Z.
Updated to
df922c4:4e223baaddslegacy_multiply_add()tocheck_binary. The original commit left it out, so the LLVM round trip did not cover it.df922c4fixes what that round trip then caught. The Linux job failed withinvalid operand (violates constant bus restrictions), because gfx10 VOP3 accepts at most two scalar operands and the fixture used three SGPRs per instruction. The fixture now movess46ands47tov18andv19first. The operand values and expected results are unchanged.Rerun on
df922c4, with the RX 9070 XT (driver 32.0.32015.7029) and WARP 10.0.26100.9818 and the debug layer on:ctest --preset dev --no-tests=error -R '^pixel_aot_'passes 2/2.AI-assisted (Claude Code).