Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

v2.5.0 Bug BB: BobbyT GPU picker (Hardware settings)

purple39f9ad041da3
diff --git a/src-tauri/src/commands/gpu.rs b/src-tauri/src/commands/gpu.rs
new file mode 100644
index 00000000..f74f0ec3
--- /dev/null
+++ b/src-tauri/src/commands/gpu.rs
@@ -0,0 +1,358 @@
+// Bug BB v2.5.0 — BobbyT Discord 2026-05-26. BobbyT has AMD RX 6800XT 16GB +
+// Intel Arc Pro B60 24GB and wants to pin the Arc Pro for inference. LU
+// previously had no GPU picker — Ollama and ComfyUI just used whatever the
+// driver picked first, which on multi-vendor / multi-GPU systems is often
+// not what the user wants. This module adds:
+// 1. `detect_gpus` — a one-shot probe that lists every NVIDIA / AMD / Intel
+// GPU the system can see (via nvidia-smi / rocm-smi / system_profiler /
+// lspci, best-effort).
+// 2. `set_gpu_selection` — persists the user's pick into AppState. The
+// next `start_ollama` / `start_comfyui` reads from that state and sets
+// CUDA_VISIBLE_DEVICES / HIP_VISIBLE_DEVICES / ONEAPI_DEVICE_SELECTOR
+// accordingly.
+//
+// Adversarial note: GPU detection on Windows without WMI is necessarily
+// imprecise — we lean on the vendor CLIs (nvidia-smi, rocm-smi) and treat
+// anything else as "unknown vendor, manual override required." This keeps
+// the binary small and avoids the WMI dependency creep.
+
+use crate::state::AppState;
+use serde::Serialize;
+use std::process::Command;
+use tauri::State;
+
+#[cfg(target_os = "windows")]
+use std::os::windows::process::CommandExt;
+
+#[cfg(target_os = "windows")]
+const CREATE_NO_WINDOW: u32 = 0x08000000;
+
+#[derive(Debug, Serialize, Clone)]
+pub struct DetectedGpu {
+ /// Zero-based device index inside the vendor's view (this is what we
+ /// pass via CUDA_VISIBLE_DEVICES / HIP_VISIBLE_DEVICES — vendor-scoped,
+ /// NOT a global index across vendors).
+ pub index: u32,
+ pub vendor: String, // "nvidia" | "amd" | "intel" | "apple" | "unknown"
+ pub name: String,
+ /// Total memory in MiB if we can read it. None when the probe couldn't
+ /// extract it (e.g. lspci output has no memory field).
+ pub memory_mib: Option<u64>,
+ /// Probe source that produced this entry. Useful for the UI tooltip
+ /// ("from nvidia-smi" / "from rocm-smi" / "from lspci").
+ pub source: String,
+}
+
+fn run_cmd(program: &str, args: &[&str]) -> Option<String> {
+ let mut cmd = Command::new(program);
+ cmd.args(args);
+ #[cfg(target_os = "windows")]
+ cmd.creation_flags(CREATE_NO_WINDOW);
+ match cmd.output() {
+ Ok(out) if out.status.success() => Some(String::from_utf8_lossy(&out.stdout).to_string()),
+ _ => None,
+ }
+}
+
+fn detect_nvidia() -> Vec<DetectedGpu> {
+ // `nvidia-smi --query-gpu=index,name,memory.total --format=csv,noheader,nounits`
+ // is portable across Linux and Windows. Output line: "0, NVIDIA GeForce RTX 4070, 12282"
+ let raw = match run_cmd(
+ "nvidia-smi",
+ &["--query-gpu=index,name,memory.total", "--format=csv,noheader,nounits"],
+ ) {
+ Some(s) => s,
+ None => return vec![],
+ };
+ raw.lines()
+ .filter_map(|line| {
+ let parts: Vec<&str> = line.split(',').map(|s| s.trim()).collect();
+ if parts.len() < 3 { return None }
+ let index: u32 = parts[0].parse().ok()?;
+ let name = parts[1].to_string();
+ let memory_mib: Option<u64> = parts[2].parse().ok();
+ Some(DetectedGpu {
+ index,
+ vendor: "nvidia".into(),
+ name,
+ memory_mib,
+ source: "nvidia-smi".into(),
+ })
+ })
+ .collect()
+}
+
+fn detect_amd() -> Vec<DetectedGpu> {
+ // rocm-smi exists on Linux + (rarely) Windows with ROCm-on-Windows. Output
+ // varies wildly between versions; we try the simplest invocation and
+ // parse loosely. Format with `--showid --showproductname`:
+ // GPU[0] : Product Name: AMD Radeon RX 6800 XT
+ // GPU[0] : Memory: 16368 MiB
+ let raw = match run_cmd("rocm-smi", &["--showid", "--showproductname", "--showmeminfo", "vram", "--csv"]) {
+ Some(s) => s,
+ None => return vec![],
+ };
+ // Try CSV parse first (newer rocm-smi). Header line then card lines.
+ let mut gpus: Vec<DetectedGpu> = Vec::new();
+ let mut lines = raw.lines().filter(|l| !l.trim().is_empty());
+ if let Some(header) = lines.next() {
+ let cols: Vec<&str> = header.split(',').map(|s| s.trim()).collect();
+ let card_col = cols.iter().position(|c| c.eq_ignore_ascii_case("device") || c.eq_ignore_ascii_case("card"));
+ let name_col = cols.iter().position(|c| c.to_lowercase().contains("product"));
+ let mem_col = cols.iter().position(|c| c.to_lowercase().contains("vram") && c.to_lowercase().contains("total"));
+ for line in lines {
+ let parts: Vec<&str> = line.split(',').map(|s| s.trim()).collect();
+ let index: u32 = card_col
+ .and_then(|i| parts.get(i))
+ .and_then(|s| s.trim_start_matches("card").parse::<u32>().ok())
+ .unwrap_or(gpus.len() as u32);
+ let name = name_col
+ .and_then(|i| parts.get(i))
+ .map(|s| s.to_string())
+ .unwrap_or_else(|| "AMD GPU".into());
+ // Memory comes as bytes; convert to MiB
+ let memory_mib = mem_col
+ .and_then(|i| parts.get(i))
+ .and_then(|s| s.parse::<u64>().ok())
+ .map(|bytes| bytes / 1024 / 1024);
+ gpus.push(DetectedGpu {
+ index,
+ vendor: "amd".into(),
+ name,
+ memory_mib,
+ source: "rocm-smi".into(),
+ });
+ }
+ }
+ gpus
+}
+
+#[cfg(target_os = "linux")]
+fn detect_other_via_lspci() -> Vec<DetectedGpu> {
+ // Best-effort fallback for Intel iGPUs / Intel Arc / Apple-Silicon-in-VM
+ // when neither nvidia-smi nor rocm-smi cover them. `lspci -nn | grep VGA`
+ // gives "00:02.0 VGA compatible controller [0300]: Intel Corporation
+ // AlderLake-S GT1 [Intel UHD Graphics 770] [8086:4680]". We parse the
+ // vendor ID ([8086:...] = Intel, [10de:...] = NVIDIA fallback,
+ // [1002:...] = AMD).
+ let raw = match run_cmd("lspci", &["-nn"]) {
+ Some(s) => s,
+ None => return vec![],
+ };
+ let mut gpus = Vec::new();
+ let mut idx_intel: u32 = 0;
+ for line in raw.lines() {
+ let lower = line.to_lowercase();
+ if !(lower.contains("vga") || lower.contains("3d controller") || lower.contains("display controller")) { continue }
+ let vendor = if lower.contains("[8086:") { "intel" }
+ else if lower.contains("[10de:") { "nvidia" }
+ else if lower.contains("[1002:") { "amd" }
+ else { "unknown" };
+ // Skip NVIDIA / AMD here because nvidia-smi / rocm-smi already
+ // produce better entries with memory info.
+ if vendor == "nvidia" || vendor == "amd" { continue }
+ // Extract the bracketed name (text between [...] just before the
+ // vendor:device ID at the end).
+ let name = line.split(':').last().unwrap_or(line).trim().to_string();
+ gpus.push(DetectedGpu {
+ index: idx_intel,
+ vendor: vendor.into(),
+ name,
+ memory_mib: None,
+ source: "lspci".into(),
+ });
+ if vendor == "intel" { idx_intel += 1; }
+ }
+ gpus
+}
+
+#[cfg(not(target_os = "linux"))]
+fn detect_other_via_lspci() -> Vec<DetectedGpu> { vec![] }
+
+#[cfg(target_os = "macos")]
+fn detect_macos() -> Vec<DetectedGpu> {
+ // macOS uses Metal/MPS via the unified GPU. We surface a single entry so
+ // the picker isn't empty, but selection has no effect (CUDA/HIP/ONEAPI
+ // env-vars don't apply on Apple Silicon).
+ let name = run_cmd("sysctl", &["-n", "machdep.cpu.brand_string"])
+ .map(|s| s.trim().to_string())
+ .unwrap_or_else(|| "Apple GPU".into());
+ vec![DetectedGpu {
+ index: 0,
+ vendor: "apple".into(),
+ name,
+ memory_mib: None,
+ source: "system".into(),
+ }]
+}
+
+#[cfg(not(target_os = "macos"))]
+fn detect_macos() -> Vec<DetectedGpu> { vec![] }
+
+#[cfg(target_os = "windows")]
+fn detect_other_via_wmic() -> Vec<DetectedGpu> {
+ // Windows fallback for Intel Arc and other GPUs that don't surface via
+ // nvidia-smi / rocm-smi. Modern PowerShell deprecated wmic.exe but it's
+ // still on Win10/11 Home for the time being. We probe it but treat
+ // failure as benign (the user can just not see the Intel card and pick
+ // "auto" instead).
+ let raw = match run_cmd("wmic", &["path", "Win32_VideoController", "get", "Name,AdapterRAM", "/format:csv"]) {
+ Some(s) => s,
+ None => return vec![],
+ };
+ let mut gpus = Vec::new();
+ let mut idx: u32 = 0;
+ for line in raw.lines().skip(1) {
+ let parts: Vec<&str> = line.split(',').map(|s| s.trim()).collect();
+ // Format: Node, AdapterRAM, Name
+ if parts.len() < 3 { continue }
+ let ram_bytes: Option<u64> = parts[1].parse().ok();
+ let name = parts[2].to_string();
+ if name.is_empty() { continue }
+ let lname = name.to_lowercase();
+ let vendor = if lname.contains("intel") { "intel" }
+ else if lname.contains("amd") || lname.contains("radeon") { "amd" }
+ else if lname.contains("nvidia") || lname.contains("geforce") || lname.contains("rtx") || lname.contains("gtx") { "nvidia" }
+ else { "unknown" };
+ // Skip NVIDIA / AMD here — nvidia-smi / rocm-smi produce better entries with memory.total
+ if vendor == "nvidia" || vendor == "amd" { continue }
+ gpus.push(DetectedGpu {
+ index: idx,
+ vendor: vendor.into(),
+ name,
+ memory_mib: ram_bytes.map(|b| b / 1024 / 1024),
+ source: "wmic".into(),
+ });
+ idx += 1;
+ }
+ gpus
+}
+
+#[cfg(not(target_os = "windows"))]
+fn detect_other_via_wmic() -> Vec<DetectedGpu> { vec![] }
+
+#[tauri::command]
+pub fn detect_gpus() -> Result<Vec<DetectedGpu>, String> {
+ let mut gpus = Vec::new();
+ gpus.extend(detect_nvidia());
+ gpus.extend(detect_amd());
+ gpus.extend(detect_other_via_lspci());
+ gpus.extend(detect_other_via_wmic());
+ gpus.extend(detect_macos());
+ Ok(gpus)
+}
+
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+pub struct GpuSelection {
+ /// Vendor whose env-var family to set ("nvidia" | "amd" | "intel" | "auto").
+ /// "auto" leaves env-vars unset and lets the runtime pick its default.
+ pub vendor: String,
+ /// Zero-based, vendor-scoped indices of the GPUs to expose. Empty list
+ /// means "all available" (env-var unset).
+ pub indices: Vec<u32>,
+}
+
+#[tauri::command]
+pub fn set_gpu_selection(state: State<'_, AppState>, selection: GpuSelection) -> Result<(), String> {
+ let mut sel = state.gpu_selection.lock().map_err(|e| e.to_string())?;
+ *sel = selection;
+ Ok(())
+}
+
+#[tauri::command]
+pub fn get_gpu_selection(state: State<'_, AppState>) -> Result<GpuSelection, String> {
+ let sel = state.gpu_selection.lock().map_err(|e| e.to_string())?;
+ Ok(sel.clone())
+}
+
+/// Apply the persisted GPU selection to a Command's env, ahead of `.spawn()`.
+/// No-op when vendor is "auto" or indices are empty — the runtime falls back
+/// to driver-decided device order, which is the previous (pre-v2.5.0)
+/// behaviour.
+pub fn apply_gpu_env(cmd: &mut Command, selection: &GpuSelection) {
+ if selection.indices.is_empty() { return }
+ let csv: String = selection.indices.iter().map(|i| i.to_string()).collect::<Vec<_>>().join(",");
+ match selection.vendor.as_str() {
+ "nvidia" => { cmd.env("CUDA_VISIBLE_DEVICES", &csv); }
+ "amd" => {
+ // HIP_VISIBLE_DEVICES is the official ROCm name; ROCR_VISIBLE_DEVICES
+ // is the lower-level Runtime equivalent that some older builds
+ // honour. Setting both is harmless.
+ cmd.env("HIP_VISIBLE_DEVICES", &csv);
+ cmd.env("ROCR_VISIBLE_DEVICES", &csv);
+ }
+ "intel" => {
+ // SYCL / oneAPI selector. Format: "level_zero:0,1" or "opencl:0".
+ // We default to level_zero which is what Intel's IPEX-LLM uses.
+ let sycl: String = selection.indices.iter().map(|i| format!("level_zero:{}", i)).collect::<Vec<_>>().join(",");
+ cmd.env("ONEAPI_DEVICE_SELECTOR", &sycl);
+ }
+ _ => {} // auto / unknown — leave env untouched
+ }
+}
+
+impl Default for GpuSelection {
+ fn default() -> Self {
+ GpuSelection { vendor: "auto".into(), indices: vec![] }
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn apply_gpu_env_sets_cuda_for_nvidia() {
+ let sel = GpuSelection { vendor: "nvidia".into(), indices: vec![1, 2] };
+ let mut cmd = Command::new("echo");
+ apply_gpu_env(&mut cmd, &sel);
+ // We can inspect envs via get_envs (Rust 1.69+).
+ let has_cuda = cmd.get_envs().any(|(k, v)| k == "CUDA_VISIBLE_DEVICES" && v.map(|s| s == "1,2").unwrap_or(false));
+ assert!(has_cuda, "CUDA_VISIBLE_DEVICES should be set to 1,2");
+ }
+
+ #[test]
+ fn apply_gpu_env_sets_hip_and_rocr_for_amd() {
+ let sel = GpuSelection { vendor: "amd".into(), indices: vec![0] };
+ let mut cmd = Command::new("echo");
+ apply_gpu_env(&mut cmd, &sel);
+ let hip = cmd.get_envs().any(|(k, v)| k == "HIP_VISIBLE_DEVICES" && v.map(|s| s == "0").unwrap_or(false));
+ let rocr = cmd.get_envs().any(|(k, v)| k == "ROCR_VISIBLE_DEVICES" && v.map(|s| s == "0").unwrap_or(false));
+ assert!(hip, "HIP_VISIBLE_DEVICES should be set");
+ assert!(rocr, "ROCR_VISIBLE_DEVICES should be set");
+ }
+
+ #[test]
+ fn apply_gpu_env_sets_oneapi_for_intel() {
+ let sel = GpuSelection { vendor: "intel".into(), indices: vec![0, 1] };
+ let mut cmd = Command::new("echo");
+ apply_gpu_env(&mut cmd, &sel);
+ let sycl = cmd.get_envs().any(|(k, v)| k == "ONEAPI_DEVICE_SELECTOR" && v.map(|s| s == "level_zero:0,level_zero:1").unwrap_or(false));
+ assert!(sycl, "ONEAPI_DEVICE_SELECTOR should be set to level_zero:0,level_zero:1");
+ }
+
+ #[test]
+ fn apply_gpu_env_is_noop_when_auto() {
+ let sel = GpuSelection { vendor: "auto".into(), indices: vec![1] };
+ let mut cmd = Command::new("echo");
+ apply_gpu_env(&mut cmd, &sel);
+ // "auto" doesn't match any vendor branch — env should be empty (no GPU vars)
+ let any_gpu_env = cmd.get_envs().any(|(k, _)| {
+ let key = k.to_string_lossy().to_string();
+ key.contains("VISIBLE_DEVICES") || key == "ONEAPI_DEVICE_SELECTOR"
+ });
+ assert!(!any_gpu_env, "auto vendor must not set any GPU env-var");
+ }
+
+ #[test]
+ fn apply_gpu_env_is_noop_when_indices_empty() {
+ let sel = GpuSelection { vendor: "nvidia".into(), indices: vec![] };
+ let mut cmd = Command::new("echo");
+ apply_gpu_env(&mut cmd, &sel);
+ let any_gpu_env = cmd.get_envs().any(|(k, _)| {
+ let key = k.to_string_lossy().to_string();
+ key.contains("VISIBLE_DEVICES") || key == "ONEAPI_DEVICE_SELECTOR"
+ });
+ assert!(!any_gpu_env, "empty indices must not set any GPU env-var");
+ }
+}
diff --git a/src-tauri/src/commands/mod.rs b/src-tauri/src/commands/mod.rs
index 56d35178..0f1f7e09 100644
--- a/src-tauri/src/commands/mod.rs
+++ b/src-tauri/src/commands/mod.rs
@@ -4,6 +4,7 @@ pub mod repo_map;
pub mod claude_code;
pub mod download;
pub mod filesystem;
+pub mod gpu;
pub mod health;
pub mod install;
pub mod process;
diff --git a/src-tauri/src/commands/process.rs b/src-tauri/src/commands/process.rs
index c4f42e94..d70e6d82 100644
--- a/src-tauri/src/commands/process.rs
+++ b/src-tauri/src/commands/process.rs
@@ -647,6 +647,13 @@ pub fn start_ollama(state: State<'_, AppState>) -> Result<serde_json::Value, Str
.stdin(Stdio::null())
.stdout(Stdio::null())
.stderr(Stdio::null());
+ // Bug BB v2.5.0 — BobbyT. Forward the user's GPU pick as
+ // CUDA_VISIBLE_DEVICES / HIP_VISIBLE_DEVICES / ONEAPI_DEVICE_SELECTOR
+ // so Ollama uses the pinned card on multi-vendor / multi-GPU machines.
+ // No-op when the pick is "auto" (default).
+ if let Ok(sel) = state.gpu_selection.lock() {
+ crate::commands::gpu::apply_gpu_env(&mut cmd, &sel);
+ }
#[cfg(target_os = "windows")]
cmd.creation_flags(CREATE_NO_WINDOW);
let result = cmd.spawn();
@@ -783,6 +790,13 @@ pub fn start_comfyui(state: State<'_, AppState>) -> Result<serde_json::Value, St
.stdin(Stdio::null())
.stdout(Stdio::piped())
.stderr(Stdio::piped());
+ // Bug BB v2.5.0 — same GPU env forwarding as start_ollama. ComfyUI's
+ // backend (torch / DirectML / IPEX) reads these on import, so the pick
+ // takes effect on next spawn (current process must be restarted for a
+ // change to apply — surfaced as a hint in the Settings UI).
+ if let Ok(sel) = state.gpu_selection.lock() {
+ crate::commands::gpu::apply_gpu_env(&mut cmd, &sel);
+ }
#[cfg(target_os = "windows")]
cmd.creation_flags(CREATE_NO_WINDOW);
let mut child = cmd.spawn()
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index a9ccf268..9974242c 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -195,6 +195,10 @@ fn main() {
commands::proxy::cancel_model_pull,
// B7 (uselu Phase 4 inspiration) — one-shot diagnostic probe
commands::health::system_health,
+ // Bug BB v2.5.0 — BobbyT GPU picker
+ commands::gpu::detect_gpus,
+ commands::gpu::set_gpu_selection,
+ commands::gpu::get_gpu_selection,
// Codex / Sprint A #2 — Repo-Map with Aider PageRank
commands::repo_map::repo_map,
// Codex / Sprint C #7 — long-running background shell tasks
diff --git a/src-tauri/src/state.rs b/src-tauri/src/state.rs
index ce9fddf5..00ce2f7b 100644
--- a/src-tauri/src/state.rs
+++ b/src-tauri/src/state.rs
@@ -5,6 +5,7 @@ use std::sync::{Arc, Mutex};
use tokio_util::sync::CancellationToken;
+use crate::commands::gpu::GpuSelection;
use crate::commands::whisper::WhisperServer;
use crate::commands::remote::RemoteServer;
use crate::python::get_python_bin;
@@ -174,6 +175,12 @@ pub struct AppState {
/// a folder during Remote dispatch (#29 follow-up); cleared on
/// undispatch / chat delete.
pub chat_workspace_overrides: Arc<Mutex<HashMap<String, std::path::PathBuf>>>,
+ /// Bug BB v2.5.0 — BobbyT Discord 2026-05-26. User-pinned GPU vendor +
+ /// indices, forwarded as CUDA_VISIBLE_DEVICES / HIP_VISIBLE_DEVICES /
+ /// ONEAPI_DEVICE_SELECTOR on next start_ollama / start_comfyui spawn.
+ /// Default "auto" + empty indices = no env-var, runtime picks default
+ /// (pre-v2.5.0 behaviour).
+ pub gpu_selection: Mutex<GpuSelection>,
}
impl AppState {
@@ -230,6 +237,9 @@ impl AppState {
// Remote Access
remote: Mutex::new(RemoteServer::new()),
chat_workspace_overrides: Arc::new(Mutex::new(HashMap::new())),
+ // Bug BB v2.5.0 — start in "auto" mode so existing installs are
+ // unchanged until the user explicitly picks a GPU in Settings.
+ gpu_selection: Mutex::new(GpuSelection::default()),
}
}
}
diff --git a/src/App.tsx b/src/App.tsx
index d8b3b915..d65b2213 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,5 +1,6 @@
import { useEffect } from 'react'
import { AppShell } from './components/layout/AppShell'
+import { useSettingsStore } from './stores/settingsStore'
function App() {
useEffect(() => {
@@ -9,6 +10,22 @@ function App() {
invoke('show_window').catch(() => {})
})
}
+
+ // Bug BB v2.5.0 — push persisted GPU selection from localStorage into
+ // AppState at app boot so the next Ollama / ComfyUI spawn picks it up
+ // without the user having to open Settings first. Read the setting
+ // synchronously off the store (already hydrated from localStorage by
+ // zustand persist middleware).
+ if (window.__TAURI_INTERNALS__) {
+ const s = useSettingsStore.getState().settings
+ const selection = {
+ vendor: s.gpuVendor || 'auto',
+ indices: s.gpuIndices || [],
+ }
+ import('@tauri-apps/api/core').then(({ invoke }) => {
+ invoke('set_gpu_selection', { selection }).catch(() => {})
+ })
+ }
}, [])
return <AppShell />
diff --git a/src/components/settings/HardwareSettings.tsx b/src/components/settings/HardwareSettings.tsx
new file mode 100644
index 00000000..ab4cae52
--- /dev/null
+++ b/src/components/settings/HardwareSettings.tsx
@@ -0,0 +1,188 @@
+// Bug BB v2.5.0 — BobbyT Discord 2026-05-26. GPU picker UI. Detects GPUs via
+// the Rust `detect_gpus` command, lets the user pick vendor + indices, and
+// forwards the selection to AppState via `set_gpu_selection`. Applied on
+// next Ollama / ComfyUI spawn (current processes need a restart).
+
+import { useEffect, useMemo, useState } from 'react'
+import { useSettingsStore } from '../../stores/settingsStore'
+import { backendCall } from '../../api/backend'
+import { Cpu, RefreshCw, AlertTriangle } from 'lucide-react'
+
+interface DetectedGpu {
+ index: number
+ vendor: string
+ name: string
+ memory_mib: number | null
+ source: string
+}
+
+type GpuVendor = 'auto' | 'nvidia' | 'amd' | 'intel'
+
+const VENDOR_LABELS: Record<GpuVendor, string> = {
+ auto: 'Auto (let runtime decide)',
+ nvidia: 'NVIDIA (CUDA_VISIBLE_DEVICES)',
+ amd: 'AMD (HIP_VISIBLE_DEVICES)',
+ intel: 'Intel (ONEAPI_DEVICE_SELECTOR)',
+}
+
+const VENDOR_HELP: Record<GpuVendor, string> = {
+ auto: 'No env-var set. Ollama / ComfyUI use whatever the driver picks first. This matches pre-v2.5.0 behaviour.',
+ nvidia: 'Forwards CUDA_VISIBLE_DEVICES. Use on NVIDIA-only or NVIDIA+iGPU setups.',
+ amd: 'Forwards HIP_VISIBLE_DEVICES + ROCR_VISIBLE_DEVICES. Works on ROCm Linux + ROCm-on-Windows.',
+ intel: 'Forwards ONEAPI_DEVICE_SELECTOR. For Intel Arc / Iris with IPEX-LLM. Ollama support is limited — verify your engine first.',
+}
+
+export function HardwareSettings() {
+ const { settings, updateSettings } = useSettingsStore()
+ const [gpus, setGpus] = useState<DetectedGpu[]>([])
+ const [loading, setLoading] = useState(false)
+ const [error, setError] = useState<string | null>(null)
+ const [showRestartHint, setShowRestartHint] = useState(false)
+
+ const vendor = (settings.gpuVendor || 'auto') as GpuVendor
+ const indices = settings.gpuIndices || []
+
+ const detect = async () => {
+ setLoading(true)
+ setError(null)
+ try {
+ const result = await backendCall<DetectedGpu[]>('detect_gpus')
+ setGpus(Array.isArray(result) ? result : [])
+ } catch (e) {
+ setError(`GPU detection failed: ${e instanceof Error ? e.message : String(e)}`)
+ setGpus([])
+ } finally {
+ setLoading(false)
+ }
+ }
+
+ useEffect(() => {
+ detect()
+ }, [])
+
+ // Push selection to AppState on every change so the next ollama / comfyui
+ // spawn picks it up. No-op when not running in Tauri (dev mode).
+ useEffect(() => {
+ backendCall('set_gpu_selection', { selection: { vendor, indices } }).catch(() => {})
+ }, [vendor, indices])
+
+ const gpusForVendor = useMemo(() => {
+ if (vendor === 'auto') return gpus
+ return gpus.filter(g => g.vendor === vendor)
+ }, [gpus, vendor])
+
+ const setVendor = (v: GpuVendor) => {
+ updateSettings({ gpuVendor: v, gpuIndices: [] }) // reset indices when vendor changes
+ setShowRestartHint(true)
+ }
+
+ const toggleIndex = (idx: number) => {
+ const next = indices.includes(idx)
+ ? indices.filter(i => i !== idx)
+ : [...indices, idx].sort((a, b) => a - b)
+ updateSettings({ gpuIndices: next })
+ setShowRestartHint(true)
+ }
+
+ return (
+ <div className="space-y-3">
+ <div className="flex items-start gap-2.5 p-2.5 rounded-lg border border-amber-200 dark:border-amber-500/20 bg-amber-50 dark:bg-amber-500/[0.08] text-amber-900 dark:text-amber-200">
+ <Cpu size={14} className="mt-0.5 shrink-0" />
+ <div className="text-[0.65rem] leading-relaxed">
+ <strong>GPU picker.</strong> Forwards CUDA_VISIBLE_DEVICES / HIP_VISIBLE_DEVICES / ONEAPI_DEVICE_SELECTOR to Ollama + ComfyUI on next spawn. Use only on multi-GPU / multi-vendor systems where the driver picks the wrong device by default.
+ </div>
+ </div>
+
+ <div>
+ <div className="flex items-center justify-between mb-1.5">
+ <span className="text-[0.7rem] text-gray-700 dark:text-gray-300 font-medium">Vendor</span>
+ <button
+ onClick={detect}
+ disabled={loading}
+ className="text-[0.6rem] text-gray-500 hover:text-gray-300 inline-flex items-center gap-1 disabled:opacity-50"
+ aria-label="Re-detect GPUs"
+ >
+ <RefreshCw size={10} className={loading ? 'animate-spin' : ''} />
+ Re-detect
+ </button>
+ </div>
+ <div className="grid grid-cols-1 gap-1">
+ {(Object.keys(VENDOR_LABELS) as GpuVendor[]).map(v => (
+ <label key={v} className="flex items-start gap-2 cursor-pointer p-1.5 rounded hover:bg-white/[0.04] border border-transparent has-[input:checked]:border-white/10 has-[input:checked]:bg-white/[0.03]">
+ <input
+ type="radio"
+ name="gpu-vendor"
+ checked={vendor === v}
+ onChange={() => setVendor(v)}
+ className="mt-0.5"
+ />
+ <div className="flex-1 min-w-0">
+ <div className="text-[0.65rem] text-gray-300">{VENDOR_LABELS[v]}</div>
+ <div className="text-[0.55rem] text-gray-500 mt-0.5 leading-relaxed">{VENDOR_HELP[v]}</div>
+ </div>
+ </label>
+ ))}
+ </div>
+ </div>
+
+ <div>
+ <div className="text-[0.7rem] text-gray-700 dark:text-gray-300 font-medium mb-1">Detected GPUs</div>
+ {error && (
+ <div className="flex items-start gap-2 p-2 rounded border border-red-500/20 bg-red-500/[0.06] text-red-300 mb-1.5">
+ <AlertTriangle size={12} className="mt-0.5 shrink-0" />
+ <span className="text-[0.6rem]">{error}</span>
+ </div>
+ )}
+ {!error && gpus.length === 0 && !loading && (
+ <div className="text-[0.6rem] text-gray-500 italic">
+ No GPUs detected via nvidia-smi / rocm-smi / lspci / wmic. The "Auto" vendor option still works — Ollama will use whatever the driver picks.
+ </div>
+ )}
+ {gpusForVendor.length > 0 && (
+ <div className="space-y-1">
+ {gpusForVendor.map(g => {
+ const checked = indices.includes(g.index)
+ const isAuto = vendor === 'auto'
+ return (
+ <label
+ key={`${g.vendor}-${g.index}-${g.name}`}
+ className={`flex items-center gap-2 p-1.5 rounded border ${
+ isAuto ? 'border-white/5 opacity-60 cursor-not-allowed' : 'border-white/8 hover:bg-white/[0.04] cursor-pointer'
+ }`}
+ >
+ <input
+ type="checkbox"
+ checked={checked && !isAuto}
+ disabled={isAuto}
+ onChange={() => toggleIndex(g.index)}
+ />
+ <div className="flex-1 min-w-0">
+ <div className="text-[0.65rem] text-gray-200 truncate">
+ <span className="font-mono text-gray-500">#{g.index}</span> {g.name}
+ </div>
+ <div className="text-[0.55rem] text-gray-500">
+ {g.vendor}
+ {g.memory_mib ? ` · ${(g.memory_mib / 1024).toFixed(1)} GB` : ''}
+ {` · via ${g.source}`}
+ </div>
+ </div>
+ </label>
+ )
+ })}
+ </div>
+ )}
+ {vendor !== 'auto' && gpusForVendor.length === 0 && gpus.length > 0 && !loading && (
+ <div className="text-[0.6rem] text-amber-300 italic mt-1">
+ No {vendor.toUpperCase()} GPUs detected on this system. Either install the vendor tool ({vendor === 'nvidia' ? 'nvidia-smi' : vendor === 'amd' ? 'rocm-smi' : 'driver providing lspci/wmic info'}) or switch back to "Auto".
+ </div>
+ )}
+ </div>
+
+ {showRestartHint && (vendor !== 'auto' || indices.length > 0) && (
+ <div className="text-[0.6rem] text-amber-300 italic">
+ GPU pick takes effect on next Ollama / ComfyUI spawn. Restart both via the Power button (top-right) or close LU to apply.
+ </div>
+ )}
+ </div>
+ )
+}
diff --git a/src/components/settings/SettingsPage.tsx b/src/components/settings/SettingsPage.tsx
index 10cce437..a13fc10b 100644
--- a/src/components/settings/SettingsPage.tsx
+++ b/src/components/settings/SettingsPage.tsx
@@ -12,6 +12,7 @@ import { FEATURE_FLAGS } from '../../lib/constants'
import { getRecommendedAgentModels } from '../../lib/model-compatibility'
import { MemorySettings } from './MemorySettings'
import { RemoteAccessSettings } from './RemoteAccessSettings'
+import { HardwareSettings } from './HardwareSettings'
import { ProviderSettings } from './ProviderConfig'
import { PermissionSettings } from './PermissionSettings'
import { MCPServerSettings } from './MCPServerSettings'
@@ -751,6 +752,13 @@ export function SettingsPage() {
</div>
</Section>
+ {/* Bug BB v2.5.0 — BobbyT GPU picker. Lazy-loads the GPU list when
+ the section opens via detect_gpus probe (nvidia-smi + rocm-smi +
+ lspci/wmic). */}
+ <Section title="Hardware (GPU picker)">
+ <HardwareSettings />
+ </Section>
+
<Section title="Image / Video Generation Timeouts">
<div className="text-[0.6rem] text-gray-500 dark:text-gray-500 leading-relaxed pb-1.5">
Maximum minutes a ComfyUI generation can run before LU aborts it. Bump these up if you run on iGPU or CPU only — a 1024px image on integrated graphics can take 30+ min.
diff --git a/src/lib/constants.ts b/src/lib/constants.ts
index c410e89e..6158e7f9 100644
--- a/src/lib/constants.ts
+++ b/src/lib/constants.ts
@@ -38,6 +38,10 @@ export const DEFAULT_SETTINGS: Settings = {
// Bug AA v2.5.0 — Ollama num_ctx override. 0 = use Ollama default (2048
// on most builds). Users with RAG / long chats can bump this up.
contextWindowOverride: 0,
+ // Bug BB v2.5.0 — GPU picker. "auto" + empty indices = no env-var,
+ // runtime picks default. User sets these via Settings → Hardware.
+ gpuVendor: 'auto',
+ gpuIndices: [],
// ── v2.5.0 Codex sprint A/B/C defaults (ported from uselu) ──────
codexArchitectMode: false,
codexArchitectModel: '',
diff --git a/src/types/settings.ts b/src/types/settings.ts
index 70a09ae0..f53a8e5e 100644
--- a/src/types/settings.ts
+++ b/src/types/settings.ts
@@ -43,6 +43,16 @@ export interface Settings {
// providers ignore this field — they manage context themselves.
/** User-side context-window override (forwarded as Ollama's num_ctx). 0 = auto. */
contextWindowOverride: number
+ // Bug BB v2.5.0 — BobbyT Discord 2026-05-26. GPU vendor + indices to
+ // forward as CUDA_VISIBLE_DEVICES / HIP_VISIBLE_DEVICES /
+ // ONEAPI_DEVICE_SELECTOR on next Ollama / ComfyUI spawn. "auto" + empty
+ // = no env-var, runtime picks default (pre-v2.5.0 behaviour). Used on
+ // multi-vendor / multi-GPU systems (e.g. BobbyT's AMD RX 6800XT + Intel
+ // Arc Pro B60 where he wants to pin the Arc).
+ /** Selected GPU vendor for env-var family ("auto" | "nvidia" | "amd" | "intel"). */
+ gpuVendor: 'auto' | 'nvidia' | 'amd' | 'intel'
+ /** Zero-based, vendor-scoped indices of GPUs to expose. Empty = all. */
+ gpuIndices: number[]
// ── v2.5.0 Codex sprint A/B/C settings (ported from uselu) ──────
/**
* Codex Architect/Editor split. When on, a separate `codexArchitectModel`