-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
[Bugfix] add missing function params to rocm_aiter_mla.py
#17911
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,24 +20,29 @@ def get_aiter_mla_metadata(max_batch_size: int, block_size: int, | |
paged_kv_last_page_lens = torch.full((max_batch_size, ), | ||
block_size, | ||
dtype=torch.int32) | ||
return paged_kv_indices, paged_kv_indptr, paged_kv_last_page_lens | ||
qo_indptr = torch.zeros(max_batch_size + 1, dtype=torch.int, device=device) | ||
return paged_kv_indices, paged_kv_indptr, paged_kv_last_page_lens, qo_indptr | ||
|
||
|
||
def aiter_mla_decode_fwd( | ||
q: torch.Tensor, | ||
kv_buffer: torch.Tensor, | ||
o: torch.Tensor, | ||
sm_scale: float, | ||
qo_indptr: torch.Tensor, | ||
max_seqlen_qo: int, | ||
kv_indptr: Optional[torch.Tensor] = None, | ||
kv_indices: Optional[torch.Tensor] = None, | ||
kv_last_page_lens: Optional[torch.Tensor] = None, | ||
sm_scale: float = 1.0, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moved down and added default value for consistency |
||
logit_cap: float = 0.0, | ||
): | ||
|
||
torch.ops.vllm.rocm_aiter_mla_decode_fwd(q, | ||
kv_buffer.view( | ||
-1, 1, 1, q.shape[-1]), | ||
o, | ||
qo_indptr, | ||
max_seqlen_qo, | ||
kv_indptr, | ||
kv_indices, | ||
kv_last_page_lens, | ||
|
@@ -49,6 +54,8 @@ def mla_decode_fwd_impl( | |
q: torch.Tensor, | ||
kv_buffer: torch.Tensor, | ||
o: torch.Tensor, | ||
qo_indptr: torch.Tensor, | ||
max_seqlen_qo: int, | ||
kv_indptr: Optional[torch.Tensor] = None, | ||
kv_indices: Optional[torch.Tensor] = None, | ||
kv_last_page_lens: Optional[torch.Tensor] = None, | ||
|
@@ -60,9 +67,11 @@ def mla_decode_fwd_impl( | |
mla_decode_fwd(q, | ||
kv_buffer.view(-1, 1, 1, q.shape[-1]), | ||
o, | ||
qo_indptr, | ||
kv_indptr, | ||
kv_indices, | ||
kv_last_page_lens, | ||
max_seqlen_qo, | ||
sm_scale=sm_scale, | ||
logit_cap=logit_cap) | ||
|
||
|
@@ -71,6 +80,8 @@ def mla_decode_fwd_fake( | |
q: torch.Tensor, | ||
kv_buffer: torch.Tensor, | ||
o: torch.Tensor, | ||
qo_indptr: torch.Tensor, | ||
max_seqlen_qo: int, | ||
kv_indptr: Optional[torch.Tensor] = None, | ||
kv_indices: Optional[torch.Tensor] = None, | ||
kv_last_page_lens: Optional[torch.Tensor] = None, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,9 +186,14 @@ | |
|
||
kv_buffer = kv_c_and_k_pe_cache.unsqueeze(2) | ||
|
||
aiter_mla_decode_fwd(q, kv_buffer, o, self.scale, | ||
aiter_mla_decode_fwd(q, | ||
kv_buffer, | ||
o, | ||
attn_metadata.qo_indptr, | ||
Check failure on line 192 in vllm/v1/attention/backends/mla/rocm_aiter_mla.py
|
||
attn_metadata.max_query_len, | ||
Check failure on line 193 in vllm/v1/attention/backends/mla/rocm_aiter_mla.py
|
||
Comment on lines
+192
to
+193
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How should we create these attributes? |
||
attn_metadata.decode.paged_kv_indptr, | ||
attn_metadata.decode.paged_kv_indices, | ||
attn_metadata.decode.paged_kv_last_page_len) | ||
attn_metadata.decode.paged_kv_last_page_len, | ||
sm_scale=self.scale) | ||
|
||
return self._v_up_proj(o) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a type check warning because these can be
None
, but the function doesn't allowNone
. Do we add moreassert
s above to ensure they're notNone
?