Skip to content

Commit e158837

Browse files
[https://nvbugs/6435642][fix] handle session reuse worker registration (NVIDIA#16444)
1 parent b602fa6 commit e158837

3 files changed

Lines changed: 28 additions & 3 deletions

File tree

tensorrt_llm/executor/proxy.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,18 @@ def mpi_done_callback(future: concurrent.futures.Future):
573573
raise RuntimeError(
574574
"Executor worker returned error") from ready_signal
575575

576-
if isinstance(self.mpi_session, MpiPoolSession) and len(status) == 3:
576+
self._register_worker_processes(status)
577+
578+
def _register_worker_processes(self, status: tuple) -> None:
579+
"""Register identities returned by locally spawned MPI workers.
580+
581+
Test session reuse replaces this module's ``MpiPoolSession`` class
582+
reference with a factory, so identify pool-backed sessions by excluding
583+
the external communication session types.
584+
"""
585+
if not isinstance(
586+
self.mpi_session,
587+
(MpiCommSession, RemoteMpiCommSessionClient)) and len(status) == 3:
577588
worker_process_identities: List[WorkerProcessIdentity] = status[2]
578589
self._worker_process_monitor.register(worker_process_identities)
579590

tests/integration/test_lists/waives.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,7 @@ test_e2e.py::test_multi_nodes_eval[MiniMax-M2-tp16-mmlu] SKIP (https://nvbugs/63
447447
test_e2e.py::test_multi_nodes_eval[MiniMax-M3-tp16-mmlu] SKIP (https://nvbugs/6373561)
448448
test_e2e.py::test_ptp_quickstart_advanced_deepseek_r1_w4afp8_8gpus[DeepSeek-R1-W4AFP8-DeepSeek-R1/DeepSeek-R1-W4AFP8] SKIP (https://nvbugs/5836830)
449449
unittest/_torch/misc/test_share_tensor.py::TestShareTensor::test_share_tensor_different_dtypes SKIP (https://nvbugs/6418021)
450-
unittest/_torch/modeling -k "modeling_out_of_tree" SKIP (https://nvbugs/6426847)
451450
unittest/_torch/modeling -k "modeling_qwen" SKIP (https://nvbugs/6433376)
452-
unittest/_torch/modeling/test_modeling_out_of_tree.py::TestOutOfTree::test_llm_api[True] SKIP (https://nvbugs/6426847)
453451
unittest/_torch/modeling/test_modeling_qwen3_5_vl.py::test_qwen35_dense_vl_resolves_mamba_ssm_cache_dtype SKIP (https://nvbugs/6433376)
454452
unittest/_torch/modules/moe/test_moe_backend.py::test_moe_backend[act=Relu2-e60_k4_h2048_i1408-seq=8-dtype=torch.bfloat16-backend=TRTLLM-quant=NVFP4-routing=Renormalize] SKIP (https://nvbugs/5989912)
455453
unittest/_torch/modules/moe/test_moe_module.py::test_configurable_moe_single_gpu -k "TRTLLM" SKIP (https://nvbugs/6464169)

tests/unittest/executor/test_proxy_fast_death.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616

1717
import asyncio
1818
import queue as _queue
19+
from unittest.mock import Mock
1920

2021
import pytest
2122

2223
from tensorrt_llm.executor import EngineDeadError
24+
from tensorrt_llm.executor import proxy as proxy_module
2325
from tensorrt_llm.executor.proxy import GenerationExecutorProxy
2426
from tensorrt_llm.executor.result import GenerationResult
2527

@@ -97,6 +99,20 @@ def test_handle_worker_death_broadcasts_event_driven():
9799
assert proxy._error_queue.get_nowait() is cause
98100

99101

102+
def test_register_worker_processes_with_session_reuse_factory(monkeypatch):
103+
"""Session reuse replaces proxy.MpiPoolSession with a factory function."""
104+
pool_session = object()
105+
monkeypatch.setattr(proxy_module, "MpiPoolSession", lambda n_workers: pool_session)
106+
proxy = _bare_proxy()
107+
proxy.mpi_session = proxy_module.MpiPoolSession(1)
108+
proxy._worker_process_monitor = Mock()
109+
identities = [object()]
110+
111+
proxy._register_worker_processes((proxy.READY_SIGNAL, None, identities))
112+
113+
proxy._worker_process_monitor.register.assert_called_once_with(identities)
114+
115+
100116
def test_result_step_raises_on_engine_dead():
101117
res = GenerationResult.__new__(GenerationResult)
102118
res.queue = _queue.Queue()

0 commit comments

Comments
 (0)