[KV Offload] Support packed HMA KV cache layout#46205
Merged
Merged
Conversation
Add an opt-in packed KV cache layout for multi-group HMA models while preserving the existing DeepSeek V4 packed path. For HMA offloading, register the packed backing as one canonical tensor and use one full-row ref per KV group so CPU offload keeps the packed topology instead of allocating/copying per-slice tensors. Benchmark notes: - openai/gpt-oss-20b, B300, 128K, OffloadingConnector, 2 CPU-hit iterations: packed HMA full-row refs used 1 CPU tensor and averaged ~124.95 ms vs per-slice registration with 12 CPU tensors at ~144.37 ms (~13.5% faster). - google/gemma-3-1b-it, 4K: packed HMA used 1 CPU tensor vs 4 and CPU-hit latency was effectively flat, ~12.23 ms vs ~12.32 ms. Tests: - .venv/bin/python -m pytest tests/v1/core/test_contiguous_kv_packing.py tests/v1/simple_kv_offload/test_scheduler.py tests/v1/kv_connector/unit/offloading_connector/test_worker.py tests/v1/kv_offload/cpu/test_gpu_worker.py -q - .venv/bin/pre-commit run ruff-check --files vllm/v1/kv_offload/base.py vllm/v1/kv_offload/cpu/gpu_worker.py vllm/distributed/kv_transfer/kv_connector/v1/offloading/worker.py Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com>
tlrmchlsmth
approved these changes
Jun 20, 2026
xuebwang-amd
pushed a commit
to xuebwang-amd/vllm
that referenced
this pull request
Jun 21, 2026
Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com> Co-authored-by: OpenAI Codex <codex@openai.com> Co-authored-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
tunglinwood
pushed a commit
to tunglinwood/vllm
that referenced
this pull request
Jun 22, 2026
Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com> Co-authored-by: OpenAI Codex <codex@openai.com> Co-authored-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
nkzhenhua
pushed a commit
to nkzhenhua/vllm
that referenced
this pull request
Jun 24, 2026
Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com> Co-authored-by: OpenAI Codex <codex@openai.com> Co-authored-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
qli88
pushed a commit
to qli88/vllm
that referenced
this pull request
Jun 26, 2026
Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com> Co-authored-by: OpenAI Codex <codex@openai.com> Co-authored-by: Tyler Michael Smith <tlrmchlsmth@gmail.com> Signed-off-by: Qiang Li <qiang.li2@amd.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
VLLM_USE_PACKED_HMA_KV_CACHEpath for multi-group HMA KV cache packingDuplicate-work check
packed HMA KV cache,gpt-oss gemma packed kv cache,VLLM_USE_PACKED_HMA_KV_CACHE,packed KV cache offloading, andhybrid KV cache offload.Benchmarks
openai/gpt-oss-20b, B300, 128K,OffloadingConnector, 2 CPU-hit iterations: packed HMA full-row refs used 1 CPU tensor and averaged ~124.95 ms vs per-slice registration with 12 CPU tensors at ~144.37 ms (~13.5% faster).google/gemma-3-1b-it, 4K: packed HMA used 1 CPU tensor vs 4 and CPU-hit latency was effectively flat, ~12.23 ms vs ~12.32 ms.Tests
.venv/bin/python -m pytest tests/v1/core/test_contiguous_kv_packing.py tests/v1/simple_kv_offload/test_scheduler.py tests/v1/kv_connector/unit/offloading_connector/test_worker.py tests/v1/kv_offload/cpu/test_gpu_worker.py -q.venv/bin/pre-commit run ruff-check --files vllm/v1/kv_offload/base.py vllm/v1/kv_offload/cpu/gpu_worker.py vllm/distributed/kv_transfer/kv_connector/v1/offloading/worker.pyruff check,ruff format, typos, mypy py3.10, SPDX, config validation, and other repository hooks successfully.AI Assistance
AI assistance was used to implement and iterate on this change. This PR has been reviewed by the author.