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

Generated by: LCOV version 2.0-1