mirror of
https://github.com/dogkeeper886/ollama37.git
synced 2025-12-12 00:37:04 +00:00
Refine GPU discovery to bootstrap once
Now that we call the GPU discovery routines many times to update memory, this splits initial discovery from free memory updating.
This commit is contained in:
@@ -1,21 +1,20 @@
|
||||
package gpu
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
|
||||
"golang.org/x/sys/cpu"
|
||||
)
|
||||
|
||||
func GetCPUVariant() string {
|
||||
return getCPUCapability().ToVariant()
|
||||
}
|
||||
|
||||
func getCPUCapability() CPUCapability {
|
||||
if cpu.X86.HasAVX2 {
|
||||
slog.Debug("CPU has AVX2")
|
||||
return "avx2"
|
||||
return CPUCapabilityAVX2
|
||||
}
|
||||
if cpu.X86.HasAVX {
|
||||
slog.Debug("CPU has AVX")
|
||||
return "avx"
|
||||
return CPUCapabilityAVX
|
||||
}
|
||||
slog.Debug("CPU does not have vector extensions")
|
||||
// else LCD
|
||||
return ""
|
||||
return CPUCapabilityBase
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user