mirror of
https://github.com/deepseek-ai/DeepGEMM.git
synced 2026-11-05 00:47:26 +00:00
[PR #354] [CLOSED] Fix OOB shared-memory read in paged MQA logits metadata for empty batches #387
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#387
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?
📋 Pull Request Information
Original PR: https://github.com/deepseek-ai/DeepGEMM/pull/354
Author: @mingyangHao
Created: 6/4/2026
Status: ❌ Closed
Base:
nv_dev← Head:fix/paged-mqa-logits-metadata-empty-oob📝 Commits (1)
6bdf229Fix OOB shared-memory read in paged MQA logits metadata for empty batches📊 Changes
1 file changed (+1 additions, -1 deletions)
View changed files
📝
deep_gemm/include/deep_gemm/scheduler/paged_mqa_logits.cuh(+1 -1)📄 Description
In the non-varlen branch of
smxx_paged_mqa_logits_metadata, when the total amount of work is zero (everycontext_lenmaps to 0 KV segments, e.g. an all-empty decode/warmup batch),seg_startsis 0 for every SM and the binary search saturates toq_idx == batch_size. The subsequentthen reads
prefix_sum[batch_size], which is out of bounds of theprefix_sumshared-memory buffer (it only holdskAlignedBatchSizeentries), causing CUDA_ERROR_ILLEGAL_ADDRESS.The varlen branch already guards the equivalent empty-work case. Clamp
num_segs_qto 0 whenq_idx >= batch_sizeso empty SMs fall through to theatom_idx == 0/kv_split_idx == 0path and emit thebatch_size * num_next_n_atomsend sentinel.Repro: call
get_paged_mqa_logits_metadatawith an all-zerocontext_lenstensor; compute-sanitizer reports "Invalid shared read" insmxx_paged_mqa_logits_metadata, which this patch eliminates. Surfaced by TensorRT-LLM DeepSeek-V4 sparse-MLA indexer warmup (empty KV) on Blackwell.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.