LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective/alg/coll_alg_factory/alg_ccu_context/all_gather - ccu_instruction_all_gather_mesh2d_mem2mem.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 41 0
Test Date: 2026-07-28 12:11:00 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_ALL_GATHER_MESH_2D_MEM2MEM_H_
      12              : #define HCCLV2_CCU_INSTRUCTION_ALL_GATHER_MESH_2D_MEM2MEM_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              : // 为AllGatherMeshMem2Mem2D实现的CCUIns、CCUCtxArg与CCUTaskArg
      25              : class CcuCtxArgAllGatherMeshMem2Mem2D : public CcuCtxArg {
      26              : public:
      27            0 :     explicit CcuCtxArgAllGatherMeshMem2Mem2D(const std::vector<uint64_t> &dSize, uint32_t rId, uint32_t axisId,
      28              :         const CollAlgOperator &op, const std::vector<std::vector<RankId>> &tempVTopo)
      29            0 :         : dimSize_(dSize), rankId_(rId), axisId_(axisId), op_(op), tempVTopo_(tempVTopo) {}
      30            0 :     CcuCtxSignature GetCtxSignature() const override
      31              :     {
      32            0 :         CcuCtxSignature signature;
      33            0 :         GenerateCcuCtxSignature(signature, CcuInstType::CCU_ALLGATHER_MESH_2D_MEM2MEM, op_, tempVTopo_);
      34            0 :         return signature;
      35            0 :     }
      36              :     std::vector<uint64_t> dimSize_;
      37              :     uint32_t rankId_;
      38              :     uint32_t axisId_;
      39              :     CollAlgOperator op_;
      40              :     std::vector<std::vector<RankId>> tempVTopo_;
      41              : };
      42              : 
      43              : class CcuTaskArgAllGatherMeshMem2Mem2D : public CcuTaskArg {
      44              : public:
      45            0 :     explicit CcuTaskArgAllGatherMeshMem2Mem2D(uint64_t inputAddr, uint64_t outputAddr, uint64_t xAxisSize,
      46            0 :         uint64_t yAxisSize, uint64_t sliceSize, uint64_t offset, uint64_t token) :
      47            0 :         inputAddr_(inputAddr), outputAddr_(outputAddr), xAxisSize_(xAxisSize), yAxisSize_(yAxisSize),
      48            0 :         sliceSize_(sliceSize), offset_(offset), token_(token) {}
      49              : 
      50              :     uint64_t inputAddr_;
      51              :     uint64_t outputAddr_;
      52              :     uint64_t xAxisSize_;
      53              :     uint64_t yAxisSize_;
      54              :     uint64_t sliceSize_;
      55              :     uint64_t offset_;
      56              :     uint64_t token_;
      57              : };
      58              : 
      59              : class CcuInstructionAllGatherMeshMem2Mem2D : public CcuInstruction {
      60              : public:
      61            0 :     CcuInstructionAllGatherMeshMem2Mem2D() : CcuInstruction()
      62              :     {
      63            0 :     }
      64              : 
      65            0 :     void Init(uint32_t rankId, uint32_t axisId, uint64_t inputAddr, uint64_t outputAddr, uint64_t xAxisArgs,
      66              :         uint64_t yAxisArgs, uint64_t sliceSize, uint64_t offset, uint64_t token, CollAlgOperator &op,
      67              :         std::vector<std::vector<RankId>> &tempVTopo)
      68              :     {
      69            0 :         if (tempVTopo.size() != DIM_SIZE) {
      70            0 :             THROW<InvalidParamsException>(StringFormat(
      71              :                 "[CcuTempAllGatherMeshMem2Mem2D] tempVTopo size is not %u, size is [%u].", DIM_SIZE, tempVTopo.size()));
      72              :         }
      73            0 :         for (uint32_t i = 0; i < tempVTopo.size(); i++) {
      74            0 :             dimSize_.push_back(tempVTopo[i].size());
      75              :         }
      76              : 
      77            0 :         rankId_ = rankId;
      78            0 :         axisId_ = axisId;
      79            0 :         inputAddr_ = inputAddr;
      80            0 :         outputAddr_ = outputAddr;
      81            0 :         xAxisArgs_ = xAxisArgs;
      82            0 :         yAxisArgs_ = yAxisArgs;
      83            0 :         sliceSize_ = sliceSize;
      84            0 :         token_ = token;
      85            0 :         offset_ = offset;
      86            0 :         op_ = op;
      87            0 :         tempVTopo_ = tempVTopo;
      88            0 :         return;
      89              :     }
      90              : 
      91            0 :     CcuInstType GetInstType() const override
      92              :     {
      93            0 :         HCCL_INFO("CcuInstructionAllGatherMeshMem2Mem2D instype is CCU_ALLGATHER_MESH_2D_MEM2MEM.");
      94            0 :         return instType_;
      95              :     }
      96              : 
      97            0 :     std::string Describe() const override
      98              :     {
      99            0 :         return StringFormat("CcuInstructionAllGatherMeshMem2Mem2D rankId [%u], instType[%s]", rankId_,
     100            0 :             instType_.Describe().c_str());
     101              :     }
     102              : 
     103              :     void SetInstType(CcuInstType instType) 
     104              :     { 
     105              :         instType_ = instType; 
     106              :     }
     107              : 
     108            0 :     std::unique_ptr<CcuCtxArg> GetCtxArg() const override
     109              :     {
     110            0 :         return std::make_unique<CcuCtxArgAllGatherMeshMem2Mem2D>(dimSize_, rankId_, axisId_, op_, tempVTopo_);
     111              :     }
     112              : 
     113            0 :     std::unique_ptr<CcuTaskArg> GetTaskArg() const override
     114              :     {
     115            0 :         return std::make_unique<CcuTaskArgAllGatherMeshMem2Mem2D>(inputAddr_, outputAddr_, xAxisArgs_, yAxisArgs_,
     116            0 :             sliceSize_, offset_, token_);
     117              :     }
     118              : 
     119              : private:
     120              :     static constexpr uint32_t DIM_SIZE = 2;
     121              :     CcuInstType instType_ = CcuInstType::CCU_ALLGATHER_MESH_2D_MEM2MEM;
     122              :     std::vector<uint64_t> dimSize_;
     123              :     uint32_t rankId_{0};
     124              :     uint32_t axisId_{0};
     125              :     uint64_t inputAddr_{0};
     126              :     uint64_t outputAddr_{0};
     127              :     uint64_t xAxisArgs_{0};
     128              :     uint64_t yAxisArgs_{0};
     129              :     uint64_t sliceSize_{0};
     130              :     uint64_t offset_{0};
     131              :     uint64_t token_{0};
     132              :     CollAlgOperator op_;
     133              :     std::vector<std::vector<RankId>> tempVTopo_;
     134              : };
     135              : 
     136              : }
     137              : #endif // HCCLV2_CCU_INSTRUCTION_ALL_GATHER_MESH_2D_MEM2MEM_H_
        

Generated by: LCOV version 2.0-1