2024-01-10 04:29:58 +00:00
|
|
|
package gpu
|
|
|
|
|
|
|
|
import (
|
|
|
|
"golang.org/x/sys/cpu"
|
|
|
|
)
|
|
|
|
|
|
|
|
func GetCPUVariant() string {
|
2024-05-15 22:13:16 +00:00
|
|
|
return getCPUCapability().ToVariant()
|
|
|
|
}
|
|
|
|
|
|
|
|
func getCPUCapability() CPUCapability {
|
2024-01-10 04:29:58 +00:00
|
|
|
if cpu.X86.HasAVX2 {
|
2024-05-15 22:13:16 +00:00
|
|
|
return CPUCapabilityAVX2
|
2024-01-10 04:29:58 +00:00
|
|
|
}
|
|
|
|
if cpu.X86.HasAVX {
|
2024-05-15 22:13:16 +00:00
|
|
|
return CPUCapabilityAVX
|
2024-01-10 04:29:58 +00:00
|
|
|
}
|
|
|
|
// else LCD
|
2024-05-15 22:13:16 +00:00
|
|
|
return CPUCapabilityBase
|
2024-01-10 04:29:58 +00:00
|
|
|
}
|