@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / bc0f6059a2
Fork 0

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

[UT] enhance free kv cache block queue popleft_n (#24220)

Signed-off-by: Andy Xie <andy.xning@gmail.com>

Ning Xie committed Sep 15, 2025 at 18:04 UTC bc0f6059a24cdebc125c984d0ca1138755285a81
1 file changed +4
tests/v1/core/test_kv_cache_utils.py
+4
@@ -280,9 +280,11 @@ def test_free_kv_cache_block_queue_popleft_n():
280 # Pop 0 block
281 # fake_head->b1->b3->b5->b4->b0->b2->fake_tail
282 assert len(queue.popleft_n(0)) == 0
283 + assert queue.num_free_blocks == 6
284 # Pop 1 block
285 # fake_head->b3->b5->b4->b0->b2->fake_tail
286 result_blocks = queue.popleft_n(1)
287 + assert queue.num_free_blocks == 5
288 assert len(result_blocks) == 1
289 assert result_blocks[0] is blocks[1]
290 for block in result_blocks:
@@ -292,6 +294,7 @@ def test_free_kv_cache_block_queue_popleft_n():
294 # fake_head->b4->b0->b2->fake_tail
295 result_blocks = queue.popleft_n(2)
296 assert len(result_blocks) == 2
297 + assert queue.num_free_blocks == 3
298 assert result_blocks[0] is blocks[3]
299 assert result_blocks[1] is blocks[5]
300 for block in result_blocks:
@@ -301,6 +304,7 @@ def test_free_kv_cache_block_queue_popleft_n():
304 # fake_head->fake_tail
305 result_blocks = queue.popleft_n(3)
306 assert len(result_blocks) == 3
307 + assert queue.num_free_blocks == 0
308 assert result_blocks[0] is blocks[4]
309 assert result_blocks[1] is blocks[0]
310 assert result_blocks[2] is blocks[2]