Skip to content

mamba-ssm: fix selective_state_update launch args when D or dt_bias is None - #1077

Merged
danieldk merged 2 commits into
huggingface:mainfrom
jiqing-feng:mamba-ssm-selective-state-update-optional
Sep 4, 2026
Merged

mamba-ssm: fix selective_state_update launch args when D or dt_bias is None#1077
danieldk merged 2 commits into
huggingface:mainfrom
jiqing-feng:mamba-ssm-selective-state-update-optional

Conversation

@jiqing-feng

Copy link
Copy Markdown
Contributor

Summary

D and dt_bias are documented as optional, but passing either as None
raises before the kernel is reached.

*(D.stride(0), D.stride(1)) if D is not None else 0 parses as
*((D.stride(0), D.stride(1)) if D is not None else 0) — a conditional
expression binds looser than the unpacking — so the None case tries to unpack
the int 0:

TypeError: Value after * must be an iterable, not int

Build the tuple first and pass a (0, 0) placeholder, which is how z_strides
a few lines above already handles the same situation.

tie_hdim separately dereferences dt_bias.stride(-1) unconditionally, so it
raises on None before the launch args are even evaluated.

Both are plain Python bugs and reproduce on CUDA.

…s None

`D` and `dt_bias` are documented as optional, but passing either as None raises
before the kernel is reached:

- `*(D.stride(0), D.stride(1)) if D is not None else 0` parses as
  `*((D.stride(0), D.stride(1)) if D is not None else 0)`, because a
  conditional expression binds looser than the unpacking, so the None case
  unpacks the int 0 and raises "Value after * must be an iterable, not int".
  Build the tuple first and pass a (0, 0) placeholder, matching how `z_strides`
  a few lines above already handles the same situation.

- `tie_hdim` dereferences `dt_bias.stride(-1)` unconditionally, so it raises on
  None before the launch args are even evaluated.

Both are plain Python bugs and reproduce on CUDA.
@github-actions github-actions Bot added the chore Version bumps, releases, misc maintenance label Aug 13, 2026
@jiqing-feng
jiqing-feng marked this pull request as ready for review September 1, 2026 02:47
@danieldk

danieldk commented Sep 4, 2026

Copy link
Copy Markdown
Member

/kernel-bot build mamba-ssm

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Build request processed.

Command: /kernel-bot build mamba-ssm
Mode: build only
Target branch: pr-1077
PR head SHA: 4fa7698223bddde96f1a3aa77de81e263373fb1e
Workflows: build.yaml, build-mac.yaml, build-windows.yaml

Dispatched (1):

@danieldk

danieldk commented Sep 4, 2026

Copy link
Copy Markdown
Member

/kernel-bot merge-and-upload mamba-ssm

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Build request failed.

Command: /kernel-bot merge-and-upload mamba-ssm
Mode: merge, build and upload
Target branch: ``
PR head SHA: 4fa7698223bddde96f1a3aa77de81e263373fb1e
Workflows: `build.yaml, build-mac.yaml, build-windows.yaml`

Failure: Failed to merge PR before build/upload. Check mergeability and required checks.

@danieldk
danieldk merged commit f6fefee into huggingface:main Sep 4, 2026
1 check failed
@danieldk

danieldk commented Sep 4, 2026

Copy link
Copy Markdown
Member

/kernel-bot merge-and-upload mamba-ssm

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Build request processed.

Command: /kernel-bot merge-and-upload mamba-ssm
Mode: merge, build and upload
Target branch: ``
PR head SHA: 4fa7698223bddde96f1a3aa77de81e263373fb1e
Workflows: `build.yaml, build-mac.yaml, build-windows.yaml`

Merge result: PR is already merged. Continuing with build/upload.

Dispatched (1):

Hub uploads:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Version bumps, releases, misc maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants