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
x/image/vector: TestFloatingAccumulateMask16 fails on js/wasm #31281
Comments
I manage to trim it down to this:
On amd64 it gives:
On wasm it gives:
This is because wasm currently only uses 64 bit float "registers" and only truncates the precision when using an explicit The spec says:
I would conclude that the test is too strict or the x/image/vector package needs more explicit rounding. |
I tried to add explicit rounding, but this rabbit hole went too deep. I now have a CL that relaxes the tests to give a tolerance of 0.1%. I'm not at all sure if this is a good solution. Advice appreciated. |
On Sun, Apr 7, 2019 at 1:40 AM Richard Musiol ***@***.***> wrote:
I tried to add explicit rounding, but this rabbit hole went too deep. I
now have a CL that relaxes the tests to give a tolerance of 0.1%. I'm not
at all sure if this is a good solution. Advice appreciated.
Do you have a link to that CL?
I would like to keep the tests checking that, at least on x86_64, the SIMD
and non-SIMD implementations produce exactly the same output. Perhaps, in
the tests, we should allow a non-zero tolerance for wasm but a zero
tolerance everywhere else. Perhaps we should add an additional test based
on that "divide 16 by 1122" snippet to help document that tolerance knob.
… |
Change https://golang.org/cl/171257 mentions this issue: |
On wasm, calculations on float32 values are done with 64 bit precision. This is allowed by the Go specification, only explicit conversions to float32 have to round to 32 bit precision. The difference caused by the additional precision accumulates over several calculations and causes the test results to not fully match the expectations. Account for this by giving a 0.1% tolerance. Fixes golang/go#31281. Change-Id: I843788f912015600a18ff3d5cf5520c60403b534 Reviewed-on: https://go-review.googlesource.com/c/image/+/171257 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Nigel Tao <nigeltao@golang.org>
On wasm, calculations on float32 values are done with 64 bit precision. This is allowed by the Go specification, only explicit conversions to float32 have to round to 32 bit precision. The difference caused by the additional precision accumulates over several calculations and causes the test results to not fully match the expectations. Account for this by giving a 0.1% tolerance. Fixes golang/go#31281. Change-Id: I843788f912015600a18ff3d5cf5520c60403b534 Reviewed-on: https://go-review.googlesource.com/c/image/+/171257 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Nigel Tao <nigeltao@golang.org>
On wasm, calculations on float32 values are done with 64 bit precision. This is allowed by the Go specification, only explicit conversions to float32 have to round to 32 bit precision. The difference caused by the additional precision accumulates over several calculations and causes the test results to not fully match the expectations. Account for this by giving a 0.1% tolerance. Fixes golang/go#31281. Change-Id: I843788f912015600a18ff3d5cf5520c60403b534 Reviewed-on: https://go-review.googlesource.com/c/image/+/171257 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Nigel Tao <nigeltao@golang.org>
On wasm, calculations on float32 values are done with 64 bit precision. This is allowed by the Go specification, only explicit conversions to float32 have to round to 32 bit precision. The difference caused by the additional precision accumulates over several calculations and causes the test results to not fully match the expectations. Account for this by giving a 0.1% tolerance. Fixes golang/go#31281. Change-Id: I843788f912015600a18ff3d5cf5520c60403b534 Reviewed-on: https://go-review.googlesource.com/c/image/+/171257 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Nigel Tao <nigeltao@golang.org>
On wasm, calculations on float32 values are done with 64 bit precision. This is allowed by the Go specification, only explicit conversions to float32 have to round to 32 bit precision. The difference caused by the additional precision accumulates over several calculations and causes the test results to not fully match the expectations. Account for this by giving a 0.1% tolerance. Fixes golang/go#31281. Change-Id: I843788f912015600a18ff3d5cf5520c60403b534 Reviewed-on: https://go-review.googlesource.com/c/image/+/171257 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Nigel Tao <nigeltao@golang.org>
On wasm, calculations on float32 values are done with 64 bit precision. This is allowed by the Go specification, only explicit conversions to float32 have to round to 32 bit precision. The difference caused by the additional precision accumulates over several calculations and causes the test results to not fully match the expectations. Account for this by giving a 0.1% tolerance. Fixes golang/go#31281. Change-Id: I843788f912015600a18ff3d5cf5520c60403b534 Reviewed-on: https://go-review.googlesource.com/c/image/+/171257 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Nigel Tao <nigeltao@golang.org>
On wasm, calculations on float32 values are done with 64 bit precision. This is allowed by the Go specification, only explicit conversions to float32 have to round to 32 bit precision. The difference caused by the additional precision accumulates over several calculations and causes the test results to not fully match the expectations. Account for this by giving a 0.1% tolerance. Fixes golang/go#31281. Change-Id: I843788f912015600a18ff3d5cf5520c60403b534 Reviewed-on: https://go-review.googlesource.com/c/image/+/171257 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Nigel Tao <nigeltao@golang.org>
On wasm, calculations on float32 values are done with 64 bit precision. This is allowed by the Go specification, only explicit conversions to float32 have to round to 32 bit precision. The difference caused by the additional precision accumulates over several calculations and causes the test results to not fully match the expectations. Account for this by giving a 0.1% tolerance. Fixes golang/go#31281. Change-Id: I843788f912015600a18ff3d5cf5520c60403b534 Reviewed-on: https://go-review.googlesource.com/c/image/+/171257 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Nigel Tao <nigeltao@golang.org>
On wasm, calculations on float32 values are done with 64 bit precision. This is allowed by the Go specification, only explicit conversions to float32 have to round to 32 bit precision. The difference caused by the additional precision accumulates over several calculations and causes the test results to not fully match the expectations. Account for this by giving a 0.1% tolerance. Fixes golang/go#31281. Change-Id: I843788f912015600a18ff3d5cf5520c60403b534 Reviewed-on: https://go-review.googlesource.com/c/image/+/171257 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Nigel Tao <nigeltao@golang.org>
x/image/vector's TestFloatingAccumulateMask16 and TestMakeFlInXxx fails on js/wasm:
https://build.golang.org/log/1bc13e32895e727dba8155e2f4b24479fa128875
/cc @neelance @cherrymui @randall77 @nigeltao @griesemer
The text was updated successfully, but these errors were encountered: