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.

install-kernels: install mamba_ssm on sm70 with Triton 3.4+, matching unsloth_zoo (#15557)

Daniel Han9b442f40a345
diff --git a/studio/backend/tests/test_kernel_install.py b/studio/backend/tests/test_kernel_install.py
index d045e3569c3..3caecb1d87b 100644
--- a/studio/backend/tests/test_kernel_install.py
+++ b/studio/backend/tests/test_kernel_install.py
@@ -392,15 +392,16 @@ def test_sm80_kernels_are_skipped_below_sm80(name, capability, capsys, monkeypat
assert f"skipping {name}, which needs sm80" in capsys.readouterr().out
-# unsloth_zoo keeps mamba_ssm's fast path on sm75 with Triton 3.4+ (torch 2.8+).
+# unsloth_zoo keeps mamba_ssm's fast path on sm70 / sm75 with Triton 3.4+ (torch 2.8+).
[email protected]("capability", ["7 5", "7 0"])
@pytest.mark.parametrize("triton", [(3, 4), (3, 6), (4, 0)])
-def test_mamba_ssm_installs_on_sm75_with_a_new_triton(uv, monkeypatch, triton):
+def test_mamba_ssm_installs_on_sm75_with_a_new_triton(uv, monkeypatch, triton, capability):
uv(False)
monkeypatch.delenv("UNSLOTH_MAMBA_PRE_AMPERE_FAST", raising = False)
monkeypatch.setattr(kernel_install, "_triton_version", lambda run: triton)
- run = _Runner([False, True], capability = "7 5")
+ run = _Runner([False, True], capability = capability)
assert kernel_install.install_kernel("mamba_ssm", _COLAB, run = run, exists = lambda url: True) == 0
assert run.installer_calls[0][-1].endswith(
"mamba_ssm-2.3.2.post1+cu13torch2.11cxx11abiTRUE-cp313-cp313-linux_x86_64.whl"
@@ -415,7 +416,7 @@ def test_mamba_ssm_is_skipped_on_sm75_with_an_old_triton(monkeypatch, capsys, tr
assert kernel_install.install_kernel("mamba_ssm", _COLAB, run = run, exists = lambda url: True) == 0
assert run.installer_calls == []
out = capsys.readouterr().out
- assert "sm75 with Triton 3.4+" in out
+ assert "sm70+ with Triton 3.4+" in out
assert ("missing" if triton is None else "%d.%d" % triton) in out
@@ -433,13 +434,13 @@ def test_triton_is_read_from_the_module(uv, monkeypatch, triton, installs):
assert bool(run.installer_calls) is installs
-def test_mamba_ssm_is_skipped_below_sm75_whatever_the_triton(monkeypatch, capsys):
+def test_mamba_ssm_is_skipped_below_sm70_whatever_the_triton(monkeypatch, capsys):
monkeypatch.delenv("UNSLOTH_MAMBA_PRE_AMPERE_FAST", raising = False)
monkeypatch.setattr(kernel_install, "_triton_version", lambda run: (3, 6))
- run = _Runner([], capability = "7 0")
+ run = _Runner([], capability = "6 1")
assert kernel_install.install_kernel("mamba_ssm", _COLAB, run = run, exists = lambda url: True) == 0
assert run.installer_calls == []
- assert "the best GPU is sm70" in capsys.readouterr().out
+ assert "the best GPU is sm61" in capsys.readouterr().out
@pytest.mark.parametrize(
diff --git a/studio/backend/utils/kernel_install.py b/studio/backend/utils/kernel_install.py
index 4486b2da191..8abfbe8b3c5 100644
--- a/studio/backend/utils/kernel_install.py
+++ b/studio/backend/utils/kernel_install.py
@@ -408,7 +408,7 @@ def resolve_wheel_url(name: str, env: dict[str, str] | None) -> str | None:
return _PINNED[name].wheel_url(env)
-# FlashAttention 2 needs sm80. mamba_ssm's Triton kernels also run on sm75 with Triton 3.4+
+# FlashAttention 2 needs sm80. mamba_ssm's Triton kernels also run on sm70 / sm75 with Triton 3.4+
# (torch 2.8+), the same rule unsloth_zoo's patch_mamba_ssm_pre_ampere_fallback applies, which
# turns the fast path off anywhere else, so the wheel would go unused there.
_GPU_GATED = ("flash_attn", "mamba_ssm")
@@ -448,13 +448,13 @@ def _pre_ampere_skip_reason(
forced = os.environ.get("UNSLOTH_MAMBA_PRE_AMPERE_FAST", "").strip()
if forced in ("0", "1"):
return None if forced == "1" else "UNSLOTH_MAMBA_PRE_AMPERE_FAST=0 turns off"
- if capability < (7, 5):
- return "needs sm80, or sm75 with Triton 3.4+"
+ if capability < (7, 0):
+ return "needs sm80, or sm70+ with Triton 3.4+"
triton = _triton_version(run)
if triton is not None and triton >= _MAMBA_SM75_MIN_TRITON:
return None
found = "missing" if triton is None else "%d.%d" % triton
- return f"needs sm80, or sm75 with Triton 3.4+ (torch 2.8+), and Triton is {found}"
+ return f"needs sm80, or sm70+ with Triton 3.4+ (torch 2.8+), and Triton is {found}"
def _gpu_capability(run: Callable[..., subprocess.CompletedProcess]) -> tuple[int, int] | None: