LCOV - code coverage report
Current view: top level - coll_communicator_mgr/communicator - independent_op.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 5 5
Test Date: 2026-08-18 17:47:01 Functions: 100.0 % 5 5

            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 INDEPENDENT_OP_RESOURCE_MANAGER_H
      12              : #define INDEPENDENT_OP_RESOURCE_MANAGER_H
      13              : 
      14              : #include <memory>
      15              : #include <string>
      16              : #include <unordered_set>
      17              : #include <atomic>
      18              : #include "hccl/hccl_res.h"
      19              : #include "hccl_independent_common.h"
      20              : #include "comm_mem_manager.h"
      21              : #include "comm_engine_res_manager.h"
      22              : #include "rank_graph.h"
      23              : #include "comm_config_pub.h"
      24              : #include "independent_op_context_manager.h"
      25              : #include "channel_manager.h"
      26              : #include "aicpu_init_param.h"
      27              : 
      28              : namespace hccl {
      29              : constexpr int32_t HCCL_COMM_ENGINE_CONFIG_NOT_SET = -1;
      30              : constexpr uint32_t HCCL_COMM_THREADNUM_CONFIG_NOT_SET = 0xffffffff;
      31              : constexpr uint32_t HCCL_COMM_NOTIFY_NUM_PER_THREAD_CONFIG_NOT_SET = 0xffffffff;
      32              : 
      33              : class IndependentOp {
      34              : public:
      35              :     IndependentOp();
      36          653 :     ~IndependentOp() = default;
      37              : 
      38              :     // 初始化资源管理器
      39              :     HcclResult SetIndependentOpConfig(
      40              :         const CommConfig& commConfig, const RankTable_t& rankTable, const HcclTopoAttr& topoAttr,
      41              :         const aclrtBinHandle binHandle, HDCommunicateParams& kfcControlTransferH2DParams,
      42              :         HDCommunicateParams& kfcStatusTransferD2HParams, CCLBufferManager& bufferManager);
      43              :     HcclResult SetChannelCallbacks(const ChannelManagerCallbacks& channelCallbacks);
      44              : 
      45              :     // 获取配置信息
      46              :     u32 GetThreadNum() const { return threadNum_; }
      47              :     u32 GetNotifyNumPerThread() const { return notifyNumPerThread_; }
      48              : 
      49              :     bool GetAicpuCommState(); // 是否线程安全
      50              :     void SetAicpuCommState(bool aicpuCommState);
      51              : 
      52            7 :     inline CommMemMgr& GetCommMemMgr() { return commMemMgr_; }
      53              : 
      54           22 :     inline CommEngineResMgr& GetCommEngineResMgr() { return engineResMgr_; }
      55              : 
      56           52 :     inline ContextManager& GetContextManager() { return contextMgr_; }
      57              : 
      58          405 :     inline ChannelManager& GetChannelManager() { return channelMgr_; }
      59              : 
      60              :     // 自定义算子Aicpu通信域公共初始化
      61              :     HcclResult KernelLaunchAicpuCommInit();
      62              : 
      63              : private:
      64              :     // config内容
      65              :     int32_t commEngine_ = -1;
      66              :     u32 threadNum_ = 0;
      67              :     u32 notifyNumPerThread_ = 0;
      68              :     u64 cclBufferSize_ = 0;
      69              :     std::string commId_;
      70              :     aclrtBinHandle binHandle_ = nullptr;
      71              : 
      72              :     // 管理器
      73              :     CommMemMgr commMemMgr_;
      74              :     CommEngineResMgr engineResMgr_;
      75              :     ContextManager contextMgr_;
      76              :     ChannelManager channelMgr_;
      77              : 
      78              :     bool isAicpuCommInit_ = false;
      79              :     CommAicpuParam commAicpuParam_{};
      80              : };
      81              : 
      82              : } // namespace hccl
      83              : #endif
        

Generated by: LCOV version 2.0-1