LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective/alg/coll_alg_factory/alg_template/aiv_alg_template - aiv_temp_scatter_mesh_1D.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 54 0
Test Date: 2026-08-18 17:47:01 Functions: 0.0 % 5 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 "hccl_aiv_utils.h"
      12              : #include "aiv_ins.h"
      13              : #include "aiv_temp_scatter_mesh_1D.h"
      14              : #include "executor_utils.h"
      15              : 
      16              : namespace Hccl {
      17              : 
      18            0 : AivTempScatterMesh1D::AivTempScatterMesh1D(
      19              :     const RankId virtualRank, const u32 tempRankSize, const std::vector<std::vector<RankId>>& tempVTopo,
      20            0 :     const std::map<RankId, u32>& tempVirtRankMap)
      21            0 :     : AivAlgTemplateBase(virtualRank, tempRankSize, tempVTopo, tempVirtRankMap)
      22            0 : {}
      23              : 
      24            0 : AivTempScatterMesh1D::~AivTempScatterMesh1D() {}
      25              : 
      26            0 : HcclResult AivTempScatterMesh1D::CalcRes(AlgTempResReq& tempResReq)
      27              : {
      28            0 :     tempResReq.queNum = 1;
      29            0 :     tempResReq.streamNum = tempResReq.queNum;
      30            0 :     HCCL_INFO("[CalcRes] tempResReq.queNum[%u]", tempResReq.queNum);
      31            0 :     CHK_RET(CalcResLinksMesh(myRank_, tempRankSize_, tempVTopo_, linkNumBtwPeers_, tempResReq));
      32            0 :     return HcclResult::HCCL_SUCCESS;
      33              : }
      34              : 
      35            0 : HcclResult AivTempScatterMesh1D::GenExtIns(
      36              :     const TempFuncs& tempFuncs, const TemplateDataParams& templateDataParams, const ResLinks& tempLinks,
      37              :     std::vector<InsQuePtr>& tempInsQues)
      38              : {
      39            0 :     HCCL_INFO("[AivTempScatterMesh1D] GenExtIns start");
      40            0 :     CHK_PRT_RET(tempInsQues.empty(), HCCL_ERROR("[AivTempScatterMesh1D] empty queue"), HcclResult::HCCL_E_INTERNAL);
      41            0 :     CHK_PTR_NULL(tempInsQues[0]);
      42            0 :     std::vector<LinkData> allLinks;
      43            0 :     for (auto iter = tempLinks.begin(); iter != tempLinks.end(); ++iter) {
      44            0 :         allLinks.emplace_back(iter->second.at(0));
      45              :     }
      46              : 
      47            0 :     IncSliceId(); // 自动增长sliceId,传入aivTag
      48              : 
      49            0 :     AivOpArgs aivScatterArgs;
      50            0 :     aivScatterArgs.cmdType = HcclCMDType::HCCL_CMD_SCATTER;
      51            0 :     aivScatterArgs.input = templateDataParams.buffInfo.inBuffBaseOff;
      52            0 :     aivScatterArgs.output = templateDataParams.buffInfo.outBuffBaseOff;
      53            0 :     aivScatterArgs.rank = u32(myRank_);
      54            0 :     aivScatterArgs.rankSize = tempRankSize_;
      55            0 :     aivScatterArgs.count = templateDataParams.sliceSize / DataTypeSizeGet(dataType_);
      56            0 :     aivScatterArgs.dataType = dataType_;
      57            0 :     aivScatterArgs.op = reduceOp_;
      58            0 :     aivScatterArgs.root = root_;
      59            0 :     aivScatterArgs.aivTag = sliceId_; // 传入aivTag,Lauch时重新组装为aivTag
      60            0 :     aivScatterArgs.isOpBase = (tempFuncs.opMode == OpMode::OPBASE);
      61            0 :     aivScatterArgs.xRankSize = tempVTopo_[0].size();
      62            0 :     aivScatterArgs.yRankSize = 0;
      63            0 :     aivScatterArgs.zRankSize = 0;
      64            0 :     for (u32 i = 0; i < tempVTopo_[0].size(); i++) {
      65            0 :         aivScatterArgs.topo_[i] = tempVTopo_[0][i];
      66              :     }
      67            0 :     if (tempVTopo_.size() > 1) {
      68            0 :         aivScatterArgs.yRankSize = tempVTopo_[1].size();
      69            0 :         for (u32 i = 0; i < tempVTopo_[1].size(); i++) {
      70            0 :             aivScatterArgs.topo_[TOPO_LEN_Y_OFFSET + i] = tempVTopo_[1][i];
      71              :         }
      72              :     }
      73            0 :     if (tempVTopo_.size() == MAX_DIM_NUM) {
      74            0 :         aivScatterArgs.zRankSize = tempVTopo_[MAX_DIM_NUM - 1].size();
      75            0 :         for (u32 i = 0; i < tempVTopo_[MAX_DIM_NUM - 1].size(); i++) {
      76            0 :             aivScatterArgs.topo_[TOPO_LEN_Z_OFFSET + i] = tempVTopo_[MAX_DIM_NUM - 1][i];
      77              :         }
      78              :     }
      79              : 
      80            0 :     aivScatterArgs.inputSliceStride = templateDataParams.inputSliceStride;
      81            0 :     aivScatterArgs.outputSliceStride = templateDataParams.outputSliceStride;
      82            0 :     aivScatterArgs.repeatNum = templateDataParams.repeatNum;
      83            0 :     aivScatterArgs.inputRepeatStride = templateDataParams.inputRepeatStride;
      84            0 :     aivScatterArgs.outputRepeatStride = templateDataParams.outputRepeatStride;
      85              : 
      86            0 :     std::unique_ptr<Instruction> aivInsScatterMesh1D = std::make_unique<AivInstruction>(allLinks, aivScatterArgs);
      87              : 
      88            0 :     tempInsQues[0]->Append(std::move(aivInsScatterMesh1D));
      89              : 
      90            0 :     HCCL_INFO("[AivTempScatterMesh1D] GenExtIns finished");
      91            0 :     return HcclResult::HCCL_SUCCESS;
      92            0 : }
      93              : 
      94              : } // namespace Hccl
        

Generated by: LCOV version 2.0-1