in dualpipe/dualpipe.py [0:0]
def _send_forward(self, phase: int) -> None:
phase ^= self.is_in_second_half
is_last_stage = (self.is_first_rank and phase == 1) or (self.is_last_rank and phase == 0)
if is_last_stage:
return
chunk_id = self.current_send_f_chunk_id[phase]
self.current_send_f_chunk_id[phase] += 1
tensors = self.output_chunks[phase][chunk_id]
comm.append_isend(self.comm_ops, tensors, self.next_rank if phase == 0 else self.prev_rank, self.group)
if not self.return_outputs:
self.to_free.extend(tensors)