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.

fix(install): a Turing or newer card rides cu130, cu126 stays the fallback

David8a2ab9973847
diff --git a/src-tauri/src/commands/install.rs b/src-tauri/src/commands/install.rs
index 261242f1..dfc1b70f 100644
--- a/src-tauri/src/commands/install.rs
+++ b/src-tauri/src/commands/install.rs
@@ -91,31 +91,39 @@ fn cancel_comfyui_install_blocking(state: &AppState) -> Result<serde_json::Value
// ── GPU helpers (Bug #10 — Blackwell PyTorch cu128 routing) ─────────────────
-/// Probe NVIDIA's compute capability of the first detected GPU and return
-/// its major version (8 for Ampere, 9 for Hopper, 12 for Blackwell, …).
+/// Probe NVIDIA's compute capability and return it as (major, minor):
+/// (8, 6) for a 3060, (7, 5) for a 2080, (12, 0) for Blackwell.
///
/// `nvidia-smi --query-gpu=compute_cap` prints lines like `12.0` (one per
-/// GPU). We take the highest major across visible GPUs because pip can
-/// only install ONE PyTorch build — picking the higher capability set
-/// satisfies every card on the box (cu128 wheels still run on Ampere etc.).
-/// Returns None when nvidia-smi is absent or the parse fails; the caller
-/// falls back to the previous default index URL.
-pub(crate) fn parse_compute_cap_output(s: &str) -> Option<u32> {
- let mut max_major: Option<u32> = None;
+/// GPU). We take the highest across visible GPUs because pip can only install
+/// ONE PyTorch build, so the higher capability set is the one that satisfies
+/// every card on the box. Returns None when nvidia-smi is absent or the parse
+/// fails, and the caller then picks the channel that covers the widest range.
+///
+/// The minor number was thrown away until 2.6.7 and is now load bearing:
+/// CUDA 13 dropped everything below Turing, and Turing is 7.5 while Volta is
+/// 7.0. A major-only reading cannot tell those two apart.
+pub(crate) fn parse_compute_cap_output(s: &str) -> Option<(u32, u32)> {
+ let mut best: Option<(u32, u32)> = None;
for line in s.lines() {
let trimmed = line.trim();
if trimmed.is_empty() {
continue;
}
- let major_str = trimmed.split('.').next().unwrap_or("");
- if let Ok(major) = major_str.parse::<u32>() {
- max_major = Some(max_major.map_or(major, |prev| prev.max(major)));
- }
+ let mut parts = trimmed.split('.');
+ let major = match parts.next().unwrap_or("").parse::<u32>() {
+ Ok(m) => m,
+ Err(_) => continue,
+ };
+ // A card that prints a bare major keeps the old reading of .0 rather
+ // than being dropped: an unparseable minor must never cost us the card.
+ let minor = parts.next().unwrap_or("0").trim().parse::<u32>().unwrap_or(0);
+ best = Some(best.map_or((major, minor), |prev| prev.max((major, minor))));
}
- max_major
+ best
}
-pub(crate) fn detect_nvidia_compute_cap_major() -> Option<u32> {
+pub(crate) fn detect_nvidia_compute_cap() -> Option<(u32, u32)> {
let mut cmd = Command::new("nvidia-smi");
cmd.args(["--query-gpu=compute_cap", "--format=csv,noheader,nounits"])
.stdout(Stdio::piped())
@@ -130,6 +138,12 @@ pub(crate) fn detect_nvidia_compute_cap_major() -> Option<u32> {
parse_compute_cap_output(&s)
}
+/// The major alone, for the trainer, whose two channels (cu121 and cu128) are
+/// split at Blackwell and have never needed the minor.
+pub(crate) fn detect_nvidia_compute_cap_major() -> Option<u32> {
+ detect_nvidia_compute_cap().map(|(major, _)| major)
+}
+
use crate::commands::torch_wheels;
// ── pip helpers (issue #32: PyTorch / ComfyUI install reliability) ───────────
@@ -685,10 +699,10 @@ pub(crate) fn process_read_bytes(_pid: u32) -> Option<u64> {
/// `torch_wheels` where it is testable without any of the hardware.
pub(crate) fn plan_pytorch_install() -> (Vec<String>, String) {
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 compute_cap = if has_nvidia { detect_nvidia_compute_cap() } else { None };
let plan = torch_wheels::comfy_wheel_plan(
has_nvidia,
- compute_cap_major,
+ compute_cap,
has_amd,
std::env::consts::OS,
);
@@ -3600,12 +3614,12 @@ mod tests {
WheelPlan::Cpu { .. } => None,
};
assert_eq!(
- first(true, Some(12), false, "windows"),
- Some("https://download.pytorch.org/whl/cu128")
+ first(true, Some((12, 0)), false, "windows"),
+ Some("https://download.pytorch.org/whl/cu130")
);
assert_eq!(
- first(true, Some(8), false, "windows"),
- Some("https://download.pytorch.org/whl/cu126")
+ first(true, Some((8, 6)), false, "windows"),
+ Some("https://download.pytorch.org/whl/cu130")
);
assert_eq!(
first(true, None, false, "windows"),
@@ -3619,7 +3633,15 @@ mod tests {
// 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)] {
+ for (nv, cap) in [
+ (true, Some((6, 1))),
+ (true, Some((7, 0))),
+ (true, Some((7, 5))),
+ (true, Some((8, 6))),
+ (true, Some((9, 0))),
+ (true, Some((12, 0))),
+ (true, None),
+ ] {
if let WheelPlan::Index { candidates, .. } = comfy_wheel_plan(nv, cap, false, "linux") {
assert!(
!candidates.iter().any(|c| c.contains("cu121")),
@@ -4046,32 +4068,44 @@ mod tests {
#[test]
fn compute_cap_parses_ampere_single_gpu() {
- assert_eq!(parse_compute_cap_output("8.6\n"), Some(8));
+ assert_eq!(parse_compute_cap_output("8.6\n"), Some((8, 6)));
}
#[test]
fn compute_cap_parses_ada_single_gpu() {
- assert_eq!(parse_compute_cap_output("8.9\n"), Some(8));
+ assert_eq!(parse_compute_cap_output("8.9\n"), Some((8, 9)));
}
#[test]
fn compute_cap_parses_hopper() {
- assert_eq!(parse_compute_cap_output("9.0\n"), Some(9));
+ assert_eq!(parse_compute_cap_output("9.0\n"), Some((9, 0)));
}
#[test]
fn compute_cap_parses_blackwell() {
- assert_eq!(parse_compute_cap_output("12.0\n"), Some(12));
+ assert_eq!(parse_compute_cap_output("12.0\n"), Some((12, 0)));
}
#[test]
fn compute_cap_multi_gpu_picks_highest() {
- assert_eq!(parse_compute_cap_output("8.6\n12.0\n"), Some(12));
+ assert_eq!(parse_compute_cap_output("8.6\n12.0\n"), Some((12, 0)));
+ // Same major, so only the minor can decide which of the two cards
+ // the one PyTorch build has to satisfy.
+ assert_eq!(parse_compute_cap_output("7.0\n7.5\n"), Some((7, 5)));
+ assert_eq!(parse_compute_cap_output("7.5\n7.0\n"), Some((7, 5)));
+ }
+
+ #[test]
+ fn compute_cap_survives_a_line_without_a_minor() {
+ // Negative control for the new minor parse: a bare major must keep
+ // the card rather than drop it, and read as .0.
+ assert_eq!(parse_compute_cap_output("8\n"), Some((8, 0)));
+ assert_eq!(parse_compute_cap_output("8.x\n"), Some((8, 0)));
}
#[test]
fn compute_cap_handles_blank_lines() {
- assert_eq!(parse_compute_cap_output("\n8.6\n\n"), Some(8));
+ assert_eq!(parse_compute_cap_output("\n8.6\n\n"), Some((8, 6)));
}
#[test]
@@ -4081,7 +4115,7 @@ mod tests {
#[test]
fn compute_cap_skips_unparseable_lines() {
- assert_eq!(parse_compute_cap_output("[Not Supported]\n8.6\n"), Some(8));
+ assert_eq!(parse_compute_cap_output("[Not Supported]\n8.6\n"), Some((8, 6)));
}
// ── Bug E (rzgrozt — Arch PEP 668 externally-managed) ─────────────────
diff --git a/src-tauri/src/commands/torch_wheels.rs b/src-tauri/src/commands/torch_wheels.rs
index bd2c33d3..5ca332e1 100644
--- a/src-tauri/src/commands/torch_wheels.rs
+++ b/src-tauri/src/commands/torch_wheels.rs
@@ -36,15 +36,45 @@ pub(crate) const ROCM_CHANNELS: &[&str] = &[
/// 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/cu130",
"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).
+/// Turing (compute capability 7.5) up to Ada and Hopper.
+///
+/// ComfyUI moved its own recommendation on 2026-08-16 and its README now says
+/// a cu130 or newer PyTorch is REQUIRED on 20 series cards and above, while
+/// the cu126 portable is labelled for 10 series and older with a written
+/// warning not to use it on anything newer. NVIDIA's CUDA 13.0 release notes
+/// give the same line from the other side: support was removed for Maxwell,
+/// Pascal and Volta, meaning everything below Turing, so cu130 starts exactly
+/// at 7.5 and cu126 is what stays behind for the cards below it.
+///
+/// Index listings read on 2026-08-28: cu130 carries torch 2.9.1 through
+/// 2.13.0 for manylinux_2_28_x86_64, manylinux_2_28_aarch64 and win_amd64,
+/// with matching torchvision and torchaudio. cu128 has stopped at 2.11.0,
+/// which is why it now sits behind cu130 rather than in front of it, and
+/// cu126 still moves (2.13.0) so it remains a real fallback for this range.
+pub(crate) const CUDA_MODERN_CHANNELS: &[&str] = &[
+ "https://download.pytorch.org/whl/cu130",
+ "https://download.pytorch.org/whl/cu128",
+ "https://download.pytorch.org/whl/cu126",
+];
+
+/// Below Turing, and the machine whose capability probe stayed silent. cu126
+/// is the living channel ComfyUI documents for this silicon (torch 2.6+,
+/// sm_50 through sm_90). A silent probe means an nvidia-smi too old to answer
+/// `--query-gpu=compute_cap`, which points at an old driver on an old card,
+/// so the wide channel is the honest guess rather than the narrow new one.
pub(crate) const CUDA_LEGACY_CHANNELS: &[&str] = &[
"https://download.pytorch.org/whl/cu126",
];
+/// Where CUDA 13 begins. NVIDIA removed every architecture below Turing in
+/// CUDA 13.0, and Turing is 7.5 while Volta is 7.0, so the minor number is
+/// what decides here.
+pub(crate) const CU130_MIN_CAP: (u32, u32) = (7, 5);
+
/// What the pip step should do about torch.
#[derive(Debug, PartialEq, Eq)]
pub(crate) enum WheelPlan {
@@ -89,12 +119,12 @@ pub(crate) fn gpu_vendors_present() -> (bool, bool) {
/// MLX and `install_comfyui` refuses before it starts.
pub(crate) fn comfy_wheel_plan(
has_nvidia: bool,
- nvidia_cap_major: Option<u32>,
+ nvidia_cap: Option<(u32, u32)>,
has_amd: bool,
os: &str,
) -> WheelPlan {
- if has_nvidia || nvidia_cap_major.is_some() {
- return nvidia_plan(nvidia_cap_major);
+ if has_nvidia || nvidia_cap.is_some() {
+ return nvidia_plan(nvidia_cap);
}
if has_amd {
if os == "linux" {
@@ -114,16 +144,28 @@ pub(crate) fn comfy_wheel_plan(
}
}
-fn nvidia_plan(cap_major: Option<u32>) -> WheelPlan {
- match cap_major {
- Some(major) if major >= 12 => WheelPlan::Index {
+fn nvidia_plan(cap: Option<(u32, u32)>) -> WheelPlan {
+ match cap {
+ Some((major, minor)) if major >= 12 => WheelPlan::Index {
candidates: CUDA_BLACKWELL_CHANNELS,
- note: "NVIDIA Blackwell GPU detected (compute capability 12.x), installing CUDA PyTorch."
- .to_string(),
+ note: format!(
+ "NVIDIA Blackwell GPU detected (compute capability {major}.{minor}), \
+ installing CUDA PyTorch."
+ ),
},
- Some(_) => WheelPlan::Index {
+ Some(cap) if cap >= CU130_MIN_CAP => WheelPlan::Index {
+ candidates: CUDA_MODERN_CHANNELS,
+ note: format!(
+ "NVIDIA GPU detected (compute capability {}.{}), installing CUDA PyTorch.",
+ cap.0, cap.1,
+ ),
+ },
+ Some((major, minor)) => WheelPlan::Index {
candidates: CUDA_LEGACY_CHANNELS,
- note: "NVIDIA GPU detected, installing CUDA PyTorch.".to_string(),
+ note: format!(
+ "NVIDIA GPU detected (compute capability {major}.{minor}, below Turing), \
+ installing the CUDA PyTorch that still carries kernels for it."
+ ),
},
None => WheelPlan::Index {
candidates: CUDA_LEGACY_CHANNELS,
@@ -244,7 +286,7 @@ mod tests {
#[test]
fn an_nvidia_card_still_wins_over_an_amd_card_in_the_same_box() {
- match comfy_wheel_plan(true, Some(8), true, "linux") {
+ match comfy_wheel_plan(true, Some((8, 6)), true, "linux") {
WheelPlan::Index { candidates, .. } => {
assert!(candidates.iter().all(|c| c.contains("/cu")), "{candidates:?}");
}
@@ -264,7 +306,7 @@ mod tests {
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") {
+ match comfy_wheel_plan(true, Some((12, 0)), false, "windows") {
WheelPlan::Index { candidates, .. } => {
assert!(!candidates.iter().any(|c| c.ends_with("cu126")), "{candidates:?}");
}
@@ -283,6 +325,72 @@ mod tests {
assert_eq!(first_live_index(&[], |_| true), None);
}
+ /// The channel a plan would try first.
+ fn first_channel(cap: Option<(u32, u32)>) -> &'static str {
+ match comfy_wheel_plan(true, cap, false, "windows") {
+ WheelPlan::Index { candidates, .. } => candidates[0],
+ other => panic!("an NVIDIA card must get wheels, got {other:?}"),
+ }
+ }
+
+ #[test]
+ fn turing_and_newer_ride_cu130_and_older_cards_stay_on_cu126() {
+ // ComfyUI 2026-08-16: cu130 or newer is required on 20 series and up.
+ // NVIDIA CUDA 13.0: everything below Turing was removed. Turing is
+ // 7.5, Volta is 7.0, so the line runs between those two.
+ assert!(first_channel(Some((7, 5))).ends_with("cu130"), "Turing");
+ assert!(first_channel(Some((8, 6))).ends_with("cu130"), "Ampere, the 3060 in the box");
+ assert!(first_channel(Some((8, 9))).ends_with("cu130"), "Ada");
+ assert!(first_channel(Some((9, 0))).ends_with("cu130"), "Hopper");
+ assert!(first_channel(Some((12, 0))).ends_with("cu130"), "Blackwell");
+ assert!(first_channel(Some((7, 0))).ends_with("cu126"), "Volta");
+ assert!(first_channel(Some((6, 1))).ends_with("cu126"), "Pascal, a 1080");
+ assert!(first_channel(Some((5, 2))).ends_with("cu126"), "Maxwell");
+ }
+
+ #[test]
+ fn a_card_cuda_13_dropped_is_never_offered_cu130_at_all() {
+ // Negative control, and the reason the minor number is read: a card
+ // below Turing must not reach cu130 even as a fallback further down
+ // the list, because CUDA 13 ships no kernel for it.
+ for cap in [(5, 2), (6, 1), (7, 0)] {
+ match comfy_wheel_plan(true, Some(cap), false, "linux") {
+ WheelPlan::Index { candidates, .. } => assert!(
+ !candidates.iter().any(|c| c.ends_with("cu130")),
+ "cap {cap:?} was offered cu130: {candidates:?}",
+ ),
+ other => panic!("expected wheels, got {other:?}"),
+ }
+ }
+ }
+
+ #[test]
+ fn a_silent_capability_probe_keeps_the_wide_channel() {
+ // An nvidia-smi too old to answer --query-gpu=compute_cap points at an
+ // old driver on an old card, so the guess that covers the most cards
+ // wins over the newest channel.
+ assert!(first_channel(None).ends_with("cu126"));
+ match comfy_wheel_plan(true, None, false, "linux") {
+ WheelPlan::Index { candidates, .. } => {
+ assert!(!candidates.iter().any(|c| c.ends_with("cu130")), "{candidates:?}");
+ }
+ other => panic!("expected wheels, got {other:?}"),
+ }
+ }
+
+ #[test]
+ fn cu126_stays_reachable_as_a_fallback_for_the_cards_it_can_still_drive() {
+ // The switch may not turn into a hard wire: a Turing to Hopper card
+ // that cannot reach cu130 has to land somewhere that works.
+ match comfy_wheel_plan(true, Some((8, 6)), false, "linux") {
+ WheelPlan::Index { candidates, .. } => {
+ assert_eq!(candidates.last().copied(), Some("https://download.pytorch.org/whl/cu126"));
+ assert!(candidates.len() > 1, "a single entry is a hard wire: {candidates:?}");
+ }
+ other => panic!("expected wheels, got {other:?}"),
+ }
+ }
+
#[test]
fn a_processor_plan_never_resolves_to_an_index() {
let plan = WheelPlan::Cpu { note: "x".to_string() };