Skip to content

Skip selective_scan_cuda build on ROCm/HIP#915

Open
ChrisLundquist wants to merge 1 commit intostate-spaces:mainfrom
ChrisLundquist:rocm-skip-selective-scan-build
Open

Skip selective_scan_cuda build on ROCm/HIP#915
ChrisLundquist wants to merge 1 commit intostate-spaces:mainfrom
ChrisLundquist:rocm-skip-selective-scan-build

Conversation

@ChrisLundquist
Copy link
Copy Markdown

Summary

  • Skip building the selective_scan_cuda CUDA extension on ROCm/HIP builds since it does not compile on HIP
  • This extension is only used by Mamba-1; Mamba-2 and Mamba-3 use Triton kernels

Problem

Installing mamba-ssm on ROCm currently requires the workaround:

MAMBA_SKIP_CUDA_BUILD=TRUE pip install mamba-ssm

Without this flag, setup.py tries to compile csrc/selective_scan/*.cu with hipcc, which fails because the CUDA kernels use APIs without HIP equivalents.

Fix

setup.py already detects HIP builds via HIP_BUILD = bool(torch.version.hip). This PR wraps the selective_scan_cuda extension in if not HIP_BUILD:, so ROCm installs get a pure-Python + Triton wheel automatically.

The selective_scan_interface.py module already handles selective_scan_cuda = None gracefully via try/except.

Tested on: AMD Radeon RX 9070 XT (gfx1201, RDNA4), ROCm 7.2.1, PyTorch 2.12.0.dev+rocm7.2

Relates to #65 (ROCm support), #914 (Mamba-3 Triton kernel fix)

🤖 Generated with Claude Code

The selective_scan_cuda CUDA extension (used by Mamba-1) does not
compile on ROCm. Mamba-2 and Mamba-3 use Triton kernels and do not
need this extension. Skip building it on HIP so that
`pip install mamba-ssm` works on ROCm without requiring
MAMBA_SKIP_CUDA_BUILD=TRUE.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant