[Bugfix] Use null block (0) for padded block table entries (#35431)
Signed-off-by: SandishKumarHN <sandish@fb.com> Signed-off-by: Matthew Bonanni <mbonanni@redhat.com> Co-authored-by: Lucas Wilkinson <LucasWilkinson@users.noreply.github.com> Co-authored-by: Matthew Bonanni <mbonanni@redhat.com>
This commit is contained in:
co-authored by
Lucas Wilkinson
Matthew Bonanni
parent
1fc69f59bb
commit
bcc6f67447
@@ -5,6 +5,7 @@ import torch
|
||||
from einops import rearrange
|
||||
|
||||
from vllm.triton_utils import tl, triton
|
||||
from vllm.v1.attention.backends.utils import PAD_SLOT_ID
|
||||
|
||||
|
||||
@triton.jit
|
||||
@@ -602,6 +603,7 @@ def _linear_attn_decode_kernel(
|
||||
cache_h_stride,
|
||||
cache_d0_stride,
|
||||
cache_d1_stride,
|
||||
pad_slot_id: tl.constexpr,
|
||||
BLOCK_SIZE: tl.constexpr,
|
||||
):
|
||||
"""
|
||||
@@ -616,8 +618,8 @@ def _linear_attn_decode_kernel(
|
||||
# Load slot index for the current batch
|
||||
slot_id = tl.load(slot_idx + pid_b).to(tl.int64)
|
||||
|
||||
# Skip if slot_id is -1 (padding)
|
||||
if slot_id == -1:
|
||||
# Skip if slot_id is PAD_SLOT_ID (padding)
|
||||
if slot_id == pad_slot_id:
|
||||
return
|
||||
|
||||
batch_id = pid_b
|
||||
@@ -727,6 +729,7 @@ def linear_decode_forward_triton(
|
||||
cache_h_stride,
|
||||
cache_d0_stride,
|
||||
cache_d1_stride,
|
||||
pad_slot_id=PAD_SLOT_ID,
|
||||
BLOCK_SIZE=BLOCK_SIZE,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user