mamba-rs 0.6.2

Mamba SSM and Mamba-3 SISO in Rust with optional CUDA GPU acceleration. Inference and training (BPTT through SSM state, AdamW), CPU + GPU paths, custom CUDA kernels, CUDA Graph capture, f32 / bf16 / f16. Opt-in deterministic training (bit-identical runs, batch-invariant inference) with a tensor-core tier that beats cuBLAS on LLM-sized models.
Documentation
name: CI

on:
  push:
    branches: [main]
  pull_request:
  schedule:
    - cron: "0 2 * * *"

permissions:
  contents: read

concurrency:
  group: ci-${{ github.event.pull_request.number || github.sha }}
  cancel-in-progress: true

env:
  CARGO_INCREMENTAL: 0
  CARGO_NET_RETRY: 10
  CARGO_TERM_COLOR: always
  RUSTFLAGS: -Dwarnings
  RUST_BACKTRACE: 1

jobs:
  lockfile:
    name: Cargo.lock up to date
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
      - run: cargo check --locked

  fmt:
    name: Rustfmt
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt
      - run: cargo fmt --all -- --check

  clippy:
    name: Clippy
    runs-on: ubuntu-latest
    timeout-minutes: 20
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy
      - uses: Swatinem/rust-cache@v2
      - run: cargo clippy --workspace --all-targets -- -D warnings

  docs:
    name: Documentation
    runs-on: ubuntu-latest
    timeout-minutes: 20
    env:
      RUSTDOCFLAGS: -Dwarnings
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@nightly
      - uses: Swatinem/rust-cache@v2
      - run: cargo doc --no-deps --workspace

  msrv:
    name: MSRV (1.97)
    runs-on: ubuntu-latest
    timeout-minutes: 20
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: "1.97"
      - uses: Swatinem/rust-cache@v2
      - run: cargo check --workspace

  basics:
    name: Gate
    runs-on: ubuntu-latest
    needs: [lockfile, fmt, clippy, docs, msrv, deny]
    steps:
      - run: exit 0

  test:
    name: Test (${{ matrix.os }} / ${{ matrix.rust }})
    needs: basics
    runs-on: ${{ matrix.os }}
    timeout-minutes: 30
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            rust: stable
          - os: ubuntu-latest
            rust: nightly
          - os: macos-latest
            rust: stable
          - os: windows-latest
            rust: stable
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.rust }}
      - uses: Swatinem/rust-cache@v2
        with:
          key: ${{ matrix.rust }}
      - run: cargo test --workspace

  cuda-check:
    # C-1 (GEMM-map audit 2026-08-01): every GPU/tier test file is
    # cfg(feature = "cuda"), so the featureless legs compile ~50 test files
    # to nothing — the whole GEMM suite could bit-rot invisibly. Hosted
    # runners have no GPU, but type-checking only needs rustc + nvcc
    # (cudarc's build script probes `nvcc --version`; execution is not
    # attempted). Running the suite on a GPU runner stays a separate,
    # deliberate decision.
    name: CUDA feature type-check
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - uses: actions/checkout@v6
      - name: Install CUDA toolkit (nvcc only, no driver)
        run: |
          sudo apt-get update -qq
          sudo apt-get install -y -qq nvidia-cuda-toolkit
          nvcc --version
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: "1.97"
      - uses: Swatinem/rust-cache@v2
        with:
          key: cuda-check
      - run: cargo check --workspace --all-targets --features cuda
      # The live-DDP surface (dist reducer, comm, watchdog wiring) only
      # compiles with the nccl feature; without this leg it would bit-rot
      # invisibly (cudarc's nccl bindings dlopen at runtime — no libnccl
      # needed to type-check).
      - run: cargo check --workspace --all-targets --features cuda,hf,gemm-blas,nccl

  publish-check:
    name: Publish dry-run
    needs: [basics, test]
    runs-on: ubuntu-latest
    timeout-minutes: 20
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - run: cargo publish --dry-run

  deny:
    name: Security audit
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@v6
      - uses: EmbarkStudios/cargo-deny-action@v2