LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective/alg/coll_alg_factory/alg_ccu_context/all_reduce - ccu_context_all_reduce_mesh2d_two_shot_mem2mem.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 1 0
Test Date: 2026-08-18 17:47:01 Functions: 0.0 % 2 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_CCU_CONTEXT_ALL_REDUCE_MESH_2D_TWO_SHOT_MEM2MEM_H_
      12              : #define HCCLV2_CCU_CONTEXT_ALL_REDUCE_MESH_2D_TWO_SHOT_MEM2MEM_H_
      13              : 
      14              : #include <vector>
      15              : #include <ios>
      16              : #include "log.h"
      17              : #include "ccu_context_alg_base.h"
      18              : #include "ccu_datatype.h"
      19              : #include "ccu_assist.h"
      20              : 
      21              : namespace Hccl {
      22              : 
      23              : class CcuContextAllReduceMeshTwoShotMem2Mem2D : public CcuContextAlgBase {
      24              : public:
      25              :     CcuContextAllReduceMeshTwoShotMem2Mem2D(
      26              :         const CcuCtxArg& arg, const std::vector<CcuTransport*>& transports, const CcuTransportGroup& group);
      27            0 :     ~CcuContextAllReduceMeshTwoShotMem2Mem2D() override {}
      28              : 
      29              :     void Algorithm() override;
      30              :     std::vector<uint64_t> GeneArgs(const CcuTaskArg& arg) override;
      31              : 
      32              : private:
      33              :     void InitVariables();
      34              :     void LoadArgs();
      35              :     void SyncAll(int ckeIdx);
      36              :     void PreSync();
      37              :     void GetSliceOffsetAndGoSize(uint64_t currentSliceRankIdx, uint64_t currStepSliceType);
      38              :     void DoAxisSync(uint32_t signalIdx);
      39              :     void DoGroupSync(int ckeIdx, uint16_t selfBit, uint16_t allBit);
      40              :     void DoGroupReduce(std::vector<CcuRep::Variable>& srcAddr, CcuRep::Variable& dstAddr);
      41              :     void AllGatherStep(CcuRep::Variable& srcAddr, std::vector<CcuRep::Variable>& dstAddr);
      42              :     void CalMeshChunkSlices(
      43              :         uint64_t totalSize, uint64_t sliceNum, std::vector<uint64_t>& slices, std::vector<uint64_t>& offsets);
      44              :     std::vector<uint64_t> dimSize_;
      45              :     uint32_t axisId_{0};
      46              :     DataType dataType_;
      47              :     DataType outputDataType_;
      48              : 
      49              :     uint32_t otherAxisId_{0};
      50              :     std::vector<uint64_t> myRankIdxInAxis_;
      51              :     uint64_t myRankIdxInCurrentAxis_{0};
      52              :     uint64_t currentAxisRankSize_{0};
      53              :     uint64_t myRankIdxInOtherAxis_{0};
      54              :     uint64_t otherAxisRankSize_{0};
      55              : 
      56              :     uint16_t selfBit_{0};
      57              :     uint16_t allBit_{0};
      58              : 
      59              :     CcuRep::Variable curOffset_;
      60              :     CcuRep::Variable curSliceSize_;
      61              : 
      62              :     std::vector<CcuRep::Variable> inputAddr_;
      63              :     std::vector<CcuRep::Variable> outputAddr_;
      64              :     std::vector<CcuRep::Variable> token_;
      65              : 
      66              :     CcuRep::Variable normalRankXSliceSize_;
      67              :     CcuRep::Variable normalRankYSliceSize_;
      68              :     CcuRep::Variable lastRankXSliceSize_;
      69              :     CcuRep::Variable lastRankYSliceSize_;
      70              : 
      71              :     std::vector<CcuRep::Variable> normalXSlices_;
      72              :     std::vector<CcuRep::Variable> normalXOffsets_;
      73              :     std::vector<CcuRep::Variable> normalYSlices_;
      74              :     std::vector<CcuRep::Variable> normalYOffsets_;
      75              :     std::vector<CcuRep::Variable> lastXSlices_;
      76              :     std::vector<CcuRep::Variable> lastXOffsets_;
      77              :     std::vector<CcuRep::Variable> lastYSlices_;
      78              :     std::vector<CcuRep::Variable> lastYOffsets_;
      79              :     std::vector<CcuRep::Variable> curOffsetVec_;
      80              :     std::vector<CcuRep::Variable> curSliceVec_;
      81              : 
      82              :     GroupOpSize normalRankXGoSize_;
      83              :     GroupOpSize normalRankYGoSize_;
      84              :     GroupOpSize lastRankXGoSize_;
      85              :     GroupOpSize lastRankYGoSize_;
      86              :     GroupOpSize currGoSize_;
      87              : 
      88              :     std::string currAxisSignalName_;
      89              :     std::string otherAxisSignalName_;
      90              :     CcuRep::MaskSignal currAxisSignal_;
      91              :     CcuRep::MaskSignal otherAxisSignal_;
      92              : 
      93              :     // 算法模板运行时的参数
      94              :     std::vector<CcuRep::Memory> tmpAddrList_;
      95              :     CcuRep::Memory tmpAddr_;
      96              : };
      97              : } // namespace Hccl
      98              : 
      99              : #endif // HCCLV2_CCU_CONTEXT_ALL_REDUCE_MESH_2D_TWO_SHOT_MEM2MEM_H_
        

Generated by: LCOV version 2.0-1