-
Notifications
You must be signed in to change notification settings - Fork 824
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
Fix LLVM speed regression #651
Conversation
bors try |
Previous timing:
With the changes from this PR:
|
73ab8bf
to
9303e5b
Compare
…een canonicalized and don't canonicalize subsequent calculation results from them.
9303e5b
to
12d5f6f
Compare
bors try |
@@ -399,6 +408,31 @@ fn canonicalize_nans( | |||
canonicalized | |||
} | |||
|
|||
// Replaces any NaN with the canonical QNaN, otherwise leaves the value alone. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style idea: maybe consider the opposite name: make_canonical_nan
.
Hi, I have reported the regression originally in wasmerio/c-wasm-simd128-example#1. If I reset |
@syrusakbary What's the status of this PR? |
934: In LLVM backend, track which floats are guaranteed to be arithmetic, which makes the canonicalization a no-op. r=nlewycky a=nlewycky # Description This is a reimplementation of the patch in PR #651. Extend state.rs ExtraInfo to track more information about floats. In addition to tracking whether the value has a pending canonicalization of NaNs, also track whether the value is known to be arithmetic (which includes infinities, regular values, and non-signalling NaNs (aka. "arithmetic NaNs" in the webassembly spec)). When the value is arithmetic, the correct sequence of operations to canonicalize the value is a no-op. Therefore, we create a lattice where pending+arithmetic=arithmetic. Also, this extends the tracking to track all values, including non-SIMD integers. That's why there are more places where pending canonicalizations are applied. Looking at c-wasm-simd128-example, this provides no performance change to the non-SIMD case (takes 58s on my noisy dev machine). The SIMD case drops from 46s to 29s. # Review - [ ] Add a short description of the the change to the CHANGELOG.md file Co-authored-by: Nick Lewycky <[email protected]>
@penzn Yes, we noticed the same thing. It's a bit of a pain because LLVM doesn't say a lot about what happens with NaN values on operations, even as simple as an |
@nlewycky I just rebuilt the benchmark with Maybe we should open an issue for this. CC @topperc |
When canonicalizing all the NaNs with the LLVM backend, the performance was slowed down 2x.
This PR fixes that by reverting the canonicalization
@nlewycky