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