LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective/alg/coll_alg_factory/alg_ccu_context/all_to_all - ccu_instruction_all_to_all_v_mesh2d.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 38 0
Test Date: 2026-07-28 12:11:00 Functions: 0.0 % 11 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_TO_ALL_V_MESH_2D_H_
      12              : #define HCCLV2_CCU_INSTRUCTION_ALL_TO_ALL_V_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              : // 为AllToAllVMesh1D实现的CCUIns、CCUCtxArg与CCUTaskArg
      25              : class CcuCtxArgAllToAllVMesh2D : public CcuCtxArg {
      26              : public:
      27            0 :     CcuCtxArgAllToAllVMesh2D(const std::vector<uint32_t> &dSize, uint32_t rId, uint64_t aId,
      28            0 :         const CollAlgOperator &op, const std::vector<std::vector<RankId>> &tempVTopo) :
      29            0 :             CcuCtxArg(), dimSize(dSize), rankId(rId), axisId(aId), op(op), tempVTopo(tempVTopo) {}
      30              : 
      31            0 :     ~CcuCtxArgAllToAllVMesh2D() override {}
      32              : 
      33            0 :     CcuCtxSignature GetCtxSignature() const override
      34              :     {
      35            0 :         CcuCtxSignature signature;
      36            0 :         GenerateCcuCtxSignature(signature, CcuInstType::CCU_ALLTOALLV_MESH_2D_DIRECT, op, tempVTopo);
      37            0 :         return signature;
      38            0 :     }
      39              :     std::vector<uint32_t> dimSize;
      40              :     uint32_t rankId;
      41              :     uint64_t axisId;
      42              :     CollAlgOperator op;
      43              :     std::vector<std::vector<RankId>> tempVTopo;
      44              : };
      45              : 
      46              : class CcuTaskArgAllToAllVMesh2D : public CcuTaskArg {
      47              : public:
      48            0 :     explicit CcuTaskArgAllToAllVMesh2D(uint64_t inputAddr, uint64_t outputAddr, uint64_t scratchAddr,
      49            0 :         uint64_t token, uint64_t scratchSliceSize, uint64_t scratchSliceBias, const A2ASendRecvInfo& localSendRecvInfo) :
      50            0 :         inputAddr(inputAddr), outputAddr(outputAddr), scratchAddr(scratchAddr), token(token),
      51            0 :         scratchSliceSize(scratchSliceSize), scratchSliceBias(scratchSliceBias), localSendRecvInfo(localSendRecvInfo) {}
      52              : 
      53              :     uint64_t inputAddr;
      54              :     uint64_t outputAddr;
      55              :     uint64_t scratchAddr;
      56              :     uint64_t token;
      57              :     uint64_t scratchSliceSize;
      58              :     uint64_t scratchSliceBias;
      59              :     A2ASendRecvInfo localSendRecvInfo;
      60              : };
      61              : 
      62              : class CcuInstructionAllToAllVMesh2D : public CcuInstruction {
      63              : public:
      64            0 :     CcuInstructionAllToAllVMesh2D(const CollAlgOperator &op, const std::vector<uint32_t> &dimSize,
      65            0 :         const std::vector<std::vector<RankId>> &tempVTopo) :
      66            0 :         CcuInstruction(), op_(op), dimSize_(dimSize), tempVTopo_(tempVTopo) {}
      67              : 
      68            0 :     void Init(uint32_t rankId, uint64_t axisId, uint64_t inputAddr, uint64_t outputAddr, uint64_t scratchAddr, uint64_t token, 
      69              :         uint64_t scratchSliceSize, uint64_t scratchSliceBias, const A2ASendRecvInfo& localSendRecvInfo)
      70              :     {
      71            0 :         axisId_ = axisId;
      72            0 :         rankId_ = rankId;
      73            0 :         inputAddr_ = inputAddr;
      74            0 :         outputAddr_ = outputAddr;
      75            0 :         scratchAddr_ = scratchAddr;
      76            0 :         token_ = token;
      77            0 :         scratchSliceSize_ = scratchSliceSize;
      78            0 :         scratchSliceBias_ = scratchSliceBias;
      79            0 :         localSendRecvInfo_ = localSendRecvInfo;
      80            0 :         return;
      81              :     }
      82              : 
      83            0 :     CcuInstType GetInstType() const override
      84              :     {
      85            0 :         HCCL_INFO("CcuInstructionAllToAllVMesh2D instype is CCU_ALLTOALLV_MESH_2D_DIRECT.");
      86            0 :         return instType_;
      87              :     }
      88              : 
      89            0 :     std::string Describe() const override
      90              :     {
      91            0 :         return StringFormat("CcuInstructionAllToAllVMesh2D rankId [%u], instType[%s]", rankId_, instType_.Describe().c_str());
      92              :     }
      93              : 
      94              :     void SetInstType(CcuInstType instType) 
      95              :     { 
      96              :         instType_ = instType; 
      97              :     }
      98              : 
      99            0 :     std::unique_ptr<CcuCtxArg> GetCtxArg() const override
     100              :     {
     101            0 :         HCCL_INFO("[CcuInstructionAlltoAllVMesh2D][GetCtxArg] dimSize.size[%u], rankId[%u], axisId[%llu], tempVTopo.size[%u]",
     102              :             dimSize_.size(), rankId_, axisId_, tempVTopo_.size());
     103            0 :         return std::make_unique<CcuCtxArgAllToAllVMesh2D>(dimSize_, rankId_, axisId_, op_, tempVTopo_);
     104              :     }
     105              : 
     106            0 :     std::unique_ptr<CcuTaskArg> GetTaskArg() const override
     107              :     {
     108            0 :         return std::make_unique<CcuTaskArgAllToAllVMesh2D>(inputAddr_, outputAddr_, scratchAddr_, token_,
     109            0 :             scratchSliceSize_, scratchSliceBias_, localSendRecvInfo_);
     110              :     }
     111              : 
     112              : private:
     113              :     CollAlgOperator op_;
     114              :     std::vector<uint32_t> dimSize_;
     115              :     std::vector<std::vector<RankId>> tempVTopo_;
     116              : 
     117              :     CcuInstType instType_ = CcuInstType::CCU_ALLTOALLV_MESH_2D_DIRECT;
     118              :     uint32_t rankId_{0};
     119              :     uint64_t axisId_{0};
     120              :     uint64_t inputAddr_{0};
     121              :     uint64_t outputAddr_{0};
     122              :     uint64_t scratchAddr_{0};
     123              :     uint64_t token_{0};
     124              :     uint64_t scratchSliceSize_{0};
     125              :     uint64_t scratchSliceBias_{0};
     126              :     A2ASendRecvInfo localSendRecvInfo_;
     127              : };
     128              : 
     129              : }
     130              : #endif // HCCLV2_CCU_INSTRUCTION_ALL_TO_ALL_V_MESH_2D_H_
        

Generated by: LCOV version 2.0-1