in dualpipe/dualpipev.py [0:0]
def _send_backward(self, phase: int) -> None:
if self.forward_only:
return
if (self.is_first_rank and phase == 0) or (self.is_last_rank and phase == 1):
return
chunk_id = self.current_send_b_chunk_id[phase]
self.current_send_b_chunk_id[phase] += 1
tensors = self.input_grad_chunks[phase][chunk_id]
self.input_grad_chunks[phase][chunk_id] = None
comm.append_isend(self.comm_ops, tensors, self.prev_rank if phase == 0 else self.next_rank, self.group)