LCOV - code coverage report
Current view: top level - stub/hccl - hccl_stub.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 61 61
Test Date: 2026-08-12 11:05:07 Functions: 100.0 % 10 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 "hccl/hcom.h"
      12              : #include "hccl/hccl_ex.h"
      13              : #include "common/bqs_log.h"
      14              : #include "hccl/hccl_so_manager.h"
      15              : 
      16            2 : HcclResult HcclInitComm(const char_t* rankTableM, uint32_t rank, const CommAttr* attr, HcclComm* comm)
      17              : {
      18            4 :     void* const func = dgw::HcclSoManager::GetInstance()->GetFunc("HcclInitComm");
      19            2 :     if (func == nullptr) {
      20            1 :         DGW_LOG_ERROR("libhccl.so can't get function [HcclInitComm]");
      21            1 :         return HCCL_E_RESERVED;
      22              :     }
      23            1 :     return (PtrToFunctionPtr<void, dgw::HcclInitCommFunc>(func))(rankTableM, rank, attr, comm);
      24              : }
      25              : 
      26            2 : HcclResult HcclFinalizeComm(HcclComm comm)
      27              : {
      28            4 :     void* const func = dgw::HcclSoManager::GetInstance()->GetFunc("HcclFinalizeComm");
      29            2 :     if (func == nullptr) {
      30            1 :         DGW_LOG_ERROR("libhccl.so can't get function [HcclFinalizeComm]");
      31            1 :         return HCCL_E_RESERVED;
      32              :     }
      33            1 :     return (PtrToFunctionPtr<void, dgw::HcclFinalizeCommFunc>(func))(comm);
      34              : }
      35              : 
      36            2 : int HcclIsend(void* buffer, int count, HcclDataType dataType, int dstRank, int tag, HcclComm comm, HcclRequest* request)
      37              : {
      38            4 :     void* const func = dgw::HcclSoManager::GetInstance()->GetFunc("HcclIsend");
      39            2 :     if (func == nullptr) {
      40            1 :         DGW_LOG_ERROR("libhccl.so can't get function [HcclIsend]");
      41            1 :         return HCCL_E_RESERVED;
      42              :     }
      43            1 :     return (PtrToFunctionPtr<void, dgw::HcclIsendFunc>(func))(buffer, count, dataType, dstRank, tag, comm, request);
      44              : }
      45              : 
      46            2 : int HcclImrecv(void* buffer, int count, HcclDataType datatype, HcclMessage* msg, HcclRequest* request)
      47              : {
      48            4 :     void* const func = dgw::HcclSoManager::GetInstance()->GetFunc("HcclImrecv");
      49            2 :     if (func == nullptr) {
      50            1 :         DGW_LOG_ERROR("libhccl.so can't get function [HcclImrecv]");
      51            1 :         return HCCL_E_RESERVED;
      52              :     }
      53            1 :     return (PtrToFunctionPtr<void, dgw::HcclImrecvFunc>(func))(buffer, count, datatype, msg, request);
      54              : }
      55              : 
      56            2 : int HcclImprobe(int srcRank, int tag, HcclComm comm, int* flag, HcclMessage* msg, HcclStatus* status)
      57              : {
      58            4 :     void* const func = dgw::HcclSoManager::GetInstance()->GetFunc("HcclImprobe");
      59            2 :     if (func == nullptr) {
      60            1 :         DGW_LOG_ERROR("libhccl.so can't get function [HcclImprobe]");
      61            1 :         return HCCL_E_RESERVED;
      62              :     }
      63            1 :     return (PtrToFunctionPtr<void, dgw::HcclImprobeFunc>(func))(srcRank, tag, comm, flag, msg, status);
      64              : }
      65              : 
      66            2 : int HcclGetCount(const HcclStatus* status, HcclDataType dataType, int* count)
      67              : {
      68            4 :     void* const func = dgw::HcclSoManager::GetInstance()->GetFunc("HcclGetCount");
      69            2 :     if (func == nullptr) {
      70            1 :         DGW_LOG_ERROR("libhccl.so can't get function [HcclGetCount]");
      71            1 :         return HCCL_E_RESERVED;
      72              :     }
      73            1 :     return (PtrToFunctionPtr<void, dgw::HcclGetCountFunc>(func))(status, dataType, count);
      74              : }
      75              : 
      76            2 : int HcclTestSome(int count, HcclRequest requestArray[], int* compCount, int compIndices[], HcclStatus compStatus[])
      77              : {
      78            4 :     void* const func = dgw::HcclSoManager::GetInstance()->GetFunc("HcclTestSome");
      79            2 :     if (func == nullptr) {
      80            1 :         DGW_LOG_ERROR("libhccl.so can't get function [HcclTestSome]");
      81            1 :         return HCCL_E_RESERVED;
      82              :     }
      83            1 :     return (PtrToFunctionPtr<void, dgw::HcclTestSomeFunc>(func))(
      84            1 :         count, requestArray, compCount, compIndices, compStatus);
      85              : }
      86              : 
      87            2 : HcclResult HcclRegisterMemory(HcclComm comm, void* addr, uint64_t size)
      88              : {
      89            4 :     void* const func = dgw::HcclSoManager::GetInstance()->GetFunc("HcclRegisterMemory");
      90            2 :     if (func == nullptr) {
      91            1 :         DGW_LOG_ERROR("libhccl.so can't get function [HcclRegisterMemory]");
      92            1 :         return HCCL_E_RESERVED;
      93              :     }
      94            1 :     return (PtrToFunctionPtr<void, dgw::HcclRegisterMemoryFunc>(func))(comm, addr, size);
      95              : }
      96              : 
      97            2 : HcclResult HcclUnregisterMemory(HcclComm comm, void* addr)
      98              : {
      99            4 :     void* const func = dgw::HcclSoManager::GetInstance()->GetFunc("HcclUnregisterMemory");
     100            2 :     if (func == nullptr) {
     101            1 :         DGW_LOG_ERROR("libhccl.so can't get function [HcclUnregisterMemory]");
     102            1 :         return HCCL_E_RESERVED;
     103              :     }
     104            1 :     return (PtrToFunctionPtr<void, dgw::HcclUnregisterMemoryFunc>(func))(comm, addr);
     105              : }
     106              : 
     107            2 : HcclResult HcclSetGrpIdCallback(int32_t (*grpIdCallback)(int32_t, int32_t*, int32_t*))
     108              : {
     109            4 :     void* const func = dgw::HcclSoManager::GetInstance()->GetFunc("HcclSetGrpIdCallback");
     110            2 :     if (func == nullptr) {
     111            1 :         DGW_LOG_ERROR("libhccl.so can't get function [HcclSetGrpIdCallback]");
     112            1 :         return HCCL_E_RESERVED;
     113              :     }
     114            1 :     return (PtrToFunctionPtr<void, dgw::HcclSetGrpIdCallback>(func))(grpIdCallback);
     115              : }
        

Generated by: LCOV version 2.0-1