Fix MLA fp8 prefill crash when max_seqlen_q > 1#12
Merged
Conversation
mla_decode_fwd only supports max_seqlen_q=1. When fp8 KV cache is used during prefill (max_seqlen_q > 1), use mla_prefill_fwd with fp8-to-bf16 conversion instead. Decode path (max_q_len == 1) still uses mla_decode_fwd with native fp8 scale support.
2 tasks
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.
Summary
mla_decode_fwdonly supportsmax_seqlen_q=1(decode). When called during fp8 prefill withmax_seqlen_q > 1, it crashes withKeyError(e.g.nhead * max_seqlen_q = 96not a valid key).mla_prefill_fwdwith fp8-to-bf16 conversion whenmax_q_len > 1. Decode path (max_q_len == 1) still usesmla_decode_fwdwith native fp8 scale support.Test plan