[Bug] TorchDist subgroup broadcast/gather passes group-local root=0/dst=0 as global rank, crashing non-zero subgroups and hanging tp_cp_broadcast
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Lĩnh vực
- backend, distributed-systems
Hướng nghiên cứu
Read tensorrt_llm/_torch/distributed/communicator.py, especially TorchDist subgroup gather and broadcast methods and the CUDA object-collective helpers. First trace how callers pass group-local roots, then run a multi-process test with nonzero subgroups; done means gather and broadcast work across the described TP, PP, and CP layouts without rank errors or hangs. The issue links open pull request #23034, so work may already be underway.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
In tensorrt_llm/_torch/distributed/communicator.py (commit 1aa0192e62d219599930f125ada7067081fb44b7, present at HEAD), TorchDist subgroup broadcast and gather collectives pass group-local root=0 / dst=0 directly as PyTorch global ranks and compare torch.distributed.get_rank() == root/dst:
# tensorrt_llm/_torch/distributed/communicator.py:1741-1801, 1839-1884
@log_op
def tp_gather(self, obj, dst=0):
global_rank = torch.distributed.get_rank()
if isinstance(obj, torch.Tensor):
if global_rank == dst:
output_list = [
torch.empty_like(obj)
for _ in range(self.mapping.tp_group_pg.size())
]
else:
output_list = None
dist.gather(obj, output_list, dst=dst, group=self.mapping.tp_group_pg)
return output_list
elif (vote_pg := self._cuda_obj_pg("tp")) is not None:
return self._cuda_gather_object(obj, vote_pg, dst)
else:
...
if global_rank == dst:
output_list = [None] * self.mapping.tp_group_pg.size()
else:
output_list = None
dist.gather_object(obj, output_list, dst=dst, group=self.mapping.tp_group_pg)
return output_list
@log_op
def tp_broadcast(self, obj, root=0, **kwargs):
if isinstance(obj, torch.Tensor):
dist.broadcast(obj, src=root, group=self.mapping.tp_group_pg)
return obj
elif (vote_pg := self._cuda_obj_pg("tp")) is not None:
return self._cuda_broadcast_object(obj, vote_pg, root)
else:
ret = [obj]
torch.distributed.broadcast_object_list(
ret, src=root, group=self.mapping.tp_group_pg, device=torch.device("cpu")
)
return ret[0]
The identical pattern appears in cp_broadcast (1788-1801), pp_gather (1840-1867), pp_broadcast (1870-1883), _cuda_gather_object (1361-1368, is_dst = torch.distributed.get_rank() == dst), and _cuda_broadcast_object (1398-1479, is_root = torch.distributed.get_rank() == root and dist.broadcast(..., src=root, group=pg)).
Unlike MPIDist (914-935), where root=0/dst=0 on tp_comm/pp_comm/cp_comm is group-local rank 0 (and callers such as AutoTuner._broadcast_cache_data at autotuner.py:3179, py_executor.py:282, py_executor.py:8059-8076, and glm_5_3_flash_nvfp4__sm_10x__tp4/modeling.py:402 rely on group-local root=0), PyTorch's dist.broadcast(..., group=pg), dist.broadcast_object_list(..., group=pg), dist.gather(..., group=pg), and dist.gather_object(..., group=pg) require src/dst to be a global rank belonging to pg.
Consequently, under any 2D/3D parallelism where a subgroup excludes global rank 0 (PP > 1, TP > 1; TP > 1, CP > 1; or ADP + PP > 1):
- Every non-zero subgroup (e.g., PP stage >= 1 TP groups
[2, 3], TP rank >= 1 PP groups[1, 3]) immediately crashes withValueError: Global rank 0 is not part of group. - In
Distributed.tp_cp_broadcast(obj, root=0)underPP=1, TP=2, CP=2(tp0=[0, 2], tp1=[1, 3], cp0=[0, 1], cp1=[2, 3]), ranks1and3crash intp_broadcast, rank2succeeds intp_broadcastand crashes incp_broadcast, and rank0succeeds intp_broadcastand hangs insidecp_broadcastwaiting on crashed rank1.
Affected Location
- Repository:
NVIDIA/TensorRT-LLM(1aa0192e62d219599930f125ada7067081fb44b7, present atHEAD) - File & lines:
tensorrt_llm/_torch/distributed/communicator.py:1361-1368,1398-1479,1742-1883(TorchDist._cuda_gather_object,_cuda_broadcast_object,tp_gather,tp_broadcast,cp_broadcast,pp_gather,pp_broadcast)
Minimal Standalone Reproduction
import datetime, types
import torch.distributed as dist
import torch.multiprocessing as mp
from tensorrt_llm._torch.distributed.communicator import TorchDist
def worker(rank, port):
dist.init_process_group(
"gloo", init_method=f"tcp://127.0.0.1:{port}", rank=rank, world_size=4,
timeout=datetime.timedelta(seconds=3),
)
# Example 1: PP=2, TP=2 -> tp0=[0,1], tp1=[2,3], pp0=[0,2], pp1=[1,3]
tp0, tp1 = dist.new_group([0, 1]), dist.new_group([2, 3])
pp0, pp1 = dist.new_group([0, 2]), dist.new_group([1, 3])
mapping = types.SimpleNamespace(
tp_size=2, cp_size=1, pp_size=2,
tp_group_pg=tp0 if rank in (0, 1) else tp1,
pp_group_pg=pp0 if rank in (0, 2) else pp1,
cp_group_pg=None,
)
td = TorchDist(mapping)
print(rank, td.pp_broadcast(rank in (0, 1), root=0))
print(rank, td.tp_cp_broadcast({"tactic": rank}, root=0))
Observed behavior / output (4-process Gloo execution against verbatim communicator.py):
- Under
PP=2, TP=2:- Ranks
1and3(pp1=[1, 3]) immediately raiseValueError: Global rank 0 is not part of groupinpp_broadcast(..., root=0)andpp_gather(..., dst=0). - Ranks
2and3(tp1=[2, 3]) immediately raiseValueError: Global rank 0 is not part of groupintp_cp_broadcast(..., root=0)andtp_gather(..., dst=0).
- Ranks
- Under
PP=1, TP=2, CP=2:tp_broadcast(..., root=0)crashes on ranks1and3(tp1=[1, 3]);cp_broadcast(..., root=0)crashes on ranks2and3(cp1=[2, 3]).- Calling
td.tp_cp_broadcast({"k": rank}, root=0)crashes ranks1, 2, 3withValueError: Global rank 0 is not part of groupwhile rank0hangs insidecp_broadcast(alive_after_timeout = [True, False, False, False]).
- Note:
_cuda_broadcast_objectand_cuda_gather_objectshare the exact sametorch.distributed.get_rank() == root/dstand rawsrc=root/dst=dstbug on the CUDA object-collective fast path (hardware-gated for live CUDA/NCCL execution).
Suggested Fix
- Resolve group-local
root/dstto the corresponding global rank viaglobal_root = dist.get_global_rank(pg, root)(andglobal_dst = dist.get_global_rank(pg, dst)) before passingsrc/dsttodist.broadcast,dist.broadcast_object_list,dist.gather,dist.gather_object,_cuda_broadcast_object, and_cuda_gather_object. - In
tp_gather,pp_gather,_cuda_gather_object, and_cuda_broadcast_object, check group membership via group-local rank (dist.get_rank(pg) == local_rootortorch.distributed.get_rank() == global_root) rather than comparing global rank directly against0. - Add a multi-GPU unit test covering
PP=2, TP=2andPP=1, TP=2, CP=2(extendingtest_ops.py, which currently only testsPP=1, TP=1, CP=2).
- Ngôn ngữ chính
- Python
- Star
- 15.2k
- Fork
- 3k
- Merge trung bình
- 2 ngày 21 giờ
- Pull request đã merge (30 ngày)
- 477
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của NVIDIA/TensorRT-LLM
-
Bug: AttributeError: 'GptOssConfig' object has no attribute 'rope_scaling_factor' with transformers >= 5.xCó thể đã có người làm @NimaVaziri đã nhận hôm nay. Đang mởPytorch
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NVIDIA/TensorRT-LLM#23406 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Inference runtime Windows
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
NVIDIA/TensorRT-LLM#23394 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: MMLU subsampling changes when evaluators are interleavedCó thể đã có người làm @LeNeLeNeWo đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
NVIDIA/TensorRT-LLM#23273 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Trace-replay Pareto window includes the drain when sessions finish out of admission orderCó thể đã có người làm @sbeierle đã nhận 3 ngày trước. Đang mởTesting
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
NVIDIA/TensorRT-LLM#23077 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
LongBench V2 blog command breaks on inline comments after continuationsCó thể đã có người làm @ddlw đã nhận 25 ngày trước. Đang mởDoc
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
NVIDIA/TensorRT-LLM#21879 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của NVIDIA/TensorRT-LLM
Issue tương tự
-
[Resource]: SpaicelyĐang mởresource-submission validation-passed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
hesreallyhim/awesome-claude-code#3875 · 1 bình luận ·
-
[Bug]: Ajax Pro login issueĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
bvis/aegis-hass#725 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
datasektionen/cashflow#468 ·
-
dont call alembic upgrade until we check whether or not the cache DB has an alembic version stampĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
#1643 unrecoverable split: 1 digest with a 403 — two earlier captures of the same URL are real 200sĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Robin-IA/Congressional-Letters-Dev#1684 ·
Maintainer thường phản hồi trong vòng 1 ngày