Skip to content

Commit 7d37b37

Browse files
committed
address reviewer comments
- replace get_kv_events with take_events for consistency with request.take_events() - remove wayward comment Signed-off-by: alec-flowers <[email protected]>
1 parent 925db1d commit 7d37b37

File tree

5 files changed

+10
-12
lines changed

5 files changed

+10
-12
lines changed

tests/v1/core/test_prefix_caching.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ def test_kv_cache_events(blocks_to_cache: int):
763763
# Allocate Blocks
764764
# Should see a single block stored event with a blocks_to_cache number of
765765
# block hashes
766-
# get_kv_events should reset the kv_event_queue
766+
# take_events should reset the kv_event_queue
767767
manager = KVCacheManager(
768768
make_kv_cache_config(block_size, num_blocks),
769769
max_model_len=8192,
@@ -775,7 +775,7 @@ def test_kv_cache_events(blocks_to_cache: int):
775775
num_tokens = block_size * blocks_to_cache
776776
req0 = make_request("0", list(range(num_tokens)))
777777
_ = manager.allocate_slots(req0, num_tokens)
778-
events = manager.get_kv_events()
778+
events = manager.take_events()
779779

780780
block = events[-1]
781781
assert (len(block.block_hashes) == blocks_to_cache == len(
@@ -792,7 +792,7 @@ def test_kv_cache_events(blocks_to_cache: int):
792792
manager.free(req0)
793793
req1 = make_request("1", list(range(num_tokens)))
794794
_ = manager.allocate_slots(req1, num_tokens)
795-
events = manager.get_kv_events()
795+
events = manager.take_events()
796796

797797
for blocks in events[:-1]:
798798
assert blocks.block_hashes[0] in stored_block_hash
@@ -805,7 +805,7 @@ def test_kv_cache_events(blocks_to_cache: int):
805805
# Should see a single all blocks cleared event
806806
manager.free(req1)
807807
manager.reset_prefix_cache()
808-
events = manager.get_kv_events()
808+
events = manager.take_events()
809809

810810
assert isinstance(events[-1], AllBlocksCleared)
811811
assert len(manager.block_pool.cached_block_hash_to_block) == 0

vllm/v1/core/block_pool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,8 @@ def get_usage(self) -> float:
313313
"""
314314
return 1.0 - (self.get_num_free_blocks() / self.num_gpu_blocks)
315315

316-
def extract_kv_events(self) -> list[KVCacheEvent]:
317-
"""Atomically extracts all events and clears the queue.
316+
def take_events(self) -> list[KVCacheEvent]:
317+
"""Atomically takes all events and clears the queue.
318318
319319
Returns:
320320
A list of KV cache events.

vllm/v1/core/kv_cache_manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,10 +387,10 @@ def free_block_hashes(self, request: Request) -> None:
387387
"""
388388
self.req_to_block_hashes.pop(request.request_id, None)
389389

390-
def get_kv_events(self) -> list[KVCacheEvent]:
391-
"""Get the KV cache events.
390+
def take_events(self) -> list[KVCacheEvent]:
391+
"""Take the KV cache events from the block pool.
392392
393393
Returns:
394394
A list of KV cache events.
395395
"""
396-
return self.block_pool.extract_kv_events()
396+
return self.block_pool.take_events()

vllm/v1/core/sched/scheduler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ def update_from_output(
688688
engine_core_outputs = EngineCoreOutputs(
689689
outputs=outputs,
690690
scheduler_stats=self.make_stats(spec_decoding_stats),
691-
kv_cache_events=self.kv_cache_manager.get_kv_events(),
691+
kv_cache_events=self.kv_cache_manager.take_events(),
692692
)
693693
if self.include_finished_set:
694694
#TODO currently sending duplicates here, improve this

vllm/v1/engine/async_llm.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,6 @@ def from_vllm_config(
134134

135135
# FIXME(rob): refactor VllmConfig to include the StatLoggers
136136
# include StatLogger in the Oracle decision.
137-
138-
# TODO (alec) ask rob about this
139137
if stat_loggers is not None:
140138
raise ValueError("Custom StatLoggers are not yet supported on V1. "
141139
"Explicitly set VLLM_USE_V1=0 to disable V1.")

0 commit comments

Comments
 (0)