-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
TestGradient with "in_hsl_longer_hue" currently fails on ppc64le and s390x #3650
Comments
I just noticed that GitHub adds a nice colour preview to the hex colour values, so I decided to "play" here 😆: Expected:
Got on ppc64el and s390x (slightly different results):
|
Thanks for the report. That's indeed not great. I can't just adjust the tests because esbuild aspires to always have deterministic output. Fixing this is going to be tricky and maybe a lot of work (not just adding the casts that https://go.dev/ref/spec#Floating_point_operators says to add, but more getting a test environment together and then verifying the fix). |
Thanks for your reply! Here is the workaround I am using to allow esbuild enters Debian testing: https://salsa.debian.org/go-team/packages/golang-github-evanw-esbuild/-/blob/debian/sid/debian/patches/0002-TestGradient-hsl-longer-hue-on-ppc64le-s390x.patch?ref_type=heads (which I am sure is not the solution you are looking for.) About a test environment: A potential good news! I am able to reproduce the same discrepancy seen on ppc64le and s390x by running the following commands on my amd64 machine:
where QEMU (/usr/bin/qemu-ppc64le-static and /usr/bin/qemu-s390x-static, found in qemu-system-ppc and qemu-system-misc packages respectively on Debian) emulates the problem seemingly perfectly! Hope a simple |
Good news! Preventing FMA in multiplyMatrices() alone allows the current "hsl longer" hue interpolation tests to pass (giving --- a/internal/css_parser/css_color_spaces.go
+++ b/internal/css_parser/css_color_spaces.go
@@ -361,9 +361,9 @@ func oklch_to_oklab(l float64, c float64, h float64) (float64, float64, float64)
}
func multiplyMatrices(A [9]float64, b0 float64, b1 float64, b2 float64) (float64, float64, float64) {
- return A[0]*b0 + A[1]*b1 + A[2]*b2,
- A[3]*b0 + A[4]*b1 + A[5]*b2,
- A[6]*b0 + A[7]*b1 + A[8]*b2
+ return float64(A[0]*b0) + float64(A[1]*b1) + float64(A[2]*b2),
+ float64(A[3]*b0) + float64(A[4]*b1) + float64(A[5]*b2),
+ float64(A[6]*b0) + float64(A[7]*b1) + float64(A[8]*b2)
}
func delta_eok(L1 float64, a1 float64, b1 float64, L2 float64, a2 float64, b2 float64) float64 { Tested on:
Of course, I don't guarantee 100% deterministic output for all possible cases out there, but at least it works for all existing test cases at the moment. I am sorry I didn't make this into a pull request. Please feel free to commit the patch above directly if you see fit. :-) Cheers! |
Thanks very much for the help with QEMU. I didn't realize it was that easy to integrate it with the Go compiler. I'm going to fix this in a more invasive way that does all color space math with a wrapper type around |
You are amazing! Your commit 5650831 is a brilliant and complete solution! Thank you! |
esbuild v0.19.12 Debian package build currently fails on ppc64le and s390x due to TestGradient relating to
in_hsl_longer_hue
, as seen currently on https://buildd.debian.org/status/package.php?p=golang-github-evanw-esbuild:The error messages are:
comparing with the expected values in internal/css_parser/css_parser_test.go:
it seems that we are getting
an extraneous#0000bf
right afterinstead of#0000c0
on s390x and ppc64el.I haven't looked any deeper into it yet, but I suspect it has something to do with different "fused mulitply and add" (FMA) operations on different architectures, similar to the following issues:
I hope to find time to take a closer look on Debian's ppc64el and s390x porterboxes soon.
Thanks!
The text was updated successfully, but these errors were encountered: