LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective/alg/coll_alg_factory/alg_ccu_context/reduce - ccu_context_reduce_mesh1d_two_shot_mem2mem.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 3 0
Test Date: 2026-08-04 10:52:23 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_REDUCE_MESH_1D_TWO_SHOT_MEM2MEM_H_
      12              : #define HCCLV2_CCU_CONTEXT_REDUCE_MESH_1D_TWO_SHOT_MEM2MEM_H_
      13              : 
      14              : #include <vector>
      15              : 
      16              : #include <ios>
      17              : #include "log.h"
      18              : #include "ccu_ctx.h"
      19              : #include "ccu_datatype.h"
      20              : 
      21              : namespace Hccl {
      22              : 
      23              : class CcuContextReduceMeshTwoShotMem2Mem1D : public CcuContext {
      24              : public:
      25              :     CcuContextReduceMeshTwoShotMem2Mem1D(const CcuCtxArg &arg, const std::vector<CcuTransport *> &transports,
      26              :                                                const CcuTransportGroup &group);
      27            0 :     ~CcuContextReduceMeshTwoShotMem2Mem1D() override
      28            0 :     {
      29            0 :     }
      30              : 
      31              :     void                  Algorithm() override;
      32              :     std::vector<uint64_t> GeneArgs(const CcuTaskArg &arg) override;
      33              : 
      34              : protected:
      35              :     void InitResource();
      36              :     void LoadArgs();
      37              :     void PreSync();
      38              :     void PostSync();
      39              :     void DoRepeatReduceTwoShot();
      40              :     void ReduceRmtToLoc(const std::vector<CcuRep::Variable> &srcAddr, const CcuRep::Variable &dstAddr);
      41              :     void BcastLocToRmt(const CcuRep::Variable &srcAddr, const std::vector<CcuRep::Variable> &dstAddr);
      42              : 
      43              : private:
      44              :     uint64_t                      rankSize_{0};
      45              :     uint32_t                      rankId_{0};
      46              :     uint32_t                      rootId_{0};
      47              :     DataType                      dataType_;
      48              :     DataType                      outputDataType_;
      49              :     ReduceOp                      reduceOp_;
      50              : 
      51              :     std::vector<CcuRep::Variable> input_;
      52              :     std::vector<CcuRep::Variable> output_;
      53              :     std::vector<CcuRep::Variable> token_;
      54              :     std::vector<CcuRep::Variable> scratch_;
      55              : 
      56              :     CcuRep::Variable              normalSliceSize_;
      57              :     CcuRep::Variable              lastSliceSize_;
      58              :     CcuRep::Variable              mySliceSize_;
      59              :     std::vector<CcuRep::Variable> sliceOffset_;
      60              :     std::vector<CcuRep::Variable> len_;
      61              :     CcuRep::Variable              isInputOutputEqual_;
      62              :     CcuRep::Variable              sliceSize_;
      63              :     CcuRep::MaskSignal            locMask_;
      64              : 
      65              :     CcuRep::Memory              srcMem_;
      66              :     CcuRep::Memory              dstMem_;
      67              :     std::vector<CcuRep::Memory> reduceScatterSrc_;
      68              :     std::vector<CcuRep::Memory> reduceScatterDst_;
      69              :     std::vector<CcuRep::Memory> gatherSrc_;
      70              :     std::vector<CcuRep::Memory> gatherDst_;
      71              : 
      72              :     uint16_t selfBit_{0};
      73              :     uint16_t allBit_{0};
      74              :     GroupOpSize localGoSize_;
      75              : 
      76              :     std::string GetLoopBlockTag(std::string loopType, int32_t index);
      77              :     void CreateReduceLoop(uint32_t size, DataType dataType, DataType outputDataType,
      78              :         ReduceOp opType);
      79              :     void ReduceLoopGroup(CcuRep::Memory outDstOrg, CcuRep::Memory srcOrg,
      80              :         std::vector<CcuRep::Memory> &scratchOrg, GroupOpSize goSize, DataType dataType, DataType outputDataType,
      81              :         ReduceOp opType);
      82              :     const std::string LOOP_BLOCK_TAG{"_local_copy_reduce_loop_"};
      83              : };
      84              : } // namespace Hccl
      85              : 
      86              : #endif // HCCLV2_CCU_CONTEXT_ALL_REDUCE_MESH_1D_H_
        

Generated by: LCOV version 2.0-1