feat: support multi machine for offline inference.#1863
feat: support multi machine for offline inference.#1863weizhehuang0827 wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for multi-machine offline inference in xLLM. It adds documentation, implements a coordinated shutdown mechanism via a new Shutdown RPC to gracefully terminate remote worker processes, and introduces LLMAssistantMaster and VLMAssistantMaster to manage assistant nodes. Feedback on the changes highlights a critical resource leak and process hang in DistManager::shutdown_remote_workers(), where only the first worker of each remote machine is shut down, leaving other worker processes orphaned on those nodes. Removing the modulo check to send the shutdown signal to all remote workers is recommended to ensure clean termination.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Description
支持 Python 离线推理的多机部署。当单台机器设备数不足以加载模型时,可将模型分布在多台机器上进行推理。
核心改动:
ShutdownRPC,允许驱动节点在推理完成后远程关闭辅助节点进程LLMAssistantMaster/VLMAssistantMaster,辅助节点构造LLM后自动进入等待循环nnodes、node_rank、master_node_addr参数区分驱动/辅助角色require_multi_node_master_addr和is_offline_worker_node工具函数进行参数校验Related Issues
N/A
Change Type
Pull Request Checklist
PR Title and Commit Messages
<type>: <subject>.Pre-commit Checks
pre-commitby runningpip install pre-commitor an equivalent command.pre-commit install.pre-commit run --all-filesand fixed any reported issues.Self Review
.agents/skills/code-review/references/custom-code-style.md, especially code written or assisted by AI.mainbranch.Build and Test Coverage
python setup.py build testhas passed on a CUDA machine.python setup.py build testhas passed on an NPU machine.python setup.py build testhas passed on an MLU machine.Reviewer Notes
ShutdownRPC 目前仅供多机离线推理使用,在线服务场景不会触发LLM对象,无需调用generate()或定义 prompts;node_rank>0时初始化完成后自动进入等待,驱动节点llm.finish()时通过shutdown_remote_workers()远程关闭