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