From 081d499ff36e8a5ba936820525e6c03f8ea8fd65 Mon Sep 17 00:00:00 2001 From: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com> Date: Thu, 16 Jul 2026 04:42:42 -0700 Subject: [PATCH] [nvbugs/6462303][fix] Use unpatched class alias for MpiPoolSession isinstance check The recently added `isinstance(self.mpi_session, MpiPoolSession)` check in proxy._start_executor_workers relied on the module-level `MpiPoolSession` name. However, the test-suite session-reuse infra (tests/test_common/ session_reuse.py) monkey-patches that same module-level symbol to a factory *function* for pool reuse. isinstance() against a non-class then raises "TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union", breaking every LLM(...) construction while the pool cache is active. Bind the real class under a private alias that the test infra never patches, and use it for the isinstance check. Construction still goes through the patched `MpiPoolSession` name, so pool reuse continues to work. Also remove the now-obsolete waiver. Signed-off-by: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com> --- tensorrt_llm/executor/proxy.py | 11 ++++++++--- tests/integration/test_lists/waives.txt | 1 - 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tensorrt_llm/executor/proxy.py b/tensorrt_llm/executor/proxy.py index 11451bad5b67..850950871dc5 100644 --- a/tensorrt_llm/executor/proxy.py +++ b/tensorrt_llm/executor/proxy.py @@ -28,8 +28,12 @@ from tensorrt_llm.logger import logger from .._utils import customized_gc_thresholds, mpi_rank, nvtx_range_debug -from ..llmapi.mpi_session import (MpiCommSession, MpiPoolSession, MpiSession, - RemoteMpiCommSessionClient, +# Alias unaffected by test-infra monkey-patching of ``MpiPoolSession`` (which +# replaces the module-level name with a factory function for pool reuse). +from ..llmapi.mpi_session import MpiCommSession +from ..llmapi.mpi_session import MpiPoolSession +from ..llmapi.mpi_session import MpiPoolSession as _RealMpiPoolSession +from ..llmapi.mpi_session import (MpiSession, RemoteMpiCommSessionClient, validate_session_world_size) from ..llmapi.tracer import enable_llm_tracer, get_tracer, global_tracer from ..llmapi.utils import (AsyncQueue, ManagedThread, _SyncQueue, @@ -573,7 +577,8 @@ def mpi_done_callback(future: concurrent.futures.Future): raise RuntimeError( "Executor worker returned error") from ready_signal - if isinstance(self.mpi_session, MpiPoolSession) and len(status) == 3: + if isinstance(self.mpi_session, + _RealMpiPoolSession) and len(status) == 3: worker_process_identities: List[WorkerProcessIdentity] = status[2] self._worker_process_monitor.register(worker_process_identities) diff --git a/tests/integration/test_lists/waives.txt b/tests/integration/test_lists/waives.txt index 4b6a59b069ec..e9cbbea16ff5 100644 --- a/tests/integration/test_lists/waives.txt +++ b/tests/integration/test_lists/waives.txt @@ -376,7 +376,6 @@ full:RTX_PRO_6000_Blackwell_Server_Edition/perf/test_perf.py::test_perf[quant:w4 full:sm100/examples/test_nemotron.py::test_llm_nemotron_3_8b_1gpu[bfloat16-fp8] SKIP (megatron-core 0.8 is not supported in python 3.12) full:sm100/unittest/bindings SKIP (Disable for Blackwell) kv_cache/test_kv_cache_v2_scheduler.py::TestKVCacheV2Llama::test_chunked_prefill SKIP (https://nvbugs/6428002) -kv_cache/test_kv_cache_v2_scheduler.py::TestKVCacheV2Llama::test_eviction_with_block_reuse SKIP (https://nvbugs/6462303) llmapi/test_llm_api_pytorch_bart.py::test_bart_pytorch_generate_encoder_decoder_end_to_end[bf16-kv-v1-cuda-graph-on-greedy-tp2-bart-large-cnn] SKIP (https://nvbugs/6463812) llmapi/test_llm_api_pytorch_moe_lora.py::test_mixtral_moe_routed_expert_fp8_multi_lora_varying_ranks[cudagraph] SKIP (https://nvbugs/6463829) llmapi/test_llm_api_pytorch_moe_lora.py::test_mixtral_moe_routed_expert_fp8_multi_lora_varying_ranks[eager] SKIP (https://nvbugs/6463829)