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

x/image/vector: TestFloatingAccumulateMask16 fails on js/wasm #31281

Closed
bradfitz opened this Issue Apr 5, 2019 · 4 comments

Comments

Projects
None yet
4 participants
@bradfitz
Copy link
Member

commented Apr 5, 2019

x/image/vector's TestFloatingAccumulateMask16 and TestMakeFlInXxx fails on js/wasm:

https://build.golang.org/log/1bc13e32895e727dba8155e2f4b24479fa128875

--- FAIL: TestFloatingAccumulateMask16 (0.00s)
    acc_test.go:239: simd=false, n=55:
        got:  [ 0  0  5b5  668a  bbe0  e875  f803  da29  b49f  4a7a  a  0  0  0  2473  d7fb  ffff  ffff  ffff  ffff  ffff  ffff  ffff  ad4d  204  0  d48  e27a  ffff  f949  8c70  3bae  2ac9  51f7  ccc4  ffff  ffff  779f  0  75a1  ffff  ffff  5d7b  0  0  0  0  b23  df73  ffff  e39e  0  5ba0  9033  8f9f]
        want: [ 0  0  5b5  668a  bbe0  e875  f803  da29  b49f  4a7a  a  0  0  0  2473  d7fb  ffff  ffff  ffff  ffff  ffff  ffff  ffff  ad4d  204  0  d48  e27a  ffff  f949  8c70  3bae  2ac9  51f7  ccc4  ffff  ffff  779f  0  75a1  ffff  ffff  5d7b  0  0  0  0  b23  df73  ffff  e39d  0  5ba0  9033  8f9f]
    acc_test.go:239: simd=false, n=79:
        got:  [ 0  0  5b5  668a  bbe0  e875  f803  da29  b49f  4a7a  a  0  0  0  2473  d7fb  ffff  ffff  ffff  ffff  ffff  ffff  ffff  ad4d  204  0  d48  e27a  ffff  f949  8c70  3bae  2ac9  51f7  ccc4  ffff  ffff  779f  0  75a1  ffff  ffff  5d7b  0  0  0  0  b23  df73  ffff  e39e  0  5ba0  9033  8f9f  609  0  0  0  0  0  8db0  ffff  ffef  1746  0  0  0  0  0  0  0  0  0  728c  ffff  ffff  3148  0]
        want: [ 0  0  5b5  668a  bbe0  e875  f803  da29  b49f  4a7a  a  0  0  0  2473  d7fb  ffff  ffff  ffff  ffff  ffff  ffff  ffff  ad4d  204  0  d48  e27a  ffff  f949  8c70  3bae  2ac9  51f7  ccc4  ffff  ffff  779f  0  75a1  ffff  ffff  5d7b  0  0  0  0  b23  df73  ffff  e39d  0  5ba0  9033  8f9f  609  0  0  0  0  0  8db0  ffff  ffef  1746  0  0  0  0  0  0  0  0  0  728c  ffff  ffff  3148  0]
    acc_test.go:239: simd=false, n=96:
        got:  [ 0  0  5b5  668a  bbe0  e875  f803  da29  b49f  4a7a  a  0  0  0  2473  d7fb  ffff  ffff  ffff  ffff  ffff  ffff  ffff  ad4d  204  0  d48  e27a  ffff  f949  8c70  3bae  2ac9  51f7  ccc4  ffff  ffff  779f  0  75a1  ffff  ffff  5d7b  0  0  0  0  b23  df73  ffff  e39e  0  5ba0  9033  8f9f  609  0  0  0  0  0  8db0  ffff  ffef  1746  0  0  0  0  0  0  0  0  0  728c  ffff  ffff  3148  0  0  0  17ac  5bce  78cb  95b7  a3d2  a3d2  cce6  ffff  ffff  3148  0  1919  9bfd  f86b  ffff]
        want: [ 0  0  5b5  668a  bbe0  e875  f803  da29  b49f  4a7a  a  0  0  0  2473  d7fb  ffff  ffff  ffff  ffff  ffff  ffff  ffff  ad4d  204  0  d48  e27a  ffff  f949  8c70  3bae  2ac9  51f7  ccc4  ffff  ffff  779f  0  75a1  ffff  ffff  5d7b  0  0  0  0  b23  df73  ffff  e39d  0  5ba0  9033  8f9f  609  0  0  0  0  0  8db0  ffff  ffef  1746  0  0  0  0  0  0  0  0  0  728c  ffff  ffff  3148  0  0  0  17ac  5bce  78cb  95b7  a3d2  a3d2  cce6  ffff  ffff  3148  0  1919  9bfd  f86b  ffff]
    acc_test.go:239: simd=false, n=120:
        got:  [ 0  0  5b5  668a  bbe0  e875  f803  da29  b49f  4a7a  a  0  0  0  2473  d7fb  ffff  ffff  ffff  ffff  ffff  ffff  ffff  ad4d  204  0  d48  e27a  ffff  f949  8c70  3bae  2ac9  51f7  ccc4  ffff  ffff  779f  0  75a1  ffff  ffff  5d7b  0  0  0  0  b23  df73  ffff  e39e  0  5ba0  9033  8f9f  609  0  0  0  0  0  8db0  ffff  ffef  1746  0  0  0  0  0  0  0  0  0  728c  ffff  ffff  3148  0  0  0  17ac  5bce  78cb  95b7  a3d2  a3d2  cce6  ffff  ffff  3148  0  1919  9bfd  f86b  ffff  ffff  ffff  ffff  ffff  ffff  ffff  ffff  3148  c63  cf97  ffff  fc17  b59d  6981  4f87  3cf1  3a68  9276  ffff  ffff  3148  8eb0  ffff  fbf5]
        want: [ 0  0  5b5  668a  bbe0  e875  f803  da29  b49f  4a7a  a  0  0  0  2473  d7fb  ffff  ffff  ffff  ffff  ffff  ffff  ffff  ad4d  204  0  d48  e27a  ffff  f949  8c70  3bae  2ac9  51f7  ccc4  ffff  ffff  779f  0  75a1  ffff  ffff  5d7b  0  0  0  0  b23  df73  ffff  e39d  0  5ba0  9033  8f9f  609  0  0  0  0  0  8db0  ffff  ffef  1746  0  0  0  0  0  0  0  0  0  728c  ffff  ffff  3148  0  0  0  17ac  5bce  78cb  95b7  a3d2  a3d2  cce6  ffff  ffff  3148  0  1919  9bfd  f86b  ffff  ffff  ffff  ffff  ffff  ffff  ffff  ffff  3148  c63  cf97  ffff  fc17  b59d  6981  4f87  3cf1  3a68  9276  ffff  ffff  3148  8eb0  ffff  fbf5]
    acc_test.go:239: simd=false, n=165:
        got:  [ 0  0  5b5  668a  bbe0  e875  f803  da29  b49f  4a7a  a  0  0  0  2473  d7fb  ffff  ffff  ffff  ffff  ffff  ffff  ffff  ad4d  204  0  d48  e27a  ffff  f949  8c70  3bae  2ac9  51f7  ccc4  ffff  ffff  779f  0  75a1  ffff  ffff  5d7b  0  0  0  0  b23  df73  ffff  e39e  0  5ba0  9033  8f9f  609  0  0  0  0  0  8db0  ffff  ffef  1746  0  0  0  0  0  0  0  0  0  728c  ffff  ffff  3148  0  0  0  17ac  5bce  78cb  95b7  a3d2  a3d2  cce6  ffff  ffff  3148  0  1919  9bfd  f86b  ffff  ffff  ffff  ffff  ffff  ffff  ffff  ffff  3148  c63  cf97  ffff  fc17  b59d  6981  4f87  3cf1  3a68  9276  ffff  ffff  3148  8eb0  ffff  fbf5  4d33  0  0  0  0  0  7214  ffff  ffff  3148  ccaf  ffff  c6ba  0  0  0  0  0  0  7214  ffff  ffff  3148  f292  ffff  b865  0  0  0  0  0  0  930c  ffff  ffff  3148  c906  ffff  f45d  249f  0  0  0  0  5ea0]
        want: [ 0  0  5b5  668a  bbe0  e875  f803  da29  b49f  4a7a  a  0  0  0  2473  d7fb  ffff  ffff  ffff  ffff  ffff  ffff  ffff  ad4d  204  0  d48  e27a  ffff  f949  8c70  3bae  2ac9  51f7  ccc4  ffff  ffff  779f  0  75a1  ffff  ffff  5d7b  0  0  0  0  b23  df73  ffff  e39d  0  5ba0  9033  8f9f  609  0  0  0  0  0  8db0  ffff  ffef  1746  0  0  0  0  0  0  0  0  0  728c  ffff  ffff  3148  0  0  0  17ac  5bce  78cb  95b7  a3d2  a3d2  cce6  ffff  ffff  3148  0  1919  9bfd  f86b  ffff  ffff  ffff  ffff  ffff  ffff  ffff  ffff  3148  c63  cf97  ffff  fc17  b59d  6981  4f87  3cf1  3a68  9276  ffff  ffff  3148  8eb0  ffff  fbf5  4d33  0  0  0  0  0  7214  ffff  ffff  3148  ccaf  ffff  c6ba  0  0  0  0  0  0  7214  ffff  ffff  3148  f292  ffff  b865  0  0  0  0  0  0  930c  ffff  ffff  3148  c906  ffff  f45d  249f  0  0  0  0  5ea0]
    acc_test.go:239: simd=false, n=208:
        got:  [ 0  0  5b5  668a  bbe0  e875  f803  da29  b49f  4a7a  a  0  0  0  2473  d7fb  ffff  ffff  ffff  ffff  ffff  ffff  ffff  ad4d  204  0  d48  e27a  ffff  f949  8c70  3bae  2ac9  51f7  ccc4  ffff  ffff  779f  0  75a1  ffff  ffff  5d7b  0  0  0  0  b23  df73  ffff  e39e  0  5ba0  9033  8f9f  609  0  0  0  0  0  8db0  ffff  ffef  1746  0  0  0  0  0  0  0  0  0  728c  ffff  ffff  3148  0  0  0  17ac  5bce  78cb  95b7  a3d2  a3d2  cce6  ffff  ffff  3148  0  1919  9bfd  f86b  ffff  ffff  ffff  ffff  ffff  ffff  ffff  ffff  3148  c63  cf97  ffff  fc17  b59d  6981  4f87  3cf1  3a68  9276  ffff  ffff  3148  8eb0  ffff  fbf5  4d33  0  0  0  0  0  7214  ffff  ffff  3148  ccaf  ffff  c6ba  0  0  0  0  0  0  7214  ffff  ffff  3148  f292  ffff  b865  0  0  0  0  0  0  930c  ffff  ffff  3148  c906  ffff  f45d  249f  0  0  0  0  5ea0  fcf1  ffff  ffff  3888  6d81  ffff  ffff  eaf5  7dcf  5533  6c2b  c07b  fff1  ffff  ffff  ffff  4a9d  d4  a6a1  ffff  ffff  ffff  ffff  ffff  ffff  d54d  8399  ffff  ffff  764b  0  1b  4ffc  bb4a  e3f5  eee3  bd4c  7e42  900  1b0c  b6fc  b6fc  7e05]
        want: [ 0  0  5b5  668a  bbe0  e875  f803  da29  b49f  4a7a  a  0  0  0  2473  d7fb  ffff  ffff  ffff  ffff  ffff  ffff  ffff  ad4d  204  0  d48  e27a  ffff  f949  8c70  3bae  2ac9  51f7  ccc4  ffff  ffff  779f  0  75a1  ffff  ffff  5d7b  0  0  0  0  b23  df73  ffff  e39d  0  5ba0  9033  8f9f  609  0  0  0  0  0  8db0  ffff  ffef  1746  0  0  0  0  0  0  0  0  0  728c  ffff  ffff  3148  0  0  0  17ac  5bce  78cb  95b7  a3d2  a3d2  cce6  ffff  ffff  3148  0  1919  9bfd  f86b  ffff  ffff  ffff  ffff  ffff  ffff  ffff  ffff  3148  c63  cf97  ffff  fc17  b59d  6981  4f87  3cf1  3a68  9276  ffff  ffff  3148  8eb0  ffff  fbf5  4d33  0  0  0  0  0  7214  ffff  ffff  3148  ccaf  ffff  c6ba  0  0  0  0  0  0  7214  ffff  ffff  3148  f292  ffff  b865  0  0  0  0  0  0  930c  ffff  ffff  3148  c906  ffff  f45d  249f  0  0  0  0  5ea0  fcf1  ffff  ffff  3888  6d81  ffff  ffff  eaf5  7dcf  5533  6c2b  c07b  fff1  ffff  ffff  ffff  4a9d  d4  a6a1  ffff  ffff  ffff  ffff  ffff  ffff  d54d  8399  ffff  ffff  764b  0  1b  4ffc  bb4a  e3f5  eee3  bd4c  7e42  900  1b0c  b6fc  b6fc  7e04]
--- FAIL: TestMakeFlInXxx (0.00s)
    acc_test.go:473: height 16: got:
        0, 0, -0.022306714, -0.3782405, -0.3333496, -0.17415217, -0.06075567, 0.11660566, 
        0.1466459, 0.41462865, 0.2907675, 0.0001568836, 0, 0, -0.14239301, -0.7012867, 
        -0.1563203, 0, 0, 0, 0, 0, 0, 0.32303038, 
        0.669093, 0.007876583, -0.05189417, -0.83278596, -0.11531985, 0.026225727, 0.42518586, 0.31546375, 
        0.06598781, -0.15304232, -0.47969282, -0.20012802, 0, 0.53272724, 0.46727282, -0.45950258, 
        -0.5404974, 0, 0.63484, 0.36515996, 0, 0, 0, -0.043517068, 
        -0.8293347, -0.12714824, 0.11086941, 0.8891306, -0.35792422, -0.20535542, 0.0022512919, 0.53743976, 
        0.023588603, 0, 0, 0, 0, -0.55346966, -0.44653034, 0.00025314797, 
        0.90882653, 0.090920314, 0, 0, 0, 0, 0, 0, 
        0, 0, -0.44745448, -0.5525455, 0, 0.8074894, 0.19251059, 0, 
        0, -0.09247626, -0.26614636, -0.11322958, -0.1129822, -0.055094406, 0, -0.16045958, 
        -0.1996116, 0, 0.80748653, 0.19251347, -0.09804728, -0.51129663, -0.3610403, -0.029615767, 
        0, 0, 0, 0, 0, 0, 0, 0.80748653, 
        0.14411618, -0.7625153, -0.18908744, 0.015273494, 0.2752866, 0.29730347, 0.10147726, 0.07259523, 
        0.009900216, -0.34395567, -0.42788061, 0, 0.80748653, -0.36487377, -0.44261277, 0.01577821, 
        0.68265676, 0.30156508, 0, 0, 0, 0, -0.44563293, -0.55436707, 
        0, 0.80748653, -0.60703933, -0.20044717, 0.22371745, 0.77628255, 0, 0, 
        0, 0, 0, -0.44563293, -0.55436707, 0, 0.80748653, -0.7550391, 
        -0.05244744, 0.2797074, 0.72029257, 0, 0, 0, 0, 0, 
        -0.57440275, -0.42559725, 0, 0.80748653, -0.59273535, -0.21475117, 0.04544876, 0.8114853, 
        0.14306593, 0, 0, 0, -0.369642, -0.61841226, -0.011945793, 0, 
        0.7791631, -0.20691496, -0.5722482, 0, 0.082185626, 0.4263731, 0.1586175, -0.089709565, 
        -0.32935488, -0.24788952, -0.00022224293, 0, 0, 0.7085409, 0.28821063, -0.6476587, 
        -0.3490929, 0, 0, 0, 0, 0, 0.16679132, 0.3191465, 
        -0.48593783, 0, 0.5379151, 0.4620849, -0.0004197069, -0.31203383, -0.41914797, -0.15886794, 
        -0.042682715, 0.1937095, 0.24624395, 0.45803434, -0.07049593, -0.60913485, 0, 0.22253108, 
        want:
        0, 0, -0.022306755, -0.3782405, -0.33334962, -0.1741521, -0.0607556, 0.11660573, 
        0.14664596, 0.41462868, 0.2907673, 0.0001568835, 0, 0, -0.14239307, -0.7012868, 
        -0.15632017, 0, 0, 0, 0, 0, 0, 0.3230303, 
        0.6690931, 0.007876594, -0.05189419, -0.832786, -0.11531975, 0.026225802, 0.42518616, 0.3154636, 
        0.06598757, -0.15304244, -0.47969276, -0.20012794, 0, 0.5327272, 0.46727282, -0.45950258, 
        -0.5404974, 0, 0.63484025, 0.36515975, 0, 0, 0, -0.04351709, 
        -0.8293345, -0.12714837, 0.11087036, 0.88912964, -0.35792422, -0.2053554, 0.0022513224, 0.5374398, 
        0.023588525, 0, 0, 0, 0, -0.55346966, -0.44653034, 0.0002531938, 
        0.9088273, 0.090919495, 0, 0, 0, 0, 0, 0, 
        0, 0, -0.44745448, -0.5525455, 0, 0.80748945, 0.19251058, 0, 
        0, -0.092476256, -0.2661464, -0.11322958, -0.11298219, -0.055094406, 0, -0.16045958, 
        -0.1996116, 0, 0.80748653, 0.19251347, -0.09804727, -0.51129663, -0.3610403, -0.029615778, 
        0, 0, 0, 0, 0, 0, 0, 0.80748653, 
        0.14411622, -0.76251525, -0.1890875, 0.01527351, 0.27528667, 0.29730347, 0.101477206, 0.07259522, 
        0.009900213, -0.34395567, -0.42788061, 0, 0.80748653, -0.3648737, -0.44261283, 0.015778137, 
        0.6826565, 0.30156538, 0, 0, 0, 0, -0.44563293, -0.55436707, 
        0, 0.80748653, -0.60703933, -0.20044717, 0.22371745, 0.77628255, 0, 0, 
        0, 0, 0, -0.44563293, -0.55436707, 0, 0.80748653, -0.7550391, 
        -0.05244744, 0.2797074, 0.72029257, 0, 0, 0, 0, 0, 
        -0.57440215, -0.42559785, 0, 0.80748653, -0.59273535, -0.21475118, 0.04544862, 0.81148535, 
        0.14306602, 0, 0, 0, -0.369642, -0.61841226, -0.011945802, 0, 
        0.7791623, -0.20691396, -0.57224834, 0, 0.08218567, 0.42637306, 0.1586175, -0.089709565, 
        -0.32935485, -0.24788953, -0.00022224105, 0, 0, 0.7085409, 0.28821066, -0.64765793, 
        -0.34909368, 0, 0, 0, 0, 0, 0.16679136, 0.31914657, 
        -0.48593786, 0, 0.537915, 0.462085, -0.00041967133, -0.3120329, -0.41914812, -0.15886839, 
        -0.042683028, 0.19370951, 0.24624406, 0.45803425, -0.07049577, -0.6091341, 0, 0.22253075, 
FAIL
FAIL	golang.org/x/image/vector	5.159s

/cc @neelance @cherrymui @randall77 @nigeltao @griesemer

@bradfitz bradfitz added this to the Go1.13 milestone Apr 5, 2019

@bradfitz bradfitz added the Arch-Wasm label Apr 5, 2019

@neelance

This comment has been minimized.

Copy link
Member

commented Apr 6, 2019

I manage to trim it down to this:

package main

import "fmt"

var x = 16

func main() {
	fmt.Println(float64(x) / 1122)
	fmt.Println(float64(float32(x) / 1122))
}

On amd64 it gives:

0.0142602495543672
0.014260249212384224

On wasm it gives:

0.0142602495543672
0.0142602495543672

This is because wasm currently only uses 64 bit float "registers" and only truncates the precision when using an explicit float32(...) conversion.

The spec says:

For instance, the value of a variable x of type float32 may be stored using additional precision beyond that of an IEEE-754 32-bit number, but float32(x) represents the result of rounding x's value to 32-bit precision. Similarly, x + 0.1 may use more than 32 bits of precision, but float32(x + 0.1) does not.

I would conclude that the test is too strict or the x/image/vector package needs more explicit rounding.

@neelance

This comment has been minimized.

Copy link
Member

commented Apr 6, 2019

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.

@nigeltao

This comment has been minimized.

Copy link
Contributor

commented Apr 6, 2019

@gopherbot

This comment has been minimized.

Copy link

commented Apr 9, 2019

Change https://golang.org/cl/171257 mentions this issue: vector: fix tests on wasm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.