Skip to content

Commit eabbd5c

Browse files
anton-kuklingopherbot
authored andcommitted
cpu: add support for amx detection
Added detection for x86 AMX, including AMX-Tile, AMX-INT8 and AMX-BF16 instruction sets. Change-Id: Ib3d663430b64d46b46b22bdd05d40f1992e37ee0 GitHub-Last-Rev: 7986ed6 GitHub-Pull-Request: #170 Reviewed-on: https://go-review.googlesource.com/c/sys/+/516815 Reviewed-by: Tobias Klauser <[email protected]> Auto-Submit: Tobias Klauser <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Tobias Klauser <[email protected]> Reviewed-by: Michael Knyszek <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent 552c4e8 commit eabbd5c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Diff for: cpu/cpu.go

+3
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ var X86 struct {
5454
HasAVX512VBMI2 bool // Advanced vector extension 512 Vector Byte Manipulation Instructions 2
5555
HasAVX512BITALG bool // Advanced vector extension 512 Bit Algorithms
5656
HasAVX512BF16 bool // Advanced vector extension 512 BFloat16 Instructions
57+
HasAMXTile bool // Advanced Matrix Extension Tile instructions
58+
HasAMXInt8 bool // Advanced Matrix Extension Int8 instructions
59+
HasAMXBF16 bool // Advanced Matrix Extension BFloat16 instructions
5760
HasBMI1 bool // Bit manipulation instruction set 1
5861
HasBMI2 bool // Bit manipulation instruction set 2
5962
HasCX16 bool // Compare and exchange 16 Bytes

Diff for: cpu/cpu_x86.go

+7
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ func initOptions() {
3737
{Name: "avx512vbmi2", Feature: &X86.HasAVX512VBMI2},
3838
{Name: "avx512bitalg", Feature: &X86.HasAVX512BITALG},
3939
{Name: "avx512bf16", Feature: &X86.HasAVX512BF16},
40+
{Name: "amxtile", Feature: &X86.HasAMXTile},
41+
{Name: "amxint8", Feature: &X86.HasAMXInt8},
42+
{Name: "amxbf16", Feature: &X86.HasAMXBF16},
4043
{Name: "bmi1", Feature: &X86.HasBMI1},
4144
{Name: "bmi2", Feature: &X86.HasBMI2},
4245
{Name: "cx16", Feature: &X86.HasCX16},
@@ -138,6 +141,10 @@ func archInit() {
138141
eax71, _, _, _ := cpuid(7, 1)
139142
X86.HasAVX512BF16 = isSet(5, eax71)
140143
}
144+
145+
X86.HasAMXTile = isSet(24, edx7)
146+
X86.HasAMXInt8 = isSet(25, edx7)
147+
X86.HasAMXBF16 = isSet(22, edx7)
141148
}
142149

143150
func isSet(bitpos uint, value uint32) bool {

0 commit comments

Comments
 (0)