Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions tensorrt_llm/_torch/pyexecutor/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
# isort: off
from tensorrt_llm.llmapi.llm_args import (
CacheTransceiverConfig, CapacitySchedulerPolicy, EagleDecodingConfig,
KvCacheCompressionConfig, KvCacheConfig, MTPDecodingConfig, PeftCacheConfig,
SamplerType, SchedulerConfig, SparseAttentionConfig, SpeculativeConfig,
TorchLlmArgs, WaitingQueuePolicy)
KVEventsConfig, KvCacheCompressionConfig, KvCacheConfig, MTPDecodingConfig,
PeftCacheConfig, SamplerType, SchedulerConfig, SparseAttentionConfig,
SpeculativeConfig, TorchLlmArgs, WaitingQueuePolicy)
# isort: on
from tensorrt_llm.logger import logger
from tensorrt_llm.lora_helper import (LoraConfig,
Expand Down Expand Up @@ -1142,6 +1142,9 @@ def _create_kv_cache_manager(
execution_stream=self._execution_stream,
layer_mask=spec_dec_layer_mask,
is_disagg=self._is_disagg,
kv_events_config=None
if estimating_kv_cache or model_engine.is_draft_model else
self._llm_args.kv_cache_config.kv_events_config,
)

if not self._skip_est:
Expand Down Expand Up @@ -1858,7 +1861,8 @@ def _create_kv_cache_manager(
num_kv_heads: Optional[Union[int, List[int]]] = None,
head_dim: Optional[int] = None,
kv_cache_type=None,
is_disagg: bool = False) -> KVCacheManager:
is_disagg: bool = False,
kv_events_config: Optional[KVEventsConfig] = None) -> KVCacheManager:
"""
Returns:
A KVCacheManager instance for the given model engine or model config
Expand Down Expand Up @@ -1989,6 +1993,12 @@ def _create_kv_cache_manager(
manager_extra_kwargs = {}
if issubclass(kv_cache_manager_cls, KVCacheManagerV2):
manager_extra_kwargs["enable_stats"] = enable_kv_cache_stats
manager_extra_kwargs["kv_events_config"] = kv_events_config
elif kv_events_config is not None and kv_events_config.enable_kv_cache_events:
logger.warning(
"kv_cache_config.kv_events_config is set but native KV event "
"publishing requires KV cache manager V2; events will not be "
f"published for {kv_cache_manager_cls.__name__}.")
if issubclass(kv_cache_manager_cls, MambaHybridCacheManagerV2):
manager_extra_kwargs["is_disagg"] = is_disagg

Expand Down
Loading