Support FlashMLA backend#4472
Merged
zhyncs merged 7 commits intosgl-project:mainfrom Mar 16, 2025
Merged
Conversation
zhyncs
approved these changes
Mar 16, 2025
merrymercy
reviewed
Mar 16, 2025
| assert self.chunked_prefill_size % self.page_size == 0 | ||
|
|
||
| if self.enable_flashmla is True: | ||
| assert self.page_size == 64, "FlashMLA only support page_size=64" |
| flashmla_index = torch.full( | ||
| (bs, max_seqlen_pad), -1, dtype=torch.int32, device=q.device | ||
| ) | ||
| create_flashmla_kv_indices_triton[(bs,)]( |
Contributor
There was a problem hiding this comment.
this metadata is the same for all layers, so we can process them only once in init_forward_metadata
Collaborator
Author
There was a problem hiding this comment.
I will fix the issue in the PR of CUDA graph.
|
Hi, I test --enable-flashmla on H20*16, and it is slower than normal version. Do you have data about E2E inference speed gain with flashmla? Thanks very much! |
Collaborator
Author
Wait for my cudagraph implementation |
This was referenced Mar 13, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
Integrate flashmla for decoding, and the accuracy test is currently okay. The current implementation is quite simple, directly integrating flashmla as the backend. Later, we need to abstract a fastmla_backend, using fa3 for prefill and flashmla for decode
Modifications
command
Todo