Unverified Commit db973c8f authored by Daniel Hiltgen's avatar Daniel Hiltgen Committed by GitHub
Browse files

win: avoid ID mixups on refresh (#12869)

On Windows AMD IDs are numeric, and can reorder based on the filter environment.
By passing in the filter env on a full discovery refresh, we'll only look at the actual devices
and ignore unsupported iGPUs.  Without this, on some systems iGPU VRAM was incorrectly
being used to populate the dGPU.
parent afaf7ce8
...@@ -335,11 +335,14 @@ func GPUDevices(ctx context.Context, runners []ml.FilteredRunnerDiscovery) []ml. ...@@ -335,11 +335,14 @@ func GPUDevices(ctx context.Context, runners []ml.FilteredRunnerDiscovery) []ml.
ctx, cancel := context.WithTimeout(ctx, 3*time.Second) ctx, cancel := context.WithTimeout(ctx, 3*time.Second)
defer cancel() defer cancel()
// Apply any dev filters to avoid re-discovering unsupported devices, and get IDs correct
devFilter := ml.GetVisibleDevicesEnv(devices)
for dir := range libDirs { for dir := range libDirs {
updatedDevices := bootstrapDevices(ctx, []string{LibOllamaPath, dir}, nil) updatedDevices := bootstrapDevices(ctx, []string{LibOllamaPath, dir}, devFilter)
for _, u := range updatedDevices { for _, u := range updatedDevices {
for i := range devices { for i := range devices {
if u.DeviceID == devices[i].DeviceID { if u.DeviceID == devices[i].DeviceID && u.PCIID == devices[i].PCIID {
updated[i] = true updated[i] = true
devices[i].FreeMemory = u.FreeMemory devices[i].FreeMemory = u.FreeMemory
break break
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment