DeepSpeed icon indicating copy to clipboard operation
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

Open SendoRay opened this issue 5 days ago • 0 comments

Summary

In deepspeed/comm/torch.py:468,481-503:

  1. TorchBackend.all_gather_base() (line 468): Checks if self.has_allgather_base:, an attribute never initialized in TorchBackend.__init__, unconditionally raising AttributeError.
  2. TorchBackend.all_gather_coalesced() (lines 490-502):
    • Calls get_coalescing_manager unconditionally even when group does not include the current rank (NON_GROUP_MEMBER -> AttributeError: 'int' object has no attribute '_get_backend') or on Gloo (_coalescing_manager unsupported).
    • Waits/returns only reqs[-1] instead of waiting on all handles in reqs (or the coalescing manager work handle).

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_base raises AttributeError: ... has no attribute 'has_allgather_base' on all ranks.
  • all_gather_coalesced(..., group=pg01) raises AttributeError on non-member rank 2 ('int' object has no attribute '_get_backend').

Suggested Fix

  1. Replace self.has_allgather_base with self.has_all_gather_into_tensor() (or check hasattr(torch.distributed.distributed_c10d, "_all_gather_base")).
  2. Guard all_gather_coalesced for NON_GROUP_MEMBER and backend support, and wait on all handles in reqs when async_op=False.

SendoRay avatar Nov 29 '26 06:11 SendoRay