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 % 49 0
Test Date: 2026-08-18 17:47:01 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(
      28              :         const std::vector<uint64_t>& dSize, uint32_t rId, uint32_t axisId, const CollAlgOperator& op,
      29              :         const std::vector<std::vector<RankId>>& tempVTopo)
      30            0 :         : dimSize_(dSize),
      31            0 :           rankId_(rId),
      32            0 :           axisId_(axisId),
      33            0 :           op_(op),
      34            0 :           tempVTopo_(tempVTopo)
      35            0 :     {}
      36            0 :     CcuCtxSignature GetCtxSignature() const override
      37              :     {
      38            0 :         CcuCtxSignature signature;
      39            0 :         GenerateCcuCtxSignature(signature, CcuInstType::CCU_ALLGATHER_MESH_2D_MEM2MEM, op_, tempVTopo_);
      40            0 :         return signature;
      41            0 :     }
      42              :     std::vector<uint64_t> dimSize_;
      43              :     uint32_t rankId_;
      44              :     uint32_t axisId_;
      45              :     CollAlgOperator op_;
      46              :     std::vector<std::vector<RankId>> tempVTopo_;
      47              : };
      48              : 
      49              : class CcuTaskArgAllGatherMeshMem2Mem2D : public CcuTaskArg {
      50              : public:
      51            0 :     explicit CcuTaskArgAllGatherMeshMem2Mem2D(
      52              :         uint64_t inputAddr, uint64_t outputAddr, uint64_t xAxisSize, uint64_t yAxisSize, uint64_t sliceSize,
      53              :         uint64_t offset, uint64_t token)
      54            0 :         : inputAddr_(inputAddr),
      55            0 :           outputAddr_(outputAddr),
      56            0 :           xAxisSize_(xAxisSize),
      57            0 :           yAxisSize_(yAxisSize),
      58            0 :           sliceSize_(sliceSize),
      59            0 :           offset_(offset),
      60            0 :           token_(token)
      61            0 :     {}
      62              : 
      63              :     uint64_t inputAddr_;
      64              :     uint64_t outputAddr_;
      65              :     uint64_t xAxisSize_;
      66              :     uint64_t yAxisSize_;
      67              :     uint64_t sliceSize_;
      68              :     uint64_t offset_;
      69              :     uint64_t token_;
      70              : };
      71              : 
      72              : class CcuInstructionAllGatherMeshMem2Mem2D : public CcuInstruction {
      73              : public:
      74            0 :     CcuInstructionAllGatherMeshMem2Mem2D() : CcuInstruction() {}
      75              : 
      76            0 :     void Init(
      77              :         uint32_t rankId, uint32_t axisId, uint64_t inputAddr, uint64_t outputAddr, uint64_t xAxisArgs,
      78              :         uint64_t yAxisArgs, uint64_t sliceSize, uint64_t offset, uint64_t token, CollAlgOperator& op,
      79              :         std::vector<std::vector<RankId>>& tempVTopo)
      80              :     {
      81            0 :         if (tempVTopo.size() != DIM_SIZE) {
      82            0 :             THROW<InvalidParamsException>(StringFormat(
      83              :                 "[CcuTempAllGatherMeshMem2Mem2D] tempVTopo size is not %u, size is [%u].", DIM_SIZE, tempVTopo.size()));
      84              :         }
      85            0 :         for (uint32_t i = 0; i < tempVTopo.size(); i++) {
      86            0 :             dimSize_.push_back(tempVTopo[i].size());
      87              :         }
      88              : 
      89            0 :         rankId_ = rankId;
      90            0 :         axisId_ = axisId;
      91            0 :         inputAddr_ = inputAddr;
      92            0 :         outputAddr_ = outputAddr;
      93            0 :         xAxisArgs_ = xAxisArgs;
      94            0 :         yAxisArgs_ = yAxisArgs;
      95            0 :         sliceSize_ = sliceSize;
      96            0 :         token_ = token;
      97            0 :         offset_ = offset;
      98            0 :         op_ = op;
      99            0 :         tempVTopo_ = tempVTopo;
     100            0 :         return;
     101              :     }
     102              : 
     103            0 :     CcuInstType GetInstType() const override
     104              :     {
     105            0 :         HCCL_INFO("CcuInstructionAllGatherMeshMem2Mem2D instype is CCU_ALLGATHER_MESH_2D_MEM2MEM.");
     106            0 :         return instType_;
     107              :     }
     108              : 
     109            0 :     std::string Describe() const override
     110              :     {
     111              :         return StringFormat(
     112            0 :             "CcuInstructionAllGatherMeshMem2Mem2D rankId [%u], instType[%s]", rankId_, instType_.Describe().c_str());
     113              :     }
     114              : 
     115              :     void SetInstType(CcuInstType instType) { instType_ = instType; }
     116              : 
     117            0 :     std::unique_ptr<CcuCtxArg> GetCtxArg() const override
     118              :     {
     119            0 :         return std::make_unique<CcuCtxArgAllGatherMeshMem2Mem2D>(dimSize_, rankId_, axisId_, op_, tempVTopo_);
     120              :     }
     121              : 
     122            0 :     std::unique_ptr<CcuTaskArg> GetTaskArg() const override
     123              :     {
     124            0 :         return std::make_unique<CcuTaskArgAllGatherMeshMem2Mem2D>(
     125            0 :             inputAddr_, outputAddr_, xAxisArgs_, yAxisArgs_, sliceSize_, offset_, token_);
     126              :     }
     127              : 
     128              : private:
     129              :     static constexpr uint32_t DIM_SIZE = 2;
     130              :     CcuInstType instType_ = CcuInstType::CCU_ALLGATHER_MESH_2D_MEM2MEM;
     131              :     std::vector<uint64_t> dimSize_;
     132              :     uint32_t rankId_{0};
     133              :     uint32_t axisId_{0};
     134              :     uint64_t inputAddr_{0};
     135              :     uint64_t outputAddr_{0};
     136              :     uint64_t xAxisArgs_{0};
     137              :     uint64_t yAxisArgs_{0};
     138              :     uint64_t sliceSize_{0};
     139              :     uint64_t offset_{0};
     140              :     uint64_t token_{0};
     141              :     CollAlgOperator op_;
     142              :     std::vector<std::vector<RankId>> tempVTopo_;
     143              : };
     144              : 
     145              : } // namespace Hccl
     146              : #endif // HCCLV2_CCU_INSTRUCTION_ALL_GATHER_MESH_2D_MEM2MEM_H_
        

Generated by: LCOV version 2.0-1