LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective/alg/coll_alg_factory/alg_ccu_context/reduce - ccu_context_reduce_mesh2d_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_2D_MEM2MEM_H_
      12              : #define HCCLV2_CCU_CONTEXT_REDUCE_MESH_2D_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              : constexpr int      INPUT_XN_ID   = 1;
      23              : constexpr int      TOKEN_XN_ID   = 2;
      24              : constexpr int      CKE_IDX_0     = 0;
      25              : constexpr int      CKE_IDX_1     = 1;
      26              : constexpr int      CKE_IDX_2     = 2;
      27              : constexpr int      CKE_IDX_3     = 3;
      28              : constexpr int      CKE_IDX_4     = 4;
      29              : constexpr uint64_t CCU_MS_SIZE   = 4096;
      30              : constexpr uint64_t LOCAL_COPY_MS = 8;
      31              : constexpr int      X_AXIS_ID     = 0;
      32              : constexpr int      Y_AXIS_ID     = 1;
      33              : 
      34              : class CcuContextReduceMeshMem2Mem2D : public CcuContextAlgBase {
      35              : public:
      36              :     CcuContextReduceMeshMem2Mem2D(const CcuCtxArg &arg, const std::vector<CcuTransport *> &transports,
      37              :                                   const CcuTransportGroup &group);
      38            0 :     ~CcuContextReduceMeshMem2Mem2D() override
      39            0 :     {
      40            0 :     }
      41              : 
      42              :     void                  Algorithm() override;
      43              :     std::vector<uint64_t> GeneArgs(const CcuTaskArg &arg) override;
      44              : 
      45              : private:
      46              :     void InitResources();
      47              :     void LoadArgs();
      48              :     void PreSync();
      49              :     void PostSync(uint32_t signalIndex);
      50              :     void AxisSync(uint32_t signalIndex);
      51              :     void ReduceStep1();
      52              :     void ReduceStep2();
      53              :     std::vector<uint64_t> CalMeshChunkSlice(uint64_t dataSize, uint64_t sliceNum); // for mesh-chunk
      54              : 
      55              :     std::vector<uint64_t> dimSize_;
      56              :     uint32_t              axisId_{0}; // 0 : X轴, 1 : Y轴
      57              : 
      58              :     std::vector<uint32_t> dimId_;        // 本rank所在行或列的编号
      59              :     uint32_t              localId_{0};   // 本chip所在行或列的编号
      60              :     uint32_t              localSize_{0}; // 本rank所在行或列的总rank数
      61              : 
      62              :     std::vector<uint32_t>         rootDimId_; // root所在行或列的编号
      63              :     uint32_t                      rootId_{0}; // 当rankid == rootid时,为root节点 则跳过write操作
      64              :     DataType                      dataType_;
      65              :     DataType                      outputDataType_;
      66              :     ReduceOp                      reduceOp_;
      67              :     std::vector<CcuRep::Variable> input_;
      68              :     CcuRep::Variable              output_;
      69              :     std::vector<CcuRep::Variable> token_;
      70              :     CcuRep::Variable              xAxisSize_;
      71              :     CcuRep::Variable              yAxisSize_;
      72              :     CcuRep::Variable              yAxisOffset_;
      73              :     CcuRep::MaskSignal            locMask_;
      74              : 
      75              :     GroupOpSize xAxisGroupOpSize_;
      76              :     GroupOpSize yAxisGroupOpSize_;
      77              :     GroupOpSize curGoSize_; // for loop-group local copy
      78              :     // variables for mesh-chunk
      79              :     std::vector<CcuRep::Variable> xChunkSize_; // for xsliceszie
      80              :     std::vector<CcuRep::Variable> yChunkSize_; // for ysliceszie
      81              :     std::vector<CcuRep::Variable> chunkSize_;  // for current axis
      82              :     CcuRep::Variable              chunkOffset_;
      83              : 
      84              :     // 跨轴同步信号
      85              :     std::string        localAxisSignalName_;
      86              :     std::string        anotherAxisSignalName_;
      87              :     CcuRep::MaskSignal localAxisSignal_;
      88              :     CcuRep::MaskSignal anotherAxisSignal_;
      89              : };
      90              : } // namespace Hccl
      91              : 
      92              : #endif // HCCLV2_CCU_CONTEXT_REDUCE_MESH_2D_MEM2MEM_H_
        

Generated by: LCOV version 2.0-1