LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective/alg/coll_alg_factory/alg_template/ins_alg_template - ins_temp_all_reduce_mesh_2D_two_shot.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_ALL_REDUCE_2D_MESH_TWO_SHOT
      12              : #define HCCLV2_INS_TEMP_ALL_REDUCE_2D_MESH_TWO_SHOT
      13              : 
      14              : #include "string_util.h"
      15              : #include "ins_alg_template_base.h"
      16              : #include "executor_utils.h"
      17              : 
      18              : namespace Hccl {
      19              : 
      20              : struct SubStageArgs {
      21              :     BufferType inType;
      22              :     BufferType outType;
      23              :     u64 inbaseOff;
      24              :     u64 outbaesOff;
      25              : };
      26              : 
      27              : class InsTempAllReduceMesh2DTwoShot : public InsAlgTemplateBase {
      28              : public:
      29              :     explicit InsTempAllReduceMesh2DTwoShot(
      30              :         const RankId virtualRank, const u32 tempRankSize, const std::vector<std::vector<RankId>>& tempVTopo,
      31              :         const std::map<RankId, u32>& tempVirtRankMap);
      32              :     ~InsTempAllReduceMesh2DTwoShot() override;
      33              : 
      34            0 :     std::string Describe() const override
      35              :     {
      36            0 :         return StringFormat("Template of all reduce 1D mesh with tempRankSize [%u].", tempRankSize_);
      37              :     }
      38              :     HcclResult GenExtIns(
      39              :         const TempFuncs& tempFuncs, const TemplateDataParams& tempAlgParams, const ResLinks& tempLinks,
      40              :         std::vector<InsQuePtr>& tempInsQues);
      41              :     HcclResult CalcRes(AlgTempResReq& tempResReq) override;
      42              :     u32 CalcScratchMultiple(BufferType input, BufferType output) const;
      43              : 
      44              : private:
      45              :     std::vector<std::tuple<QId, QId, u32>>
      46              :     CreateQueNotifiesRequest(u32 queueNum, u32 pairNum, QId masterIdX, QId masterIdY) const;
      47              :     HcclResult BuildSlice(
      48              :         const std::vector<RankId>& rankInfo, const u64 dataSize, const u64 chunkSize,
      49              :         RankSliceInfo& sliceInfoVec) const;
      50              :     HcclResult RunReduceScatter(
      51              :         SubStageArgs& subparams, const RankSliceInfo& sliceInfoVec, const ResLinks& tempLinks,
      52              :         std::vector<InsQuePtr>& tempInsQues, const std::vector<RankId>& rankInfo) const;
      53              :     HcclResult RunAllgather(
      54              :         SubStageArgs& subparams, const RankSliceInfo& sliceInfoVec, const ResLinks& tempLinks,
      55              :         std::vector<InsQuePtr>& tempInsQues, const std::vector<RankId>& rankInfo) const;
      56              :     HcclResult InitInnerParams(
      57              :         const TempFuncs& tempFuncs, const TemplateDataParams& tempAlgParams, const ResLinks& tempLinks,
      58              :         std::vector<InsQuePtr>& tempInsQues);
      59              : 
      60              :     RankSliceInfo XsliceInfoVec_;
      61              :     RankSliceInfo YsliceInfoVec_;
      62              :     RankSliceInfo XsliceInfoVecS2_;
      63              :     RankSliceInfo YsliceInfoVecS2_;
      64              :     u64 XDataSize_{0};
      65              :     u64 YDataSize_{0};
      66              :     u32 M_{0};
      67              :     u32 N_{0};
      68              :     u64 chunkSize_{0};
      69              :     u32 XAlgrankId_{0};
      70              :     u32 YAlgrankId_{0};
      71              :     std::vector<InsQuePtr> XtempInsQues_;
      72              :     std::vector<InsQuePtr> YtempInsQues_;
      73              :     u64 YDataSizeS2_{0};
      74              :     u64 XDataSizeS2_{0};
      75              : };
      76              : 
      77              : } // namespace Hccl
      78              : 
      79              : #endif // !HCCLV2_INS_TEMP_ALL_REDUCE_2D_MESH_TWO_SHOT
        

Generated by: LCOV version 2.0-1