Vendor the upstream changes with Avx512 (#7225)

Thanks to @fwessels we have Avx512 support with 4x improvement
This commit is contained in:
Harshavardhana
2019-02-12 04:02:27 -08:00
committed by Nitish Tiwari
parent fef5416b3c
commit 118270d76f
10 changed files with 847 additions and 32 deletions
+14 -7
View File
@@ -10,12 +10,12 @@ import (
type Option func(*options)
type options struct {
maxGoroutines int
minSplitSize int
useAVX2, useSSSE3, useSSE2 bool
usePAR1Matrix bool
useCauchy bool
shardSize int
maxGoroutines int
minSplitSize int
useAVX512, useAVX2, useSSSE3, useSSE2 bool
usePAR1Matrix bool
useCauchy bool
shardSize int
}
var defaultOptions = options{
@@ -29,8 +29,9 @@ func init() {
}
// Detect CPU capabilities.
defaultOptions.useSSSE3 = cpuid.CPU.SSSE3()
defaultOptions.useAVX2 = cpuid.CPU.AVX2()
defaultOptions.useSSE2 = cpuid.CPU.SSE2()
defaultOptions.useAVX2 = cpuid.CPU.AVX2()
defaultOptions.useAVX512 = cpuid.CPU.AVX512F() && cpuid.CPU.AVX512BW()
}
// WithMaxGoroutines is the maximum number of goroutines number for encoding & decoding.
@@ -88,6 +89,12 @@ func withSSE2(enabled bool) Option {
}
}
func withAVX512(enabled bool) Option {
return func(o *options) {
o.useAVX512 = enabled
}
}
// WithPAR1Matrix causes the encoder to build the matrix how PARv1
// does. Note that the method they use is buggy, and may lead to cases
// where recovery is impossible, even if there are enough parity