[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
+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}
)