From 8c51b92654100aa1d698aeef862cad09c8cc5df8 Mon Sep 17 00:00:00 2001 From: Jiangyun Zhu Date: Sun, 30 Aug 2026 18:31:47 +0800 Subject: [PATCH] [Bugfix] Avoid global config lookup in sparse indexer forward (#54400) Signed-off-by: zjy0516 Co-authored-by: OpenAI Codex --- vllm/model_executor/layers/sparse_attn_indexer.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/vllm/model_executor/layers/sparse_attn_indexer.py b/vllm/model_executor/layers/sparse_attn_indexer.py index a87b313f31..bad32f520a 100644 --- a/vllm/model_executor/layers/sparse_attn_indexer.py +++ b/vllm/model_executor/layers/sparse_attn_indexer.py @@ -769,6 +769,7 @@ class SparseAttnIndexer(CustomOp): # during model construction) and pass them into the custom op, rather # than threading them through per-step metadata. parallel_config = get_current_vllm_config().parallel_config + self._parallel_config = parallel_config self.dcp_world_size = parallel_config.decode_context_parallel_size self.dcp_rank = get_dcp_group().rank_in_group if self.dcp_world_size > 1 else 0 self.use_pcp = parallel_config.prefill_context_parallel_size > 1 @@ -787,9 +788,7 @@ class SparseAttnIndexer(CustomOp): (it's set up in Worker.initialize_from_config, ahead of warmup/serving). """ if self._cp_kv_cache_interleave_size is None: - value = ( - get_current_vllm_config().parallel_config.cp_kv_cache_interleave_size - ) + value = self._parallel_config.cp_kv_cache_interleave_size if isinstance(get_forward_context().attn_metadata, dict): self._cp_kv_cache_interleave_size = value return value