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 11, 17:30 UTC
[bug] Fix "Current vLLM config is not set." warnings when FlashInfer attention is used (#30241)
Signed-off-by: Po-Han Huang <pohanh@nvidia.com>
Po-Han Huang (NVIDIA) committed
Dec 11, 2025 at 03:18 UTC
eea41804a4b4f84a80f63375ce2e77668d70bda5
2 files changed
+6
-1
vllm/utils/flashinfer.py
+4
-1
@@ -269,6 +269,8 @@ def supports_trtllm_attention() -> bool:
269
270
def force_use_trtllm_attention() -> bool | None:
271
"""
272
+ This function should only be called during initialization stage when vllm config
273
+ is set.
274
Return `None` if --attention-config.use_trtllm_attention is not set,
275
return `True` if TRTLLM attention is forced to be used,
276
return `False` if TRTLLM attention is forced to be not used.
@@ -296,11 +298,12 @@ def use_trtllm_attention(
298
kv_cache_dtype: str,
299
q_dtype: torch.dtype,
300
is_prefill: bool,
301
+ # None means auto-detection, True means force on, False means force off
302
+ force_use_trtllm: bool | None = None,
303
has_sinks: bool = False,
304
has_spec: bool = False,
305
) -> bool:
306
"""Return `True` if TRTLLM attention is used."""
303
- force_use_trtllm = force_use_trtllm_attention()
307
308
# CLI argument is set to 0 - respect it
309
if force_use_trtllm is not None and not force_use_trtllm:
vllm/v1/attention/backends/flashinfer.py
+2
@@ -429,6 +429,7 @@ class FlashInferMetadataBuilder(AttentionMetadataBuilder[FlashInferMetadata]):
429
super().__init__(kv_cache_spec, layer_names, vllm_config, device)
430
self.cache_config = vllm_config.cache_config
431
self.model_config = vllm_config.model_config
432
+ self.attention_config = vllm_config.attention_config
433
self._workspace_buffer = None
434
self._prefill_wrapper: (
435
BatchPrefillWithPagedKVCacheWrapper | BatchDCPPrefillWrapper | None
@@ -779,6 +780,7 @@ class FlashInferMetadataBuilder(AttentionMetadataBuilder[FlashInferMetadata]):
780
self.cache_dtype,
781
self.q_data_type,
782
is_prefill=True,
783
+ force_use_trtllm=self.attention_config.use_trtllm_attention,
784
has_sinks=self.has_sinks,
785
has_spec=uses_spec_reorder,
786
)