A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 5, 07:15 UTC
[Bugfix] Fix V1 dummy run writing NaN to KV cache null block (#39444)
Signed-off-by: Elvir Crncevic <elvircrn@gmail.com> Co-authored-by: Claude Sonnet 4 <noreply@anthropic.com>
Elvir Crnčević committed
Apr 10, 2026 at 10:09 UTC
ad720aefe909e5a49629944fc45c09f5ee31d857
1 file changed
+7
-1
vllm/v1/worker/gpu_model_runner.py
+7
-1
@@ -5356,12 +5356,18 @@ class GPUModelRunner(
5356
attn_metadata: PerLayerAttnMetadata | None = None
5357
5358
slot_mappings_by_group, slot_mappings = self._get_slot_mappings(
5359
- num_tokens_padded=num_tokens,
5359
+ num_tokens_padded=num_tokens_padded,
5360
num_reqs_padded=num_reqs_padded,
5361
num_tokens_unpadded=num_tokens_unpadded,
5362
ubatch_slices=ubatch_slices_padded,
5363
)
5364
5365
+ # Dummy runs have no real slot assignments — fill with -1 so
5366
+ # concat_and_cache kernels skip the KV write.
5367
+ if slot_mappings_by_group is not None:
5368
+ for sm in slot_mappings_by_group.values():
5369
+ sm.fill_(-1)
5370
+
5371
# _dummy_run shares pinned CPU buffers (seq_lens, query_start_loc,
5372
# etc.) with execute_model. It must participate in the same event
5373
# protocol so that back-to-back dummy/real steps don't overwrite