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-07-28 12:11:00 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(const RankId virtualRank, const u32 tempRankSize,
      23              :                                    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(const TempFuncs &tempFuncs, const RankSliceInfo &sliceInfoVec, const BuffInfo &buffInfo,
      33              :                           const ResLinks &tempLinks, std::vector<PrimQuePtr> &tempPrimQues) override;
      34              :     using AlgTemplateBase::CalcSliceInfo;
      35              :     HcclResult CalcSliceInfo(const AllignInfo &allignInfo, const bool forAllReduce, const u64 dataSize,
      36              :                              RankSliceInfo &sliceInfoVec) override;
      37              :     HcclResult CalcSliceInfoAllReduce(const AllignInfo &allignInfo, const u64 dataSize, RankSliceInfo &sliceInfoVec) const;
      38              :     using AlgTemplateBase::CalcRes;
      39              :     HcclResult CalcRes(const bool forAllReduce, AlgTempResReq &tempResReq, u32 &requiredScratchMultiplier) override;
      40              :     using AlgTemplateBase::CalcResDetour;
      41              :     HcclResult CalcResDetour(const bool forAllReduce, const RankGraph *rankGraph, AlgTempResReq &tempResReq,
      42              :                              u32 &requiredScratchMultiplier) override;
      43              :     HcclResult CalcResDetour(const bool forAllReduce, ConnectedLinkMgr *linkMgr, AlgTempResReq &tempResReq,
      44              :                              u32 &requiredScratchMultiplier) override;
      45              : 
      46              : private:
      47              :     HcclResult CalcResLinks(AlgTempResReq &tempResReq);
      48              : 
      49              :     HcclResult RunMesh(const u32 myAlgRank, const std::vector<RankId> &vTopo, const RankSliceInfo &sliceInfoVec,
      50              :                        const ResLinks &tempLinks, std::vector<PrimQuePtr> &tempPrimQues);
      51              : 
      52              :     HcclResult RunIndividualPeerDetour(const RankId neighborRank, const SliceInfo &sendReduceSlice,
      53              :                                        const SliceInfo &recvReduceSlice, const ResLinks &tempLinks,
      54              :                                        std::vector<PrimQuePtr> &detourPrimQues);
      55              :     HcclResult RunIndividualPeer(const RankId neighborRank, const LinkData &neighborLinkData,
      56              :                                  const SliceInfo &sendReduceSlice, const SliceInfo &recvReduceSlice,
      57              :                                  PrimQuePtr currQue) const;
      58              :     HcclResult GetSendRecvRedLinks(const RankId neighborRank, const ResLinks &tempLinks,
      59              :                                    std::vector<std::vector<LinkDataIterator>> &sendRecvLinks) const;
      60              : 
      61              :     std::unique_ptr<PrimGroup> RunSendRecvReduce(const RankId neighborRank, const LinkData &sendLinkData,
      62              :                                                  const LinkData &recvLinkData, const SliceInfo &currSendReduceSlice,
      63              :                                                  const SliceInfo &currRecvReduceSlice) const;
      64              : 
      65              :     HcclResult PostCopyOffload(const RankSliceInfo &sliceInfoVec, std::vector<PrimQuePtr> &tempPrimQues);
      66              : 
      67              :     u32 majorQueNum_       = 0;
      68              :     u32 queNumPerNeighbor_ = 1;
      69              : };
      70              : 
      71              : } // namespace Hccl
      72              : 
      73              : #endif // !HCCLV2_TEMP_REDUCE_SCATTER_MESH
        

Generated by: LCOV version 2.0-1