LCOV - code coverage report
Current view: top level - coll_communicator_mgr/dfx - hcclCommDfxLite.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 2 0
Test Date: 2026-08-04 10:52:23 Functions: 0.0 % 1 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              : #ifndef HCCL_COMM_DFX_LITE_H
      11              : #define HCCL_COMM_DFX_LITE_H
      12              : #include "mirror_task_manager_lite.h"
      13              : #include "hcclCommProfilingLite.h"
      14              : #include "hccl_common.h"
      15              : #include "buffer.h"
      16              : #include "common.h"
      17              : #include "hcclCommOp.h"
      18              : 
      19              : namespace hccl {
      20              : // NOTE: HcclCommDfxLite is designed for AICPU single-threaded environments.
      21              : // channelRemoteRankIdLite_ and its access methods (AddChannelRemoteRankId/GetChannelRemoteRankId)
      22              : // are NOT thread-safe. If used in multi-threaded environments, external synchronization is required.
      23              : class HcclCommDfxLite {
      24              : public:
      25              :      // 构造函数(接收CommunicatorImplLite中已经存在的MirrorTaskManager指针)
      26              :     explicit HcclCommDfxLite();
      27              : 
      28              :     // 初始化DFX系统 - 修改为返回HcclResult类型
      29              :     HcclResult Init(u32 deviceId, const std::string& commTag, u32 rankSize);
      30              :     // 获取MirrorTaskManager
      31              :     Hccl::MirrorTaskManagerLite* GetMirrorTaskManagerLite() const;
      32              : 
      33              :     // Profiling相关接口(直接暴露,不通过GetProfilingImpl)- 全部修改为返回HcclResult类型
      34              :     HcclResult ReportAllTasks();
      35              :     HcclResult ReportHcclOpInfo(const Hccl::DfxOpInfo& hcclOpInfo);
      36              :     HcclResult UpdateProfStat();
      37              :     HcclResult SetCurrDfxOpInfo(std::shared_ptr<Hccl::DfxOpInfo> dfxOpInfo);
      38            0 :     std::function<HcclResult(u32, u32, const Hccl::TaskParam&, u64)> GetCallback() const {
      39            0 :         return addTaskCallback_;
      40              :     }
      41              :     // 将remoteRankId添加到channelRemoteRankId_表中
      42              :     void AddChannelRemoteRankId(u64 handle, u32 remoteRankId);
      43              :     // 在channelRemoteRankId_表中对remoteRankId进行查找
      44              :     u32 GetChannelRemoteRankId(u64 handle);
      45              : private:
      46              :     std::unique_ptr<Hccl::MirrorTaskManagerLite> mirrorTaskManagerLite_{nullptr};
      47              :     std::unique_ptr<HcclCommProfilingLite> profilingImpl_{nullptr};
      48              :     std::unordered_map<u64, u32> channelRemoteRankIdLite_{};
      49              :     std::string commTag_{};
      50              :     u32 deviceId_{0};
      51              :     u32 rankSize_{0};
      52              :     std::function<HcclResult(u32, u32, const Hccl::TaskParam&, u64)> addTaskCallback_{};
      53              :     bool initializedFlag_{false};
      54              : };
      55              : 
      56              : }
      57              : #endif
        

Generated by: LCOV version 2.0-1