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.

Prebuilt wheels: build causal-conv1d and mamba-ssm for Linux torch 2.10 to 2.12 (#14336)

Daniel Han4b8447f63a21
diff --git a/.github/scripts/prebuilt_wheels.py b/.github/scripts/prebuilt_wheels.py
index 2387a8da18b..7a0d9606d2f 100644
--- a/.github/scripts/prebuilt_wheels.py
+++ b/.github/scripts/prebuilt_wheels.py
@@ -112,6 +112,11 @@ PLATFORMS = {
"abi": "TRUE",
"label": "",
"pytorch_nvcc": "ccache /usr/local/cuda-13.0/bin/nvcc",
+ # Upstream's torch2.10 causal-conv1d / mamba-ssm wheels (205 / 351 MB, reused on 2.11 and
+ # 2.12) carry -lineinfo and every arch; ours are ~30 / ~55 MB. Upstream flash-attn 2.8.1 is
+ # already smaller than ours there (125 MB, no PTX), so it is not built for these torches.
+ "extra_torches": ("2.10.0", "2.11.0", "2.12.0"),
+ "extra_torch_packages": ("causal-conv1d", "mamba-ssm"),
},
"win_amd64": {
"os": "windows",
@@ -132,6 +137,9 @@ PLATFORMS = {
"abi": "TRUE",
"label": " / linux_aarch64",
"pytorch_nvcc": "ccache /usr/local/cuda-13.0/bin/nvcc",
+ # Same as linux_x86_64 for the older torches.
+ "extra_torches": ("2.10.0", "2.11.0", "2.12.0"),
+ "extra_torch_packages": ("causal-conv1d", "mamba-ssm"),
},
# NVIDIA publishes flash-attn for Windows on ARM itself (studio resolves it), so only the other
# two are built here, against the only CUDA torch that exists for it: NVIDIA's 2.14.0+cu134,
@@ -153,6 +161,7 @@ PLATFORMS = {
_PLATFORM_DEFAULTS = {
"torches": None, # every TORCH_VERSIONS entry
"packages": None, # every SPECS entry
+ "extra_torch_packages": None, # packages built for `extra_torches` (None = `packages`)
"torch_local": "",
"torch_index_args": "--index-url https://download.pytorch.org/whl/cu130",
}
@@ -276,8 +285,16 @@ def _platform_torches(platform: str) -> tuple[str, ...]:
)
-# Accepted from a dispatch; each platform builds only its own subset (2.10.0, 2.11.0 and 2.12.0
-# are win_amd64 only).
+def _platform_packages(platform: str, torch_version: str) -> tuple[str, ...]:
+ """Packages a platform builds for one torch: `extra_torch_packages` for its `extra_torches`."""
+ packages = _platform(platform, "packages") or tuple(SPECS)
+ if torch_version in (_platform(platform, "extra_torches") or ()):
+ packages = _platform(platform, "extra_torch_packages") or packages
+ return packages
+
+
+# Accepted from a dispatch; each platform builds only its own subset (2.10.0, 2.11.0 and 2.12.0:
+# every package on win_amd64, causal-conv1d and mamba-ssm on Linux).
ALLOWED_TORCH = tuple(
sorted(
{torch for platform in PLATFORMS for torch in _platform_torches(platform)},
@@ -398,11 +415,11 @@ def build_matrix(
for platform in chosen_platforms:
target = PLATFORMS[platform]
torches = _platform_torches(platform)
- packages_here = _platform(platform, "packages") or tuple(SPECS)
local = _platform(platform, "torch_local")
for torch_version in chosen_torch:
if torch_version not in torches:
continue
+ packages_here = _platform_packages(platform, torch_version)
for python_version in chosen_python:
for package in chosen_packages:
if package not in packages_here:
@@ -455,8 +472,8 @@ def build_matrix(
if not include:
raise SystemExit(
"no cells: none of the chosen platforms builds that package / torch combination "
- "(torch 2.10.0 to 2.12.0 are win_amd64 only; win_arm64 builds causal-conv1d and "
- "mamba-ssm for torch 2.14.0 only)."
+ "(torch 2.10.0 to 2.12.0 build flash-attn on win_amd64 only; win_arm64 builds "
+ "causal-conv1d and mamba-ssm for torch 2.14.0 only)."
)
return include
@@ -635,6 +652,19 @@ def _packages(rows: list[dict]) -> str:
return _join([f"{package} {version}" for package, version in pairs])
+def _built(rows: list[dict]) -> str:
+ """`flash-attn 2.8.4, built for PyTorch ...`, split by package where coverage differs (Linux
+ builds causal-conv1d and mamba-ssm for torch 2.10 to 2.12 but flash-attn only for 2.13+)."""
+ by_coverage: dict[str, list[dict]] = {}
+ for package in SPECS:
+ package_rows = [row for row in rows if row["package"] == package]
+ if package_rows:
+ by_coverage.setdefault(_coverage(package_rows), []).extend(package_rows)
+ return "; ".join(
+ f"{_packages(group)}, built for {coverage}" for coverage, group in by_coverage.items()
+ )
+
+
def render_notes(entries: list[tuple[str, str]], tag: str, repo: str) -> str:
"""One-sentence release body from `(sha256, filename)` pairs.
@@ -655,11 +685,11 @@ def render_notes(entries: list[tuple[str, str]], tag: str, repo: str) -> str:
if len(platforms) == 1:
return (
f"Prebuilt {PLATFORM_NAMES[platforms[0]]} CUDA {CUDA_TAG} wheels for "
- f"{_packages(parsed)}, built for {_coverage(parsed)}.{tail}"
+ f"{_built(parsed)}.{tail}"
)
# Per platform: separate runs need not cover the same packages or torch minors.
per_platform = " ".join(
- f"{PLATFORM_NAMES[platform]}: {_packages(rows)}, built for {_coverage(rows)}."
+ f"{PLATFORM_NAMES[platform]}: {_built(rows)}."
for platform in platforms
for rows in [[row for row in parsed if row["platform"] == platform]]
)
@@ -738,6 +768,8 @@ def _cmd_wheel_name(args: argparse.Namespace) -> int:
# The same cells build_matrix accepts: no name for a wheel nothing builds.
if args.torch not in _platform_torches(args.platform):
raise SystemExit(f"torch {args.torch} is not built for {args.platform}")
+ if args.package not in _platform_packages(args.platform, args.torch):
+ raise SystemExit(f"{args.package} for torch {args.torch} is not built for {args.platform}")
print(wheel_name(args.package, args.torch, args.python, args.platform))
return 0
diff --git a/.github/workflows/prebuilt-cuda-wheels.yml b/.github/workflows/prebuilt-cuda-wheels.yml
index 9e4199fbe47..a1620b25379 100644
--- a/.github/workflows/prebuilt-cuda-wheels.yml
+++ b/.github/workflows/prebuilt-cuda-wheels.yml
@@ -29,7 +29,7 @@ on:
workflow_dispatch:
inputs:
torch_versions:
- description: 'torch versions to build for, comma separated (2.13.0, 2.14.0; 2.10.0, 2.11.0 and 2.12.0 build on win_amd64 only)'
+ description: 'torch versions to build for, comma separated (2.13.0, 2.14.0; 2.10.0, 2.11.0 and 2.12.0: every package on win_amd64, causal-conv1d and mamba-ssm on Linux)'
type: string
default: '2.13.0,2.14.0'
python_versions:
diff --git a/tests/python/test_prebuilt_cuda_wheels_windows.py b/tests/python/test_prebuilt_cuda_wheels_windows.py
index 4f4008ba754..18afe07107d 100644
--- a/tests/python/test_prebuilt_cuda_wheels_windows.py
+++ b/tests/python/test_prebuilt_cuda_wheels_windows.py
@@ -157,7 +157,7 @@ class TestMatrix:
assert prebuilt_wheels.TRITON_WINDOWS["2.14"].startswith("3.8.0.post")
@pytest.mark.parametrize("torch_version", ["2.10.0", "2.11.0", "2.12.0"])
- def test_win_amd64_only_torches_are_opt_in(self, torch_version):
+ def test_older_torches_are_opt_in(self, torch_version):
torch_mm = prebuilt_wheels.torch_minor(torch_version)
cells = prebuilt_wheels.build_matrix(
torches = torch_version, platforms = "win_amd64", pythons = "3.11,3.12,3.13"
@@ -170,16 +170,32 @@ class TestMatrix:
if cell["package"] == "mamba-ssm":
triton = prebuilt_wheels.TRITON_WINDOWS[torch_mm]
assert cell["smoke_extra"] == f"triton-windows=={triton}"
- for platform in ("linux_x86_64", "linux_aarch64", "win_arm64"):
+ with pytest.raises(SystemExit):
+ prebuilt_wheels.build_matrix(torches = torch_version, platforms = "win_arm64")
+ # Linux builds causal-conv1d and mamba-ssm only: upstream flash-attn 2.8.1 is smaller there.
+ for platform in ("linux_x86_64", "linux_aarch64"):
with pytest.raises(SystemExit):
- prebuilt_wheels.build_matrix(torches = torch_version, platforms = platform)
+ prebuilt_wheels.build_matrix(
+ torches = torch_version, platforms = platform, packages = "flash-attn"
+ )
+ linux = prebuilt_wheels.build_matrix(
+ torches = torch_version, platforms = platform, pythons = "3.11,3.12,3.13"
+ )
+ assert len(linux) == 6
+ assert {c["package"] for c in linux} == {"causal-conv1d", "mamba-ssm"}
+ assert {c["python_tag"] for c in linux} == {"cp311", "cp312", "cp313"}
+ for cell in linux:
+ assert cell["wheel_name"].endswith(f"-{platform}.whl")
+ assert f"+cu13torch{torch_mm}cxx11abiTRUE-" in cell["wheel_name"]
# A default dispatch builds what it did before.
assert torch_version not in {cell["torch"] for cell in prebuilt_wheels.build_matrix()}
both = prebuilt_wheels.build_matrix(torches = f"{torch_version},2.13.0")
- assert {(c["platform"], c["torch"]) for c in both} == {
- ("win_amd64", torch_version),
- ("win_amd64", "2.13.0"),
- ("linux_x86_64", "2.13.0"),
+ assert {(c["platform"], c["torch"], c["package"]) for c in both} == {
+ *(("win_amd64", torch_version, p) for p in prebuilt_wheels.SPECS),
+ *(("win_amd64", "2.13.0", p) for p in prebuilt_wheels.SPECS),
+ *(("linux_x86_64", "2.13.0", p) for p in prebuilt_wheels.SPECS),
+ ("linux_x86_64", torch_version, "causal-conv1d"),
+ ("linux_x86_64", torch_version, "mamba-ssm"),
}
def test_win_amd64_inherits_a_new_global_torch(self, monkeypatch):
@@ -274,14 +290,14 @@ class TestNames:
assert out == "causal_conv1d-1.7.0+cu13torch2.13cxx11abiTRUE-cp313-cp313-win_amd64.whl"
def test_wheel_name_cli_refuses_a_cell_nothing_builds(self):
- def name(*platform):
+ def name(package, *platform):
return subprocess.run(
[
sys.executable,
str(SCRIPTS / "prebuilt_wheels.py"),
"wheel-name",
"--package",
- "mamba-ssm",
+ package,
"--torch",
"2.11.0",
"--python",
@@ -292,13 +308,27 @@ class TestNames:
text = True,
)
- for platform in ([], ["--platform", "linux_x86_64"], ["--platform", "win_arm64"]):
- result = name(*platform)
- assert result.returncode != 0
+ # win_arm64 builds torch 2.14 only; Linux builds no flash-attn for torch 2.10 to 2.12.
+ for package, platform in (
+ ("mamba-ssm", ["--platform", "win_arm64"]),
+ ("flash-attn", []),
+ ("flash-attn", ["--platform", "linux_x86_64"]),
+ ("flash-attn", ["--platform", "linux_aarch64"]),
+ ):
+ result = name(package, *platform)
+ assert result.returncode != 0, (package, platform)
assert "not built for" in result.stderr
- result = name("--platform", "win_amd64")
- assert result.returncode == 0
- assert result.stdout.strip().endswith("torch2.11cxx11abiTRUE-cp312-cp312-win_amd64.whl")
+ for package, platform in (
+ ("flash-attn", "win_amd64"),
+ ("mamba-ssm", "win_amd64"),
+ ("mamba-ssm", "linux_x86_64"),
+ ("causal-conv1d", "linux_aarch64"),
+ ):
+ result = name(package, "--platform", platform)
+ assert result.returncode == 0, (package, platform)
+ assert result.stdout.strip().endswith(
+ f"torch2.11cxx11abiTRUE-cp312-cp312-{platform}.whl"
+ )
def test_round_trip_on_both_platforms(self):
for platform in prebuilt_wheels.PLATFORMS:
@@ -352,6 +382,22 @@ class TestNotes:
"built for PyTorch 2.13 and 2.14 on Python 3.13.\n"
)
+ def test_packages_with_different_coverage_are_described_apart(self):
+ """Linux torch 2.10 to 2.12 carries causal-conv1d and mamba-ssm but no flash-attn."""
+ entries = [
+ (f"{index:064x}", prebuilt_wheels.wheel_name(package, torch, "3.13", "linux_x86_64"))
+ for index, (package, torch) in enumerate(
+ [(pkg, "2.10.0") for pkg in ("causal-conv1d", "mamba-ssm")]
+ + [(pkg, "2.13.0") for pkg in prebuilt_wheels.SPECS]
+ )
+ ]
+ notes = prebuilt_wheels.render_notes(entries, tag = "t", repo = "r")
+ assert notes == (
+ "Prebuilt Linux x86_64 CUDA 13 wheels for flash-attn 2.8.4, built for PyTorch 2.13 on "
+ "Python 3.13; causal-conv1d 1.7.0 and mamba-ssm 2.3.2.post1, built for PyTorch 2.10 "
+ "and 2.13 on Python 3.13.\n"
+ )
+
def test_torch_minors_with_different_interpreters_are_not_merged(self):
entries = [
(f"{index:064x}", prebuilt_wheels.wheel_name(package, torch, python, "win_amd64"))