LCOV - code coverage report
Current view: top level - legacy/ascend910/algorithm/impl/coll_executor - coll_executor_base.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 2 2
Test Date: 2026-08-18 17:47:01 Functions: 66.7 % 3 2

            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 HCCL_COLL_EXECUTOR_BASE_H
      12              : #define HCCL_COLL_EXECUTOR_BASE_H
      13              : 
      14              : #include "hccl_impl.h"
      15              : #include "topo_matcher.h"
      16              : #include "coll_alg_param.h"
      17              : #include "executor_impl.h"
      18              : #include "coll_alg_utils.h"
      19              : #include "hccl_aiv.h"
      20              : 
      21              : namespace hccl {
      22              : 
      23              : class CollExecutorBase {
      24              : public:
      25              :     CollExecutorBase(const HcclDispatcher dispatcher, std::unique_ptr<TopoMatcher>& topoMatcher);
      26          184 :     virtual ~CollExecutorBase() = default;
      27              : 
      28              :     // 每次构造完必须调用 SetAlgType
      29              :     HcclResult SetAlgType(const AlgType algType);
      30              : 
      31              :     HcclResult SetCCLInBuffer(u64 cclbufferSize);
      32              :     HcclResult SetIsSupportSDMAReduce(bool isSupportSDMAReduce);
      33              :     HcclResult SetAlgOpContext(AlgOpContext algOpContext);
      34              :     HcclResult SetAivClearEnable(bool aivClearEnable);
      35              : 
      36              :     virtual HcclResult CalcResRequest(const OpParam& param, AlgResourceRequest& resourceRequest) = 0;
      37              :     virtual HcclResult Orchestrate(OpParam& param, AlgResourceResponse& algRes) = 0;
      38              :     virtual HcclResult GetAivExecParam(const OpParam& param, AlgResourceResponse& algRes, AivSuperKernelArgs& args);
      39              :     virtual HcclResult GetAdjInfo(AlgResourceResponse& algRes, AdjInfo& adjInfo);
      40              :     // AIV拷贝通信域信息到device上
      41              :     virtual HcclResult PrepareCommInfoToDevice(AlgResourceResponse& algResource);
      42              :     // AIV支持Roce直通Rma信息拷贝
      43              :     HcclResult SetRmaInfo(void* rmaInfo);
      44              : 
      45              :     // batchsendrecv需要增量建链
      46              :     virtual HcclResult CalcIncreLinkRequest(
      47              :         const OpParam& param, std::set<u32>& ranksLinked, AlgResourceRequest& resourceRequest, bool& needIncreLink);
      48              : 
      49              :     virtual void SetWorkflowMode(HcclWorkflowMode workflowMode);
      50              :     virtual HcclWorkflowMode GetExecutorWorkflowMode() const;
      51              : 
      52              :     static HcclResult RunTemplate(const std::unique_ptr<AlgTemplateBase>& tempAlg, const SubCommInfo& commInfo);
      53              : 
      54              :     // batchsendrecv retry使用
      55              :     virtual HcclResult CreatePairWiseList(HcclSendRecvItem* sendRecvInfo, u32 itemNum);
      56              :     virtual HcclResult GetPairWiseList(std::vector<std::vector<HcclSendRecvItem*>>& sendRecvPairList);
      57              :     virtual HcclResult
      58              :     CalNumBlocks(u32& numBlocks, u32 rankSize, u64 dataSize = 0, HcclCMDType cmdType = HcclCMDType::HCCL_CMD_INVALID);
      59              :     HcclResult GetNumBlocks(u32& numBlocks) const;
      60              :     HcclResult SetNumBlocks(const u32& numBlocks);
      61              :     HcclResult GetCache(HcclCacheInfo& cacheInfo);
      62              :     HcclResult SetOpCounter(const OpCounterInfo& opCounter);
      63              : 
      64           75 :     inline AlgDesc GetAlgDesc() { return desc_; }
      65              : 
      66              :     // 用于alltoallv算子的aicpu展开cache
      67              :     virtual HcclResult MarkNeedAlltoallvCache();
      68              :     virtual HcclResult
      69              :     GetHcclOffsetDstRanksMap(std::unordered_map<uint64_t, std::vector<uint32_t>>& hcclOffsetDstRanksMap) const;
      70              : 
      71              : protected:
      72              :     const HcclDispatcher dispatcher_;
      73              :     u64 inCCLbufferSize_{0}; // CCLIN大小,用于计算scratch
      74              :     AlgType algType_;        // 算法类型
      75              :     std::unique_ptr<TopoMatcher>& topoMatcher_;
      76              :     bool isSupportSDMAReduce_ = false;
      77              :     AlgOpContext algOpContext_;
      78              :     bool aivClearEnable_ = false;
      79              :     u32 numBlocks_ = MAX_NUM_BLOCKS;
      80              :     OpCounterInfo opCounter_;
      81              :     AlgDesc desc_;
      82              :     void* rmaInfo_ = nullptr;
      83              :     HcclCacheInfo cacheInfo_;
      84              : };
      85              : } // namespace hccl
      86              : #endif
        

Generated by: LCOV version 2.0-1