[Bugfix] Avoid global config lookup in sparse indexer forward (#54400)
Signed-off-by: zjy0516 <riverclouds.zhu@qq.com> Co-authored-by: OpenAI Codex <codex@openai.com>
Jiangyun Zhu committed
Aug 30, 2026 at 18:31 UTC
8c51b92654100aa1d698aeef862cad09c8cc5df8
1 file changed
+2
-3
vllm/model_executor/layers/sparse_attn_indexer.py
+2
-3
@@ -769,6 +769,7 @@ class SparseAttnIndexer(CustomOp):
769
# during model construction) and pass them into the custom op, rather
770
# than threading them through per-step metadata.
771
parallel_config = get_current_vllm_config().parallel_config
772
+ self._parallel_config = parallel_config
773
self.dcp_world_size = parallel_config.decode_context_parallel_size
774
self.dcp_rank = get_dcp_group().rank_in_group if self.dcp_world_size > 1 else 0
775
self.use_pcp = parallel_config.prefill_context_parallel_size > 1
@@ -787,9 +788,7 @@ class SparseAttnIndexer(CustomOp):
788
(it's set up in Worker.initialize_from_config, ahead of warmup/serving).
789
"""
790
if self._cp_kv_cache_interleave_size is None:
790
- value = (
791
- get_current_vllm_config().parallel_config.cp_kv_cache_interleave_size
792
- )
791
+ value = self._parallel_config.cp_kv_cache_interleave_size
792
if isinstance(get_forward_context().attn_metadata, dict):
793
self._cp_kv_cache_interleave_size = value
794
return value