LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective/alg/coll_alg_factory/alg_template/ins_alg_template - ins_temp_reduce_scatter_aicpu_reduce_mesh_2D.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 40 0
Test Date: 2026-07-28 12:11:00 Functions: 0.0 % 7 0

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2025 Huawei Technologies Co., Ltd.
       3              :  * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
       4              :  * CANN Open Software License Agreement Version 2.0 (the "License").
       5              :  * Please refer to the License for details. You may not use this file except in compliance with the License.
       6              :  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
       7              :  * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
       8              :  * See LICENSE in the root of the software repository for the full text of the License.
       9              :  */
      10              : 
      11              : #include "log.h"
      12              : 
      13              : #include "alg_data_trans_wrapper.h"
      14              : #include "ins_temp_reduce_scatter_aicpu_reduce_mesh_2D.h"
      15              : 
      16              : namespace Hccl {
      17            0 : InsTempReduceScatterAicpuReduceMesh2D::InsTempReduceScatterAicpuReduceMesh2D(const RankId virtualRank, const u32 tempRankSize,
      18              :                                    const std::vector<std::vector<RankId>> &tempVTopo,
      19            0 :                                    const std::map<RankId, u32>            &tempVirtRankMap)
      20            0 :     : InsAlgTemplateBase(virtualRank, tempRankSize, tempVTopo, tempVirtRankMap), alltoallMesh2D_(myRank_, tempRankSize_, tempVTopo_, tempVirtRankMap_)
      21              : {
      22            0 : }
      23              : 
      24            0 : InsTempReduceScatterAicpuReduceMesh2D::~InsTempReduceScatterAicpuReduceMesh2D()
      25              : {
      26            0 : }
      27              : 
      28            0 : HcclResult InsTempReduceScatterAicpuReduceMesh2D::CalcRes(AlgTempResReq &tempResReq)
      29              : {
      30            0 :     CHK_RET(alltoallMesh2D_.CalcRes(tempResReq));
      31            0 :     return HcclResult::HCCL_SUCCESS;
      32              : }
      33              : 
      34            0 : u32 InsTempReduceScatterAicpuReduceMesh2D::CalcScratchMultiple(BufferType inBuffType, BufferType outBuffType) const
      35              : {   
      36              :     (void) inBuffType;
      37              :     (void) outBuffType;
      38            0 :     const u32 executor2DTemp = 4;
      39            0 :     return tempRankSize_ * executor2DTemp;
      40              : }
      41              : 
      42            0 : HcclResult InsTempReduceScatterAicpuReduceMesh2D::RunAicpuLocalReduce(const TemplateDataParams &templateDataParams, std::vector<InsQuePtr> &tempInsQues)
      43              : {      
      44            0 :     u64 baseOffset = templateDataParams.sliceSize * tempRankSize_;
      45            0 :     DataSlice dataSlice = DataSlice(BufferType::SCRATCH, baseOffset, templateDataParams.sliceSize);
      46            0 :     for (u32 rankId = 1; rankId < tempRankSize_; rankId++) {
      47            0 :         DataSlice addSlice = DataSlice(BufferType::SCRATCH, baseOffset + templateDataParams.sliceSize * rankId, templateDataParams.sliceSize);
      48            0 :         AicpuReduce(tempInsQues[0], addSlice, dataSlice, dataType_, redOp_);
      49              :     }
      50            0 :     DataSlice outputSlice = DataSlice(BufferType::OUTPUT, templateDataParams.buffInfo.inBuffBaseOff, templateDataParams.sliceSize);
      51            0 :     LocalCopy(tempInsQues[0], dataSlice, outputSlice);
      52            0 :     return HCCL_SUCCESS;
      53              : }
      54              : 
      55            0 : HcclResult InsTempReduceScatterAicpuReduceMesh2D::GenExtIns(const TempFuncs &tempFuncs, const TemplateDataParams &templateDataParams,
      56              :                         const ResLinks &tempLinks, std::vector<InsQuePtr> &tempInsQues)
      57              : {
      58            0 :     HCCL_INFO("[InsTempReduceScatterAicpuReduceMesh2D] Run start");
      59            0 :     if (tempVTopo_[0].size() == 1) {
      60            0 :         return HcclResult::HCCL_SUCCESS;
      61              :     }
      62            0 :     opMode_              = tempFuncs.opMode;
      63            0 :     queNum_ = tempVTopo_[0].size() + tempVTopo_[1].size();
      64            0 :     CHK_PRT_RET(queNum_ > tempInsQues.size(),
      65              :         HCCL_ERROR("[CollAlgFactory] [InsTempReduceScatterAicpuReduceMesh2D] Rank [%d], requiredQue Error.", myRank_),
      66              :         HcclResult::HCCL_E_INTERNAL);
      67              : 
      68            0 :     TempFuncs alltoallFuncs = tempFuncs;
      69            0 :     TemplateDataParams alltoallParams = templateDataParams;
      70            0 :     alltoallFuncs.isBottom = false;
      71            0 :     alltoallParams.buffInfo.outBuffBaseOff = templateDataParams.sliceSize * tempRankSize_;
      72            0 :     alltoallParams.outputSliceStride = templateDataParams.sliceSize;
      73            0 :     alltoallMesh2D_.SetDataType(dataType_);
      74            0 :     alltoallMesh2D_.GenExtIns(alltoallFuncs, alltoallParams, tempLinks, tempInsQues);
      75            0 :     StreamSync(tempInsQues);
      76            0 :     RunAicpuLocalReduce(templateDataParams, tempInsQues);
      77            0 :     HCCL_INFO("[InsTempReduceScatterAicpuReduceMesh2D] Run finished");
      78            0 :     return HCCL_SUCCESS;
      79            0 : }
      80              : 
      81              : } // namespace Hccl
        

Generated by: LCOV version 2.0-1