-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
Discuss: FP accuracy loss by performance improvement on ARM64 #24033
Comments
I suggest the second one. FP accuracy loss is a common issue, we usually do |
The bitwise equality check in the test is deliberate. The results you are seeing with the new optimizations are probably more accurate, not less. I suspect you just need to introduce LoweredRound ops, adding rules like this:
This is needed because the Go spec says that |
Yes, I think @mundaym is right. We should not use fused FP operations if there is an explicit conversion. Sorry I forgot it in the review. |
Thank you. @mundaym I see it. |
Change https://golang.org/cl/96355 mentions this issue: |
My last https://go-review.googlesource.com/c/go/+/94901 improved FP computation performance by about
9% on ARM64, but introduced a little accuracy lost.
The main idea is packing a pair of FMUL/FADD instructions into a single FMADD, and its benefits
How ever accuracy loss also be introduced. Such as
The test case go/src/cmd/compile/internal/gc/testdata/fp.go failed.
There are two solutions
Roll back to the less optimized fmul/fadd
Modify the test case, something like pattern matching
float32(0.6046603 * 0.9405091) + 0.6645601 == 1.2332485
float32(0.6046603 * 0.9405091) + 0.6645601 == 1.233248*
What is your opinion?
The text was updated successfully, but these errors were encountered: