[Bugfix][Multimodal] Handle prefix-covered items in SHM worker cache (#54994)

Signed-off-by: waizuichougou <2082431897@qq.com>
Signed-off-by: Nick Hill <nickhill123@gmail.com>
Co-authored-by: Nick Hill <nickhill123@gmail.com>
This commit is contained in:
waizuichougou
2026-09-03 06:39:34 +00:00
committed by GitHub
co-authored by Nick Hill
parent 27a94d1ce4
commit 3f1af35e01
4 changed files with 115 additions and 4 deletions
+23
View File
@@ -139,3 +139,26 @@ def test_strip_covered_mm_data_mrope() -> None:
assert set(stripped[1].data.keys()) == {"pixel_values", "image_grid_thw"}
# original list is not mutated
assert set(covered.data.keys()) == {"pixel_values", "image_grid_thw"}
def test_strip_covered_mm_data_shm_address_item() -> None:
"""SHM address descriptors must survive stripping even when covered: the
worker needs the address to resolve the payload and to acknowledge the
sender's writer reference. Stripping it crashed the SHM receiver cache on
the second identical request (vllm-project/vllm#54994)."""
address_item = MultiModalKwargsItem(
{
"address": MultiModalFieldElem(data=4096, field=MultiModalBatchedField()),
"monotonic_id": MultiModalFieldElem(data=7, field=MultiModalBatchedField()),
}
)
feature = MultiModalFeatureSpec(
data=address_item,
mm_position=PlaceholderRange(offset=0, length=100),
identifier="shm_item",
modality="image",
)
stripped = strip_covered_mm_data([feature], num_computed_tokens=250)
assert stripped[0].data is address_item