LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective/alg/coll_alg_factory/alg_ccu_context/reduce_scatter - ccu_instruction_reduce_scatter_mesh1d_2die.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 41 0
Test Date: 2026-07-28 12:11:00 Functions: 0.0 % 9 0

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2026 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_REDUCE_SCATTER_MESH_1D_2DIE_H_
      12              : #define HCCLV2_CCU_INSTRUCTION_REDUCE_SCATTER_MESH_1D_2DIE_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              : // 为ReduceScatterMesh1D实现的CCUIns、CCUCtxArg与CCUTaskArg
      25              : class CcuCtxArgReduceScatterMesh1D2Die : public CcuCtxArg {
      26              : public:
      27            0 :     explicit CcuCtxArgReduceScatterMesh1D2Die(const std::vector<uint64_t> &dSize, uint32_t rId,
      28              :                                               const CollAlgOperator &op, bool rmtReduceWithMyRank,
      29              :                                               const std::vector<std::vector<RankId>> &tempVTopo)
      30            0 :         : dimSize_(dSize), rankId_(rId), rmtReduceWithMyRank_(rmtReduceWithMyRank), op_(op), tempVTopo_(tempVTopo)
      31              :     {
      32            0 :     }
      33            0 :     CcuCtxSignature GetCtxSignature() const override
      34              :     {
      35            0 :         CcuCtxSignature signature;
      36            0 :         GenerateCcuCtxSignature(signature, CcuInstType::CCU_REDUCE_SCATTER_MESH_1D_DIRECT, op_, tempVTopo_);
      37            0 :         return signature;
      38            0 :     }
      39              :     std::vector<uint64_t>            dimSize_;
      40              :     u32                              rankId_;
      41              :     bool                             rmtReduceWithMyRank_;
      42              :     CollAlgOperator                  op_;
      43              :     std::vector<std::vector<RankId>> tempVTopo_;
      44              : };
      45              : 
      46              : class CcuTaskArgReduceScatterMesh1D2Die : public CcuTaskArg {
      47              : public:
      48            0 :     explicit CcuTaskArgReduceScatterMesh1D2Die(uint64_t inputAddr, uint64_t outputAddr, uint64_t scratchAddr,
      49              :                                                uint64_t sliceSize, uint64_t token)
      50            0 :         : inputAddr_(inputAddr), outputAddr_(outputAddr), scratchAddr_(scratchAddr), sliceSize_(sliceSize),
      51            0 :           token_(token)
      52              :     {
      53            0 :     }
      54              : 
      55              :     uint64_t inputAddr_{0};
      56              :     uint64_t outputAddr_{0};
      57              :     uint64_t scratchAddr_{0};
      58              :     uint64_t sliceSize_{0};
      59              :     uint64_t token_{0};
      60              : };
      61              : 
      62              : class CcuInstructionReduceScatterMesh1D2Die : public CcuInstruction {
      63              : public:
      64            0 :     CcuInstructionReduceScatterMesh1D2Die() : CcuInstruction()
      65              :     {
      66            0 :     }
      67              : 
      68            0 :     void Init(uint32_t rankId, CollAlgOperator &op, bool rmtReduceWithMyRank,
      69              :               std::vector<std::vector<RankId>> &tempVTopo, uint64_t inputAddr, uint64_t outputAddr,
      70              :               uint64_t scratchAddr, uint64_t sliceSize, uint64_t token)
      71              :     {
      72            0 :         u32 maxDimNum = 1;
      73            0 :         if (tempVTopo.size() != maxDimNum) {
      74            0 :             THROW<InvalidParamsException>(StringFormat(
      75              :                 "[CcuInstructionReduceScatterMesh1D2Die] tempVTopo size is not 1, size is [%zu].", tempVTopo.size()));
      76              :         }
      77              : 
      78            0 :         dimSize_.push_back(tempVTopo[0].size());
      79            0 :         rankId_              = rankId;
      80            0 :         op_                  = op;
      81            0 :         rmtReduceWithMyRank_ = rmtReduceWithMyRank;
      82            0 :         tempVTopo_           = tempVTopo;
      83            0 :         inputAddr_   = inputAddr;
      84            0 :         outputAddr_  = outputAddr;
      85            0 :         scratchAddr_ = scratchAddr;
      86            0 :         sliceSize_   = sliceSize;
      87            0 :         token_       = token;
      88            0 :     }
      89              : 
      90            0 :     CcuInstType GetInstType() const override
      91              :     {
      92            0 :         HCCL_INFO("CcuInstructionReduceScatterMesh1D2Die instype is CCU_REDUCE_SCATTER_MESH_1D_2DIE.");
      93            0 :         return instType_;
      94              :     }
      95              : 
      96            0 :     std::string Describe() const override
      97              :     {
      98            0 :         return StringFormat("CcuInstructionReduceScatterMesh1D2Die rankId [%u], instType[%s]", rankId_,
      99            0 :                             instType_.Describe().c_str());
     100              :     }
     101              : 
     102              :     void SetInstType(CcuInstType instType) 
     103              :     { 
     104              :         instType_ = instType; 
     105              :     }
     106              : 
     107            0 :     std::unique_ptr<CcuCtxArg> GetCtxArg() const override
     108              :     {
     109            0 :         return std::make_unique<CcuCtxArgReduceScatterMesh1D2Die>(dimSize_, rankId_, op_, rmtReduceWithMyRank_,
     110            0 :                                                                   tempVTopo_);
     111              :     }
     112              : 
     113            0 :     std::unique_ptr<CcuTaskArg> GetTaskArg() const override
     114              :     {
     115            0 :         return std::make_unique<CcuTaskArgReduceScatterMesh1D2Die>(inputAddr_, outputAddr_, scratchAddr_, sliceSize_,
     116            0 :                                                                    token_);
     117              :     }
     118              : 
     119              : private:
     120              :     CcuInstType instType_ = CcuInstType::CCU_REDUCE_SCATTER_MESH_1D_2DIE;
     121              : 
     122              :     std::vector<uint64_t>            dimSize_;
     123              :     u32                              rankId_{0};
     124              :     CollAlgOperator                  op_;
     125              :     bool                             rmtReduceWithMyRank_{true};
     126              :     std::vector<std::vector<RankId>> tempVTopo_;
     127              :     uint64_t inputAddr_{0};
     128              :     uint64_t outputAddr_{0};
     129              :     uint64_t scratchAddr_{0};
     130              :     uint64_t sliceSize_{0};
     131              :     uint64_t token_{0};
     132              : };
     133              : 
     134              : } // namespace Hccl
     135              : #endif // HCCLV2_CCU_INSTRUCTION_REDUCE_SCATTER_MESH_1D_2DIE_H_
        

Generated by: LCOV version 2.0-1