LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/resource/transport/aicpu - roce_transport_lite_impl.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 1 0
Test Date: 2026-08-04 10:52:23 Functions: 0.0 % 1 0

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2026 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 ROCE_TRANSPORT_LITE_IMPL_H
      11              : #define ROCE_TRANSPORT_LITE_IMPL_H
      12              : 
      13              : #include <vector>
      14              : #include <memory>
      15              : #include "base_transport_lite_impl.h"
      16              : #include "notify_lite.h"
      17              : #include "rma_buffer_lite.h"
      18              : #include "rmt_rma_buffer_lite.h"
      19              : #include "rdma_conn_lite_v2.h"
      20              : 
      21              : namespace Hccl {
      22              : 
      23              : class RoceTransportLiteImpl : public BaseTransportLiteImpl {
      24              : public:
      25              :     explicit RoceTransportLiteImpl(std::vector<char> &uniqueId);
      26            0 :     RoceTransportLiteImpl() = default;
      27              :     ~RoceTransportLiteImpl() override;
      28              : 
      29              :     void Init(std::vector<char> &uniqueId);
      30              : 
      31              :     std::string Describe() const override;
      32              : 
      33              :     // ========== Buffer 构造接口 ==========
      34              :     HcclResult BuildLocRmaBufferLite(const uintptr_t addr, const size_t size, RmaBufferLite &rmaBufferLite) override;
      35              : 
      36              :     // ========== RMA 数据传输接口 ==========
      37              :     void Read(const RmaBufferLite &loc, const Buffer &rmt, const StreamLite &stream) override;
      38              :     void Write(const RmaBufferLite &loc, const Buffer &rmt, const StreamLite &stream) override;
      39              :     void WriteReduce(const RmaBufferLite &loc, const Buffer &rmt, const ReduceIn &reduceIn,
      40              :                      const StreamLite &stream) override;
      41              :     void WriteWithNotify(const RmaBufferLite &loc, const Buffer &rmt, const WithNotifyIn &withNotify,
      42              :                          const StreamLite &stream) override;
      43              :     void WriteReduceWithNotify(const RmaBufferLite &loc, const Buffer &rmt, const ReduceIn &reduceIn,
      44              :                                const WithNotifyIn &withNotify, const StreamLite &stream) override;
      45              : 
      46              :     // ========== 同步 / Notify 接口 ==========
      47              :     HcclResult Fence() override;
      48              :     void Post(u32 index, const StreamLite &stream) override;
      49              :     void WaitWithTimeout(u32 index, const StreamLite &stream, u32 timeout) override;
      50              : 
      51              :     // ========== 错误上报 接口 ==========
      52              :     HcclResult PollCq(int32_t numEntries, int32_t timeOut, std::vector<int32_t> &errList);
      53              : 
      54              :     // 设置TaskException开关
      55              :     void SetTaskExceptionEnable(bool flag) { taskExceptionEnable_ = flag; }
      56              : 
      57              : private:
      58              :     u32 notifyNum_{0};
      59              :     u32 bufferNum_{0};
      60              :     u32 connNum_{0};
      61              : 
      62              :     bool fence_{false};
      63              :     bool taskExceptionEnable_{true};
      64              : 
      65              :     std::vector<std::unique_ptr<NotifyLite>> localNotifies_{};
      66              :     std::vector<RmtRmaBufferLite> remoteNotifies_{};
      67              :     std::vector<RmaBufferLite> locBufferVec_{};
      68              :     std::vector<RmtRmaBufferLite> rmtBufferVec_{};
      69              :     std::vector<std::vector<char>> connUniqueIdVec_{};
      70              :     std::vector<std::unique_ptr<RdmaConnLiteV2>> connVec_{};
      71              :     std::unique_ptr<RmaBufferLite> notifyValueBuffer_{};
      72              : 
      73              :     RmaBufSliceLite GetRmaBufSlicelite(const RmaBufferLite &lite) const;
      74              :     RmaBufSliceLite GetNotifySlicelite(u32 index) const;
      75              :     RmtRmaBufSliceLite GetRmtRmaBufSliceLite(const Buffer &rmtBuf) const;
      76              :     RmtRmaBufSliceLite GetRmtNotifySliceLite(u32 index) const;
      77              :     void SetFenceConfig(SqeConfigLite &cfg);
      78              : 
      79              :     void ParseLocNotifyVec(std::vector<char> &data);
      80              :     void ParseRmtNotifyVec(std::vector<char> &data);
      81              :     void ParseNotifyValueBuffer(std::vector<char> &data);
      82              :     void ParseLocBufferVec(std::vector<char> &data);
      83              :     void ParseRmtBufferVec(std::vector<char> &data);
      84              :     void ParseConnVec(std::vector<char> &data);
      85              : 
      86              :     // ========== 底层 Task 构造接口(rtsq) ==========
      87              :     void BuildRdmaDbSendTask(const StreamLite &stream, u64 remoteAddr, u64 dbValue) const;
      88              :     void BuildNotifyWaitTask(u32 notifyId, const StreamLite &stream, u32 timeout) const;
      89              : 
      90              :     // ========== Profiling接口 ==========
      91              :     void ReportDmaTask(const void *src, const void *dst, u64 size, const StreamLite &stream, u32 taskId,
      92              :                        TaskParamType taskType, DmaOp dmaOp, u64 notifyId, u32 notifyValue, const char *funcName);
      93              :     void ReportReduceTask(const void *src, const void *dst, u64 size, const ReduceIn &reduceIn,
      94              :                           const StreamLite &stream, u32 taskId, TaskParamType taskType, u64 notifyId,
      95              :                           u32 notifyValue, const char *funcName);
      96              :     void ReportNotifyWaitTask(u64 notifyId, const StreamLite &stream, u32 taskId);
      97              :     bool IsReportTask();
      98              : };
      99              : 
     100              : } // namespace Hccl
     101              : #endif
        

Generated by: LCOV version 2.0-1