golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.12k stars 17.68k forks source link

runtime: hash collisions in arm64 #33960

Closed randall77 closed 5 years ago

randall77 commented 5 years ago

The arm64 builder is failing on a hash function tests I just checked in. I think the assembly code is using only the low 32 bits of the seed. The test that makes this evident is:

--- FAIL: TestSmhasherSeed (0.13s)
    smhasher_test.go:94: unexpected number of collisions: got=100000 mean=0.000000 stddev=0.000033
FAIL
FAIL    bytes/hash  0.319s

aeshashbody does:

    VMOV    R3, V30.S[0]
    VMOV    R1, V30.S[1] // load length into seed

We should really use VMOVD into V30.D[0] and V30.D[1], I think.

@mengzhuo @cherryyz

gopherbot commented 5 years ago

Change https://golang.org/cl/192498 mentions this issue: runtime: use all 64 bits of hash seed on arm64