LCOV - code coverage report
Current view: top level - aicpu_schedule/core/operator_kernel/control_flow - operator_kernel_wait_notify.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 14 14
Test Date: 2026-07-28 10:54:05 Functions: 100.0 % 3 3

            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              : #include "operator_kernel_wait_notify.h"
      11              : 
      12              : #include "aicpusd_status.h"
      13              : #include "aicpusd_resource_manager.h"
      14              : 
      15              : 
      16              : namespace AicpuSchedule {
      17              : namespace {
      18              : const std::string KERNEL_WAIT_NOTIFY = "waitNotify";
      19              : }  // namespace
      20              : 
      21            2 : int32_t OperatorKernelWaitNotify::Compute(const AicpuTaskInfo &kernelTaskInfo, const RunContext &taskContext)
      22              : {
      23            2 :     const auto info = PtrToPtr<void, TsAicpuNotify>(ValueToPtr(kernelTaskInfo.paraBase));
      24            2 :     if (info == nullptr) {
      25            1 :         aicpusd_err("ModelWait kernelTaskInfo paramBase is null, modelId[%u], streamId[%u], taskId[%u]",
      26              :             taskContext.modelId, taskContext.streamId, kernelTaskInfo.taskID);
      27            1 :         return AICPU_SCHEDULE_ERROR_PARAMETER_NOT_VALID;
      28              :     }
      29            1 :     return DoCompute(info->notify_id, taskContext);
      30              : }
      31              : 
      32            1 : int32_t OperatorKernelWaitNotify::DoCompute(const uint32_t notifyId, const RunContext &taskContext) const
      33              : {
      34            1 :     bool needWait = false;
      35            1 :     EventWaitManager::NotifyWaitManager().WaitEvent(static_cast<size_t>(notifyId), taskContext.streamId, needWait);
      36            1 :     if (needWait) {
      37            1 :         bool * const pending = const_cast<bool *>(&taskContext.pending);
      38            1 :         *pending = true;
      39              :     }
      40            1 :     return AICPU_SCHEDULE_OK;
      41              : }
      42              : 
      43            6 : REGISTER_OPERATOR_KERNEL(KERNEL_WAIT_NOTIFY, OperatorKernelWaitNotify);
      44              : }  // namespace AicpuSchedule
        

Generated by: LCOV version 2.0-1