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.

feat(install): Windows plus AMD bekommt AMDs eigenen ROCm-Radkanal

purple6d5dc61e6528
diff --git a/src-tauri/src/commands/install.rs b/src-tauri/src/commands/install.rs
index dfc1b70f..672e66d5 100644
--- a/src-tauri/src/commands/install.rs
+++ b/src-tauri/src/commands/install.rs
@@ -588,16 +588,15 @@ pub fn pip_install_streaming_with_retry_cancellable(
/// Pure: the pip argument set for the PyTorch install, for a given wheel
/// index. Split from the probe so the arg shapes are testable without
/// nvidia-smi on the machine.
-pub(crate) fn pytorch_pip_args(index_url: Option<&str>) -> Vec<String> {
- let mut args: Vec<String> = [
- "-m", "pip", "install",
- "--progress-bar", "off",
- "--no-input",
- "torch", "torchvision", "torchaudio",
- ]
- .iter()
- .map(|s| s.to_string())
- .collect();
+pub(crate) fn pytorch_pip_args(index_url: Option<&str>, packages: &[&str]) -> Vec<String> {
+ let mut args: Vec<String> = ["-m", "pip", "install", "--progress-bar", "off", "--no-input"]
+ .iter()
+ .map(|s| s.to_string())
+ .collect();
+ // The package names come from the plan: AMD's Windows index serves a slim
+ // torch plus a device package behind an extra, so "torch" alone would build
+ // an environment with no kernels for any card.
+ args.extend(packages.iter().map(|s| s.to_string()));
if let Some(u) = index_url {
args.push("--index-url".to_string());
args.push(u.to_string());
@@ -698,21 +697,26 @@ pub(crate) fn process_read_bytes(_pid: u32) -> Option<u64> {
/// 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 (has_nvidia, has_amd) = torch_wheels::gpu_vendors_present();
+ let (has_nvidia, has_amd, amd_names) = torch_wheels::gpu_vendor_facts();
let compute_cap = if has_nvidia { detect_nvidia_compute_cap() } else { None };
+ let amd_refs: Vec<&str> = amd_names.iter().map(|s| s.as_str()).collect();
let plan = torch_wheels::comfy_wheel_plan(
has_nvidia,
compute_cap,
has_amd,
+ &amd_refs,
std::env::consts::OS,
);
- let note = plan.note().to_string();
- let index = torch_wheels::resolve_plan_index(&plan);
+ // The note is resolved WITH the index: a plan that reached for AMD's
+ // Windows channel and found it dead falls back to the processor wheels,
+ // and then the sentence in "Step 2/3" has to be the fallback's, not the
+ // one the plan set out with.
+ let (index, packages, note) = torch_wheels::resolve_plan(&plan);
let gpu_info = match index {
Some(url) => format!("{note} ({url})"),
None => note,
};
- (pytorch_pip_args(index), gpu_info)
+ (pytorch_pip_args(index, packages), gpu_info)
}
#[tauri::command]
@@ -3609,8 +3613,9 @@ 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) {
+ let first = |nv, cap, amd, os| match comfy_wheel_plan(nv, cap, amd, &[], os) {
WheelPlan::Index { candidates, .. } => Some(candidates[0]),
+ WheelPlan::IndexOrCpu { candidates, .. } => Some(candidates[0]),
WheelPlan::Cpu { .. } => None,
};
assert_eq!(
@@ -3642,7 +3647,7 @@ mod tests {
(true, Some((12, 0))),
(true, None),
] {
- if let WheelPlan::Index { candidates, .. } = comfy_wheel_plan(nv, cap, false, "linux") {
+ 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 {:?}",
@@ -3697,7 +3702,8 @@ mod tests {
#[test]
fn pytorch_args_carry_the_wheel_index_when_given() {
- let args = pytorch_pip_args(Some("https://download.pytorch.org/whl/cu128"));
+ use crate::commands::torch_wheels::TORCH_TRIO;
+ let args = pytorch_pip_args(Some("https://download.pytorch.org/whl/cu128"), TORCH_TRIO);
assert_eq!(args.first().map(String::as_str), Some("-m"));
assert!(args.contains(&"torch".to_string()));
assert!(args.contains(&"torchvision".to_string()));
@@ -3709,11 +3715,26 @@ mod tests {
#[test]
fn pytorch_args_without_index_stay_on_pypi() {
- let args = pytorch_pip_args(None);
+ use crate::commands::torch_wheels::TORCH_TRIO;
+ let args = pytorch_pip_args(None, TORCH_TRIO);
assert!(!args.iter().any(|a| a == "--index-url"));
assert!(args.contains(&"torch".to_string()));
}
+ #[test]
+ fn pytorch_args_pass_a_channels_own_package_names_through_untouched() {
+ // AMD's Windows index serves torch behind a device extra. pip has to
+ // see "torch[device-all]" verbatim; a bare "torch" from that index is
+ // an environment with no kernels for any card.
+ use crate::commands::torch_wheels::{TORCH_TRIO, TORCH_TRIO_AMD_WINDOWS};
+ let args = pytorch_pip_args(Some("https://repo.amd.com/rocm/whl-multi-arch/"), TORCH_TRIO_AMD_WINDOWS);
+ assert!(args.contains(&"torch[device-all]".to_string()), "{args:?}");
+ assert!(args.contains(&"torchvision".to_string()));
+ // NEGATIVE CONTROL: the extra is never bolted onto the normal channels.
+ let plain = pytorch_pip_args(Some("https://download.pytorch.org/whl/cu130"), TORCH_TRIO);
+ assert!(!plain.iter().any(|a| a.contains('[')), "{plain:?}");
+ }
+
// ── install_custom_node helpers (#72 bob: VHS install loop) ─────────
#[test]
diff --git a/src-tauri/src/commands/process.rs b/src-tauri/src/commands/process.rs
index b40a4cff..ffb2c065 100644
--- a/src-tauri/src/commands/process.rs
+++ b/src-tauri/src/commands/process.rs
@@ -350,7 +350,15 @@ pub(crate) fn force_gpu_warning(
"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."
+ // Since Runde 12 LU does install AMD's own Windows ROCm wheels for
+ // the RDNA 3, 3.5 and 4 cards AMD supports, so the old absolute
+ // "PyTorch ships no ROCm wheels for Windows" is no longer true.
+ // What IS true whenever this branch fires is that the environment
+ // ended up with processor wheels anyway, either because the card is
+ // outside that list or because the index did not answer. Still no
+ // reinstall advice: on the cards that reach this message a rebuild
+ // lands in the same place.
+ "Your card is AMD, and this ComfyUI environment holds processor wheels: pytorch.org publishes no Windows ROCm wheels, and AMD's own Windows ROCm index either does not cover this card or did not answer when the environment was built. Use a ComfyUI of your own on ZLUDA or DirectML, 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."
diff --git a/src-tauri/src/commands/torch_wheels.rs b/src-tauri/src/commands/torch_wheels.rs
index 5ca332e1..30606c7e 100644
--- a/src-tauri/src/commands/torch_wheels.rs
+++ b/src-tauri/src/commands/torch_wheels.rs
@@ -32,6 +32,33 @@ pub(crate) const ROCM_CHANNELS: &[&str] = &[
"https://download.pytorch.org/whl/rocm6.4",
];
+/// AMD's own ROCm wheels for Windows. RESEARCHED, NOT PROVEN.
+///
+/// pytorch.org really does publish Linux ROCm wheels only, and the comment
+/// above still holds for it. What changed is the conclusion drawn from that:
+/// AMD publishes win_amd64 ROCm wheels from its own indexes, and this is the
+/// one ComfyUI Desktop ships against, which is the closest thing to a field
+/// proof this path has. Read 2026-08-30: it serves win_amd64 torch up to
+/// 2.13.0+rocm7.14.0 and is described in Comfy-Desktop's own
+/// `torch-index-stacks.md` as the only mechanism serving Windows ROCm wheels.
+///
+/// We own no AMD card. Nobody here has watched this install finish, let alone
+/// render. That is why the plan built from it falls back to the processor
+/// wheels when the index does not answer, instead of doing what the pytorch.org
+/// ladders do and using the last entry regardless.
+pub(crate) const ROCM_WINDOWS_CHANNELS: &[&str] = &["https://repo.amd.com/rocm/whl-multi-arch/"];
+
+/// What pip installs when the index is a plain PyTorch channel.
+pub(crate) const TORCH_TRIO: &[&str] = &["torch", "torchvision", "torchaudio"];
+
+/// AMD's multi-arch index serves a slim `torch` plus one device package per
+/// gfx target, selected through an extra. Installing bare `torch` from it would
+/// produce an environment with no kernels for any card, so the extra is not
+/// optional here. `device-all` is what AMD documents and what Comfy-Desktop
+/// pins. RESEARCHED, NOT PROVEN, like the channel itself.
+pub(crate) const TORCH_TRIO_AMD_WINDOWS: &[&str] =
+ &["torch[device-all]", "torchvision", "torchaudio"];
+
/// 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.
@@ -86,6 +113,21 @@ pub(crate) enum WheelPlan {
candidates: &'static [&'static str],
note: String,
},
+ /// Try these indexes, and install the PROCESSOR wheels if none answers.
+ ///
+ /// The difference from `Index` is the dead-network case, and it is
+ /// deliberate: this variant exists for a channel nobody here has ever run,
+ /// so an unreachable channel falls back to what the app did before rather
+ /// than to a guess.
+ IndexOrCpu {
+ candidates: &'static [&'static str],
+ /// What pip installs from that index. Not every channel serves the
+ /// same package names, so the plan carries them.
+ packages: &'static [&'static str],
+ note: String,
+ /// The sentence the fallback shows when no candidate answered.
+ cpu_note: String,
+ },
/// Install the plain PyPI wheels, which run on the processor. No index.
Cpu { note: String },
}
@@ -95,20 +137,135 @@ impl WheelPlan {
pub(crate) fn note(&self) -> &str {
match self {
WheelPlan::Index { note, .. } => note,
+ WheelPlan::IndexOrCpu { note, .. } => note,
WheelPlan::Cpu { note } => note,
}
}
}
+/// What is known about an AMD card LU can only see by the name the OS gives it.
+///
+/// Nothing here is a guess about silicon: the gfx targets behind these ranges
+/// were read out of the published wheels on 2026-08-30 (the code object list in
+/// libtorch, which is what `torch.cuda.get_arch_list()` reports) and matched
+/// against AMD's own compatibility matrix.
+#[derive(Debug, PartialEq, Eq, Clone, Copy)]
+pub(crate) enum AmdCoverage {
+ /// The wheels carry this family's gfx target and AMD supports it here.
+ Supported,
+ /// Wheels for this family exist on this OS, but AMD makes no support
+ /// promise for it, so LU will not send the user down that road.
+ NotPromised,
+ /// No official wheel carries this family's gfx target at all. The install
+ /// SUCCEEDS and the first kernel then dies.
+ NoKernels,
+ /// The name says AMD and nothing more. An APU that reports itself as
+ /// "AMD Radeon(TM) Graphics" lands here, and so does a workstation card.
+ Unknown,
+}
+
+/// The Radeon RX model number out of an adapter name, if it carries one.
+///
+/// Every probe spells it differently. wmic and the registry give
+/// "AMD Radeon RX 6700 XT", lspci gives
+/// "Advanced Micro Devices, Inc. [AMD/ATI] Navi 22 [Radeon RX 6700 XT]", and
+/// rocm-smi gives the product name. All three contain "RX <four digits>", so
+/// that is what is read, and nothing else is inferred.
+fn radeon_rx_model(name: &str) -> Option<u32> {
+ let lower = name.to_lowercase();
+ let bytes = lower.as_bytes();
+ let mut from = 0usize;
+ while let Some(rel) = lower[from..].find("rx") {
+ let at = from + rel;
+ // "rx" has to be a word of its own, or "Firepro Sx" style names and
+ // any word ending in rx would start matching digits after them.
+ let before_ok = at == 0 || !bytes[at - 1].is_ascii_alphanumeric();
+ if before_ok {
+ let digits: String = lower[at + 2..]
+ .trim_start()
+ .chars()
+ .take_while(|c| c.is_ascii_digit())
+ .collect();
+ if digits.len() == 4 {
+ if let Ok(n) = digits.parse::<u32>() {
+ return Some(n);
+ }
+ }
+ }
+ from = at + 2;
+ }
+ None
+}
+
+/// What one AMD card can expect from the wheels this OS has.
+///
+/// Measured wheel contents, 2026-08-30. Linux, torch 2.10 and up: gfx1030,
+/// 1100, 1101, 1102, 1200, 1201, 950, 1150, 1151 are in, and gfx1010, 1012,
+/// 1031, 1032, 1033 to 1036 and 90c are in NO official wheel. Windows: AMD's
+/// support promise covers RDNA 3, 3.5 and 4 and stops there. RDNA 2 wheels are
+/// built for Windows but with hipBLASLt, composable_kernel and rocWMMA
+/// excluded from every gfx103X target, and AMD promises nothing for them.
+pub(crate) fn amd_coverage(name: &str, os: &str) -> AmdCoverage {
+ let Some(model) = radeon_rx_model(name) else {
+ return AmdCoverage::Unknown;
+ };
+ match (os, model) {
+ // RDNA1. In no wheel on either OS.
+ (_, 5000..=5999) => AmdCoverage::NoKernels,
+ // RX 6400 to 6750 are gfx1031/1032/1034, in no official wheel anywhere.
+ (_, 6000..=6799) => AmdCoverage::NoKernels,
+ // RX 6800 and up are gfx1030: in the Linux wheels and sound over the
+ // rocBLAS path, but outside AMD's Windows promise.
+ ("linux", 6800..=6999) => AmdCoverage::Supported,
+ (_, 6800..=6999) => AmdCoverage::NotPromised,
+ // RDNA3 (gfx1100/1101/1102) and RDNA4 (gfx1200/1201).
+ (_, 7000..=7999) | (_, 9000..=9999) => AmdCoverage::Supported,
+ _ => AmdCoverage::Unknown,
+ }
+}
+
+/// The verdict for a whole machine. The best card wins, for the same reason
+/// NVIDIA wins over AMD: the plan has to serve the card the user renders on.
+/// A card we cannot place never overrides one we can.
+pub(crate) fn amd_fleet_coverage(names: &[&str], os: &str) -> AmdCoverage {
+ let mut verdict = AmdCoverage::Unknown;
+ for name in names {
+ match amd_coverage(name, os) {
+ AmdCoverage::Supported => return AmdCoverage::Supported,
+ AmdCoverage::NoKernels => verdict = AmdCoverage::NoKernels,
+ AmdCoverage::NotPromised if verdict != AmdCoverage::NoKernels => {
+ verdict = AmdCoverage::NotPromised
+ }
+ _ => {}
+ }
+ }
+ verdict
+}
+
/// 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 (nvidia, amd, _) = gpu_vendor_facts();
+ (nvidia, amd)
+}
+
+/// The same probe, plus the names of the AMD cards it found. The names are what
+/// `amd_coverage` reads, and they are the only thing we have: no probe here
+/// reports a gfx target, and rocm-smi, which could, is exactly the tool the
+/// affected machines do not have installed.
+pub(crate) fn gpu_vendor_facts() -> (bool, bool, Vec<String>) {
let gpus = crate::commands::gpu::detect_gpus().unwrap_or_default();
+ let amd_names: Vec<String> = gpus
+ .iter()
+ .filter(|g| g.vendor == "amd")
+ .map(|g| g.name.clone())
+ .collect();
(
gpus.iter().any(|g| g.vendor == "nvidia"),
- gpus.iter().any(|g| g.vendor == "amd"),
+ !amd_names.is_empty(),
+ amd_names,
)
}
@@ -121,12 +278,14 @@ pub(crate) fn comfy_wheel_plan(
has_nvidia: bool,
nvidia_cap: Option<(u32, u32)>,
has_amd: bool,
+ amd_names: &[&str],
os: &str,
) -> WheelPlan {
if has_nvidia || nvidia_cap.is_some() {
return nvidia_plan(nvidia_cap);
}
if has_amd {
+ let coverage = amd_fleet_coverage(amd_names, os);
if os == "linux" {
return WheelPlan::Index {
candidates: ROCM_CHANNELS,
@@ -135,6 +294,22 @@ pub(crate) fn comfy_wheel_plan(
.to_string(),
};
}
+ if os == "windows" && coverage == AmdCoverage::Supported {
+ return WheelPlan::IndexOrCpu {
+ candidates: ROCM_WINDOWS_CHANNELS,
+ packages: TORCH_TRIO_AMD_WINDOWS,
+ note: "AMD GPU detected. Installing AMD's own ROCm build of PyTorch for \
+ Windows, from the index ComfyUI Desktop installs from. Researched, \
+ not proven: LU owns no AMD card, so this path has never run on our \
+ hardware. If the index does not answer, the processor build is \
+ installed instead and this stays exactly as slow as it was before."
+ .to_string(),
+ cpu_note: format!(
+ "AMD's Windows ROCm index did not answer. {}",
+ amd_without_rocm_note(os),
+ ),
+ };
+ }
return WheelPlan::Cpu {
note: amd_without_rocm_note(os),
};
@@ -181,17 +356,27 @@ fn nvidia_plan(cap: Option<(u32, u32)>) -> WheelPlan {
/// 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 \
+ let head = "AMD GPU detected, but pytorch.org publishes 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" {
+ // The old version of this sentence said PyTorch has no Windows ROCm
+ // wheels at all, full stop, and sent the reader to DirectML first. Both
+ // halves were wrong by 2026-08-30: AMD publishes its own Windows ROCm
+ // wheels, LU installs them for the cards AMD supports, and torch-directml
+ // has not seen a release since 2024-09-15, pins torch 2.4.1 and is in
+ // Microsoft's declared maintenance mode. A customer who reads ComfyUI's
+ // README finds the AMD channel in a minute, so claiming it does not
+ // exist costs us the whole answer.
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."
+ "{head} AMD publishes its own Windows ROCm wheels, and LU installs those for \
+ the RDNA 3, 3.5 and 4 cards AMD supports there, but not for this card. \
+ To drive it anyway you need a ComfyUI of your own on ZLUDA or DirectML, \
+ 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, and DirectML has been frozen on \
+ an old PyTorch since 2024."
)
} else {
format!("{head} Linux with ROCm is the supported way to use this card for image and video.")
@@ -239,12 +424,36 @@ pub(crate) fn index_serves_torch(index: &str) -> bool {
.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> {
+/// The first candidate that answers, and nothing if none does.
+///
+/// The strict twin of `first_live_index`, for a channel that has never been
+/// proven here: handing out an unreachable index would leave the user with a
+/// failed install where the old behaviour gave a working, slow one.
+pub(crate) fn first_live_index_strict<'a>(
+ candidates: &[&'a str],
+ mut alive: impl FnMut(&str) -> bool,
+) -> Option<&'a str> {
+ candidates.iter().copied().find(|c| alive(c))
+}
+
+/// Resolve a plan into (index, packages, note). A `None` index means the plain
+/// PyPI wheels, which is what `pytorch_pip_args(None, ..)` installs. The note
+/// comes back with it because a plan that falls back to the processor has a
+/// different sentence to show than the one it started with.
+pub(crate) fn resolve_plan(plan: &WheelPlan) -> (Option<&'static str>, &'static [&'static str], String) {
match plan {
- WheelPlan::Cpu { .. } => None,
- WheelPlan::Index { candidates, .. } => first_live_index(candidates, index_serves_torch),
+ WheelPlan::Cpu { note } => (None, TORCH_TRIO, note.clone()),
+ WheelPlan::Index { candidates, note } => (
+ first_live_index(candidates, index_serves_torch),
+ TORCH_TRIO,
+ note.clone(),
+ ),
+ WheelPlan::IndexOrCpu { candidates, packages, note, cpu_note } => {
+ match first_live_index_strict(candidates, index_serves_torch) {
+ Some(url) => (Some(url), packages, note.clone()),
+ None => (None, TORCH_TRIO, cpu_note.clone()),
+ }
+ }
}
}
@@ -254,7 +463,7 @@ mod tests {
#[test]
fn an_amd_linux_box_gets_rocm_wheels_not_processor_wheels() {
- match comfy_wheel_plan(false, None, true, "linux") {
+ 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");
@@ -269,7 +478,7 @@ mod tests {
// 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) {
+ match comfy_wheel_plan(false, None, true, &[], os) {
WheelPlan::Cpu { note } => {
assert!(
!note.contains("installing CUDA PyTorch"),
@@ -286,7 +495,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, 6)), true, "linux") {
+ match comfy_wheel_plan(true, Some((8, 6)), true, &[], "linux") {
WheelPlan::Index { candidates, .. } => {
assert!(candidates.iter().all(|c| c.contains("/cu")), "{candidates:?}");
}
@@ -296,7 +505,7 @@ mod tests {
#[test]
fn a_box_with_no_card_at_all_keeps_the_processor_build() {
- match comfy_wheel_plan(false, None, false, "linux") {
+ match comfy_wheel_plan(false, None, false, &[], "linux") {
WheelPlan::Cpu { note } => assert!(note.contains("No GPU")),
other => panic!("expected processor wheels, got {other:?}"),
}
@@ -306,7 +515,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, 0)), 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:?}");
}
@@ -327,7 +536,7 @@ mod tests {
/// The channel a plan would try first.
fn first_channel(cap: Option<(u32, u32)>) -> &'static str {
- match comfy_wheel_plan(true, cap, false, "windows") {
+ match comfy_wheel_plan(true, cap, false, &[], "windows") {
WheelPlan::Index { candidates, .. } => candidates[0],
other => panic!("an NVIDIA card must get wheels, got {other:?}"),
}
@@ -354,7 +563,7 @@ mod tests {
// 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") {
+ 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:?}",
@@ -370,7 +579,7 @@ mod tests {
// 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") {
+ match comfy_wheel_plan(true, None, false, &[], "linux") {
WheelPlan::Index { candidates, .. } => {
assert!(!candidates.iter().any(|c| c.ends_with("cu130")), "{candidates:?}");
}
@@ -382,7 +591,7 @@ mod tests {
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") {
+ 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:?}");
@@ -391,9 +600,156 @@ mod tests {
}
}
+ // ── Windows plus AMD, Runde 12 ────────────────────────────────────────
+ //
+ // "PyTorch ships ROCm wheels for Linux only" was true about pytorch.org and
+ // false about the world. AMD publishes win_amd64 ROCm wheels from its own
+ // indexes, ComfyUI documents them in its README, and ComfyUI Desktop
+ // installs them. LU was the only one of the five products compared on
+ // 2026-08-30 with no GPU path at all for Windows AMD.
+ //
+ // RESEARCHED, NOT PROVEN throughout: we own no AMD card.
+
+ const RX_7900: &str = "AMD Radeon RX 7900 XTX";
+ const RX_9070: &str = "Advanced Micro Devices, Inc. [AMD/ATI] Navi 48 [Radeon RX 9070 XT]";
+ const RX_6700: &str = "AMD Radeon RX 6700 XT";
+ const RX_6800: &str = "AMD Radeon RX 6800 XT";
+ const RX_5700: &str = "AMD Radeon RX 5700 XT";
+ const APU: &str = "AMD Radeon(TM) Graphics";
+
+ #[test]
+ fn a_supported_amd_card_on_windows_gets_amds_own_wheels_not_processor_wheels() {
+ for name in [RX_7900, RX_9070] {
+ match comfy_wheel_plan(false, None, true, &[name], "windows") {
+ WheelPlan::IndexOrCpu { candidates, packages, note, cpu_note } => {
+ assert_eq!(candidates, ROCM_WINDOWS_CHANNELS);
+ assert!(candidates[0].contains("repo.amd.com"), "{candidates:?}");
+ // The device extra is not optional on this index.
+ assert!(packages.iter().any(|p| p.contains("[device-")), "{packages:?}");
+ // Honesty is part of the message, not just the comment.
+ assert!(note.to_lowercase().contains("researched, not proven"), "{note}");
+ assert!(cpu_note.contains("did not answer"), "{cpu_note}");
+ }
+ other => panic!("{name} must get AMD's Windows wheels, got {other:?}"),
+ }
+ }
+ }
+
+ #[test]
+ fn an_unreachable_amd_channel_falls_back_to_exactly_what_the_app_did_before() {
+ // NEGATIVE CONTROL for the whole feature: this path has never run on
+ // real hardware, so a dead index may not leave the user worse off than
+ // 2.6.6 did. No index, the processor wheels, and the fallback sentence.
+ let plan = comfy_wheel_plan(false, None, true, &[RX_7900], "windows");
+ let WheelPlan::IndexOrCpu { candidates, cpu_note, .. } = &plan else {
+ panic!("expected the AMD Windows plan, got {plan:?}");
+ };
+ assert_eq!(first_live_index_strict(candidates, |_| false), None);
+ assert_eq!(first_live_index_strict(candidates, |_| true), Some(candidates[0]));
+ assert!(cpu_note.contains("processor build"), "{cpu_note}");
+ // and the ladder variant would have done the opposite, which is why
+ // this plan is a different variant and not a longer candidate list
+ assert_eq!(first_live_index(candidates, |_| false), Some(candidates[0]));
+ }
+
+ #[test]
+ fn a_card_amd_does_not_support_on_windows_keeps_the_processor_wheels() {
+ // RDNA1 and the RX 6400 to 6750 range are in no official wheel at all,
+ // and RDNA2 above them is built for Windows but with hipBLASLt,
+ // composable_kernel and rocWMMA stripped out and no promise attached.
+ // Sending any of them to the AMD index would be a guess with a 3 GB
+ // download and a broken environment at the end.
+ for name in [RX_6700, RX_6800, RX_5700, APU] {
+ match comfy_wheel_plan(false, None, true, &[name], "windows") {
+ WheelPlan::Cpu { note } => {
+ assert!(note.contains("AMD"), "{name}: never named the card");
+ assert!(!note.contains("installing CUDA"), "{name}: {note}");
+ }
+ other => panic!("{name} has no supported Windows wheel, got {other:?}"),
+ }
+ }
+ // A machine with both still gets the channel, for the card that can use it.
+ assert!(matches!(
+ comfy_wheel_plan(false, None, true, &[RX_6700, RX_7900], "windows"),
+ WheelPlan::IndexOrCpu { .. },
+ ));
+ }
+
+ #[test]
+ fn the_card_name_is_read_and_never_guessed() {
+ // The three probes spell the same card three ways, and all three have
+ // to land on the same verdict or the plan depends on which tool ran.
+ assert_eq!(radeon_rx_model("AMD Radeon RX 7900 XTX"), Some(7900));
+ assert_eq!(radeon_rx_model(RX_9070), Some(9070));
+ assert_eq!(radeon_rx_model("Radeon RX 6600"), Some(6600));
+ // NEGATIVE CONTROL: nothing is invented out of a name without a model.
+ assert_eq!(radeon_rx_model(APU), None);
+ assert_eq!(radeon_rx_model("AMD Radeon Pro W7900"), None);
+ assert_eq!(radeon_rx_model("Intel(R) UHD Graphics 770"), None);
+ assert_eq!(amd_coverage(APU, "windows"), AmdCoverage::Unknown);
+ // and a name whose "rx" is part of another word must not match
+ assert_eq!(radeon_rx_model("Matrox G7900"), None);
+ }
+
+ #[test]
+ fn the_windows_text_no_longer_claims_a_wheel_that_exists_does_not() {
+ // The old sentence said PyTorch has no Windows ROCm wheels, period, and
+ // led with DirectML. A customer who reads ComfyUI's README finds the
+ // AMD channel in a minute, and then the whole answer is worthless.
+ let note = amd_without_rocm_note("windows");
+ assert!(note.contains("pytorch.org publishes ROCm wheels for Linux only"), "{note}");
+ assert!(note.contains("AMD publishes its own Windows ROCm wheels"), "{note}");
+ // DirectML may still be named as a last resort, but not before ZLUDA
+ // and not without saying it has been frozen.
+ assert!(note.contains("DirectML"));
+ assert!(note.find("ZLUDA") < note.find("DirectML"), "{note}");
+ assert!(note.contains("frozen"), "{note}");
+ assert!(!amd_without_rocm_note("linux").contains("DirectML"));
+ }
+
+ #[test]
+ fn nvidia_and_linux_are_untouched_by_the_windows_amd_channel() {
+ // The point of the whole change is that it adds a branch. Nothing that
+ // worked before may route through AMD's index or through its extras.
+ for (nv, cap, amd, names, os) in [
+ (true, Some((8, 6)), false, &[][..], "windows"),
+ (true, Some((12, 0)), false, &[][..], "windows"),
+ (true, None, false, &[][..], "linux"),
+ (true, Some((8, 6)), true, &[RX_7900][..], "windows"),
+ (false, None, true, &[RX_7900][..], "linux"),
+ (false, None, true, &[RX_6700][..], "linux"),
+ ] {
+ let plan = comfy_wheel_plan(nv, cap, amd, names, os);
+ assert!(
+ !matches!(plan, WheelPlan::IndexOrCpu { .. }),
+ "{os} {names:?} nvidia={nv} must not reach the AMD Windows plan: {plan:?}",
+ );
+ let (index, packages, _) = match &plan {
+ WheelPlan::Index { candidates, note } => {
+ (first_live_index(candidates, |_| true), TORCH_TRIO, note)
+ }
+ WheelPlan::Cpu { note } => (None, TORCH_TRIO, note),
+ other => panic!("{other:?}"),
+ };
+ assert!(
+ index.is_none_or(|u| u.contains("download.pytorch.org")),
+ "{os} {names:?} left pytorch.org: {index:?}",
+ );
+ assert_eq!(packages, TORCH_TRIO, "{os} {names:?} got a foreign package list");
+ }
+ // and a no-GPU box is still a no-GPU box
+ assert!(matches!(
+ comfy_wheel_plan(false, None, false, &[], "windows"),
+ WheelPlan::Cpu { .. },
+ ));
+ }
+
#[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);
+ let (index, packages, note) = resolve_plan(&plan);
+ assert_eq!(index, None);
+ assert_eq!(packages, TORCH_TRIO);
+ assert_eq!(note, "x");
}
}