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_mesh1d_detour.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 56 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_1D_DETOUR_H_
      12              : #define HCCLV2_CCU_INSTRUCTION_ALL_GATHER_MESH_1D_DETOUR_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              : class CcuCtxArgAllGatherMeshDetour1D : public CcuCtxArg {
      25              : public:
      26            0 :     explicit CcuCtxArgAllGatherMeshDetour1D(
      27              :         const std::vector<uint64_t>& dSize, uint32_t rId, const CollAlgOperator& op,
      28              :         const std::vector<std::vector<RankId>>& tempVTopo, uint64_t singleTransportSize, uint64_t detourPathNum,
      29              :         uint64_t pathNumPerPeer)
      30            0 :         : dimSize_(dSize),
      31            0 :           rankId_(rId),
      32            0 :           op_(op),
      33            0 :           tempVTopo_(tempVTopo),
      34            0 :           singleTransportSize_(singleTransportSize),
      35            0 :           detourPathNum_(detourPathNum),
      36            0 :           pathNumPerPeer_(pathNumPerPeer)
      37            0 :     {}
      38              : 
      39            0 :     CcuCtxSignature GetCtxSignature() const override
      40              :     {
      41            0 :         CcuCtxSignature signature;
      42            0 :         GenerateCcuCtxSignature(signature, CcuInstType::CCU_ALLGATHER_MESH_1D_DETOUR, op_, tempVTopo_);
      43            0 :         return signature;
      44            0 :     }
      45              : 
      46              :     std::vector<uint64_t> dimSize_;
      47              :     uint32_t rankId_;
      48              :     CollAlgOperator op_;
      49              :     std::vector<std::vector<RankId>> tempVTopo_;
      50              :     uint64_t singleTransportSize_;
      51              :     uint64_t detourPathNum_;
      52              :     uint64_t pathNumPerPeer_;
      53              : };
      54              : 
      55              : class CcuTaskArgAllGatherMeshDetour1D : public CcuTaskArg {
      56              : public:
      57            0 :     explicit CcuTaskArgAllGatherMeshDetour1D(
      58              :         uint64_t inputAddr, uint64_t outputAddr, uint64_t token, uint64_t baseOffset, uint64_t tailOffset,
      59              :         uint64_t tailSize, uint64_t loopIterNum, const std::vector<uint64_t>& lengths)
      60            0 :         : inputAddr_(inputAddr),
      61            0 :           outputAddr_(outputAddr),
      62            0 :           token_(token),
      63            0 :           baseOffset_(baseOffset),
      64            0 :           tailOffset_(tailOffset),
      65            0 :           tailSize_(tailSize),
      66            0 :           loopIterNum_(loopIterNum),
      67            0 :           lengths_(lengths)
      68            0 :     {}
      69              : 
      70              :     uint64_t inputAddr_;
      71              :     uint64_t outputAddr_;
      72              :     uint64_t token_;
      73              :     uint64_t baseOffset_;
      74              :     uint64_t tailOffset_;
      75              :     uint64_t tailSize_; // 尾块数据量
      76              :     uint64_t loopIterNum_;
      77              :     std::vector<uint64_t> lengths_; // 每个loop迭代一次搬运时每个ms上的数据量
      78              : };
      79              : 
      80              : class CcuInstructionAllGatherMeshDetour1D : public CcuInstruction {
      81              : public:
      82            0 :     CcuInstructionAllGatherMeshDetour1D() : CcuInstruction() {}
      83              : 
      84            0 :     void InitDetourInfo(
      85              :         uint32_t rankId, uint64_t inputAddr, uint64_t outputAddr, uint64_t token, uint64_t baseOffset,
      86              :         uint64_t tailOffset, uint64_t tailSize, uint64_t loopIterNum, std::vector<uint64_t>& lengths,
      87              :         uint64_t singleTransportSize, uint64_t detourPathNum, uint64_t pathNumPerPeer, CollAlgOperator& op,
      88              :         std::vector<std::vector<RankId>>& tempVTopo)
      89              :     {
      90            0 :         u32 maxDimNum = 1;
      91            0 :         if (tempVTopo.size() != maxDimNum) {
      92            0 :             THROW<InvalidParamsException>(StringFormat(
      93              :                 "[CcuInstructionAllGatherMeshDetour1D] tempVTopo size is not 1, size is [%zu].", tempVTopo.size()));
      94              :         }
      95            0 :         dimSize_.push_back(tempVTopo[0].size());
      96            0 :         rankId_ = rankId;
      97            0 :         inputAddr_ = inputAddr;
      98            0 :         outputAddr_ = outputAddr;
      99            0 :         token_ = token;
     100            0 :         baseOffset_ = baseOffset;
     101            0 :         tailOffset_ = tailOffset;
     102            0 :         tailSize_ = tailSize;
     103            0 :         loopIterNum_ = loopIterNum;
     104            0 :         lengths_ = lengths;
     105            0 :         singleTransportSize_ = singleTransportSize;
     106            0 :         detourPathNum_ = detourPathNum;
     107            0 :         pathNumPerPeer_ = pathNumPerPeer;
     108            0 :         op_ = op;
     109            0 :         tempVTopo_ = tempVTopo;
     110            0 :         return;
     111              :     }
     112              : 
     113            0 :     CcuInstType GetInstType() const override
     114              :     {
     115            0 :         HCCL_INFO("CcuInstructionAllGatherMeshDetour1D instype is CCU_ALLGATHER_MESH_1D_DETOUR.");
     116            0 :         return instType_;
     117              :     }
     118              : 
     119            0 :     std::string Describe() const override
     120              :     {
     121              :         return StringFormat(
     122            0 :             "CcuInstructionAllGatherMeshDetour1D rankId [%u], instType[%s]", rankId_, instType_.Describe().c_str());
     123              :     }
     124              : 
     125            0 :     std::unique_ptr<CcuCtxArg> GetCtxArg() const override
     126              :     {
     127            0 :         return std::make_unique<CcuCtxArgAllGatherMeshDetour1D>(
     128            0 :             dimSize_, rankId_, op_, tempVTopo_, singleTransportSize_, detourPathNum_, pathNumPerPeer_);
     129              :     }
     130              : 
     131            0 :     std::unique_ptr<CcuTaskArg> GetTaskArg() const override
     132              :     {
     133            0 :         return std::make_unique<CcuTaskArgAllGatherMeshDetour1D>(
     134            0 :             inputAddr_, outputAddr_, token_, baseOffset_, tailOffset_, tailSize_, loopIterNum_, lengths_);
     135              :     }
     136              : 
     137              :     void SetInstType(CcuInstType instType) { instType_ = instType; }
     138              : 
     139              : private:
     140              :     CcuInstType instType_ = CcuInstType::CCU_ALLGATHER_MESH_1D_DETOUR;
     141              :     std::vector<uint64_t> dimSize_;
     142              :     uint32_t rankId_{0};
     143              :     uint64_t inputAddr_{0};
     144              :     uint64_t outputAddr_{0};
     145              :     uint64_t token_{0};
     146              :     uint64_t baseOffset_{0};
     147              :     uint64_t tailOffset_{0};
     148              :     uint64_t tailSize_{0};
     149              :     uint64_t loopIterNum_{0};
     150              :     std::vector<uint64_t> lengths_;
     151              : 
     152              :     uint64_t singleTransportSize_{0};
     153              :     uint64_t detourPathNum_{0}; // 到每个对端有几个绕路路径
     154              :     uint64_t pathNumPerPeer_{0};
     155              :     CollAlgOperator op_;
     156              :     std::vector<std::vector<RankId>> tempVTopo_;
     157              : };
     158              : 
     159              : } // namespace Hccl
     160              : #endif // HCCLV2_CCU_INSTRUCTION_ALL_GATHER_MESH_1D_H_
        

Generated by: LCOV version 2.0-1