|
36 | 36 | from dynamo._core import Client, Context |
37 | 37 | from dynamo.common.gms_failover import release_attached_gms_failover_lock |
38 | 38 | from dynamo.common.utils.structural_tag import serialize_structural_tag |
| 39 | +from dynamo.gms_router_policy import ( |
| 40 | + maybe_fetch_gms_placement, |
| 41 | + resolve_env_gms_daemon_socket, |
| 42 | +) |
39 | 43 | from dynamo.health_check import HEALTH_CHECK_KEY |
40 | 44 | from dynamo.llm.exceptions import EngineShutdown |
41 | 45 | from dynamo.logits_processing.examples import HelloWorldLogitsProcessor |
@@ -106,12 +110,20 @@ def _collective_rpc(self, method: str, rpc_tags: list[str]) -> None: |
106 | 110 | """Call TRT-LLM collective_rpc for KV cache sleep/wake.""" |
107 | 111 | rpc = getattr(self._engine.llm, "_collective_rpc", None) |
108 | 112 | if rpc is None: |
109 | | - logger.warning( |
110 | | - "TRT-LLM does not expose _collective_rpc; skipping %s", method |
| 113 | + raise RuntimeError( |
| 114 | + f"TRT-LLM does not expose _collective_rpc; cannot {method} KV cache" |
111 | 115 | ) |
112 | | - return |
113 | 116 |
|
114 | | - rpc(method, args=(rpc_tags,), kwargs={}, non_block=False) |
| 117 | + try: |
| 118 | + rpc(method, args=(rpc_tags,), kwargs={}, non_block=False) |
| 119 | + except NotImplementedError as exc: |
| 120 | + message = str(exc) |
| 121 | + if "MPI collective_rpc only supports model_world_size == 1" in message: |
| 122 | + raise RuntimeError( |
| 123 | + "TRT-LLM MPI executor does not support " |
| 124 | + f"collective_rpc({method}) for multi-rank KV cache control" |
| 125 | + ) from exc |
| 126 | + raise |
115 | 127 |
|
116 | 128 | @staticmethod |
117 | 129 | def _release_gms_weights() -> None: |
@@ -1004,6 +1016,16 @@ async def _generate_locally_impl( |
1004 | 1016 | # Normalize OpenAI format to TRT-LLM internal format |
1005 | 1017 | self._normalize_request_format(request) |
1006 | 1018 |
|
| 1019 | + await maybe_fetch_gms_placement( |
| 1020 | + request, |
| 1021 | + resolve_env_gms_daemon_socket( |
| 1022 | + "GMS_TRTLLM_DAEMON_SOCKET", |
| 1023 | + default_when_cross_node="/tmp/gms.sock", |
| 1024 | + ), |
| 1025 | + logger=logging.getLogger(__name__), |
| 1026 | + request_id=context.id(), |
| 1027 | + ) |
| 1028 | + |
1007 | 1029 | # Setup disaggregated params based on PREFILL/DECODE mode |
1008 | 1030 | ( |
1009 | 1031 | disaggregated_params, |
|
0 commit comments