Skip to content

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

Draft
jiqing-feng wants to merge 1 commit into
huggingface:mainfrom
jiqing-feng:mamba-ssm-selective-state-update-optional
Draft

mamba-ssm: fix selective_state_update launch args when D or dt_bias is None#1077
jiqing-feng wants to merge 1 commit 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
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.

1 participant