LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective/alg/coll_alg_factory/alg_template/prim_alg_template - temp_reduce_scatter_mesh.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 2 0
Test Date: 2026-08-18 17:47:01 Functions: 0.0 % 1 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              : #ifndef HCCLV2_TEMP_REDUCE_SCATTER_MESH
      12              : #define HCCLV2_TEMP_REDUCE_SCATTER_MESH
      13              : 
      14              : #include "string_util.h"
      15              : 
      16              : #include "alg_template_base_v2.h"
      17              : 
      18              : namespace Hccl {
      19              : 
      20              : class TempReduceScatterMesh : public AlgTemplateBase {
      21              : public:
      22              :     explicit TempReduceScatterMesh(
      23              :         const RankId virtualRank, const u32 tempRankSize, const std::vector<std::vector<RankId>>& tempVTopo,
      24              :         const std::map<RankId, u32>& tempVirtRankMap);
      25              :     ~TempReduceScatterMesh() override;
      26              : 
      27            0 :     std::string Describe() const override
      28              :     {
      29            0 :         return StringFormat("Template of reduce scatter mesh with tempRankSize [%u].", tempRankSize_);
      30              :     }
      31              : 
      32              :     HcclResult GenPrimQue(
      33              :         const TempFuncs& tempFuncs, const RankSliceInfo& sliceInfoVec, const BuffInfo& buffInfo,
      34              :         const ResLinks& tempLinks, std::vector<PrimQuePtr>& tempPrimQues) override;
      35              :     using AlgTemplateBase::CalcSliceInfo;
      36              :     HcclResult CalcSliceInfo(
      37              :         const AllignInfo& allignInfo, const bool forAllReduce, const u64 dataSize,
      38              :         RankSliceInfo& sliceInfoVec) override;
      39              :     HcclResult
      40              :     CalcSliceInfoAllReduce(const AllignInfo& allignInfo, const u64 dataSize, RankSliceInfo& sliceInfoVec) const;
      41              :     using AlgTemplateBase::CalcRes;
      42              :     HcclResult CalcRes(const bool forAllReduce, AlgTempResReq& tempResReq, u32& requiredScratchMultiplier) override;
      43              :     using AlgTemplateBase::CalcResDetour;
      44              :     HcclResult CalcResDetour(
      45              :         const bool forAllReduce, const RankGraph* rankGraph, AlgTempResReq& tempResReq,
      46              :         u32& requiredScratchMultiplier) override;
      47              :     HcclResult CalcResDetour(
      48              :         const bool forAllReduce, ConnectedLinkMgr* linkMgr, AlgTempResReq& tempResReq,
      49              :         u32& requiredScratchMultiplier) override;
      50              : 
      51              : private:
      52              :     HcclResult CalcResLinks(AlgTempResReq& tempResReq);
      53              : 
      54              :     HcclResult RunMesh(
      55              :         const u32 myAlgRank, const std::vector<RankId>& vTopo, const RankSliceInfo& sliceInfoVec,
      56              :         const ResLinks& tempLinks, std::vector<PrimQuePtr>& tempPrimQues);
      57              : 
      58              :     HcclResult RunIndividualPeerDetour(
      59              :         const RankId neighborRank, const SliceInfo& sendReduceSlice, const SliceInfo& recvReduceSlice,
      60              :         const ResLinks& tempLinks, std::vector<PrimQuePtr>& detourPrimQues);
      61              :     HcclResult RunIndividualPeer(
      62              :         const RankId neighborRank, const LinkData& neighborLinkData, const SliceInfo& sendReduceSlice,
      63              :         const SliceInfo& recvReduceSlice, PrimQuePtr currQue) const;
      64              :     HcclResult GetSendRecvRedLinks(
      65              :         const RankId neighborRank, const ResLinks& tempLinks,
      66              :         std::vector<std::vector<LinkDataIterator>>& sendRecvLinks) const;
      67              : 
      68              :     std::unique_ptr<PrimGroup> RunSendRecvReduce(
      69              :         const RankId neighborRank, const LinkData& sendLinkData, const LinkData& recvLinkData,
      70              :         const SliceInfo& currSendReduceSlice, const SliceInfo& currRecvReduceSlice) const;
      71              : 
      72              :     HcclResult PostCopyOffload(const RankSliceInfo& sliceInfoVec, std::vector<PrimQuePtr>& tempPrimQues);
      73              : 
      74              :     u32 majorQueNum_ = 0;
      75              :     u32 queNumPerNeighbor_ = 1;
      76              : };
      77              : 
      78              : } // namespace Hccl
      79              : 
      80              : #endif // !HCCLV2_TEMP_REDUCE_SCATTER_MESH
        

Generated by: LCOV version 2.0-1