-
Couldn't load subscription status.
- Fork 133
Fused TopK and Sigmoid kernel #1251
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
base: main
Are you sure you want to change the base?
Conversation
| "f'{AITER_CSRC_DIR}/py_itfs_cu/asm_topksoftmax.cu'" | ||
| "f'{AITER_CSRC_DIR}/py_itfs_cu/asm_topksoftmax.cu'", | ||
| "f'{AITER_CSRC_DIR}/py_itfs_ck/topk_sigmoid_kernels.cu'", | ||
| "f'{CK_DIR}/example/ck_tile/09_topk_softmax/topk_softmax_api.cpp'" |
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.
can we move it out of module_moe_asm, it's quite heavy now
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.
Created a new module for topk.
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.
we should remove these as we had them in new module
aiter/ops/moe_op.py
Outdated
| ) -> None: ... | ||
|
|
||
|
|
||
| @compile_ops("module_moe_asm") |
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.
...
op_tests/test_moe_topk_sigmoid.py
Outdated
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| test_topk_sigmoid(dtype=torch.float16) |
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.
please add arg parser to allow user test other case, refer this one
Line 714 in 3d6afb2
| default=[(32, 32), (40, 40), (64, 64), (111, 111), (128, 128), (160, 160)], |
| "f'{AITER_CSRC_DIR}/py_itfs_cu/asm_topksoftmax.cu'" | ||
| "f'{AITER_CSRC_DIR}/py_itfs_cu/asm_topksoftmax.cu'", | ||
| "f'{AITER_CSRC_DIR}/py_itfs_ck/topk_sigmoid_kernels.cu'", | ||
| "f'{CK_DIR}/example/ck_tile/09_topk_softmax/topk_softmax_api.cpp'" |
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.
we should remove these as we had them in new module
Motivation
Llama4 Maverick uses a custom routing function that isn't using a softmax but only sigmoid: https://github.com/vllm-project/vllm/blob/main/vllm/model_executor/models/llama4.py#L62-L71
Especially in inference that custom routing function done in torch only becomes a significant overhead.
Technical Details
Relies on a PR in composable_kernel: ROCm/composable_kernel#3062
Need to bump 3rdparty/composable_kernel after merging the CK PR.
Test Plan
Added a simple test into op_tests that test both fp16 and bf16 cases.
Test Result
Submission Checklist