-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
triton softmax support multi-batch #152
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
tests/test_fastnn/test_softmax.py
Outdated
@@ -15,19 +15,19 @@ def _test_softmax_core(): | |||
|
|||
for seq_ in test_seq_: | |||
for dtype in test_dtype: | |||
sample_input = torch.rand(batch_, chunk_, head_, seq_, | |||
sample_input = torch.rand(batch, batch_, chunk_, head_, seq_, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, without the batch dimension it would work correctly as well
I found it would fail when the batch dimension comes to 2. |
Update: |
Support another batch dimension for softmax. In training or batch inference, we may add a batch dimension as the first dimension of some tensors. However, we use the third dimension(
tensor.shape[2]
) as thehead_dim
, which would be influenced. In this pr, I modify it totensor.shape[-3]
to solve this problem. CUDA kernel is modified as well.Enable test_atten_core, this test is skipped by default and never be used.