Skip to content
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

Fix Triton decode kernel & ut #1819

Merged
merged 3 commits into from
Oct 27, 2024
Merged

Conversation

ispobock
Copy link
Collaborator

Motivation

  • Set upper-bound limit for BLOCK_H in grouped decode Triton kernel to avoid OOM
  • Fix and add Triton attention kernel unit tests

@ispobock ispobock requested review from ByronHsu and removed request for Ying1123, merrymercy and zhyncs October 27, 2024 17:36
@@ -534,7 +545,7 @@ def _decode_grouped_softmax_reducev_fwd(
BLOCK = 128
batch, head_num = b_seq_len.shape[0], logits.shape[0]
kv_group_num = logits.shape[0] // v_buffer.shape[1]
BLOCK_H = max(16, triton.next_power_of_2(kv_group_num))
BLOCK_H = max(16, min(64, triton.next_power_of_2(kv_group_num)))
Copy link
Collaborator

@ByronHsu ByronHsu Oct 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. just curious - under what case will this OOM? and is it OOM on SRAM?

Copy link
Collaborator Author

@ispobock ispobock Oct 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The OOM is for shared memory. For deepseek-v2,the head_num is 128 if we use DP. I added this situation in the unit test.

@merrymercy merrymercy merged commit c77762d into sgl-project:main Oct 27, 2024
13 checks passed
zolinthecow pushed a commit to zolinthecow/sglang that referenced this pull request Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants