LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective/alg/coll_alg_factory/alg_ccu_context/all_to_all - ccu_instruction_all_to_all_mesh1d.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 49 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_TO_ALL_MESH_1D_H_
      12              : #define HCCLV2_CCU_INSTRUCTION_ALL_TO_ALL_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              : // 为AllToAllMesh1D实现的CCUIns、CCUCtxArg与CCUTaskArg
      25              : class CcuCtxArgAllToAllMesh1D : public CcuCtxArg {
      26              : public:
      27            0 :     explicit CcuCtxArgAllToAllMesh1D(
      28              :         const std::vector<uint64_t>& dSize, uint32_t rId, const CollAlgOperator& op,
      29              :         const std::vector<std::vector<RankId>>& tempVTopo, bool loadFromMem = false)
      30            0 :         : dimSize(dSize),
      31            0 :           rankId(rId),
      32            0 :           op(op),
      33            0 :           tempVTopo(tempVTopo),
      34            0 :           loadFromMem(loadFromMem)
      35            0 :     {}
      36            0 :     CcuCtxSignature GetCtxSignature() const override
      37              :     {
      38            0 :         CcuCtxSignature signature;
      39            0 :         GenerateCcuCtxSignature(signature, CcuInstType::CCU_ALLTOALL_MESH_1D_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              :     bool loadFromMem;
      47              : };
      48              : 
      49              : class CcuTaskArgAllToAllMesh1D : public CcuTaskArg {
      50              : public:
      51            0 :     explicit CcuTaskArgAllToAllMesh1D(
      52              :         uint64_t inputAddr, uint64_t outputAddr, uint64_t sliceSize, uint64_t token, uint64_t srcOffset,
      53              :         uint64_t dstOffset, uint64_t srcStride)
      54            0 :         : inputAddr(inputAddr),
      55            0 :           outputAddr(outputAddr),
      56            0 :           sliceSize(sliceSize),
      57            0 :           token(token),
      58            0 :           srcOffset(srcOffset),
      59            0 :           dstOffset(dstOffset),
      60            0 :           srcStride(srcStride)
      61            0 :     {}
      62              : 
      63              :     uint64_t inputAddr;
      64              :     uint64_t outputAddr;
      65              :     uint64_t sliceSize;
      66              :     uint64_t token;
      67              :     uint64_t srcOffset;
      68              :     uint64_t dstOffset;
      69              :     uint64_t srcStride;
      70              : };
      71              : 
      72              : class CcuInstructionAllToAllMesh1D : public CcuInstruction {
      73              : public:
      74            0 :     CcuInstructionAllToAllMesh1D() : CcuInstruction() {}
      75              : 
      76            0 :     void Init(
      77              :         uint32_t rankId, uint64_t inputAddr, uint64_t outputAddr, uint64_t sliceSize, uint64_t token,
      78              :         uint64_t srcOffset, uint64_t dstOffset, uint64_t srcStride, CollAlgOperator& op,
      79              :         std::vector<std::vector<RankId>>& tempVTopo, bool loadFromMem = false)
      80              :     {
      81            0 :         u32 maxDimNum = 1;
      82            0 :         if (tempVTopo.size() != maxDimNum) {
      83            0 :             THROW<InvalidParamsException>(StringFormat(
      84              :                 "[CcuInstructionAllToAllMesh1D] 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 :         inputAddr_ = inputAddr;
      89            0 :         outputAddr_ = outputAddr;
      90            0 :         sliceSize_ = sliceSize;
      91            0 :         token_ = token;
      92            0 :         srcOffset_ = srcOffset;
      93            0 :         dstOffset_ = dstOffset;
      94            0 :         srcStride_ = srcStride;
      95            0 :         op_ = op;
      96            0 :         tempVTopo_ = tempVTopo;
      97            0 :         loadFromMem_ = loadFromMem;
      98            0 :         return;
      99              :     }
     100              : 
     101            0 :     CcuInstType GetInstType() const override
     102              :     {
     103            0 :         HCCL_INFO("CcuInstructionAllToAllMesh1D instype is CCU_ALLTOALL_MESH_1D_DIRECT.");
     104            0 :         return instType_;
     105              :     }
     106              : 
     107            0 :     std::string Describe() const override
     108              :     {
     109              :         return StringFormat(
     110            0 :             "CcuInstructionAllToAllMesh1D rankId [%u], instType[%s]", rankId_, instType_.Describe().c_str());
     111              :     }
     112              : 
     113            0 :     std::unique_ptr<CcuCtxArg> GetCtxArg() const override
     114              :     {
     115            0 :         return std::make_unique<CcuCtxArgAllToAllMesh1D>(dimSize_, rankId_, op_, tempVTopo_, loadFromMem_);
     116              :     }
     117              : 
     118              :     void SetInstType(CcuInstType instType) { instType_ = instType; }
     119              : 
     120            0 :     std::unique_ptr<CcuTaskArg> GetTaskArg() const override
     121              :     {
     122            0 :         return std::make_unique<CcuTaskArgAllToAllMesh1D>(
     123            0 :             inputAddr_, outputAddr_, sliceSize_, token_, srcOffset_, dstOffset_, srcStride_);
     124              :     }
     125              : 
     126              : private:
     127              :     CcuInstType instType_ = CcuInstType::CCU_ALLTOALL_MESH_1D_DIRECT;
     128              :     std::vector<uint64_t> dimSize_;
     129              :     uint32_t rankId_{0};
     130              :     uint64_t inputAddr_{0};
     131              :     uint64_t outputAddr_{0};
     132              :     uint64_t sliceSize_{0};
     133              :     uint64_t token_{0};
     134              :     uint64_t srcOffset_{0};
     135              :     uint64_t dstOffset_{0};
     136              :     uint64_t srcStride_{0};
     137              :     CollAlgOperator op_;
     138              :     std::vector<std::vector<RankId>> tempVTopo_;
     139              :     bool loadFromMem_{false};
     140              : };
     141              : 
     142              : } // namespace Hccl
     143              : #endif // HCCLV2_CCU_INSTRUCTION_ALL_ALL_TO_ALL_MESH_1D_H
        

Generated by: LCOV version 2.0-1