LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/resource/connection/aicpu - rma_conn_lite.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 64.7 % 34 22
Test Date: 2026-08-18 17:47:01 Functions: 90.9 % 11 10

            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_conn_lite.h"
      12              : #include "ipc_conn_lite.h"
      13              : #include "rdma_conn_lite.h"
      14              : #include "ub_conn_lite.h"
      15              : #include "binary_stream.h"
      16              : #include "exception_util.h"
      17              : #include "not_support_exception.h"
      18              : #include "log.h"
      19              : namespace Hccl {
      20          114 : RmaConnLite::RmaConnLite(const UbJettyLiteId& id, const UbJettyLiteAttr& attr, const Eid& rmtEid)
      21          114 :     : dieId_(id.dieId_),
      22          114 :       funcId_(id.funcId_),
      23          114 :       jettyId_(id.jettyId_),
      24          114 :       dbAddr_(attr.dbAddr_),
      25          114 :       sqVa_(attr.sqVa_),
      26          114 :       sqDepth_(attr.sqDepth_),
      27          114 :       jfcPollMode_(attr.jfcPollMode_),
      28          114 :       tpn_(attr.tpn_),
      29          114 :       rmtEid_(rmtEid)
      30              : {
      31          150 :     HCCL_INFO(
      32              :         "RmaConnLite id.dieId %u, id.funcId %u, id.jettyId %u, attr.dbaddr %llu, attr.sqVa %llu, attr.sqDepth %u",
      33              :         id.dieId_, id.funcId_, id.jettyId_, attr.dbAddr_, attr.sqVa_, attr.sqDepth_);
      34          114 : }
      35              : 
      36            1 : RmaConnLite::RmaConnLite(const u64 qpVa) : qpVa_(qpVa) {}
      37              : 
      38            0 : std::unique_ptr<RmaConnLite> RmaConnLite::Create(std::vector<char>& uniqueId)
      39              : {
      40            0 :     BinaryStream binaryStream(uniqueId);
      41              :     u32 type;
      42            0 :     binaryStream >> type;
      43            0 :     auto connType = static_cast<RmaConnLiteType::Value>(type);
      44            0 :     if (connType == RmaConnLiteType::RDMA) {
      45            0 :         return std::make_unique<RdmaConnLite>(0); // 待RdmaConnLite构造实现
      46              :     }
      47            0 :     if (connType == RmaConnLiteType::P2P) {
      48            0 :         return std::make_unique<IpcConnLite>(); // 待IpcConnLite构造实现
      49              :     }
      50            0 :     if (connType == RmaConnLiteType::UB) {
      51            0 :         return std::make_unique<UbConnLite>(uniqueId);
      52              :     }
      53            0 :     THROW<NotSupportException>(StringFormat("Unsupported rma connection type: %d", connType));
      54              :     return nullptr;
      55            0 : }
      56              : 
      57            6 : std::string RmaConnLite::Describe() { return StringFormat("RmaConnLite"); }
      58              : 
      59           31 : UbJettyLiteId RmaConnLite::GetUbJettyLiteId() const { return UbJettyLiteId(dieId_, funcId_, jettyId_); }
      60              : 
      61           16 : UbJettyLiteAttr RmaConnLite::GetUbJettyLiteAttr() const
      62              : {
      63           16 :     return UbJettyLiteAttr(dbAddr_, sqVa_, sqDepth_, tpn_, dwqeCacheLocked_, jfcPollMode_);
      64              : }
      65              : 
      66           24 : Eid RmaConnLite::GetRmtEid() const { return rmtEid_; }
      67              : 
      68            8 : Eid RmaConnLite::GetLocEid() const { return locEid_; }
      69              : 
      70            1 : u32 RmaConnLite::GetQpVa() const { return qpVa_; }
      71              : 
      72           11 : uint64_t RmaConnLite::GetJettyHandle() const { return jettyHandle_; }
      73              : 
      74           11 : uint32_t RmaConnLite::GetJettyId() const { return jettyId_; }
      75              : 
      76              : } // namespace Hccl
        

Generated by: LCOV version 2.0-1