mirror of
https://github.com/deepseek-ai/DeepGEMM.git
synced 2026-11-05 00:47:26 +00:00
[GH-ISSUE #209] [QUESTION] dsv32 mqa_logits kernel not considering causal masking? #118
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/DeepGEMM#118
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @carlushuang on GitHub (Oct 7, 2025).
Original GitHub issue: https://github.com/deepseek-ai/DeepGEMM/issues/209
Thanks for dsv32 great work!
By analysis the
fp8_mqa_logitsandfp8_paged_mqa_logitsfunction, looks like after the q@k, we don't consider causal masking before topk?I know the q/k feed to mqa_logits kernel is different from the q/k feed to MLA attention kernel, but we use the output of the mqa_logits kernel (and topk 2048) as indexer into the real MLA's kvcache, hence during the real attention computation we need consider causal, in prefill or decode(MTP) case.
vLLM prefill dispatch using
torch.ops._C.top_k_per_rowseems not considering causal, decode dispatch looks like considered causal in MTP case after the logits kernel, before topk.not sure if it is suppose to let the framework side to do causal before topk, or actually causal is not important during the indexer kernel?
@zheanxu commented on GitHub (Oct 22, 2025):
To apply causal masking, you can set
clean_logits=True. In this case, the subsequentclean_logitskernel will perform the masking. See:github.com/deepseek-ai/DeepGEMM@c9f8b34dcd/csrc/apis/attention.hpp (L120)A more efficient approach is to set
clean_logits=Falseand incorporate causal masking directly into the topk operation — i.e., ignore masked positions during topk selection. However, this requires implementing your own topk kernel.