LCOV - code coverage report
Current view: top level - legacy/ascend910/platform/resource/notify - remote_notify_impl.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 70.2 % 47 33
Test Date: 2026-08-04 10:52:23 Functions: 90.0 % 10 9

            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 "remote_notify_impl.h"
      12              : #include "rts_notify.h"
      13              : #include "bare_notify.h"
      14              : #include "esched_notify.h"
      15              : 
      16              : namespace hccl {
      17         1127 : RemoteNotifyImpl::RemoteNotifyImpl()
      18              : {
      19         1127 : }
      20              : 
      21         1127 : RemoteNotifyImpl::~RemoteNotifyImpl()
      22              : {
      23         1127 : }
      24              : 
      25            1 : HcclResult RemoteNotifyImpl::Init(const std::vector<u8>& byteVector)
      26              : {
      27            1 :     HcclNotifyInfo notifyInfo;
      28            1 :     CHK_RET(NotifyBase::Deserialize(byteVector, notifyInfo));
      29            1 :     NotifyType notifyType = static_cast<NotifyType>(notifyInfo.type);
      30              : 
      31            1 :     HCCL_DEBUG("[RemoteNotifyImpl]notifyType[%u], remote withIpc[%d].", notifyInfo.type, notifyInfo.ipcNotify.withIpc);
      32              : 
      33            1 :     switch (notifyType) {
      34            1 :         case NotifyType::RUNTIME_NOTIFY:
      35              :         case NotifyType::RUNTIME_NOTIFY_MC2:
      36              :             {
      37            1 :                 notify_.reset(new (std::nothrow) RtsNotify(notifyType, notifyInfo));
      38            1 :                 break;
      39              :             }
      40              : 
      41            0 :         case NotifyType::BARE_NOTIFY:
      42              :             {
      43            0 :                 notify_.reset(new (std::nothrow) BareNotify(notifyType, notifyInfo));
      44            0 :                 break;
      45              :             }
      46              : 
      47            0 :         case NotifyType::ESCHED_EVENT:
      48              :             {
      49            0 :                 notify_.reset(new (std::nothrow) EschedNotify(notifyType, notifyInfo));
      50            0 :                 break;
      51              :             }
      52              : 
      53            0 :         default:
      54              :             {
      55            0 :                 HCCL_ERROR("[Create][RemoteNotify]No specified notify type[%d]!", notifyType);
      56            0 :                 break;
      57              :             }
      58              :     }
      59              : 
      60            1 :     CHK_SMART_PTR_NULL(notify_);
      61            1 :     return HCCL_SUCCESS;
      62              : }
      63              : 
      64         1126 : HcclResult RemoteNotifyImpl::Init(const HcclSignalInfo &notifyInfo, const NotifyLoadType type)
      65              : {
      66         1126 :     if (type == NotifyLoadType::DEVICE_NOTIFY) {
      67         1126 :         notify_.reset(new (std::nothrow) RtsNotify(NotifyType::RUNTIME_NOTIFY_MC2, notifyInfo));
      68              :     } else {
      69            0 :         notify_.reset(new (std::nothrow) RtsNotify(NotifyType::RUNTIME_NOTIFY, notifyInfo));
      70              :     }
      71              : 
      72         1126 :     HCCL_DEBUG("[Create][LocalNotify]notify load type[%d]. notifyInfo.resId[%u]", type, notifyInfo.resId);
      73              : 
      74         1126 :     CHK_SMART_PTR_NULL(notify_);
      75              : 
      76              : #ifdef CCL_KERNEL
      77         1126 :     CHK_RET(static_cast<RtsNotify*>(notify_.get())->InitAndVerifySingleSignal());
      78              : #endif
      79              : 
      80         1126 :     return HCCL_SUCCESS;
      81              : }
      82              : 
      83            1 : HcclResult RemoteNotifyImpl::Open()
      84              : {
      85            1 :     return notify_->Open();
      86              : }
      87              : 
      88            4 : HcclResult RemoteNotifyImpl::Close()
      89              : {
      90            4 :     if (notify_) {
      91            4 :         return notify_->Close();
      92              :     }
      93            0 :     notify_ = nullptr;
      94            0 :     return HCCL_SUCCESS;
      95              : }
      96              : 
      97            0 : HcclResult RemoteNotifyImpl::Post(Stream& stream, HcclDispatcher dispatcher, s32 stage)
      98              : {
      99            0 :     return notify_->Post(stream, dispatcher, stage);
     100              : }
     101              : 
     102         1131 : HcclResult RemoteNotifyImpl::GetNotifyData(HcclSignalInfo &notifyInfo)
     103              : {
     104         1131 :     return notify_->GetNotifyData(notifyInfo);
     105              : }
     106              : 
     107            3 : HcclResult RemoteNotifyImpl::SetNotifyData(HcclSignalInfo &notifyInfo)
     108              : {
     109            3 :     return notify_->SetNotifyData(notifyInfo);
     110              : }
     111              : 
     112            4 : HcclResult RemoteNotifyImpl::GetNotifyOffset(u64 &notifyOffset)
     113              : {
     114            4 :     return notify_->GetNotifyOffset(notifyOffset);
     115              : }
     116              : }
        

Generated by: LCOV version 2.0-1