v_fma_mix_* are not fused; using tb_fma removes the WARP device (0x887a0005) #40
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator#40
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@artareias on GitHub · 2026-11-21 18:57 UTC · original
tombox-xshaderemitsv_fma_mix_f32/v_fma_mixlo_f16/v_fma_mixhi_f16asa * b + c, which is not fused. The RDNA 2 ISA guide (p. 173) describes them as fused multiply-add. Onevop3_basiccase shows it:(1 + 2^-23) * (1 - 2^-24) - 1expects0x337ffffe(single rounding) and the emitter returns0.Hardware adapter vs WARP
Changing the emitter to use the existing
tb_fmahelper (mad(a, b, c), the same onev_fma_f32uses) athlsl.rs, in thev_fma_mixbranch:gives, for
vop::basic::vop3_basic(Windows 10 19045, rustc 1.100.0):TOMBOX_EXEC_HW=1), driver 32.0.32015.7029v_bfe_i32, see #33): the fused case passesv_fma_mix_f32case reportsdevice removed 0x887a0005and every later case fails withCreateGraphicsPipelineState hr=0x887a0005The first case is harmless:
1.0 * 1.0 + (-0.5), all three sources f16-low (opsel_hi = 7,opsel = 0).v_fma_f32with the sametb_fmadoes not remove the device on WARP.What I compared
Compiling only (no execution) with dxc 1.8 (Windows SDK 10.0.26100,
-T ps_6_0), the two shapes differ only in where the operands come from. Both lower toFMad(op 46); no half types or min-precision appear.DXIL: three
LegacyF16ToF32(op 131) feeding oneFMad. Thev_fma_f32shape (asfloatoperands) has just theFMad. So the trigger looks like WARP executingFMadonLegacyF16ToF32results, but I did not run this minimal shader on WARP in isolation; I only saw it throughvop3_basic.Why it is not a PR
The fused form fixes one case on the RX 7600 but turns a 37-case failure into a device removal in the default WARP mode. I did not include it in #39 (which only fixes the
mixhiexpectation). If someone knows a fused form WARP accepts, or can confirm the WARP crash in isolation, the emitter change is one line.@omonkeyz on GitHub · 2026-11-22 13:20 UTC · original
Fixed on main in
b72625c: v_fma_mix* now use a single-rounding fused path (tb_fma_rto / exact_mix16) instead of a*b+c. Thanks!