add feature / fix bug: I fixed the kNRows
feature in forward
#161
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thank you for sharing this splendid work!
I found that
kNRows
is always1
inoriginal selective_scan
, and I observed that if I use greaterkNRows
inselective scan
, the faster the code would run. The phenomenon is consistent with mamba.py, when addingd_state
, the time consumption keeps. Though it is not strictly right, but adding the burden of one thread and reducing the number of blocks (as SM is limited) really works in most of cases.So I reopen that feature which may be deprecated in
original selective_scan
, and fixed some bugs related to it.I have tested with
pytest tests/ops/test_selective_scan_.py
(which you may delete later), and all tests pass.Note that I have only fixed the forward procedure, so in backward,
nrows
is still1
.Before Merging: I found that, when I uncomment all alternative parameters, the test is not all pass. However,
mamba_ssm-1.1.3.post1+cu122torch2.2cxx11abiFALSE-cp310-cp310-linux_x86_64.whl
acts the same.