LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/resource/connection - rma_connection.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 63.9 % 36 23
Test Date: 2026-08-18 17:47:01 Functions: 50.0 % 14 7

            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              : #include "rma_connection.h"
      12              : 
      13              : namespace Hccl {
      14              : 
      15          124 : RmaConnection::RmaConnection(Socket* socket, const RmaConnType rmaConnType) : socket(socket), rmaConnType(rmaConnType)
      16              : {
      17          124 :     status = RmaConnStatus::INIT;
      18          124 : }
      19              : 
      20          124 : RmaConnection::~RmaConnection()
      21              : {
      22          124 :     if (status != RmaConnStatus::CLOSE) {
      23          124 :         remoteBufs.clear();
      24          124 :         status = RmaConnStatus::CLOSE;
      25              :     }
      26          124 : }
      27              : 
      28            0 : void RmaConnection::Close()
      29              : {
      30            0 :     remoteBufs.clear();
      31            0 :     status = RmaConnStatus::CLOSE;
      32            0 : }
      33              : 
      34            0 : RmaConnStatus RmaConnection::GetStatus() { return status; }
      35              : 
      36            1 : void RmaConnection::Bind(RemoteRmaBuffer* remoteRmaBuf, BufferType bufType)
      37              : {
      38            3 :     HCCL_INFO(
      39              :         "[RmaConnection][%s] bind bufType[%s] Buffer[%s].", Describe().c_str(), bufType.Describe().c_str(),
      40              :         remoteRmaBuf->Describe().c_str());
      41            1 :     remoteBufs[bufType] = remoteRmaBuf;
      42            1 : }
      43              : 
      44            2 : RemoteRmaBuffer* RmaConnection::GetRemoteRmaBuffer(const BufferType& bufType)
      45              : {
      46            2 :     auto iter = remoteBufs.find(bufType);
      47            2 :     if (iter != remoteBufs.end()) {
      48            1 :         return remoteBufs[bufType];
      49              :     } else {
      50            1 :         return nullptr;
      51              :     }
      52              : }
      53              : 
      54            2 : unique_ptr<BaseTask> RmaConnection::PrepareRead(
      55              :     [[maybe_unused]] const MemoryBuffer& remoteMemBuf, [[maybe_unused]] const MemoryBuffer& localMemBuf,
      56              :     [[maybe_unused]] const SqeConfig& config)
      57              : {
      58            8 :     MACRO_THROW(NotSupportException, StringFormat("RmaConnection not support this function."));
      59              : }
      60              : 
      61            0 : unique_ptr<BaseTask> RmaConnection::PrepareReadReduce(
      62              :     [[maybe_unused]] const MemoryBuffer& remoteMemBuf, [[maybe_unused]] const MemoryBuffer& localMemBuf,
      63              :     [[maybe_unused]] DataType datatype, [[maybe_unused]] ReduceOp reduceOp, [[maybe_unused]] const SqeConfig& config)
      64              : {
      65            0 :     MACRO_THROW(NotSupportException, StringFormat("RmaConnection not support this function."));
      66              : }
      67              : 
      68            0 : unique_ptr<BaseTask> RmaConnection::PrepareWrite(
      69              :     [[maybe_unused]] const MemoryBuffer& remoteMemBuf, [[maybe_unused]] const MemoryBuffer& localMemBuf,
      70              :     [[maybe_unused]] const SqeConfig& config)
      71              : {
      72            0 :     MACRO_THROW(NotSupportException, StringFormat("RmaConnection not support this function."));
      73              : }
      74              : 
      75            1 : unique_ptr<BaseTask> RmaConnection::PrepareWriteReduce(
      76              :     [[maybe_unused]] const MemoryBuffer& remoteMemBuf, [[maybe_unused]] const MemoryBuffer& localMemBuf,
      77              :     [[maybe_unused]] DataType datatype, [[maybe_unused]] ReduceOp reduceOp, [[maybe_unused]] const SqeConfig& config)
      78              : {
      79            4 :     MACRO_THROW(NotSupportException, StringFormat("RmaConnection not support this function."));
      80              : }
      81              : 
      82            1 : unique_ptr<BaseTask> RmaConnection::PrepareInlineWrite(
      83              :     [[maybe_unused]] const MemoryBuffer& remoteMemBuf, [[maybe_unused]] u64 data,
      84              :     [[maybe_unused]] const SqeConfig& config)
      85              : {
      86            4 :     MACRO_THROW(NotSupportException, StringFormat("RmaConnection not support this function."));
      87              : }
      88              : 
      89            0 : unique_ptr<BaseTask> RmaConnection::PrepareWriteWithNotify(
      90              :     [[maybe_unused]] const MemoryBuffer& remoteMemBuf, [[maybe_unused]] const MemoryBuffer& localMemBuf,
      91              :     [[maybe_unused]] u64 data, [[maybe_unused]] const MemoryBuffer& remoteNotifyMemBuf,
      92              :     [[maybe_unused]] const SqeConfig& config)
      93              : {
      94            0 :     MACRO_THROW(NotSupportException, StringFormat("RmaConnection not support this function."));
      95              : }
      96              : 
      97            0 : unique_ptr<BaseTask> RmaConnection::PrepareWriteReduceWithNotify(
      98              :     [[maybe_unused]] const MemoryBuffer& remoteMemBuf, [[maybe_unused]] const MemoryBuffer& localMemBuf,
      99              :     [[maybe_unused]] DataType datatype, [[maybe_unused]] ReduceOp reduceOp, [[maybe_unused]] u64 data,
     100              :     [[maybe_unused]] const MemoryBuffer& remoteNotifyMemBuf, [[maybe_unused]] const SqeConfig& config)
     101              : {
     102            0 :     MACRO_THROW(NotSupportException, StringFormat("RmaConnection not support this function."));
     103              : }
     104              : 
     105              : } // namespace Hccl
        

Generated by: LCOV version 2.0-1