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 % 51 0
Test Date: 2026-08-18 17:47:01 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(
      28              :         const std::vector<uint32_t>& dSize, uint32_t rId, uint64_t aId, const CollAlgOperator& op,
      29              :         const std::vector<std::vector<RankId>>& tempVTopo)
      30            0 :         : CcuCtxArg(),
      31            0 :           dimSize(dSize),
      32            0 :           rankId(rId),
      33            0 :           axisId(aId),
      34            0 :           op(op),
      35            0 :           tempVTopo(tempVTopo)
      36            0 :     {}
      37              : 
      38            0 :     ~CcuCtxArgAllToAllVMesh2D() override {}
      39              : 
      40            0 :     CcuCtxSignature GetCtxSignature() const override
      41              :     {
      42            0 :         CcuCtxSignature signature;
      43            0 :         GenerateCcuCtxSignature(signature, CcuInstType::CCU_ALLTOALLV_MESH_2D_DIRECT, op, tempVTopo);
      44            0 :         return signature;
      45            0 :     }
      46              :     std::vector<uint32_t> dimSize;
      47              :     uint32_t rankId;
      48              :     uint64_t axisId;
      49              :     CollAlgOperator op;
      50              :     std::vector<std::vector<RankId>> tempVTopo;
      51              : };
      52              : 
      53              : class CcuTaskArgAllToAllVMesh2D : public CcuTaskArg {
      54              : public:
      55            0 :     explicit CcuTaskArgAllToAllVMesh2D(
      56              :         uint64_t inputAddr, uint64_t outputAddr, uint64_t scratchAddr, uint64_t token, uint64_t scratchSliceSize,
      57              :         uint64_t scratchSliceBias, const A2ASendRecvInfo& localSendRecvInfo)
      58            0 :         : inputAddr(inputAddr),
      59            0 :           outputAddr(outputAddr),
      60            0 :           scratchAddr(scratchAddr),
      61            0 :           token(token),
      62            0 :           scratchSliceSize(scratchSliceSize),
      63            0 :           scratchSliceBias(scratchSliceBias),
      64            0 :           localSendRecvInfo(localSendRecvInfo)
      65            0 :     {}
      66              : 
      67              :     uint64_t inputAddr;
      68              :     uint64_t outputAddr;
      69              :     uint64_t scratchAddr;
      70              :     uint64_t token;
      71              :     uint64_t scratchSliceSize;
      72              :     uint64_t scratchSliceBias;
      73              :     A2ASendRecvInfo localSendRecvInfo;
      74              : };
      75              : 
      76              : class CcuInstructionAllToAllVMesh2D : public CcuInstruction {
      77              : public:
      78            0 :     CcuInstructionAllToAllVMesh2D(
      79              :         const CollAlgOperator& op, const std::vector<uint32_t>& dimSize,
      80              :         const std::vector<std::vector<RankId>>& tempVTopo)
      81            0 :         : CcuInstruction(),
      82            0 :           op_(op),
      83            0 :           dimSize_(dimSize),
      84            0 :           tempVTopo_(tempVTopo)
      85            0 :     {}
      86              : 
      87            0 :     void Init(
      88              :         uint32_t rankId, uint64_t axisId, uint64_t inputAddr, uint64_t outputAddr, uint64_t scratchAddr, uint64_t token,
      89              :         uint64_t scratchSliceSize, uint64_t scratchSliceBias, const A2ASendRecvInfo& localSendRecvInfo)
      90              :     {
      91            0 :         axisId_ = axisId;
      92            0 :         rankId_ = rankId;
      93            0 :         inputAddr_ = inputAddr;
      94            0 :         outputAddr_ = outputAddr;
      95            0 :         scratchAddr_ = scratchAddr;
      96            0 :         token_ = token;
      97            0 :         scratchSliceSize_ = scratchSliceSize;
      98            0 :         scratchSliceBias_ = scratchSliceBias;
      99            0 :         localSendRecvInfo_ = localSendRecvInfo;
     100            0 :         return;
     101              :     }
     102              : 
     103            0 :     CcuInstType GetInstType() const override
     104              :     {
     105            0 :         HCCL_INFO("CcuInstructionAllToAllVMesh2D instype is CCU_ALLTOALLV_MESH_2D_DIRECT.");
     106            0 :         return instType_;
     107              :     }
     108              : 
     109            0 :     std::string Describe() const override
     110              :     {
     111              :         return StringFormat(
     112            0 :             "CcuInstructionAllToAllVMesh2D 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 :         HCCL_INFO(
     120              :             "[CcuInstructionAlltoAllVMesh2D][GetCtxArg] dimSize.size[%u], rankId[%u], axisId[%llu], tempVTopo.size[%u]",
     121              :             dimSize_.size(), rankId_, axisId_, tempVTopo_.size());
     122            0 :         return std::make_unique<CcuCtxArgAllToAllVMesh2D>(dimSize_, rankId_, axisId_, op_, tempVTopo_);
     123              :     }
     124              : 
     125            0 :     std::unique_ptr<CcuTaskArg> GetTaskArg() const override
     126              :     {
     127            0 :         return std::make_unique<CcuTaskArgAllToAllVMesh2D>(
     128            0 :             inputAddr_, outputAddr_, scratchAddr_, token_, scratchSliceSize_, scratchSliceBias_, localSendRecvInfo_);
     129              :     }
     130              : 
     131              : private:
     132              :     CollAlgOperator op_;
     133              :     std::vector<uint32_t> dimSize_;
     134              :     std::vector<std::vector<RankId>> tempVTopo_;
     135              : 
     136              :     CcuInstType instType_ = CcuInstType::CCU_ALLTOALLV_MESH_2D_DIRECT;
     137              :     uint32_t rankId_{0};
     138              :     uint64_t axisId_{0};
     139              :     uint64_t inputAddr_{0};
     140              :     uint64_t outputAddr_{0};
     141              :     uint64_t scratchAddr_{0};
     142              :     uint64_t token_{0};
     143              :     uint64_t scratchSliceSize_{0};
     144              :     uint64_t scratchSliceBias_{0};
     145              :     A2ASendRecvInfo localSendRecvInfo_;
     146              : };
     147              : 
     148              : } // namespace Hccl
     149              : #endif // HCCLV2_CCU_INSTRUCTION_ALL_TO_ALL_V_MESH_2D_H_
        

Generated by: LCOV version 2.0-1