-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Add fused top-K softmax kernel for MoE #2769
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
Merged
Merged
Changes from 38 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
ad66935
Add CUTLASS as a submodule
WoosukKwon 396e537
Port CUTLASS extensions
WoosukKwon 0cd9436
Port MoE kernels
WoosukKwon cb4524c
Move moe_kernels
WoosukKwon c191207
Port MoE GEMM
WoosukKwon cfa4554
Port CUTLASS kernels
WoosukKwon 90ccdfa
Remove MoE gemm
WoosukKwon 3e90c1a
Merge branch 'main' into cutlass-moe
WoosukKwon 77a5c8d
Remove unused CUTLASS kernels
WoosukKwon f1583de
Minor
WoosukKwon de7a749
Add topk_softmax kernels
WoosukKwon e5c62e8
Remove unnecessary headers
WoosukKwon e127d9b
Add MoE namespace
WoosukKwon c3096a0
Minor
WoosukKwon 9a561cc
Add permute_kernels
WoosukKwon ba07256
Remove unused
WoosukKwon def2ccd
Move
WoosukKwon 72256cc
Move
WoosukKwon e86fd06
Remove
WoosukKwon 612f961
Add MoE MLP
WoosukKwon 0bf8fb9
Add cudaUtils
WoosukKwon c09179d
Fix headers
WoosukKwon 2ab65df
Enable BF16
WoosukKwon c74fc79
Err msg
WoosukKwon 6320de4
Add unpermute_and_reduce
WoosukKwon 9b57e39
Add renormalize
WoosukKwon 55fae45
Add FusedMoE
WoosukKwon 5dcf104
Remove dependency on cutlass
WoosukKwon 92ac8dd
Remove CUTLASS
WoosukKwon cf559dc
Fix Mixtral & DeepSeek
WoosukKwon 3246328
Minor
WoosukKwon 51940a4
Add .cuda
WoosukKwon 26d327f
Fix setup
WoosukKwon 1cc84e1
Fix MoE test
WoosukKwon 67f04c3
Fix copyright header
WoosukKwon 186901b
yapf
WoosukKwon 26ef5a0
Minor fix
WoosukKwon 6f33c73
Add minor comment
WoosukKwon a94dd8c
Address review on test_moe
WoosukKwon fe8c108
Fix docstring
WoosukKwon 9a5d9d8
Add assert statements
WoosukKwon 7cd63e9
Merge branch 'main' into topk-softmax
WoosukKwon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include "moe_ops.h" | ||
|
||
#include <torch/extension.h> | ||
|
||
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { | ||
m.def("topk_softmax", &topk_softmax, "Apply topk softmax to the gating outputs."); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#pragma once | ||
|
||
#include <torch/extension.h> | ||
|
||
void topk_softmax( | ||
torch::Tensor& topk_weights, | ||
torch::Tensor& topk_indices, | ||
torch::Tensor& token_expert_indices, | ||
torch::Tensor& gating_output); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Uh oh!
There was an error while loading. Please reload this page.