A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 14, 05:30 UTC
[Perf][Easy] Early stop in request_block_hasher (#26112)
Signed-off-by: Jialin Ouyang <Jialin.Ouyang@gmail.com>
Jialin Ouyang committed
Oct 5, 2025 at 01:46 UTC
201c971e96c103273a42cb5606760b498f162f76
1 file changed
+4
vllm/v1/core/kv_cache_utils.py
+4
@@ -585,6 +585,10 @@ def get_request_block_hasher(
585
start_token_idx = len(request.block_hashes) * block_size
586
num_tokens = request.num_tokens
587
588
+ if start_token_idx + block_size > num_tokens:
589
+ # Early stop when there no new full blocks created.
590
+ return []
591
+
592
curr_mm_idx = 0
593
if start_token_idx > 0:
594
# Set curr_mm_idx = -1 to indicate the last mm input.