Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cranelift: Add MinGW fma regression tests #4517

Merged
merged 3 commits into from
Jul 29, 2022

Conversation

afonso360
Copy link
Contributor

See #4512 for context.

It looks like MinGW has an incorrect implementation of fma. This did not show up in the current fma test suite, but it did show when @alexcrichton tried to upgrade to windows-latest on CI.

In this PR we just add the test cases that were submitted to the original bug report of MinGW.

Opening this as a draft, and eventually we'll add a fix for this as well.

cc: @cfallin @alexcrichton

@github-actions github-actions bot added the cranelift Issues related to the Cranelift code generator label Jul 23, 2022
@alexcrichton
Copy link
Member

Since this is just for the interpreter one possibility would be to use libm::fma which is a port of musl's implementation to Rust which should provide stability across platforms perhaps.

@afonso360
Copy link
Contributor Author

afonso360 commented Jul 26, 2022

libm's fma seems a lot better than MinGW's we are now only off by 1 LSB.

I've filed rust-lang/libm#263 to follow up with libm.

@afonso360
Copy link
Contributor Author

@alexcrichton since there is no way to know how long this is going to take with libm. What do you think about disabling the interpreter on the fma tests temporarily?

An alternative could be to have a reduced set of inputs that does not fail in a separate file.

That way we can resolve this now and move ahead with the CI upgrades.

@afonso360 afonso360 marked this pull request as ready for review July 29, 2022 06:59
The interpreter can run `fma.clif` on most platforms, however on
`x86_64-pc-windows-gnu` we use libm which has issues with some inputs.
We should delete `fma-interpreter.clif` and enable the interpreter on
the main `fma.clif` file once those are fixed.
@afonso360 afonso360 force-pushed the mingw-fma-regress branch from 1ff2113 to f157967 Compare July 29, 2022 07:03
@afonso360 afonso360 requested a review from alexcrichton July 29, 2022 09:29
@alexcrichton
Copy link
Member

Sounds reasonable to me, thanks for helping to push on this @afonso360!

@alexcrichton alexcrichton merged commit 1f058a0 into bytecodealliance:main Jul 29, 2022
afonso360 added a commit to afonso360/wasmtime that referenced this pull request Aug 10, 2022
This resolves an issue with incorrect fmaf on the x86_64-pc-windows-gnu target under some inputs.

See: bytecodealliance#4517
alexcrichton pushed a commit that referenced this pull request Aug 10, 2022
* cranelift: Upgrade libm to 0.2.4

This resolves an issue with incorrect fmaf on the x86_64-pc-windows-gnu target under some inputs.

See: #4517

* supply-chain: Vet `libm` 0.2.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cranelift Issues related to the Cranelift code generator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants