Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

discovery: fix cuda overlap case (#13176)

Daniel Hiltgendba62ff3a572
diff --git a/discover/runner.go b/discover/runner.go
index 34a9364ec..0915594dc 100644
--- a/discover/runner.go
+++ b/discover/runner.go
@@ -125,10 +125,20 @@ func GPUDevices(ctx context.Context, runners []ml.FilteredRunnerDiscovery) []ml.
supportedMu := sync.Mutex{}
supported := make(map[string]map[string]map[string]int) // [Library][libDir][ID] = pre-deletion devices index
for i := range devices {
+ libDir := devices[i].LibraryPath[len(devices[i].LibraryPath)-1]
if !devices[i].NeedsInitValidation() {
+ // No need to validate, add to the supported map
+ supportedMu.Lock()
+ if _, ok := supported[devices[i].Library]; !ok {
+ supported[devices[i].Library] = make(map[string]map[string]int)
+ }
+ if _, ok := supported[devices[i].Library][libDir]; !ok {
+ supported[devices[i].Library][libDir] = make(map[string]int)
+ }
+ supported[devices[i].Library][libDir][devices[i].ID] = i
+ supportedMu.Unlock()
continue
}
- libDir := devices[i].LibraryPath[len(devices[i].LibraryPath)-1]
slog.Debug("verifying if device is supported", "library", libDir, "description", devices[i].Description, "compute", devices[i].Compute(), "id", devices[i].ID, "pci_id", devices[i].PCIID)
wg.Add(1)
go func(i int) {