@@ -1593,30 +1593,21 @@ flagcxResult_t flagcxC2cPlanner::execute(const void *sendbuff, void *recvbuff,
15931593 cclAdaptors[flagcxCCLAdaptorDevice]->groupEnd ();
15941594
15951595 if (commOp_ == flagcxCommOpAllGather) {
1596- int nSteps_ = comm_->nclusters ;
1597- refreshFunc_.run (recvTmpBuff, datatype, stream);
15981596 flagcxHeteroGroupStart ();
15991597 for (int i = 0 ; i < heteroFuncPipeline_[0 ].size (); ++i) {
16001598 heteroFuncPipeline_[0 ][i].run (sendTmpBuff, recvTmpBuff, datatype, comm_,
16011599 stream);
16021600 }
16031601 flagcxHeteroGroupEnd ();
16041602 deviceAdaptor->streamSynchronize (stream);
1605- for (int s = 1 ; s < nSteps_ - 1 ; ++s) {
1606- cclAdaptors[flagcxCCLAdaptorDevice]->groupStart ();
1607- for (int i = 0 ; i < homoInterFuncPipeline_[s].size (); ++i) {
1608- homoInterFuncPipeline_[s][i].run (
1609- recvTmpBuff, recvTmpBuff, datatype, redOp_,
1610- comm_->globalrank2homorank [root], comm_, stream);
1611- }
1612- cclAdaptors[flagcxCCLAdaptorDevice]->groupEnd ();
16131603
1614- // execute refresh func
1615- // todo: support pipeline steps in refresh func
1616- refreshFunc_.run (recvTmpBuff, datatype, stream);
1604+ flagcxStream_t het_stream;
1605+ deviceAdaptor->streamCreate (&het_stream);
16171606
1618- // execute postHomoFunc
1607+ for ( int s = 1 ; s < nSteps_ - 1 ; ++s) {
16191608 cclAdaptors[flagcxCCLAdaptorDevice]->groupStart ();
1609+ // no need for refresh func in allgather
1610+ // execute postHomoFunc
16201611 for (int i = 0 ; i < postHomoFuncPipeline_[s].size (); ++i) {
16211612 postHomoFuncPipeline_[s][i].run (recvTmpBuff, recvbuff, datatype, redOp_,
16221613 comm_->globalrank2homorank [root], comm_,
@@ -1627,31 +1618,24 @@ flagcxResult_t flagcxC2cPlanner::execute(const void *sendbuff, void *recvbuff,
16271618 flagcxHeteroGroupStart ();
16281619 for (int i = 0 ; i < heteroFuncPipeline_[s].size (); ++i) {
16291620 heteroFuncPipeline_[s][i].run (sendTmpBuff, recvTmpBuff, datatype, comm_,
1630- stream );
1621+ het_stream );
16311622 }
16321623 flagcxHeteroGroupEnd ();
16331624 deviceAdaptor->streamSynchronize (stream);
1625+ deviceAdaptor->streamSynchronize (het_stream);
16341626 }
1635- cclAdaptors[flagcxCCLAdaptorDevice]->groupStart ();
1636- for (int i = 0 ; i < homoInterFuncPipeline_[nSteps_ - 1 ].size (); ++i) {
1637- homoInterFuncPipeline_[nSteps_ - 1 ][i].run (
1638- recvTmpBuff, recvTmpBuff, datatype, redOp_,
1639- comm_->globalrank2homorank [root], comm_, stream);
1640- }
1641- cclAdaptors[flagcxCCLAdaptorDevice]->groupEnd ();
16421627
1643- // execute refresh func
1644- // todo: support pipeline steps in refresh func
1645- refreshFunc_.run (recvTmpBuff, datatype, stream);
1646-
1647- // execute postHomoFunc
1628+ // last pipeline
16481629 cclAdaptors[flagcxCCLAdaptorDevice]->groupStart ();
1630+ // execute postHomoFunc
16491631 for (int i = 0 ; i < postHomoFuncPipeline_[nSteps_ - 1 ].size (); ++i) {
16501632 postHomoFuncPipeline_[nSteps_ - 1 ][i].run (
16511633 recvTmpBuff, recvbuff, datatype, redOp_,
16521634 comm_->globalrank2homorank [root], comm_, stream);
16531635 }
16541636 cclAdaptors[flagcxCCLAdaptorDevice]->groupEnd ();
1637+
1638+ deviceAdaptor->streamDestroy (het_stream);
16551639 } else {
16561640 for (int i = 0 ; i < heteroAndHomoInterFuncLoops_; ++i) {
16571641 // execute refreshFunc
0 commit comments