Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: match audio.cpp CUDA runtime to bundle architecture (#15491)

Daniel Han1ced9390afab
diff --git a/studio/backend/tests/test_audio_cpp_update.py b/studio/backend/tests/test_audio_cpp_update.py
index b5494a51ee8..478c1a10a68 100644
--- a/studio/backend/tests/test_audio_cpp_update.py
+++ b/studio/backend/tests/test_audio_cpp_update.py
@@ -161,6 +161,30 @@ def test_the_size_adds_the_cuda_runtime_zip(managed, monkeypatch):
assert plan["status"]["update_size_bytes"] == 400_000_000 and plan["update_available"] is True
[email protected]("arch", ["arm64", "x64"])
[email protected]("reverse", [False, True])
+def test_update_size_uses_the_matching_architecture_runtime_in_a_mixed_release(
+ managed, monkeypatch, arch, reverse
+):
+ monkeypatch.setattr(aupd.platform, "system", lambda: "Windows")
+ monkeypatch.setattr(aupd.platform, "machine", lambda: arch)
+ monkeypatch.setattr(aupd._installer(), "torch_provides_cuda_runtime", lambda _major: False)
+ _write_record(
+ managed.tree,
+ asset = f"audio-v0.9.0-unsloth.1-bin-windows-{arch}-cuda13.zip",
+ accelerator = "cuda",
+ accelerator_request = "cuda",
+ )
+ assets = [
+ (f"audio-{_LATEST}-bin-windows-{arch}-cuda13.zip", 100_000_000),
+ (f"audio-{_LATEST}-cudart-windows-x64-cuda13.zip", 300_000_000),
+ (f"audio-{_LATEST}-cudart-windows-arm64-cuda13.zip", 200_000_000),
+ ]
+ managed.state.assets = dict(reversed(assets) if reverse else assets)
+ size = aupd.chained_phase_plan()["status"]["update_size_bytes"]
+ assert size == (300_000_000 if arch == "arm64" else 400_000_000)
+
+
@pytest.mark.parametrize("torch_has_runtime", [False, True])
def test_the_cuda_runtime_zip_follows_the_current_torch(managed, monkeypatch, torch_has_runtime):
monkeypatch.setattr(aupd.platform, "system", lambda: "Windows")
diff --git a/studio/install_audio_cpp_prebuilt.py b/studio/install_audio_cpp_prebuilt.py
index 6d9887eedad..74691b0f1d9 100644
--- a/studio/install_audio_cpp_prebuilt.py
+++ b/studio/install_audio_cpp_prebuilt.py
@@ -416,13 +416,22 @@ def resolve_release_asset(
def cudart_asset_for(asset_names: Sequence[str], bundle: str) -> Optional[str]:
- """The separate Windows CUDA runtime archive matching a CUDA bundle's line."""
- match = _CUDA_LINE.search(bundle)
- if not match or "-windows-" not in bundle:
+ """The Windows CUDA runtime matching the bundle's architecture and CUDA line."""
+ host = re.search(r"-bin-(?:windows|win)-([^-]+)-", bundle, re.IGNORECASE)
+ arch = _ARCH_TOKENS.get(host.group(1).lower()) if host else None
+ if host is None or arch is None:
+ return None
+ match = _CUDA_LINE.match("-" + bundle[host.end() :])
+ if not match:
return None
line = match.group(0)[1:]
for name in asset_names:
- if "-cudart-windows-" in name and name.endswith(f"-{line}.zip"):
+ runtime = re.search(r"-cudart-(?:windows|win)-([^-]+)-", name, re.IGNORECASE)
+ if (
+ runtime is not None
+ and _ARCH_TOKENS.get(runtime.group(1).lower()) == arch
+ and name.endswith(f"-{line}.zip")
+ ):
return name
return None
diff --git a/tests/studio/install/test_install_audio_cpp_prebuilt_logic.py b/tests/studio/install/test_install_audio_cpp_prebuilt_logic.py
index c931bc4d07e..91f7a91ef76 100644
--- a/tests/studio/install/test_install_audio_cpp_prebuilt_logic.py
+++ b/tests/studio/install/test_install_audio_cpp_prebuilt_logic.py
@@ -105,6 +105,50 @@ def test_cudart_archive_matches_the_bundle_line():
assert M.cudart_asset_for(ASSETS, f"audio-{TAG}-bin-windows-x64-cpu.zip") is None
[email protected]("arch", ["arm64", "x64"])
[email protected]("reverse", [False, True])
+def test_cudart_archive_matches_architecture_independently_of_release_asset_order(arch, reverse):
+ tag = "v0.9.2-drama3-base-small-unsloth.2"
+ names = [
+ f"audio-{tag}-bin-windows-arm64-cpu.zip",
+ f"audio-{tag}-bin-windows-arm64-cuda13.zip",
+ f"audio-{tag}-cudart-windows-x64-cuda13.zip",
+ f"audio-{tag}-cudart-windows-arm64-cuda13.zip",
+ f"audio-{tag}-cudart-windows-{arch}-cuda12.zip",
+ ]
+ if reverse:
+ names.reverse()
+ assert M.cudart_asset_for(names, f"audio-{tag}-bin-windows-{arch}-cuda13.zip") == (
+ f"audio-{tag}-cudart-windows-{arch}-cuda13.zip"
+ )
+
+
[email protected]("arch,other", [("arm64", "x64"), ("x64", "arm64")])
+def test_cudart_never_falls_back_to_another_or_an_unspecified_architecture(arch, other):
+ names = [
+ f"audio-{TAG}-cudart-windows-{other}-cuda13.zip",
+ f"audio-{TAG}-cudart-windows-cuda13.zip",
+ f"audio-{TAG}-cudart-windows-unknown-cuda13.zip",
+ ]
+ assert M.cudart_asset_for(names, f"audio-{TAG}-bin-windows-{arch}-cuda13.zip") is None
+
+
[email protected]("arch", ["unknown", "riscv64", ""])
+def test_cudart_requires_a_known_bundle_architecture(arch):
+ names = [f"audio-{TAG}-cudart-windows-x64-cuda13.zip"]
+ assert M.cudart_asset_for(names, f"audio-{TAG}-bin-windows-{arch}-cuda13.zip") is None
+
+
+ "bundle_arch,runtime_arch", [("x64", "AMD64"), ("amd64", "x86_64"), ("ARM64", "aarch64")]
+)
+def test_cudart_preserves_explicit_legacy_architecture_aliases(bundle_arch, runtime_arch):
+ runtime = f"audio-{TAG}-cudart-windows-{runtime_arch}-cuda12.4.zip"
+ assert (
+ M.cudart_asset_for([runtime], f"audio-{TAG}-bin-win-{bundle_arch}-cuda12.4.zip") == runtime
+ )
+
+
@pytest.mark.parametrize(
"version,major",
[("2.10.0+cu130", 13), ("2.8.0+cu128", 12), ("2.5.1+cu124", 12), ("2.8.0", None)],