LCOV - code coverage report
Current view: top level - legacy/ascend950/framework/communicator/hostdpu - flush_manager.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 50.0 % 4 2
Test Date: 2026-08-18 17:47:01 Functions: 50.0 % 2 1

            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_FLUSH_MANAGER_H
      12              : #define HCCL_FLUSH_MANAGER_H
      13              : 
      14              : #include <memory.h>
      15              : #include <unordered_map>
      16              : #include "flush_handle.h"
      17              : #include "infiniband/verbs.h"
      18              : 
      19              : namespace Hccl {
      20              : 
      21              : #define ROCE_WR_FLUSH (static_cast<ibv_wr_opcode>(0x40))
      22              : 
      23              : class FlushManager {
      24              : public:
      25              :     static FlushManager& GetInstance();
      26              :     FlushManager(const FlushManager&) = delete;
      27              :     FlushManager& operator=(const FlushManager&) = delete;
      28              : 
      29              :     HcclResult initFlushHandle(IpAddress ip, u32 devPhyId);
      30              :     HcclResult Flush();
      31              : 
      32              : private:
      33              :     FlushManager();
      34              :     ~FlushManager();
      35              :     std::unordered_map<IpAddress, std::shared_ptr<FlushHandle>> flushHandleMap_;
      36              : 
      37              :     // flush实现
      38              :     HcclResult FlushParamPrepare(std::shared_ptr<FlushHandle> flushHandlePtr, ibv_send_wr* swr) const;
      39              :     HcclResult ExecuteRdmaRead(ibv_qp* loopbackqp0, ibv_cq* cq, ibv_send_wr& swr, int timeoutSec) const;
      40              : 
      41              :     // flush销毁
      42              :     HcclResult DestroyAll();
      43              :     std::mutex mutex_;
      44            2 :     int FlushPostSend(struct ibv_qp* qp, struct ibv_send_wr* wr, struct ibv_send_wr** bad_wr) const
      45              :     {
      46            2 :         return ibv_post_send(qp, wr, bad_wr);
      47              :     }
      48            0 :     int FlushPollCq(struct ibv_cq* cq, int num_entries, struct ibv_wc* wc) const
      49              :     {
      50            0 :         return ibv_poll_cq(cq, num_entries, wc);
      51              :     }
      52              : };
      53              : 
      54              : } // namespace Hccl
      55              : 
      56              : #endif
        

Generated by: LCOV version 2.0-1