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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio (AMD/ROCm): use MIOpen immediate mode for image and video convs (#13323)
Daniel Hanef5e0507a0c9
diff --git a/studio/backend/core/inference/diffusion_speed.py b/studio/backend/core/inference/diffusion_speed.pyindex 1aa50b11eb6..5bc9f88c73c 100644--- a/studio/backend/core/inference/diffusion_speed.py+++ b/studio/backend/core/inference/diffusion_speed.py@@ -503,6 +503,8 @@ def apply_speed_optims(install_vae_attn_chunks(getattr(pipe, "vae", None), target, logger)except Exception as exc: # noqa: BLE001 - keep stock attention_warn(logger, "vae attention chunks", exc)+ # Stability, not speed, so also before the `off` return.+ _enable_miopen_immediate(logger)# TF32 (max) and cudnn.benchmark (any non-off CUDA load) are process-global; the caller restores them so a later# `off` load never inherits them.if mode == SPEED_OFF:@@ -1777,6 +1779,30 @@ def _enable_cudnn_benchmark(logger: Any) -> bool:return False+def _enable_miopen_immediate(logger: Any) -> bool:+ """ROCm: ask MIOpen for a conv solution instead of miopenFind*, whose trial launches on unseen shapes+ are where #9130's uncatchable abort came from. MIOPEN_FIND_MODE / MIOPEN_FIND_ENFORCE keep Find. Not in+ snapshot_backend_flags: an unload restoring it would reopen Find under a co-resident pipeline."""+ if os.environ.get("MIOPEN_FIND_MODE") or os.environ.get("MIOPEN_FIND_ENFORCE"):+ return False+ try:+ import torch++ from core._torchao_stub import _module_is_rocm++ miopen = getattr(torch.backends, "miopen", None)+ if not _module_is_rocm(torch) or miopen is None or not hasattr(miopen, "immediate"):+ return False+ if not miopen.immediate:+ miopen.immediate = True+ if logger is not None:+ logger.info("diffusion.speed: MIOpen immediate mode on (no Find trial launches)")+ return True+ except Exception as exc: # noqa: BLE001 - keep torch's Find path+ _warn(logger, "miopen immediate", exc)+ return False++def _enable_tf32(logger: Any) -> bool:try:import torchdiff --git a/studio/backend/tests/test_diffusion_speed.py b/studio/backend/tests/test_diffusion_speed.pyindex 8705a25fddb..9a7dbe994e7 100644--- a/studio/backend/tests/test_diffusion_speed.py+++ b/studio/backend/tests/test_diffusion_speed.py@@ -590,6 +590,57 @@ def test_speed_default_skips_cudnn_benchmark_on_rocm(monkeypatch, hip, version):assert torch.backends.cudnn.benchmark is False[email protected]("speed_mode", [SPEED_OFF, SPEED_DEFAULT])+ "hip, version",+ [("7.13.0", "2.11.0+rocm7.13.0"), (None, "2.9.1+rocmsdk20251116")],+ ids = ["version_hip", "rocm_tag_only"],+)+def test_rocm_load_turns_on_miopen_immediate(monkeypatch, hip, version, speed_mode):+ # #9130: torch's MIOpen Find trial-launches kernels; one faulting there aborted the server.+ monkeypatch.delenv("MIOPEN_FIND_MODE", raising = False)+ monkeypatch.delenv("MIOPEN_FIND_ENFORCE", raising = False)+ torch = _stub_torch(monkeypatch)+ torch.version = types.SimpleNamespace(hip = hip)+ torch.__version__ = version+ torch.backends.miopen = types.SimpleNamespace(immediate = False)+ flags = snapshot_backend_flags()+ apply_speed_optims(+ _Pipe(with_compile = True), _target(), is_gguf = False, family = _family(), speed_mode = speed_mode+ )+ assert torch.backends.miopen.immediate is True+ restore_backend_flags(flags)+ assert torch.backends.miopen.immediate is True+++ "hip, version, env",+ [+ (None, "2.11.0+cu130", {}),+ ("7.13.0", "2.11.0+rocm7.13.0", {"MIOPEN_FIND_MODE": "NORMAL"}),+ ("7.13.0", "2.11.0+rocm7.13.0", {"MIOPEN_FIND_ENFORCE": "SEARCH"}),+ ],+ ids = ["cuda_torch", "explicit_find_mode", "explicit_find_enforce"],+)+def test_miopen_immediate_left_alone(monkeypatch, hip, version, env):+ for name in ("MIOPEN_FIND_MODE", "MIOPEN_FIND_ENFORCE"):+ monkeypatch.delenv(name, raising = False)+ for name, value in env.items():+ monkeypatch.setenv(name, value)+ torch = _stub_torch(monkeypatch)+ torch.version = types.SimpleNamespace(hip = hip)+ torch.__version__ = version+ torch.backends.miopen = types.SimpleNamespace(immediate = False)+ apply_speed_optims(+ _Pipe(with_compile = True),+ _target(),+ is_gguf = False,+ family = _family(),+ speed_mode = SPEED_DEFAULT,+ )+ assert torch.backends.miopen.immediate is False++def test_speed_default_respects_family_cudnn_benchmark_opt_out(monkeypatch):torch = _stub_torch(monkeypatch)family = types.SimpleNamespace(supports_torch_compile = True, cudnn_benchmark = False)