LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective/alg/coll_alg_factory/alg_ccu_context/broadcast - ccu_instruction_broadcast_mesh2d_mem2mem.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 43 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_BROADCAST_2D_MEM2MEM_H_
      12              : #define HCCLV2_CCU_INSTRUCTION_BROADCAST_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              : // 为BroadcastMesh2D实现的CCUIns、CCUCtxArg与CCUTaskArg
      25              : class CcuCtxArgBroadcastMeshMem2mem2D : public CcuCtxArg {
      26              : public:
      27            0 :     explicit CcuCtxArgBroadcastMeshMem2mem2D(
      28              :         const std::vector<uint64_t>& dSize, uint32_t rId, uint32_t aId, const CollAlgOperator& op,
      29              :         const std::vector<std::vector<RankId>>& tempVTopo)
      30            0 :         : dimSize_(dSize),
      31            0 :           rankId_(rId),
      32            0 :           axisId_(aId),
      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_BROADCAST_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 CcuTaskArgBroadcastMeshMem2mem2D : public CcuTaskArg {
      50              : public:
      51            0 :     explicit CcuTaskArgBroadcastMeshMem2mem2D(
      52              :         uint64_t inputAddr, uint64_t sliceSize, uint64_t xAxisSize, uint64_t yAxisSize, uint64_t token)
      53            0 :         : inputAddr_(inputAddr),
      54            0 :           sliceSize_(sliceSize),
      55            0 :           xAxisSize_(xAxisSize),
      56            0 :           yAxisSize_(yAxisSize),
      57            0 :           token_(token)
      58              :     {
      59            0 :         HCCL_INFO(
      60              :             "[CcuTaskArgBroadcastMeshMem2mem2D] inputAddr[%llu], sliceSize[%llu], "
      61              :             "xAxisSize[%llu], yAxisSize[%llu]",
      62              :             inputAddr_, sliceSize_, xAxisSize_, yAxisSize_);
      63            0 :     }
      64              :     uint64_t inputAddr_;
      65              :     uint64_t sliceSize_;
      66              :     uint64_t xAxisSize_;
      67              :     uint64_t yAxisSize_;
      68              :     uint64_t token_;
      69              : };
      70              : 
      71              : class CcuInstructionBroadcastMeshMem2Mem2D : public CcuInstruction {
      72              : public:
      73            0 :     CcuInstructionBroadcastMeshMem2Mem2D() : CcuInstruction() {}
      74              : 
      75            0 :     void Init(
      76              :         std::vector<uint64_t> dimSize, uint32_t rankId, uint64_t inputAddr, uint64_t axisId, uint64_t sliceSize,
      77              :         uint64_t xAxisSize, uint64_t yAxisSize, uint64_t token, CollAlgOperator& op,
      78              :         std::vector<std::vector<RankId>>& tempVTopo)
      79              :     {
      80            0 :         dimSize_ = dimSize;
      81            0 :         rankId_ = rankId;
      82            0 :         inputAddr_ = inputAddr;
      83            0 :         axisId_ = axisId;
      84            0 :         sliceSize_ = sliceSize;
      85            0 :         xAxisSize_ = xAxisSize;
      86            0 :         yAxisSize_ = yAxisSize;
      87            0 :         token_ = token;
      88            0 :         op_ = op;
      89            0 :         tempVTopo_ = tempVTopo;
      90            0 :         return;
      91              :     }
      92              : 
      93            0 :     CcuInstType GetInstType() const override
      94              :     {
      95            0 :         HCCL_INFO("CcuInstructionBroadcastMeshMem2Mem2D instype is CCU_BROADCAST_MESH_2D_MEM2MEM.");
      96            0 :         return instType_;
      97              :     }
      98              : 
      99            0 :     std::string Describe() const override
     100              :     {
     101              :         return StringFormat(
     102            0 :             "CcuInstructionBroadcastMeshMem2Mem2D rankId [%u], instType[%s]", rankId_, instType_.Describe().c_str());
     103              :     }
     104              : 
     105              :     void SetInstType(CcuInstType instType) { instType_ = instType; }
     106              : 
     107            0 :     std::unique_ptr<CcuCtxArg> GetCtxArg() const override
     108              :     {
     109            0 :         return std::make_unique<CcuCtxArgBroadcastMeshMem2mem2D>(dimSize_, rankId_, axisId_, op_, tempVTopo_);
     110              :     }
     111              : 
     112            0 :     std::unique_ptr<CcuTaskArg> GetTaskArg() const override
     113              :     {
     114            0 :         return std::make_unique<CcuTaskArgBroadcastMeshMem2mem2D>(
     115            0 :             inputAddr_, sliceSize_, xAxisSize_, yAxisSize_, token_);
     116              :     }
     117              : 
     118              : private:
     119              :     CcuInstType instType_ = CcuInstType::CCU_BROADCAST_MESH_2D_MEM2MEM;
     120              :     std::vector<uint64_t> dimSize_;
     121              :     uint32_t rankId_{0};
     122              :     uint64_t axisId_{0};
     123              :     uint64_t inputAddr_{0};
     124              :     uint64_t sliceSize_{0};
     125              :     uint64_t xAxisSize_{0};
     126              :     uint64_t yAxisSize_{0};
     127              :     uint64_t token_{0};
     128              :     CollAlgOperator op_;
     129              :     std::vector<std::vector<RankId>> tempVTopo_;
     130              : };
     131              : 
     132              : } // namespace Hccl
     133              : #endif // HCCLV2_CCU_INSTRUCTION_BROADCAST_MESH_2D_H_
        

Generated by: LCOV version 2.0-1