Skip to content

x/crypto/blake2b: amd64 SIMD assembly implementions not selected #24828

Closed
@aead

Description

@aead

What version of Go are you using (go version)?

go 1.10.1

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/andreas/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/andreas/go"
GORACE=""
GOROOT="/home/andreas/.go/1.10.1"
GOTMPDIR=""
GOTOOLDIR="/home/andreas/.go/1.10.1/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="0"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build324948782=/tmp/go-build -gno-record-gcc-switches"

What did you do?

  1. go get golang.org/x/crypto
  2. go test -v golang.org/x/crypto/blake2b

What did you expect to see?

=== RUN   TestHashes
--- PASS: TestHashes (0.00s)
	blake2b_test.go:30: AVX2 version
	blake2b_test.go:35: AVX version
	blake2b_test.go:40: SSE4 version
	blake2b_test.go:44: generic version
=== RUN   TestHashes2X
--- PASS: TestHashes2X (0.03s)
	blake2b_test.go:54: AVX2 version
	blake2b_test.go:59: AVX version
	blake2b_test.go:64: SSE4 version
	blake2b_test.go:68: generic version
=== RUN   TestSelfTest
--- PASS: TestSelfTest (0.00s)
PASS
ok  	golang.org/x/crypto/blake2b	0.039s

What did you see instead?

=== RUN   TestHashes
--- PASS: TestHashes (0.00s)
	blake2b_test.go:45: generic version
=== RUN   TestHashes2X
--- PASS: TestHashes2X (0.01s)
	blake2b_test.go:69: generic version
=== RUN   TestMarshal
--- PASS: TestMarshal (0.00s)
=== RUN   TestSelfTest
--- PASS: TestSelfTest (0.00s)
PASS
ok  	golang.org/x/crypto/blake2b	0.016s

CL 106336 switched from runtime.support_avx() (which was removed from the runtime) to a linker-mapping scheme. However it seems like the linker does not set the variables correctly. Furthermore the SSE4 var seems to use the wrong link-name:
s / cpu.X86.HasSSE4 / cpu.X86.HasSSE41 See https://github.com/golang/go/blob/master/src/internal/cpu/cpu.go#L31

Even fixing this seems not to change anything. Further the the AVX and AVX2 code is not selected anyway.
/cc @ianlancetaylor

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions