-
-
Notifications
You must be signed in to change notification settings - Fork 16.7k
[HMA] [KVEvent] Enable GPU-side KV events for HMA #37688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
orozery
merged 16 commits into
vllm-project:main
from
hickeyma:add-evicted-grps-blck-rem-prop
Apr 12, 2026
+300
−28
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
1868127
[HMA] [KVEvent] Add evicted groups field to BlockRemoved KV event
hickeyma e79db5e
Enable KV events for HMA
hickeyma 4a43340
Add group ids to BlockStored events
hickeyma 1155116
Update kV evenys subscriber example with latest properties
hickeyma f0d4e7f
Change group id to be an int instead of a list of ints
hickeyma 41610fa
Remove CPU side changes for HMA
hickeyma 8870615
Change new event field names to group_idx
hickeyma b59c3a9
Add unit tests
hickeyma b9b0d18
Fix block stored and removed events hashes
hickeyma 2cf9a3f
Update vllm/distributed/kv_events.py
hickeyma 63aaaa8
Update vllm/distributed/kv_events.py
hickeyma 110733b
Extend e2e test test_kv_cache_events to test HMA events
hickeyma d88885e
Merge branch 'main' into add-evicted-grps-blck-rem-prop
hickeyma f75108f
Merge branch 'main' into add-evicted-grps-blck-rem-prop
hickeyma efe1a31
Merge branch 'main' into add-evicted-grps-blck-rem-prop
hickeyma ef478be
Merge branch 'main' into add-evicted-grps-blck-rem-prop
hickeyma File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # SPDX-FileCopyrightText: Copyright contributors to the vLLM project | ||
|
|
||
| import pytest | ||
|
|
||
| from vllm.distributed.kv_events import BlockRemoved, BlockStored | ||
|
|
||
| # Minimal ExternalBlockHash for testing (bytes are a valid ExternalBlockHash). | ||
| _FAKE_HASH: bytes = b"\xab" * 32 | ||
|
|
||
|
|
||
| def _make_block_stored(group_idx: int | None = None) -> BlockStored: | ||
| return BlockStored( | ||
| block_hashes=[_FAKE_HASH], | ||
| parent_block_hash=None, | ||
| token_ids=[1, 2, 3, 4], | ||
| block_size=4, | ||
| lora_id=None, | ||
| medium="GPU", | ||
| lora_name=None, | ||
| group_idx=group_idx, | ||
| ) | ||
|
|
||
|
|
||
| def _make_block_removed(group_idx: int | None = None) -> BlockRemoved: | ||
| return BlockRemoved( | ||
| block_hashes=[_FAKE_HASH], | ||
| medium="GPU", | ||
| group_idx=group_idx, | ||
| ) | ||
|
|
||
|
|
||
| def test_block_stored_default_group_idx_is_none(): | ||
| """group_idx defaults to None when not provided.""" | ||
| event = _make_block_stored() | ||
| assert event.group_idx is None | ||
|
|
||
|
|
||
| def test_block_removed_default_group_idx_is_none(): | ||
| """group_idx defaults to None when not provided.""" | ||
| event = _make_block_removed() | ||
| assert event.group_idx is None | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("group_idx", [1, 2, 3]) | ||
| def test_block_stored_hash_differs_by_group_idx(group_idx: int): | ||
| """BlockStored events that differ only in group_idx must hash differently.""" | ||
| other_group_idx = group_idx + 1 | ||
| event_a = _make_block_stored(group_idx=group_idx) | ||
| event_b = _make_block_stored(group_idx=other_group_idx) | ||
| assert hash(event_a) != hash(event_b) | ||
|
|
||
|
|
||
| def test_block_stored_hash_same_for_equal_group_idx(): | ||
| """Two BlockStored events with identical fields produce the same hash.""" | ||
| event_a = _make_block_stored(group_idx=1) | ||
| event_b = _make_block_stored(group_idx=1) | ||
| assert hash(event_a) == hash(event_b) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("group_idx", [1, 2, 3]) | ||
| def test_block_removed_hash_differs_by_group_idx(group_idx: int): | ||
| """BlockRemoved events that differ only in group_idx must hash differently.""" | ||
| other_group_idx = group_idx + 1 | ||
| event_a = _make_block_removed(group_idx=group_idx) | ||
| event_b = _make_block_removed(group_idx=other_group_idx) | ||
| assert hash(event_a) != hash(event_b) | ||
|
|
||
|
|
||
| def test_block_removed_hash_same_for_equal_group_idx(): | ||
| """Two BlockRemoved events with identical fields produce the same hash.""" | ||
| event_a = _make_block_removed(group_idx=1) | ||
| event_b = _make_block_removed(group_idx=1) | ||
| assert hash(event_a) == hash(event_b) |
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.