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.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(install): an AMD card gets ROCm wheels instead of a processor only ComfyUI
David57196b312bab
diff --git a/src-tauri/src/commands/install.rs b/src-tauri/src/commands/install.rsindex f140f8dc..261242f1 100644--- a/src-tauri/src/commands/install.rs+++ b/src-tauri/src/commands/install.rs@@ -130,6 +130,8 @@ pub(crate) fn detect_nvidia_compute_cap_major() -> Option<u32> {parse_compute_cap_output(&s)}+use crate::commands::torch_wheels;+// ── pip helpers (issue #32: PyTorch / ComfyUI install reliability) ───────────/// Push a log line to the shared install state. Best-effort — silently@@ -660,53 +662,43 @@ pub(crate) fn process_read_bytes(_pid: u32) -> Option<u64> {None}-/// Pure: the wheel index for a GPU situation, kept apart from the nvidia-smi-/// probes so the channel choice is testable.+/// GPU probe + wheel choice + pip args, shared between the first install and+/// `repair_comfyui_env` so the two can never drift apart.///-/// Bug #10 (vokurta, RTX 6000 Blackwell, 2026-05-11): SM 12.0 GPUs need-/// PyTorch cu128 wheels; older channels simply don't ship the kernel and the-/// first compute call dies with "no kernel image is available".+/// Bug #10 (vokurta, RTX 6000 Blackwell, 2026-05-11): SM 12.0 GPUs need their+/// own CUDA channel, older ones simply do not ship the kernel and the first+/// compute call dies with "no kernel image is available".////// Box measurement 2026-08-16 (W2, #98): everything below Blackwell used to/// get cu121, but that channel is frozen at torch 2.5.1 while ComfyUI's own/// unpinned requirements move on. Current cores import comfy_kitchen, whose/// custom ops use builtin generic annotations (`kernel_size: list[int]`) that/// torch only accepts from 2.6 on, so a freshly repaired venv died at import-/// with the infer_schema ValueError. cu126 is the living channel (torch 2.6+,-/// sm_50 through sm_90, ComfyUI's own documented default), so repaired and-/// fresh installs follow the requirements instead of trailing them.-pub(crate) fn pytorch_index_for(- has_nvidia: bool,- compute_cap_major: Option<u32>,-) -> Option<&'static str> {- match compute_cap_major {- Some(major) if major >= 12 => Some("https://download.pytorch.org/whl/cu128"),- Some(_) => Some("https://download.pytorch.org/whl/cu126"),- None if has_nvidia => Some("https://download.pytorch.org/whl/cu126"),- None => None,- }-}--/// GPU probe + wheel choice + pip args, shared between the first install and-/// `repair_comfyui_env` so the two can never drift apart (same cu128/cu126/-/// CPU decision, same flags).+/// with the infer_schema ValueError.+///+/// AMD bundle 2026-08-28 (numbrain, lapbo, petermanmancusso, sancora): the+/// probe was `nvidia-smi` and nothing else, so an AMD card came out of it+/// looking exactly like a machine with no card, and the venv got the+/// processor wheels. Those wheels install cleanly and then answer+/// "Torch not compiled with CUDA enabled" the moment the user forces the GPU.+/// The vendor list now decides, and the choice itself lives in+/// `torch_wheels` where it is testable without any of the hardware.pub(crate) fn plan_pytorch_install() -> (Vec<String>, String) {- let mut nv = Command::new("nvidia-smi");- nv.stdout(Stdio::piped()).stderr(Stdio::piped());- #[cfg(target_os = "windows")]- nv.creation_flags(CREATE_NO_WINDOW);- let has_nvidia = nv.output().map(|o| o.status.success()).unwrap_or(false);-+ let (has_nvidia, has_amd) = torch_wheels::gpu_vendors_present();let compute_cap_major = if has_nvidia { detect_nvidia_compute_cap_major() } else { None };- let pytorch_index = pytorch_index_for(has_nvidia, compute_cap_major);-- let gpu_info = match (has_nvidia, compute_cap_major) {- (true, Some(major)) if major >= 12 => "NVIDIA Blackwell GPU detected (SM 12.0+) — installing PyTorch cu128",- (true, Some(_)) => "NVIDIA GPU detected, installing CUDA PyTorch (cu126)",- (true, None) => "NVIDIA GPU detected (compute capability probe failed), falling back to cu126",- (false, _) => "No NVIDIA GPU — installing CPU PyTorch",+ let plan = torch_wheels::comfy_wheel_plan(+ has_nvidia,+ compute_cap_major,+ has_amd,+ std::env::consts::OS,+ );+ let note = plan.note().to_string();+ let index = torch_wheels::resolve_plan_index(&plan);+ let gpu_info = match index {+ Some(url) => format!("{note} ({url})"),+ None => note,};- (pytorch_pip_args(pytorch_index), gpu_info.to_string())+ (pytorch_pip_args(index), gpu_info)}#[tauri::command]@@ -3602,28 +3594,39 @@ mod tests {#[test]fn pytorch_index_rides_living_channels() {+ use crate::commands::torch_wheels::{comfy_wheel_plan, WheelPlan};+ let first = |nv, cap, amd, os| match comfy_wheel_plan(nv, cap, amd, os) {+ WheelPlan::Index { candidates, .. } => Some(candidates[0]),+ WheelPlan::Cpu { .. } => None,+ };assert_eq!(- pytorch_index_for(true, Some(12)),+ first(true, Some(12), false, "windows"),Some("https://download.pytorch.org/whl/cu128"));assert_eq!(- pytorch_index_for(true, Some(8)),+ first(true, Some(8), false, "windows"),Some("https://download.pytorch.org/whl/cu126"));assert_eq!(- pytorch_index_for(true, None),+ first(true, None, false, "windows"),Some("https://download.pytorch.org/whl/cu126"));- assert_eq!(pytorch_index_for(false, None), None);+ assert_eq!(first(false, None, false, "linux"), None);}#[test]fn pytorch_index_never_picks_the_frozen_cu121_channel() {// Negative control: cu121 is stuck at torch 2.5.1, which current// ComfyUI cores reject at import (comfy_kitchen infer_schema).+ use crate::commands::torch_wheels::{comfy_wheel_plan, WheelPlan};for (nv, cap) in [(true, Some(6)), (true, Some(7)), (true, Some(8)), (true, Some(9)), (true, Some(12)), (true, None)] {- let idx = pytorch_index_for(nv, cap).unwrap_or("");- assert!(!idx.contains("cu121"), "frozen channel chosen for cap {:?}", cap);+ if let WheelPlan::Index { candidates, .. } = comfy_wheel_plan(nv, cap, false, "linux") {+ assert!(+ !candidates.iter().any(|c| c.contains("cu121")),+ "frozen channel chosen for cap {:?}",+ cap+ );+ }}}diff --git a/src-tauri/src/commands/mod.rs b/src-tauri/src/commands/mod.rsindex 21791221..5f7bf3b5 100644--- a/src-tauri/src/commands/mod.rs+++ b/src-tauri/src/commands/mod.rs@@ -19,6 +19,7 @@ pub mod search;pub mod secret;pub mod shell;pub mod system;+pub mod torch_wheels;pub mod trainer;pub mod tts;pub mod video;diff --git a/src-tauri/src/commands/process.rs b/src-tauri/src/commands/process.rsindex f623e1a2..58cb310a 100644--- a/src-tauri/src/commands/process.rs+++ b/src-tauri/src/commands/process.rs@@ -277,6 +277,41 @@ pub fn decide_comfy_cpu_flag(}}+/// Force GPU is a promise LU keeps, not a claim LU checks: the flag drops+/// `--cpu` and ComfyUI then asks torch for a device. On a venv holding+/// CUDA-only wheels and an AMD card that ends in+/// "Torch not compiled with CUDA enabled" and nothing else, which is what+/// numbrain, lapbo, petermanmancusso and sancora all saw. The flag still+/// wins, the user asked for it, but the reason is in the output panel before+/// the traceback is.+///+/// `torch_gpu`: Some(false) = the venv's torch reports no usable GPU,+/// Some(true) = it does, None = the probe did not answer and we say nothing+/// rather than guess.+pub(crate) fn force_gpu_warning(+ mode: ComfyGpuMode,+ torch_gpu: Option<bool>,+ has_amd: bool,+ os: &str,+) -> Option<String> {+ if mode != ComfyGpuMode::ForceGpu || torch_gpu != Some(false) {+ return None;+ }+ let head = "ComfyUI GPU is set to Force GPU, but the PyTorch in this ComfyUI environment reports no usable GPU. ComfyUI will stop with \"Torch not compiled with CUDA enabled\" instead of rendering.";+ let fix = match (has_amd, os) {+ (true, "linux") => {+ "Your card is AMD and this environment holds CUDA-only wheels. Reinstall the ComfyUI environment from Settings > ComfyUI: LU now installs the ROCm build of PyTorch when it sees an AMD card."+ }+ (true, "windows") => {+ "Your card is AMD and PyTorch ships no ROCm wheels for Windows, so no reinstall can fix this here. Use a ComfyUI of your own on DirectML or ZLUDA, or set ComfyUI GPU back to Auto and render on the processor."+ }+ _ => {+ "Reinstall the ComfyUI environment from Settings > ComfyUI so PyTorch is rebuilt for the card LU detects, or set ComfyUI GPU back to Auto."+ }+ };+ Some(format!("[LU] {head} {fix}"))+}+/// Skip these directories during ComfyUI searchconst SKIP_DIRS: &[&str] = &["node_modules", ".git", "__pycache__", "venv", ".venv", "site-packages",@@ -1336,6 +1371,23 @@ fn start_comfyui_blocking(state: &AppState) -> Result<serde_json::Value, String>// shd_scorpion (RX 7900 XTX): remember what we actually launched with so// the Create tab can warn instead of letting a CPU gen time out silently.*state.comfy_started_cpu.lock().unwrap() = Some(needs_cpu_fallback);+ // Force GPU skips the probe above on purpose, so ask separately and only+ // in that mode: the answer costs a torch import once per python path and+ // buys the sentence that explains the crash that is about to happen.+ let force_gpu_note = if gpu_mode == ComfyGpuMode::ForceGpu {+ let (_, has_amd) = crate::commands::torch_wheels::gpu_vendors_present();+ force_gpu_warning(+ gpu_mode,+ comfy_gpu_available_cached(&python, Some(&state.comfy_gpu_cache)),+ has_amd,+ std::env::consts::OS,+ )+ } else {+ None+ };+ if let Some(note) = &force_gpu_note {+ println!("[ComfyUI] {note}");+ }let mut comfy_args: Vec<&str> = vec!["main.py","--listen", "127.0.0.1",@@ -1406,6 +1458,9 @@ fn start_comfyui_blocking(state: &AppState) -> Result<serde_json::Value, String>let mut buf = state.comfy_output.lock().unwrap();buf.clear();buf.push_back(format!("[start] {} main.py --port {}", python, port_str));+ if let Some(note) = &force_gpu_note {+ buf.push_back(note.clone());+ }}let capture = |line: String, sink: &Arc<Mutex<std::collections::VecDeque<String>>>| {println!("[ComfyUI] {}", line);@@ -2385,6 +2440,33 @@ mod tests {fn probe_comfy_gpu_on_empty_python_is_definitive_false() {assert_eq!(probe_comfy_gpu(""), Some(false));}++ #[test]+ fn force_gpu_on_a_torch_without_a_gpu_says_why_before_the_crash() {+ let linux = force_gpu_warning(ComfyGpuMode::ForceGpu, Some(false), true, "linux")+ .expect("an AMD Linux box with CUDA wheels must be told");+ assert!(linux.contains("Torch not compiled with CUDA enabled"), "{linux}");+ assert!(linux.contains("ROCm"), "the Linux way out is a reinstall: {linux}");+ let win = force_gpu_warning(ComfyGpuMode::ForceGpu, Some(false), true, "windows")+ .expect("an AMD Windows box must be told too");+ assert!(win.contains("DirectML"), "{win}");+ // Never promise a reinstall that cannot exist: there are no ROCm+ // wheels for Windows, so the message must not send the user there.+ assert!(!win.contains("Reinstall the ComfyUI environment"), "{win}");+ let other = force_gpu_warning(ComfyGpuMode::ForceGpu, Some(false), false, "windows")+ .expect("a non-AMD box with a dead torch is still worth a word");+ assert!(!other.contains("AMD"), "{other}");+ }++ #[test]+ fn nothing_is_said_when_there_is_nothing_to_say() {+ // Negative controls: the note only belongs to Force GPU on a torch+ // that answered "no GPU". Everything else stays quiet.+ assert_eq!(force_gpu_warning(ComfyGpuMode::ForceGpu, Some(true), true, "linux"), None);+ assert_eq!(force_gpu_warning(ComfyGpuMode::ForceGpu, None, true, "linux"), None);+ assert_eq!(force_gpu_warning(ComfyGpuMode::Auto, Some(false), true, "linux"), None);+ assert_eq!(force_gpu_warning(ComfyGpuMode::ForceCpu, Some(false), true, "linux"), None);+ }}/// Cloud mode = cloud-only inference: release every LOCAL model backend sodiff --git a/src-tauri/src/commands/torch_wheels.rs b/src-tauri/src/commands/torch_wheels.rsnew file mode 100644index 00000000..bd2c33d3--- /dev/null+++ b/src-tauri/src/commands/torch_wheels.rs@@ -0,0 +1,291 @@+//! Which PyTorch wheels belong on THIS machine.+//!+//! Two environments in the app build a Python venv and put torch in it: the+//! ComfyUI environment (`install.rs`) and the character trainer (`trainer.rs`).+//! Both used to ask `nvidia-smi` and nothing else, so an AMD card was+//! indistinguishable from a machine with no card at all and got the wheels a+//! card-less box gets. On the ComfyUI side that is exactly what numbrain,+//! lapbo, petermanmancusso and sancora reported: ComfyUI installs, starts,+//! and renders on the processor, and forcing the GPU produces+//! "Torch not compiled with CUDA enabled" because the wheels really are+//! CUDA-only.+//!+//! The decisions live here as pure functions with the probes injected, so a+//! test can drive every branch on a machine that has none of the hardware.+//! We own no AMD card, so the ROCm side of this file is researched against+//! download.pytorch.org and ComfyUI's own README rather than measured.++use std::time::Duration;++/// PyTorch's ROCm channels, the one we want most first.+///+/// Listing read from download.pytorch.org on 2026-08-28: rocm7.2 and rocm7.1+/// both carry torch up to 2.13.0, rocm6.4 stops at 2.9.1, and every single+/// wheel in every ROCm channel is `manylinux_2_28_x86_64`. There is no+/// win_amd64 ROCm wheel anywhere, which is the whole reason the Windows+/// branch below installs processor wheels instead of pretending. ComfyUI's+/// own README names rocm7.2 as the AMD install line, so that one leads and+/// the two older channels are there to catch a channel that gets retired.+pub(crate) const ROCM_CHANNELS: &[&str] = &[+ "https://download.pytorch.org/whl/rocm7.2",+ "https://download.pytorch.org/whl/rocm7.1",+ "https://download.pytorch.org/whl/rocm6.4",+];++/// Blackwell and newer: CUDA 12.6 has no sm_120 kernels at all, so cu126 is+/// not a fallback for these cards, it is a broken install. Only channels that+/// carry the kernel may appear here.+pub(crate) const CUDA_BLACKWELL_CHANNELS: &[&str] = &[+ "https://download.pytorch.org/whl/cu128",+];++/// Everything else with an NVIDIA card. cu126 is the living channel ComfyUI+/// itself documents for older silicon (torch 2.6+, sm_50 through sm_90).+pub(crate) const CUDA_LEGACY_CHANNELS: &[&str] = &[+ "https://download.pytorch.org/whl/cu126",+];++/// What the pip step should do about torch.+#[derive(Debug, PartialEq, Eq)]+pub(crate) enum WheelPlan {+ /// Install from the first of these indexes that answers. The list is+ /// never empty, and its last entry is the fallback that gets used even+ /// when nothing answers, so a blocked network cannot leave the installer+ /// without a channel.+ Index {+ candidates: &'static [&'static str],+ note: String,+ },+ /// Install the plain PyPI wheels, which run on the processor. No index.+ Cpu { note: String },+}++impl WheelPlan {+ /// The sentence the install log shows while this plan runs.+ pub(crate) fn note(&self) -> &str {+ match self {+ WheelPlan::Index { note, .. } => note,+ WheelPlan::Cpu { note } => note,+ }+ }+}++/// Which vendors this machine has, from the same probe the hardware picker+/// uses, so a card that shows up in Settings is a card the installers know+/// about. That probe survives a missing rocm-smi, which is the only reason an+/// AMD card is visible here at all.+pub(crate) fn gpu_vendors_present() -> (bool, bool) {+ let gpus = crate::commands::gpu::detect_gpus().unwrap_or_default();+ (+ gpus.iter().any(|g| g.vendor == "nvidia"),+ gpus.iter().any(|g| g.vendor == "amd"),+ )+}++/// The torch plan for the ComfyUI environment.+///+/// NVIDIA wins on a box that has both cards: it is the one every ComfyUI+/// feature is proven on. macOS never reaches this code, local media there is+/// MLX and `install_comfyui` refuses before it starts.+pub(crate) fn comfy_wheel_plan(+ has_nvidia: bool,+ nvidia_cap_major: Option<u32>,+ has_amd: bool,+ os: &str,+) -> WheelPlan {+ if has_nvidia || nvidia_cap_major.is_some() {+ return nvidia_plan(nvidia_cap_major);+ }+ if has_amd {+ if os == "linux" {+ return WheelPlan::Index {+ candidates: ROCM_CHANNELS,+ note: "AMD GPU detected, installing the ROCm build of PyTorch. \+ ComfyUI will run on the card instead of the processor once this finishes."+ .to_string(),+ };+ }+ return WheelPlan::Cpu {+ note: amd_without_rocm_note(os),+ };+ }+ WheelPlan::Cpu {+ note: "No GPU detected, installing the processor build of PyTorch.".to_string(),+ }+}++fn nvidia_plan(cap_major: Option<u32>) -> WheelPlan {+ match cap_major {+ Some(major) if major >= 12 => WheelPlan::Index {+ candidates: CUDA_BLACKWELL_CHANNELS,+ note: "NVIDIA Blackwell GPU detected (compute capability 12.x), installing CUDA PyTorch."+ .to_string(),+ },+ Some(_) => WheelPlan::Index {+ candidates: CUDA_LEGACY_CHANNELS,+ note: "NVIDIA GPU detected, installing CUDA PyTorch.".to_string(),+ },+ None => WheelPlan::Index {+ candidates: CUDA_LEGACY_CHANNELS,+ note: "NVIDIA GPU detected (the compute capability probe stayed silent), \+ installing the CUDA PyTorch that covers the widest range of cards."+ .to_string(),+ },+ }+}++/// What an AMD card can and cannot do on an operating system PyTorch ships no+/// ROCm wheels for. Windows is the case that matters (all four reporters of+/// the AMD bundle who are not on Linux are there); anything else that is not+/// Linux gets the same honest answer minus the Windows-only names.+pub(crate) fn amd_without_rocm_note(os: &str) -> String {+ let head = "AMD GPU detected, but PyTorch ships ROCm wheels for Linux only \+ (checked 2026-08-28: every wheel in the rocm7.2, rocm7.1 and rocm6.4 \+ channels is a Linux wheel). ComfyUI is being installed with the \+ processor build, which works but is slow.";+ if os == "windows" {+ format!(+ "{head} To drive the card on Windows you need a ComfyUI of your own on \+ DirectML or ZLUDA, then point LU at it and set \+ Settings > Hardware > ComfyUI GPU to force GPU. ZLUDA stands in for the \+ CUDA runtime, it is not a CUDA PyTorch build, so it only helps a ComfyUI \+ that was set up for it."+ )+ } else {+ format!("{head} Linux with ROCm is the supported way to use this card for image and video.")+ }+}++/// The first candidate that answers, otherwise the last one.+///+/// Pure over the probe, so a test can drive both ends without a network. The+/// fallback is deliberate: an install behind a proxy that blocks our probe+/// still gets a channel to try, which is the behaviour the app had before any+/// of this existed.+pub(crate) fn first_live_index<'a>(+ candidates: &[&'a str],+ mut alive: impl FnMut(&str) -> bool,+) -> Option<&'a str> {+ if candidates.is_empty() {+ return None;+ }+ for c in candidates {+ if alive(c) {+ return Some(c);+ }+ }+ candidates.last().copied()+}++/// Does this wheel index actually serve torch right now?+///+/// Runs on its own thread: a blocking HTTP client panics inside a tokio+/// runtime, and this is called from both a plain worker thread and a Tauri+/// command, so the thread makes the call site irrelevant.+pub(crate) fn index_serves_torch(index: &str) -> bool {+ let url = format!("{}/torch/", index.trim_end_matches('/'));+ std::thread::spawn(move || {+ reqwest::blocking::Client::builder()+ .timeout(Duration::from_secs(8))+ .build()+ .ok()+ .and_then(|c| c.get(&url).send().ok())+ .map(|r| r.status().is_success())+ .unwrap_or(false)+ })+ .join()+ .unwrap_or(false)+}++/// Resolve a plan into the index pip should use. `None` means the plain PyPI+/// wheels, which is what `pytorch_pip_args(None)` installs.+pub(crate) fn resolve_plan_index(plan: &WheelPlan) -> Option<&'static str> {+ match plan {+ WheelPlan::Cpu { .. } => None,+ WheelPlan::Index { candidates, .. } => first_live_index(candidates, index_serves_torch),+ }+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn an_amd_linux_box_gets_rocm_wheels_not_processor_wheels() {+ match comfy_wheel_plan(false, None, true, "linux") {+ WheelPlan::Index { candidates, note } => {+ assert_eq!(candidates, ROCM_CHANNELS);+ assert!(candidates[0].contains("rocm"), "first candidate is a ROCm channel");+ assert!(note.contains("AMD"), "the log says what was detected: {note}");+ }+ other => panic!("AMD on Linux must get wheels, got {other:?}"),+ }+ }++ #[test]+ fn an_amd_box_without_rocm_wheels_is_told_the_truth_instead_of_getting_cuda() {+ // Negative control: no ROCm channel exists for Windows, so the plan+ // must NOT hand out an index at all, and it must not claim CUDA.+ for os in ["windows", "freebsd"] {+ match comfy_wheel_plan(false, None, true, os) {+ WheelPlan::Cpu { note } => {+ assert!(+ !note.contains("installing CUDA PyTorch"),+ "{os}: promised CUDA wheels to an AMD card",+ );+ assert!(note.contains("AMD"), "{os}: never named the card");+ }+ other => panic!("{os} has no ROCm wheels, got {other:?}"),+ }+ }+ assert!(amd_without_rocm_note("windows").contains("DirectML"));+ assert!(!amd_without_rocm_note("linux").contains("DirectML"));+ }++ #[test]+ fn an_nvidia_card_still_wins_over_an_amd_card_in_the_same_box() {+ match comfy_wheel_plan(true, Some(8), true, "linux") {+ WheelPlan::Index { candidates, .. } => {+ assert!(candidates.iter().all(|c| c.contains("/cu")), "{candidates:?}");+ }+ other => panic!("expected CUDA wheels, got {other:?}"),+ }+ }++ #[test]+ fn a_box_with_no_card_at_all_keeps_the_processor_build() {+ match comfy_wheel_plan(false, None, false, "linux") {+ WheelPlan::Cpu { note } => assert!(note.contains("No GPU")),+ other => panic!("expected processor wheels, got {other:?}"),+ }+ }++ #[test]+ fn blackwell_never_gets_a_channel_without_its_kernels() {+ // Negative control: cu126 has no sm_120 kernel, so it may not appear+ // in the Blackwell ladder even as a last fallback.+ match comfy_wheel_plan(true, Some(12), false, "windows") {+ WheelPlan::Index { candidates, .. } => {+ assert!(!candidates.iter().any(|c| c.ends_with("cu126")), "{candidates:?}");+ }+ other => panic!("expected CUDA wheels, got {other:?}"),+ }+ }++ #[test]+ fn the_first_answering_index_wins_and_a_dead_network_still_yields_one() {+ let list = ["a", "b", "c"];+ assert_eq!(first_live_index(&list, |i| i == "a"), Some("a"));+ assert_eq!(first_live_index(&list, |i| i == "b"), Some("b"));+ // Negative control: nothing answers, so the last entry is handed out+ // rather than nothing at all.+ assert_eq!(first_live_index(&list, |_| false), Some("c"));+ assert_eq!(first_live_index(&[], |_| true), None);+ }++ #[test]+ fn a_processor_plan_never_resolves_to_an_index() {+ let plan = WheelPlan::Cpu { note: "x".to_string() };+ assert_eq!(resolve_plan_index(&plan), None);+ }+}diff --git a/src-tauri/src/commands/trainer.rs b/src-tauri/src/commands/trainer.rsindex a689c972..e8d0899b 100644--- a/src-tauri/src/commands/trainer.rs+++ b/src-tauri/src/commands/trainer.rs@@ -185,28 +185,36 @@ fn force_python_utf8(cmd: &mut Command) {/// cu121 wheels carry kernels up to sm_90 (Hopper). Blackwell reports/// compute capability 12.x, so every RTX 50 card needs the cu128 build./// An unreadable probe keeps the cu121 default.-fn torch_index_for_cap(cap_major: Option<u32>) -> &'static str {+///+/// One entry each: the trainer is proven on exactly these two channels and a+/// silent hop to a neighbouring one would be a change nobody measured. The+/// slice shape exists so the ROCm branch, which has three living channels,+/// can share one plan type.+const TRAINER_CU128: &[&str] = &["https://download.pytorch.org/whl/cu128"];+const TRAINER_CU121: &[&str] = &["https://download.pytorch.org/whl/cu121"];++fn torch_index_for_cap(cap_major: Option<u32>) -> &'static [&'static str] {match cap_major {- Some(major) if major >= 12 => "https://download.pytorch.org/whl/cu128",- _ => "https://download.pytorch.org/whl/cu121",+ Some(major) if major >= 12 => TRAINER_CU128,+ _ => TRAINER_CU121,}}-/// PyTorch's ROCm channel, which is what an AMD card needs instead of a CUDA-/// build. Measured against download.pytorch.org on 2026-08-19: the rocm6.2,-/// rocm6.3, rocm6.4 and rocm7.0 channels all exist and every torch wheel in-/// every one of them is `manylinux_2_28_x86_64`. There is no win_amd64 ROCm-/// wheel anywhere, which is the whole reason the Windows branch below refuses-/// instead of downloading something. rocm6.4 carries torch 2.9.1 and is the-/// older of the two living channels, so it is the smaller step from the CUDA-/// builds the trainer is proven on.-const ROCM_INDEX: &str = "https://download.pytorch.org/whl/rocm6.4";+/// PyTorch's ROCm channels, which is what an AMD card needs instead of a CUDA+/// build. The list is shared with the ComfyUI installer and is walked live at+/// install time, newest first, so a channel that gets retired costs a probe+/// instead of a broken install. Re-read on 2026-08-28: there is still no+/// win_amd64 ROCm wheel in any of them, which is the whole reason the Windows+/// branch below refuses instead of downloading something.+use crate::commands::torch_wheels::ROCM_CHANNELS;/// What the two pip steps should do about torch on THIS machine.#[derive(Debug, PartialEq, Eq)]pub(crate) enum TorchPlan {- /// Install from this wheel index, and say this while doing it.- Wheels { index: &'static str, note: String },+ /// Install from the first of these wheel indexes that answers, and say+ /// this while doing it. Never empty; the last entry is the fallback that+ /// gets used even when no probe answers.+ Wheels { candidates: &'static [&'static str], note: String },/// No wheel exists that could drive this GPU on this OS. Nothing is/// downloaded and the sentence is the whole answer.NoWheels(String),@@ -231,26 +239,25 @@ pub(crate) fn trainer_torch_plan(os: &str,) -> TorchPlan {if has_nvidia || nvidia_cap_major.is_some() || !has_amd {- let index = torch_index_for_cap(nvidia_cap_major);+ let candidates = torch_index_for_cap(nvidia_cap_major);return TorchPlan::Wheels {- index,+ candidates,note: format!(- "GPU compute capability: {}, PyTorch wheels: {index}",+ "GPU compute capability: {}, PyTorch wheels: {}",nvidia_cap_major.map_or("unknown".to_string(), |c| format!("{c}.x")),+ candidates[0],),};}if os == "linux" {return TorchPlan::Wheels {- index: ROCM_INDEX,- note: format!(- concat!(- "AMD GPU detected, PyTorch wheels: {} (the ROCm build). ",- "Honest limit: the training step runs an 8 bit optimizer that we ",- "have only ever proven on CUDA, so this environment may still stop there.",- ),- ROCM_INDEX,- ),+ candidates: ROCM_CHANNELS,+ note: concat!(+ "AMD GPU detected, installing the ROCm build of PyTorch. ",+ "Honest limit: the training step runs an 8 bit optimizer that we ",+ "have only ever proven on CUDA, so this environment may still stop there.",+ )+ .to_string(),};}TorchPlan::NoWheels(@@ -273,11 +280,7 @@ pub(crate) fn trainer_torch_plan(/// knows about. That probe already survives a missing rocm-smi, which is the/// only reason an AMD card is visible here at all.fn gpu_vendors_present() -> (bool, bool) {- let gpus = crate::commands::gpu::detect_gpus().unwrap_or_default();- (- gpus.iter().any(|g| g.vendor == "nvidia"),- gpus.iter().any(|g| g.vendor == "amd"),- )+ crate::commands::torch_wheels::gpu_vendors_present()}/// The card a training run would use, as a name for messages. None means the@@ -849,11 +852,20 @@ fn provision_trainer_env(// no GPU at all.let (has_nvidia, has_amd) = gpu_vendors_present();let cap = crate::commands::install::detect_nvidia_compute_cap_major();- let (torch_index, wheel_note) =+ let (candidates, wheel_note) =match trainer_torch_plan(has_nvidia, cap, has_amd, std::env::consts::OS) {- TorchPlan::Wheels { index, note } => (index, note),+ TorchPlan::Wheels { candidates, note } => (candidates, note),TorchPlan::NoWheels(why) => return Err(why),};+ // The channel is picked here and not inside the plan: the plan stays a+ // pure function the tests can drive, and only the real install pays for a+ // network probe.+ let torch_index = crate::commands::torch_wheels::first_live_index(+ candidates,+ crate::commands::torch_wheels::index_serves_torch,+ )+ .unwrap_or(candidates[0]);+ let wheel_note = format!("{wheel_note} (wheel index: {torch_index})");let _ = fs::create_dir_all(root.join("models"));@@ -1425,11 +1437,11 @@ mod tests {#[test]fn blackwell_routes_to_cu128_and_older_cards_keep_cu121() {use super::torch_index_for_cap;- assert_eq!(torch_index_for_cap(Some(12)), "https://download.pytorch.org/whl/cu128");- assert_eq!(torch_index_for_cap(Some(13)), "https://download.pytorch.org/whl/cu128");- assert_eq!(torch_index_for_cap(Some(9)), "https://download.pytorch.org/whl/cu121");- assert_eq!(torch_index_for_cap(Some(8)), "https://download.pytorch.org/whl/cu121");- assert_eq!(torch_index_for_cap(None), "https://download.pytorch.org/whl/cu121");+ assert_eq!(torch_index_for_cap(Some(12))[0], "https://download.pytorch.org/whl/cu128");+ assert_eq!(torch_index_for_cap(Some(13))[0], "https://download.pytorch.org/whl/cu128");+ assert_eq!(torch_index_for_cap(Some(9))[0], "https://download.pytorch.org/whl/cu121");+ assert_eq!(torch_index_for_cap(Some(8))[0], "https://download.pytorch.org/whl/cu121");+ assert_eq!(torch_index_for_cap(None)[0], "https://download.pytorch.org/whl/cu121");}#[test]@@ -1438,8 +1450,12 @@ mod tests {// numbrain and lapbo: no NVIDIA card, so the old probe answered None// and the plan was the same cu121 a machine with no GPU at all gets.match trainer_torch_plan(false, None, true, "linux") {- TorchPlan::Wheels { index, note } => {- assert_eq!(index, "https://download.pytorch.org/whl/rocm6.4");+ TorchPlan::Wheels { candidates, note } => {+ assert!(+ candidates.iter().all(|c| c.contains("/rocm")),+ "an AMD card may only be offered ROCm channels: {candidates:?}",+ );+ assert_eq!(candidates, crate::commands::torch_wheels::ROCM_CHANNELS);assert!(note.contains("AMD"), "the log line names the card: {note}");// Never sold as proven: the 8 bit optimizer is CUDA only here.assert!(note.contains("Honest limit"), "note hides the limit: {note}");@@ -1478,8 +1494,8 @@ mod tests {(true, Some(8), true),] {match trainer_torch_plan(has_nvidia, cap, has_amd, "windows") {- TorchPlan::Wheels { index, .. } => assert_eq!(- index,+ TorchPlan::Wheels { candidates, .. } => assert_eq!(+ candidates,torch_index_for_cap(cap),"nvidia={has_nvidia} cap={cap:?} amd={has_amd} moved channel",),diff --git a/src/components/create/experimental/CreateExperimental.tsx b/src/components/create/experimental/CreateExperimental.tsxindex d007a536..be3402cb 100644--- a/src/components/create/experimental/CreateExperimental.tsx+++ b/src/components/create/experimental/CreateExperimental.tsx@@ -167,10 +167,15 @@ function CreateExperimentalInner() {{/* The right AMD path differs per OS — three users followed thegeneric ZLUDA pointer on Linux, where ZLUDA guides areWindows-only dead ends (numbrain/lapbo/suraj3014, 2026-08-02).- Linux AMD wants a ROCm torch inside ComfyUI's own venv. */}+ Linux AMD wants a ROCm torch inside ComfyUI's own venv.+ Since 2.6.7 the ComfyUI installer picks the ROCm wheels itself+ on an AMD Linux box, so the fix is a reinstall and not a pip+ line the user has to type by hand. Windows has no ROCm wheel at+ all, so it gets the honest version instead of a channel that+ does not exist there. */}{isLinux()- ? ' AMD GPU? Install the ROCm build of PyTorch into ComfyUI’s venv (pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.2), then set Settings → Hardware → ComfyUI GPU to force GPU.'- : ' AMD GPU? Point LU at a ROCm/ZLUDA ComfyUI and set Settings → Hardware → ComfyUI GPU to force GPU.'}+ ? ' AMD GPU? LU installs the ROCm build of PyTorch for AMD cards now. Reinstall the ComfyUI environment from Settings → ComfyUI, then set Settings → Hardware → ComfyUI GPU to Auto.'+ : ' AMD GPU? PyTorch ships no ROCm wheels for Windows, so this card needs a DirectML or ZLUDA ComfyUI of your own. Point LU at it and set Settings → Hardware → ComfyUI GPU to force GPU.'}</span></div>)}