2024-01-09 20:29:58 -08:00
|
|
|
package gpu
|
|
|
|
|
|
|
|
import (
|
2024-01-18 10:52:01 -08:00
|
|
|
"log/slog"
|
2024-01-09 20:29:58 -08:00
|
|
|
|
|
|
|
"golang.org/x/sys/cpu"
|
|
|
|
)
|
|
|
|
|
|
|
|
func GetCPUVariant() string {
|
|
|
|
if cpu.X86.HasAVX2 {
|
2024-05-09 11:44:45 -07:00
|
|
|
slog.Debug("CPU has AVX2")
|
2024-01-09 20:29:58 -08:00
|
|
|
return "avx2"
|
|
|
|
}
|
|
|
|
if cpu.X86.HasAVX {
|
2024-05-09 11:44:45 -07:00
|
|
|
slog.Debug("CPU has AVX")
|
2024-01-09 20:29:58 -08:00
|
|
|
return "avx"
|
|
|
|
}
|
2024-05-09 11:44:45 -07:00
|
|
|
slog.Debug("CPU does not have vector extensions")
|
2024-01-09 20:29:58 -08:00
|
|
|
// else LCD
|
|
|
|
return ""
|
|
|
|
}
|