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

Generated by: LCOV version 2.0-1