LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective/alg/coll_alg_factory/alg_template/ins_alg_template - ins_temp_scatter_mesh_2d.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_INS_TEMP_SCATTER_MESH_2D
      12              : #define HCCLV2_INS_TEMP_SCATTER_MESH_2D
      13              : 
      14              : #include "string_util.h"
      15              : 
      16              : #include "ins_alg_template_base.h"
      17              : #include "executor_utils.h"
      18              : 
      19              : namespace Hccl {
      20              : 
      21              : class InsTempScatterMesh2D : public InsAlgTemplateBase {
      22              : public:
      23              :     explicit InsTempScatterMesh2D(
      24              :         const RankId virtualRank, const u32 tempRankSize, const std::vector<std::vector<RankId>>& tempVTopo,
      25              :         const std::map<RankId, u32>& tempVirtRankMap);
      26              :     ~InsTempScatterMesh2D() override;
      27              : 
      28            0 :     std::string Describe() const override
      29              :     {
      30            0 :         return StringFormat("Instruction based Template of scatter mesh 2D with tempRankSize [%u].", tempRankSize_);
      31              :     }
      32              : 
      33              :     HcclResult GenExtIns(
      34              :         TempFuncs& tempFuncs, TemplateDataParams& tempAlgParams, ResLinks& tempResLinks,
      35              :         std::vector<InsQuePtr>& tempInsQues);
      36              :     HcclResult CalcRes(AlgTempResReq& tempResReq) override;
      37              :     u32 CalcScratchMultiple(BufferType inBuffType, BufferType outBuffType) const;
      38              : 
      39              : private:
      40              :     HcclResult PreDataCopy(const TemplateDataParams& tempAlgParams, std::vector<InsQuePtr>& tempInsQues) const;
      41              :     HcclResult PostDataCopy(const TemplateDataParams& tempAlgParams, std::vector<InsQuePtr>& tempInsQues) const;
      42              : 
      43              :     HcclResult RootMeshSend(
      44              :         TemplateDataParams& tempAlgParams, ResLinks& tempResLinks, const std::vector<RankId> vTopo,
      45              :         const u32 xyRankSize, u32 rankDistX, u32 rankDistY, u64 dataOffSet, u64 tranDataSize,
      46              :         std::vector<InsQuePtr>& tempInsQues) const;
      47              :     HcclResult RankRecvFromRoot(
      48              :         TemplateDataParams& tempAlgParams, ResLinks& tempResLinks, const u32 xyRankSize, u32 rankDist, u64 dataOffSet,
      49              :         u64 tranDataSize, std::vector<InsQuePtr>& tempInsQues) const;
      50              :     HcclResult RunDataCombine(
      51              :         TemplateDataParams& tempAlgParams, ResLinks& tempResLinks, u64 tranDataSizeX, u64 tranDataSizeY,
      52              :         std::vector<InsQuePtr>& tempInsQues);
      53              : 
      54              :     HcclResult DataCombineSend(
      55              :         const TemplateDataParams& tempAlgParams, ResLinks& tempResLinks, const std::vector<RankId> vTopo,
      56              :         u64 dataOffSet, u64 tranDataSize, std::vector<InsQuePtr>& tempInsQues) const;
      57              :     HcclResult DataCombineRecv(
      58              :         const TemplateDataParams& tempAlgParams, LinkData link, u64 dataOffSet, u64 tranDataSize,
      59              :         InsQuePtr queue) const;
      60              : 
      61              :     HcclResult GetRankId(u32 xRank, u32 yRank, u32& rank) const;
      62              : 
      63              :     HcclResult
      64              :     SendDirect(TemplateDataParams& tempAlgParams, InsQuePtr queue, const LinkData link, u32 remoteRank) const;
      65              :     HcclResult SendTransit(
      66              :         const TemplateDataParams& tempAlgParams, InsQuePtr queue, const LinkData link, u32 remoteRank, u32 xyRankSize,
      67              :         u32 rankDistX, u32 rankDistY, u64 xyOffSet, u64 tranDataSize) const;
      68              :     HcclResult
      69              :     RecvDirect(TemplateDataParams& tempAlgParams, InsQuePtr queue, const LinkData link, u32 remoteRank) const;
      70              :     HcclResult RecvTransit(
      71              :         const TemplateDataParams& tempAlgParams, InsQuePtr queue, const LinkData link, u32 remoteRank, u32 xyRankSize,
      72              :         u32 rankDist, u64 xyOffSet, u64 tranDataSize) const;
      73              : 
      74              :     u32 queNum_{0};
      75              :     u32 xQueNum_{0};
      76              :     u32 yQueNum_{0};
      77              : 
      78              :     u32 xRankSize_{0};
      79              :     u32 yRankSize_{0};
      80              : 
      81              :     u32 myRankX_{0};
      82              :     u32 myRankY_{0};
      83              :     u32 rootX_{0};
      84              :     u32 rootY_{0};
      85              : 
      86              :     std::vector<InsQuePtr> xInsQues_;
      87              :     std::vector<InsQuePtr> yInsQues_;
      88              : 
      89              :     bool enableInterRankCounterNotify_{false};
      90              : };
      91              : 
      92              : } // namespace Hccl
      93              : 
      94              : #endif // HCCLV2_INS_TEMP_SCATTER_MESH_2D
        

Generated by: LCOV version 2.0-1