upgrade to cpuid/v2
This commit is contained in:
parent
d373079f35
commit
09d3897aaa
6
cpu.go
6
cpu.go
|
@ -2,9 +2,9 @@
|
|||
|
||||
package blake3
|
||||
|
||||
import "github.com/klauspost/cpuid"
|
||||
import "github.com/klauspost/cpuid/v2"
|
||||
|
||||
var (
|
||||
haveAVX2 = cpuid.CPU.AVX2()
|
||||
haveAVX512 = cpuid.CPU.AVX512F()
|
||||
haveAVX2 = cpuid.CPU.Supports(cpuid.AVX2)
|
||||
haveAVX512 = cpuid.CPU.Supports(cpuid.AVX512F)
|
||||
)
|
||||
|
|
|
@ -3,7 +3,7 @@ package blake3
|
|||
import (
|
||||
"syscall"
|
||||
|
||||
"github.com/klauspost/cpuid"
|
||||
"github.com/klauspost/cpuid/v2"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -12,8 +12,8 @@ var (
|
|||
)
|
||||
|
||||
func init() {
|
||||
haveAVX2 = cpuid.CPU.AVX2()
|
||||
haveAVX512 = cpuid.CPU.AVX512F()
|
||||
haveAVX2 = cpuid.CPU.Supports(cpuid.AVX2)
|
||||
haveAVX512 = cpuid.CPU.Supports(cpuid.AVX512F)
|
||||
if !haveAVX512 {
|
||||
// On some Macs, AVX512 detection is buggy, so fallback to sysctl
|
||||
b, _ := syscall.Sysctl("hw.optional.avx512f")
|
||||
|
|
4
go.mod
4
go.mod
|
@ -2,6 +2,4 @@ module lukechampine.com/blake3
|
|||
|
||||
go 1.13
|
||||
|
||||
require (
|
||||
github.com/klauspost/cpuid v1.3.1
|
||||
)
|
||||
require github.com/klauspost/cpuid/v2 v2.0.9
|
||||
|
|
4
go.sum
4
go.sum
|
@ -1,2 +1,2 @@
|
|||
github.com/klauspost/cpuid v1.3.1 h1:5JNjFYYQrZeKRJ0734q51WCEEn2huer72Dc7K+R/b6s=
|
||||
github.com/klauspost/cpuid v1.3.1/go.mod h1:bYW4mA6ZgKPob1/Dlai2LviZJO7KGI3uoWLd42rAQw4=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
|
|
Reference in New Issue