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_mem2mem_with_stride.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 57 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_MEM2MEM_WITH_STRIDE_H_
      12              : #define HCCLV2_CCU_INSTRUCTION_ALL_GATHER_MESH_1D_MEM2MEM_WITH_STRIDE_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              : // 为AllGatherMesh1D实现的CCUIns、CCUCtxArg与CCUTaskArg
      25              : class CcuCtxArgAllGatherMesh1DMem2MemWithStride : public CcuCtxArg {
      26              : public:
      27            0 :     explicit CcuCtxArgAllGatherMesh1DMem2MemWithStride(
      28              :         const std::vector<uint64_t>& dimSize, uint32_t rankId, const CollAlgOperator& op,
      29              :         const std::vector<std::vector<RankId>>& tempVTopo)
      30            0 :         : dimSize_(dimSize),
      31            0 :           rankId_(rankId),
      32            0 :           op_(op),
      33            0 :           tempVTopo_(tempVTopo)
      34            0 :     {}
      35            0 :     CcuCtxSignature GetCtxSignature() const override
      36              :     {
      37            0 :         CcuCtxSignature signature;
      38            0 :         GenerateCcuCtxSignature(
      39            0 :             signature, CcuInstType::CCU_ALLGATHER_MESH_1D_MEM2MEM_WITH_STRIDE_DIRECT, op_, tempVTopo_);
      40            0 :         return signature;
      41            0 :     }
      42              :     std::vector<uint64_t> dimSize_;
      43              :     uint32_t rankId_;
      44              :     CollAlgOperator op_;
      45              :     std::vector<std::vector<RankId>> tempVTopo_;
      46              : };
      47              : 
      48              : class CcuTaskArgAllGatherMesh1DMem2MemWithStride : public CcuTaskArg {
      49              : public:
      50            0 :     explicit CcuTaskArgAllGatherMesh1DMem2MemWithStride(
      51              :         uint64_t inputAddr, uint64_t outputAddr, uint64_t token, uint64_t inputSliceStride, uint64_t outputSliceStride,
      52              :         uint64_t repeatNum, uint64_t inputRepeatStride, uint64_t outputRepeatStride, uint64_t normalSliceSize,
      53              :         uint64_t lastSliceSize, uint64_t isInputOutputEqual)
      54            0 :         : inputAddr_(inputAddr),
      55            0 :           outputAddr_(outputAddr),
      56            0 :           token_(token),
      57            0 :           inputSliceStride_(inputSliceStride),
      58            0 :           outputSliceStride_(outputSliceStride),
      59            0 :           repeatNum_(repeatNum),
      60            0 :           inputRepeatStride_(inputRepeatStride),
      61            0 :           outputRepeatStride_(outputRepeatStride),
      62            0 :           normalSliceSize_(normalSliceSize),
      63            0 :           lastSliceSize_(lastSliceSize),
      64            0 :           isInputOutputEqual_(isInputOutputEqual)
      65            0 :     {}
      66              : 
      67              :     uint64_t inputAddr_;
      68              :     uint64_t outputAddr_;
      69              :     uint64_t token_;
      70              : 
      71              :     uint64_t inputSliceStride_;
      72              :     uint64_t outputSliceStride_;
      73              :     uint64_t repeatNum_;
      74              :     uint64_t inputRepeatStride_;
      75              :     uint64_t outputRepeatStride_;
      76              : 
      77              :     uint64_t normalSliceSize_;
      78              :     uint64_t lastSliceSize_;
      79              :     uint64_t isInputOutputEqual_;
      80              : };
      81              : 
      82              : class CcuInstructionAllGatherMesh1DMem2MemWithStride : public CcuInstruction {
      83              : public:
      84            0 :     CcuInstructionAllGatherMesh1DMem2MemWithStride() : CcuInstruction() {}
      85              : 
      86            0 :     void Init(
      87              :         uint32_t rankId, uint32_t repeatNum, const CollAlgOperator& op,
      88              :         const std::vector<std::vector<RankId>>& tempVTopo, uint64_t inputAddr, uint64_t outputAddr, uint64_t token,
      89              :         uint64_t inputSliceStride, uint64_t outputSliceStride, uint64_t inputRepeatStride, uint64_t outputRepeatStride,
      90              :         uint64_t normalSliceSize, uint64_t lastSliceSize, uint64_t isInputOutputEqual)
      91              :     {
      92            0 :         u32 maxDimNum = 1;
      93            0 :         if (tempVTopo.size() != maxDimNum) {
      94            0 :             THROW<InvalidParamsException>(StringFormat(
      95              :                 "[CcuInstructionAllGatherMesh1D] tempVTopo size is not 1, size is [%zu].", tempVTopo.size()));
      96              :         }
      97            0 :         dimSize_.push_back(tempVTopo[0].size());
      98            0 :         rankId_ = rankId;
      99            0 :         repeatNum_ = repeatNum;
     100            0 :         op_ = op;
     101            0 :         tempVTopo_ = tempVTopo;
     102            0 :         inputAddr_ = inputAddr;
     103            0 :         outputAddr_ = outputAddr;
     104            0 :         token_ = token;
     105            0 :         inputSliceStride_ = inputSliceStride;
     106            0 :         outputSliceStride_ = outputSliceStride;
     107            0 :         inputRepeatStride_ = inputRepeatStride;
     108            0 :         outputRepeatStride_ = outputRepeatStride;
     109            0 :         normalSliceSize_ = normalSliceSize;
     110            0 :         lastSliceSize_ = lastSliceSize;
     111            0 :         isInputOutputEqual_ = isInputOutputEqual;
     112            0 :         return;
     113              :     }
     114              : 
     115            0 :     CcuInstType GetInstType() const override
     116              :     {
     117            0 :         HCCL_INFO("CcuInstructionAllGatherMesh1D instype is CCU_ALLGATHER_MESH_1D_MEM2MEM_WITH_STRIDE_DIRECT.");
     118            0 :         return instType_;
     119              :     }
     120              : 
     121            0 :     std::string Describe() const override
     122              :     {
     123              :         return StringFormat(
     124            0 :             "CcuInstructionAllGatherMesh1D rankId [%u], instType[%s]", rankId_, instType_.Describe().c_str());
     125              :     }
     126              : 
     127            0 :     std::unique_ptr<CcuCtxArg> GetCtxArg() const override
     128              :     {
     129            0 :         return std::make_unique<CcuCtxArgAllGatherMesh1DMem2MemWithStride>(dimSize_, rankId_, op_, tempVTopo_);
     130              :     }
     131              : 
     132            0 :     std::unique_ptr<CcuTaskArg> GetTaskArg() const override
     133              :     {
     134            0 :         return std::make_unique<CcuTaskArgAllGatherMesh1DMem2MemWithStride>(
     135            0 :             inputAddr_, outputAddr_, token_, inputSliceStride_, outputSliceStride_, repeatNum_, inputRepeatStride_,
     136            0 :             outputRepeatStride_, normalSliceSize_, lastSliceSize_, isInputOutputEqual_);
     137              :     }
     138              : 
     139              :     void SetInstType(CcuInstType instType) { instType_ = instType; }
     140              : 
     141              : private:
     142              :     CcuInstType instType_ = CcuInstType::CCU_ALLGATHER_MESH_1D_MEM2MEM_WITH_STRIDE_DIRECT;
     143              :     std::vector<uint64_t> dimSize_;
     144              :     uint32_t rankId_{0};
     145              :     uint32_t repeatNum_{0};
     146              :     CollAlgOperator op_;
     147              :     std::vector<std::vector<RankId>> tempVTopo_;
     148              :     uint64_t inputAddr_{0};
     149              :     uint64_t outputAddr_{0};
     150              :     uint64_t token_{0};
     151              :     uint64_t inputSliceStride_{0};
     152              :     uint64_t outputSliceStride_{0};
     153              :     uint64_t inputRepeatStride_{0};
     154              :     uint64_t outputRepeatStride_{0};
     155              :     uint64_t normalSliceSize_{0};
     156              :     uint64_t lastSliceSize_{0};
     157              :     uint64_t isInputOutputEqual_{0};
     158              : };
     159              : 
     160              : } // namespace Hccl
     161              : #endif // HCCLV2_CCU_INSTRUCTION_ALL_GATHER_MESH_1D_MEM2MEM_WITH_STRIDE_H_
        

Generated by: LCOV version 2.0-1