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_v_mesh1d_mem2mem.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 38 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_REDUCE_SCATTER_V_MESH_1D_MEM2MEM_H_
      12              : #define HCCLV2_CCU_INSTRUCTION_REDUCE_SCATTER_V_MESH_1D_MEM2MEM_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              : // 为ReduceScatterVMeshMem2Mem1D实现的CCUIns、CCUCtxArg与CCUTaskArg
      25              : class CcuCtxArgReduceScatterVMeshMem2Mem1D : public CcuCtxArg {
      26              : public:
      27            0 :     explicit CcuCtxArgReduceScatterVMeshMem2Mem1D(const std::vector<uint64_t> &dSize, uint32_t rId,
      28            0 :         const CollAlgOperator &op, const std::vector<std::vector<RankId>> &tempVTopo) :
      29            0 :             dimSize_(dSize), rankId_(rId), op_(op), tempVTopo_(tempVTopo) {}
      30            0 :     CcuCtxSignature GetCtxSignature() const override
      31              :     {
      32            0 :         CcuCtxSignature signature;
      33            0 :         GenerateCcuCtxSignature(signature, CcuInstType::CCU_REDUCE_SCATTER_V_MESH_1D_MEM2MEM_DIRECT, op_, tempVTopo_);
      34            0 :         return signature;
      35            0 :     }
      36              :     std::vector<uint64_t> dimSize_;
      37              :     uint32_t rankId_;
      38              :     CollAlgOperator op_;
      39              :     std::vector<std::vector<RankId>> tempVTopo_;
      40              : };
      41              : 
      42              : class CcuTaskArgReduceScatterVMeshMem2Mem1D : public CcuTaskArg {
      43              : public:
      44            0 :     explicit CcuTaskArgReduceScatterVMeshMem2Mem1D(uint64_t inputAddr, uint64_t outputAddr, uint64_t scratchAddr, uint64_t scratchInterval, uint64_t sliceSize, uint64_t offset,
      45            0 :         uint64_t token) :
      46            0 :         inputAddr_(inputAddr), outputAddr_(outputAddr), scratchAddr_(scratchAddr), scratchInterval_(scratchInterval), sliceSize_(sliceSize), offset_(offset), token_(token) {}
      47              : 
      48              :     uint64_t inputAddr_;
      49              :     uint64_t outputAddr_;
      50              :     uint64_t scratchAddr_;
      51              :     uint64_t scratchInterval_;
      52              :     uint64_t sliceSize_;
      53              :     uint64_t offset_;
      54              :     uint64_t token_;
      55              : };
      56              : 
      57              : class CcuInstructionReduceScatterVMeshMem2Mem1D : public CcuInstruction {
      58              : public:
      59            0 :     CcuInstructionReduceScatterVMeshMem2Mem1D() : CcuInstruction()
      60              :     {
      61            0 :     }
      62              : 
      63            0 :     void Init(uint32_t rankId, uint64_t inputAddr, uint64_t outputAddr, uint64_t scratchAddr, uint64_t scratchInterval, uint64_t sliceSize,
      64              :         uint64_t offset, uint64_t token, CollAlgOperator &op, std::vector<std::vector<RankId>> &tempVTopo)
      65              :     {
      66            0 :         u32 maxDimNum = 1;
      67            0 :         if (tempVTopo.size() != maxDimNum) {
      68            0 :             THROW<InvalidParamsException>(StringFormat(
      69              :                 "[CcuInstructionReduceScatterVMeshMem2Mem1D] tempVTopo size is not 1, size is [%zu].", tempVTopo.size()));
      70              :         }
      71            0 :         dimSize_.push_back(tempVTopo[0].size());
      72            0 :         rankId_ = rankId;
      73            0 :         inputAddr_ = inputAddr;
      74            0 :         outputAddr_ = outputAddr;
      75            0 :         scratchAddr_ = scratchAddr;
      76            0 :         scratchInterval_ = scratchInterval;
      77            0 :         sliceSize_ = sliceSize;
      78            0 :         token_ = token;
      79            0 :         offset_ = offset;
      80            0 :         op_ = op;
      81            0 :         tempVTopo_ = tempVTopo;
      82            0 :         return;
      83              :     }
      84              : 
      85            0 :     CcuInstType GetInstType() const override
      86              :     {
      87            0 :         HCCL_INFO("CcuInstructionReduceScatterVMeshMem2Mem1D instype is CCU_REDUCE_SCATTER_V_MESH_1D_MEM2MEM_DIRECT.");
      88            0 :         return instType_;
      89              :     }
      90              : 
      91            0 :     std::string Describe() const override
      92              :     {
      93            0 :         return StringFormat("CcuInstructionReduceScatterVMeshMem2Mem1D rankId [%u], instType[%s]", rankId_, instType_.Describe().c_str());
      94              :     }
      95              : 
      96              :     void SetInstType(CcuInstType instType) 
      97              :     { 
      98              :         instType_ = instType; 
      99              :     }
     100              : 
     101            0 :     std::unique_ptr<CcuCtxArg> GetCtxArg() const override
     102              :     {
     103            0 :         return std::make_unique<CcuCtxArgReduceScatterVMeshMem2Mem1D>(dimSize_, rankId_, op_, tempVTopo_);
     104              :     }
     105              : 
     106            0 :     std::unique_ptr<CcuTaskArg> GetTaskArg() const override
     107              :     {
     108            0 :         return std::make_unique<CcuTaskArgReduceScatterVMeshMem2Mem1D>(inputAddr_, outputAddr_, scratchAddr_, scratchInterval_, sliceSize_, offset_, token_);
     109              :     }
     110              : 
     111              : private:
     112              :     CcuInstType instType_ = CcuInstType::CCU_REDUCE_SCATTER_V_MESH_1D_MEM2MEM_DIRECT;
     113              :     std::vector<uint64_t> dimSize_;
     114              :     uint32_t rankId_{0};
     115              :     uint64_t inputAddr_{0};
     116              :     uint64_t outputAddr_{0};
     117              :     uint64_t scratchAddr_{0};
     118              :     uint64_t scratchInterval_{0};
     119              :     uint64_t sliceSize_{0};
     120              :     uint64_t offset_{0};
     121              :     uint64_t token_{0};
     122              :     CollAlgOperator op_;
     123              :     std::vector<std::vector<RankId>> tempVTopo_;
     124              : };
     125              : 
     126              : }
     127              : #endif // HCCLV2_CCU_INSTRUCTION_REDUCE_SCATTER_V_MESH_1D_MEM2MEM_H_
        

Generated by: LCOV version 2.0-1