DeepSpeed
DeepSpeed copied to clipboard
[Bug] TorchBackend.all_gather_base references nonexistent self.has_allgather_base and all_gather_coalesced only waits reqs[-1] / crashes on Gloo & non-member ranks
Summary
In deepspeed/comm/torch.py:468,481-503:
TorchBackend.all_gather_base()(line 468): Checksif self.has_allgather_base:, an attribute never initialized inTorchBackend.__init__, unconditionally raisingAttributeError.TorchBackend.all_gather_coalesced()(lines 490-502):- Calls
get_coalescing_managerunconditionally even whengroupdoes not include the current rank (NON_GROUP_MEMBER->AttributeError: 'int' object has no attribute '_get_backend') or on Gloo (_coalescing_managerunsupported). - Waits/returns only
reqs[-1]instead of waiting on all handles inreqs(or the coalescing manager work handle).
- Calls
Affected Location
- Repository:
deepspeedai/DeepSpeed(master,deepspeed/comm/torch.py:468,481-503)
Minimal Standalone Reproduction
3-rank Gloo group with subgroup pg01 = dist.new_group([0, 1]):
all_gather_baseraisesAttributeError: ... has no attribute 'has_allgather_base'on all ranks.all_gather_coalesced(..., group=pg01)raisesAttributeErroron non-member rank 2 ('int' object has no attribute '_get_backend').
Suggested Fix
- Replace
self.has_allgather_basewithself.has_all_gather_into_tensor()(or checkhasattr(torch.distributed.distributed_c10d, "_all_gather_base")). - Guard
all_gather_coalescedforNON_GROUP_MEMBERand backend support, and wait on all handles inreqswhenasync_op=False.