Skip to content

Commit

Permalink
cpu: add Int8 matrix multiplication instructions CPU feature flag for…
Browse files Browse the repository at this point in the history
  • Loading branch information
hmartinez82 authored and gopherbot committed Jul 17, 2024
1 parent bce4cf7 commit 7bb0bf7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions cpu/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ var ARM64 struct {
HasSVE2 bool // Scalable Vector Extensions 2
HasASIMDFHM bool // Advanced SIMD multiplication FP16 to FP32
HasDIT bool // Data Independent Timing support
HasI8MM bool // Advanced SIMD Int8 matrix multiplication instructions
_ CacheLinePad
}

Expand Down
6 changes: 6 additions & 0 deletions cpu/cpu_arm64.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func initOptions() {
{Name: "asimddp", Feature: &ARM64.HasASIMDDP},
{Name: "asimdfhm", Feature: &ARM64.HasASIMDFHM},
{Name: "dit", Feature: &ARM64.HasDIT},
{Name: "i8mm", Feature: &ARM64.HasI8MM},
}
}

Expand Down Expand Up @@ -146,6 +147,11 @@ func parseARM64SystemRegisters(isar0, isar1, pfr0 uint64) {
ARM64.HasLRCPC = true
}

switch extractBits(isar1, 52, 55) {
case 1:
ARM64.HasI8MM = true
}

// ID_AA64PFR0_EL1
switch extractBits(pfr0, 16, 19) {
case 0:
Expand Down
2 changes: 2 additions & 0 deletions cpu/cpu_linux_arm64.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const (
hwcap_DIT = 1 << 24

hwcap2_SVE2 = 1 << 1
hwcap2_I8MM = 1 << 13
)

// linuxKernelCanEmulateCPUID reports whether we're running
Expand Down Expand Up @@ -112,6 +113,7 @@ func doinit() {

// HWCAP2 feature bits
ARM64.HasSVE2 = isSet(hwCap2, hwcap2_SVE2)
ARM64.HasI8MM = isSet(hwCap2, hwcap2_I8MM)
}

func isSet(hwc uint, value uint) bool {
Expand Down

0 comments on commit 7bb0bf7

Please sign in to comment.