LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective/alg/coll_alg_factory/alg_template/aiv_alg_template - aiv_alg_template_base.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 50 0
Test Date: 2026-08-18 17:47:01 Functions: 0.0 % 16 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              : #include "aiv_alg_template_base.h"
      12              : 
      13              : namespace Hccl {
      14              : 
      15            0 : AivAlgTemplateBase::AivAlgTemplateBase(
      16              :     const RankId virtualRank, const u32 tempRankSize, const std::vector<std::vector<RankId>>& tempVTopo,
      17            0 :     const std::map<RankId, u32>& tempVirtRankMap)
      18            0 :     : myRank_(virtualRank),
      19            0 :       tempRankSize_(tempRankSize),
      20            0 :       tempVTopo_(tempVTopo),
      21            0 :       tempVirtRankMap_(tempVirtRankMap)
      22            0 : {}
      23              : 
      24            0 : AivAlgTemplateBase::~AivAlgTemplateBase() {}
      25              : 
      26            0 : void AivAlgTemplateBase::SetCollOp(const CollAlgOperator& op)
      27              : {
      28            0 :     op_ = op;
      29            0 :     return;
      30              : }
      31              : 
      32            0 : void AivAlgTemplateBase::SetDmaMode(const DmaMode dmaMode)
      33              : {
      34            0 :     dmaMode_ = dmaMode;
      35            0 :     return;
      36              : }
      37              : 
      38            0 : void AivAlgTemplateBase::InitReduceInfo(const ReduceOp& redOp, const DataType& dataType)
      39              : {
      40            0 :     reduceOp_ = redOp;
      41            0 :     dataType_ = dataType;
      42            0 :     return;
      43              : }
      44              : 
      45            0 : void AivAlgTemplateBase::SetDataType(const DataType& dataType)
      46              : {
      47            0 :     dataType_ = dataType;
      48            0 :     return;
      49              : }
      50              : 
      51            0 : void AivAlgTemplateBase::SetRoot(const u32 root)
      52              : {
      53            0 :     root_ = root;
      54            0 :     return;
      55              : }
      56              : 
      57            0 : HcclResult AivAlgTemplateBase::CalcRes(AlgTempResReq& tempResReq)
      58              : {
      59              :     (void)tempResReq;
      60            0 :     HCCL_ERROR("[AivAlgTemplateBase] Unsupported interface of resource calculation!");
      61            0 :     return HcclResult::HCCL_E_INTERNAL;
      62              : }
      63              : 
      64            0 : HcclResult AivAlgTemplateBase::CalcResDetour(const RankGraph* rankGraph, AlgTempResReq& tempResReq)
      65              : {
      66              :     (void)rankGraph;
      67              :     (void)tempResReq;
      68            0 :     HCCL_ERROR("[AivAlgTemplateBase] Current alg do not support detour mode!");
      69            0 :     return HcclResult::HCCL_E_INTERNAL;
      70              : }
      71              : 
      72            0 : HcclResult AivAlgTemplateBase::CalcResDetour(ConnectedLinkMgr* linkMgr, AlgTempResReq& tempResReq)
      73              : {
      74              :     (void)linkMgr;
      75              :     (void)tempResReq;
      76            0 :     HCCL_ERROR("[AivAlgTemplateBase] Current alg do not support detour mode!");
      77            0 :     return HcclResult::HCCL_E_INTERNAL;
      78              : }
      79              : 
      80            0 : u32 AivAlgTemplateBase::CalcScratchMultiple(BufferType inBuffType, BufferType outBuffType)
      81              : {
      82              :     (void)inBuffType;
      83              :     (void)outBuffType;
      84              :     // AIV模式默认返回一整块Scratch
      85            0 :     return 1;
      86              : }
      87              : 
      88            0 : HcclResult AivAlgTemplateBase::GenExtIns(
      89              :     const TempFuncs& tempFuncs, const TemplateDataParams& templateDataParams, const ResLinks& tempLinks,
      90              :     std::vector<InsQuePtr>& tempInsQues)
      91              : {
      92              :     (void)tempFuncs;
      93              :     (void)templateDataParams;
      94              :     (void)tempLinks;
      95              :     (void)tempInsQues;
      96            0 :     HCCL_ERROR("[AivAlgTemplateBase] Unsupported interface of instruction generation!");
      97            0 :     return HcclResult::HCCL_E_INTERNAL;
      98              : }
      99              : 
     100            0 : void AivAlgTemplateBase::IncSliceId()
     101              : {
     102            0 :     sliceId_++;
     103            0 :     return;
     104              : }
     105              : 
     106            0 : HcclResult AivAlgTemplateBase::CalNumBlocks(u32& numBlocks, u64 dataSize, u32 numBlocksLimit)
     107              : {
     108              :     (void)dataSize;
     109            0 :     if (numBlocksLimit >= tempRankSize_) {
     110            0 :         numBlocks = tempRankSize_;
     111              :     } else {
     112            0 :         numBlocks = numBlocksLimit;
     113              :     }
     114            0 :     HCCL_INFO("[AivAlgTemplateBase] Actually use core num[%u]", numBlocks);
     115            0 :     return HCCL_SUCCESS;
     116              : }
     117              : 
     118            0 : HcclResult AivAlgTemplateBase::setPathNumMap(const std::map<u32, u32>& rank2PathNumMap) const
     119              : {
     120              :     (void)rank2PathNumMap;
     121            0 :     HCCL_WARNING("[AivAlgTemplateBase] Unsupported interface of setPathNumMap!");
     122            0 :     return HCCL_SUCCESS;
     123              : }
     124              : 
     125              : } // namespace Hccl
        

Generated by: LCOV version 2.0-1