[Bugfix] Keep grid dims for XD-RoPE models on a prefix-cache hit (#53456)

Signed-off-by: Mikhail Kostryukov <mike@triptrack.net>
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
drakosha
2026-08-25 01:14:32 +00:00
committed by GitHub
co-authored by Claude
parent 09fddeb4ce
commit 9bf0d4717e
5 changed files with 32 additions and 4 deletions
+4
View File
@@ -1843,6 +1843,10 @@ class ModelConfig:
def uses_xdrope_dim(self) -> int:
return uses_xdrope_dim(self.hf_config)
@property
def uses_xdrope(self) -> bool:
return self.uses_xdrope_dim > 0
@property
def is_multimodal_model(self) -> bool:
return self.multimodal_config is not None
+5 -4
View File
@@ -216,12 +216,13 @@ def strip_covered_mm_data(
mm_features: list[MultiModalFeatureSpec],
num_computed_tokens: int,
uses_mrope: bool = False,
uses_xdrope: bool = False,
) -> list[MultiModalFeatureSpec]:
"""Drop the tensor data of mm items whose placeholder span is fully inside
a prefix-cache-covered region: no encoder run can be scheduled for them,
so the workers never consume the payload fields. M-RoPE models are the
exception: the worker computes positions for the whole prompt from the
CPU-side metadata fields (e.g. grid dims), so those are kept. The
so the workers never consume the payload fields. M-RoPE and XD-RoPE models
are the exception: the worker computes positions for the whole prompt from
the CPU-side metadata fields (e.g. grid dims), so those are kept. The
scheduler-side ``Request`` keeps the full features."""
if not mm_features or num_computed_tokens == 0:
return mm_features
@@ -233,7 +234,7 @@ def strip_covered_mm_data(
return f
data = None
if uses_mrope:
if uses_mrope or uses_xdrope:
data = MultiModalKwargsItem(
{k: elem for k, elem in f.data.items() if elem.field.keep_on_cpu}
)
+2
View File
@@ -55,6 +55,7 @@ class NewRequestData:
block_ids: tuple[list[int], ...],
prefill_token_ids: list[int] | None = None,
uses_mrope: bool = False,
uses_xdrope: bool = False,
) -> "NewRequestData":
return cls(
req_id=request.request_id,
@@ -63,6 +64,7 @@ class NewRequestData:
request.mm_features,
request.num_computed_tokens,
uses_mrope=uses_mrope,
uses_xdrope=uses_xdrope,
),
sampling_params=request.sampling_params,
pooling_params=request.pooling_params,
+3
View File
@@ -87,6 +87,7 @@ class Scheduler(SchedulerInterface):
self.cache_config = vllm_config.cache_config
self.lora_config = vllm_config.lora_config
self.model_uses_mrope = vllm_config.model_config.uses_mrope
self.model_uses_xdrope = vllm_config.model_config.uses_xdrope
self.kv_cache_config = kv_cache_config
self.kv_events_config = vllm_config.kv_events_config
self.parallel_config = vllm_config.parallel_config
@@ -1223,6 +1224,7 @@ class Scheduler(SchedulerInterface):
req_to_new_blocks[req.request_id].get_block_ids(),
req._all_token_ids,
uses_mrope=self.model_uses_mrope,
uses_xdrope=self.model_uses_xdrope,
)
for req in scheduled_new_reqs
]
@@ -1232,6 +1234,7 @@ class Scheduler(SchedulerInterface):
req,
req_to_new_blocks[req.request_id].get_block_ids(),
uses_mrope=self.model_uses_mrope,
uses_xdrope=self.model_uses_xdrope,
)
for req in scheduled_new_reqs
]