Repository navigation
Conversation
The lowering emits the product rounded (and flushed) before the add, which is what the ISA says, yet a driver folds the fmul into the fadd behind it as an FMA though nothing carries a fast-math flag: on the 2070-class card here the tail of the product escapes one rounding where two were due (2 of 2560 inputs on v_mad, 102 of 14440 on v_mac, WARP none, the model none). An FMad over a zero signed by the operands' signs rounds exactly like the plain product and hides the multiply behind a call the fusion pass sees no other side of; with it the arithmetic suite meets both backends word for word. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
664d7e0 to
7054097
Compare
|
Tested on Linux (Arch, kernel 7.3.5, 3× RTX 4090 driver 620.73.04), Rust 1.98.1 (pinned). PR head
Not tested: Windows MSVC build, the title itself. AI-assisted. |
|
Automated triage for the maintainers. Merge candidate. In Cost: three integer ops per CI: Generated by Claude Code |
Offline measurement on a retail dumpResult: no count change against I merged head 7054097 onto No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code). |
Same root cause as #1903 (FMad over an opaque zero), this time on the plain
v_mad_f32/v_mac_f32paths: the lowering emits the product rounded beforethe add, which is what the ISA says, but the driver folds the
fmulinto thefollowing
faddas an FMA although nothing carries a fast-math flag. Onerounding where two were due shifts the tail of the product:
v_mad_f32: 2 of 2560 inputs mismatch on hardware, 0 on WARP, 0 in themodel (
[3f7fffff, 3f800001, bf800000]straddles 1.0, where double vssingle rounding is visible);
v_mac_f32: 102 of 14440.The legacy variants already pass, because
legacy_mulends in aselectthat cuts the
fmul → faddedge. This replaces the plain product with anFMad over a zero signed by the operands' own signs (
sign(a) ^ sign(b)),which rounds exactly like a plain IEEE multiply — signed zeros included,
denormal outputs the same way as the fused
v_fma_f32path alreadyverified — and hides the multiply behind a call the fusion pass sees no
other side of. +19/−2 in
emit/lower.rs, no test changes.With it,
arithmetic_matches_the_hardwarepasses on both backends word forword (the rest of the suite's failures on this branch are the ones covered
by #1903, #1896 and #1857).
Local: RTX 5070 Laptop GPU (driver 616.87) and WARP, 240 tests pass.
AI-assisted (Mistral Vibe).