TensorRT-LLM icon indicating copy to clipboard operation
TensorRT-LLM copied to clipboard

[Bug]: MPIPoolExecutor is not defined with ENABLE_MULTI_DEVICE=OFF

Open xiaozhang8tuo opened this issue 1 month ago • 1 comments

Description

When TensorRT-LLM is built with ENABLE_MULTI_DEVICE=OFF, the default single-GPU launch path fails with:

NameError: name 'MPIPoolExecutor' is not defined

Cause

In tensorrt_llm/llmapi/mpi_session.py, MPIPoolExecutor is imported only inside if ENABLE_MULTI_DEVICE:, but GenerationExecutorProxy -> MpiPoolSession._start_mpi_pool uses it on the default startup path.

Workaround

Set TLLM_WORKER_USE_SINGLE_PROCESS=1, which uses the single-process worker path in executor.py.

Environment

  • TensorRT-LLM v1.3.0rc28
  • Wheel built with ENABLE_MULTI_DEVICE=OFF;BUILD_NCCL_EXTENSIONS=OFF;ENABLE_UCX=OFF;BUILD_DEEP_EP=OFF
  • CUDA 13.2, Python 3.10, PyTorch 2.13.0+cu130
  • Single H200, PyTorch backend

Notes

Follow-up requested in #20580, which fixes mpi_allgather for the same build configuration. This issue is not addressed by that PR.

xiaozhang8tuo avatar Oct 20 '26 01:10 xiaozhang8tuo

I checked current main at ec782566f50ad9548e99818fa1d74c7c66cc572d; the default classic executor still reaches MpiPoolSession with ENABLE_MULTI_DEVICE=OFF. I also checked #20580 and #13737: the former explicitly leaves startup out of scope, and the latter does not change this executor launch path. The proposed commit is on my fork; no upstream PR is open yet.

I have prepared a focused proposal: when MPI is disabled and no session is supplied, automatically select the existing in-process TP1 worker, which is the path used by the reported TLLM_WORKER_USE_SINGLE_PROCESS=1 workaround. Reject a multi-rank request at this factory boundary and preserve supplied sessions and explicit Ray/RPC selection. The change also forwards the supplied postprocessing configuration into the in-process worker instead of dropping it.

There are 19 CPU routing/handoff cases registered in l0_cpu.yml. Using source-extracted factory methods with substituted configuration/launch dependencies, six cases fail on the baseline and all nineteen pass with the proposal. This is not matching-build or inference validation: my normal-import run stops at missing native libraries.

Would an engineer consider the automatic in-process fallback acceptable for this build configuration, or should the fix retain a separate spawned worker? The fallback changes process isolation and can affect streaming performance, so I would like to settle that scope before requesting code review. Simply reusing the existing ProcessPoolExecutorSession currently encounters its unimplemented abstract abort method and would need broader lifecycle work.

If the in-process approach is acceptable, matching-build startup, generation, streaming and shutdown validation would still be needed. @xiaozhang8tuo, would your ENABLE_MULTI_DEVICE=OFF H200 environment be available for that check once the scope is agreed?

codebreaker77 avatar Oct 21 '26 17:10 codebreaker77