mirror of
https://github.com/golang/sys.git
synced 2026-02-09 04:06:04 +03:00
cpu: add support for AVX-VNNI and IFMA detection
Added detection for x86 AVX-VNNI (VEX-coded Vector Neural Network Instructions) and AVX-IFMA (VEX-coded Integer Fused Multiply Add), including both the base VNNI set and the Int8 extention.
This commit is contained in:
@@ -41,6 +41,40 @@ func TestAVX512HasAVX2AndAVX(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAVX512BF16HasAVX512(t *testing.T) {
|
||||
if runtime.GOARCH == "amd64" {
|
||||
if cpu.X86.HasAVX512BF16 && !cpu.X86.HasAVX512 {
|
||||
t.Fatal("HasAVX512 expected true, got false")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestAVXVNNIHasAVX(t *testing.T) {
|
||||
if cpu.X86.HasAVXVNNI && !cpu.X86.HasAVX {
|
||||
t.Fatal("HasAVX expected true, got false")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAVXIFMAHasAVXVNNIAndAVX(t *testing.T) {
|
||||
if cpu.X86.HasAVXIFMA && !cpu.X86.HasAVX {
|
||||
t.Fatal("HasAVX expected true, got false")
|
||||
}
|
||||
|
||||
if cpu.X86.HasAVXIFMA && !cpu.X86.HasAVXVNNI {
|
||||
t.Fatal("HasAVXVNNI expected true, got false")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAVXVNNIInt8HasAVXVNNIAndAVX(t *testing.T) {
|
||||
if cpu.X86.HasAVXVNNIInt8 && !cpu.X86.HasAVXVNNI {
|
||||
t.Fatal("HasAVXVNNI expected true, got false")
|
||||
}
|
||||
|
||||
if cpu.X86.HasAVXVNNIInt8 && !cpu.X86.HasAVX {
|
||||
t.Fatal("HasAVX expected true, got false")
|
||||
}
|
||||
}
|
||||
|
||||
func TestARM64minimalFeatures(t *testing.T) {
|
||||
if runtime.GOARCH != "arm64" || runtime.GOOS == "ios" {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user