LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective/alg/coll_alg_factory/alg_ccu_context/reduce - ccu_instruction_reduce_mesh2d.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 41 0
Test Date: 2026-08-04 10:52:23 Functions: 0.0 % 9 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_INSTRUCTION_REDUCE_MESH_2D_H_
      12              : #define HCCLV2_CCU_INSTRUCTION_REDUCE_MESH_2D_H_
      13              : 
      14              : #include "template_utils.h"
      15              : #include "instruction.h"
      16              : #include "ins_queue.h"
      17              : #include "ccu_context_utils.h"
      18              : #include "ccu_ctx_signature.h"
      19              : #include "ccu_ins.h"
      20              : #include "ccu_rank_group.h"
      21              : 
      22              : namespace Hccl {
      23              : 
      24              : // 为ReduceMesh2D实现的CCUIns、CCUCtxArg与CCUTaskArg
      25              : class CcuCtxArgReduceMesh2D : public CcuCtxArg {
      26              : public:
      27            0 :     explicit CcuCtxArgReduceMesh2D(const std::vector<uint64_t> &dSize, uint32_t rId, uint32_t rootId, uint32_t aId,
      28            0 :     const CollAlgOperator &op, const std::vector<std::vector<RankId>> &tempVTopo) :
      29            0 :             dimSize_(dSize), rankId_(rId), rootId_(rootId), axisId_(aId), op_(op), tempVTopo_(tempVTopo) {}
      30            0 :     CcuCtxSignature GetCtxSignature() const override
      31              :     {
      32            0 :         CcuCtxSignature signature;
      33            0 :         GenerateCcuCtxSignature(signature, CcuInstType::CCU_REDUCE_MESH_2D_DIRECT, op_, tempVTopo_);
      34            0 :         return signature;
      35            0 :     }
      36              : 
      37              :     std::vector<uint64_t> dimSize_;
      38              :     uint32_t rankId_;
      39              :     uint32_t rootId_;
      40              :     uint32_t axisId_;
      41              :     CollAlgOperator op_;
      42              :     std::vector<std::vector<RankId>> tempVTopo_;
      43              : };
      44              : 
      45              : class CcuTaskArgReduceMesh2D : public CcuTaskArg {
      46              : public:
      47            0 :     explicit CcuTaskArgReduceMesh2D(uint64_t inputAddr, uint64_t outputAddr, uint64_t sliceSize,
      48            0 :         uint64_t xAxisSize, uint64_t yAxisSize, uint64_t offset, uint64_t token) :
      49            0 :         inputAddr_(inputAddr), outputAddr_(outputAddr), sliceSize_(sliceSize), xAxisSize_(xAxisSize), yAxisSize_(yAxisSize),
      50            0 :         offset_(offset), token_(token) {}
      51              : 
      52              :     uint64_t inputAddr_;
      53              :     uint64_t outputAddr_;
      54              :     uint64_t sliceSize_;
      55              :     uint64_t xAxisSize_;
      56              :     uint64_t yAxisSize_;
      57              :     uint64_t offset_;
      58              :     uint64_t token_;
      59              : };
      60              : 
      61              : class CcuInstructionReduceMesh2D : public CcuInstruction {
      62              : public:
      63            0 :     CcuInstructionReduceMesh2D() : CcuInstruction()
      64              :     {
      65            0 :     }
      66              : 
      67            0 :     void Init(std::vector<uint64_t> dimSize, uint32_t rankId, uint32_t rootId, uint64_t axisId, uint64_t inputAddr, uint64_t outputAddr, uint64_t sliceSize, uint64_t xAxisSize,
      68              :         uint64_t yAxisSize, uint64_t offset, uint64_t token, CollAlgOperator &op, std::vector<std::vector<RankId>> &tempVTopo)
      69              :     {
      70            0 :         dimSize_ = dimSize;
      71            0 :         rankId_ = rankId;
      72            0 :         rootId_ = rootId;
      73            0 :         axisId_ = axisId;
      74            0 :         inputAddr_ = inputAddr;
      75            0 :         outputAddr_ = outputAddr;
      76            0 :         sliceSize_ = sliceSize;
      77            0 :         xAxisSize_ = xAxisSize;
      78            0 :         yAxisSize_ = yAxisSize;
      79            0 :         offset_ = offset;
      80            0 :         token_ = token;
      81            0 :         op_ = op;
      82            0 :         tempVTopo_ = tempVTopo;
      83            0 :         return;
      84              :     }
      85              : 
      86            0 :     CcuInstType GetInstType() const override
      87              :     {
      88            0 :         HCCL_INFO("CcuInstructionReduceMesh2D instype is CCU_REDUCE_MESH_2D_DIRECT.");
      89            0 :         return instType_;
      90              :     }
      91              : 
      92            0 :     std::string Describe() const override
      93              :     {
      94            0 :         return StringFormat("CcuInstructionReduceMesh2D rankId [%u], instType[%d]", rankId_, instType_);
      95              :     }
      96              : 
      97              :     void SetInstType(CcuInstType instType) 
      98              :     { 
      99              :         instType_ = instType; 
     100              :     }
     101              : 
     102            0 :     std::unique_ptr<CcuCtxArg> GetCtxArg() const override
     103              :     {
     104            0 :         HCCL_INFO("[CcuInstructionReduceMesh2D] GetCtxArg begin");
     105            0 :         return std::make_unique<CcuCtxArgReduceMesh2D>(dimSize_, rankId_, rootId_, axisId_, op_, tempVTopo_);
     106              :     }
     107              : 
     108            0 :     std::unique_ptr<CcuTaskArg> GetTaskArg() const override
     109              :     {
     110            0 :         HCCL_INFO("[CcuInstructionReduceMesh2D] GetTaskArg begin");
     111            0 :         return std::make_unique<CcuTaskArgReduceMesh2D>(inputAddr_, outputAddr_, sliceSize_, xAxisSize_,
     112            0 :             yAxisSize_, offset_, token_);
     113              :     }
     114              : 
     115              : private:
     116              :     CcuInstType instType_ = CcuInstType::CCU_REDUCE_MESH_2D_DIRECT;
     117              :     std::vector<uint64_t> dimSize_;
     118              :     uint32_t rankId_{0};
     119              :     uint32_t rootId_{0};
     120              :     uint64_t axisId_{0};
     121              :     uint64_t offset_{0};
     122              :     uint64_t token_{0};
     123              :     uint64_t inputAddr_{0};
     124              :     uint64_t outputAddr_{0};
     125              :     uint64_t sliceSize_{0};
     126              :     uint64_t xAxisSize_{0};
     127              :     uint64_t yAxisSize_{0};
     128              :     CollAlgOperator op_;
     129              :     std::vector<std::vector<RankId>> tempVTopo_;
     130              : };
     131              : 
     132              : }
     133              : #endif // HCCLV2_CCU_INSTRUCTION_REDUCE_MESH_2D_H_
        

Generated by: LCOV version 2.0-1