LCOV - code coverage report
Current view: top level - aicpu_schedule/core/hwts_kernel - hwts_kernel_common.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 89.5 % 19 17
Test Date: 2026-07-28 10:54:05 Functions: 100.0 % 1 1

            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 "hwts_kernel_common.h"
      12              : 
      13              : #include <cstring>
      14              : #include "aicpusd_msg_send.h"
      15              : #include "aicpusd_drv_manager.h"
      16              : 
      17              : namespace {
      18              : }
      19              : 
      20              : namespace AicpuSchedule {
      21            4 : int32_t HwTsKernelCommon::ProcessEndGraph(const uint32_t modelId)
      22              : {
      23            4 :     const auto model = AicpuModelManager::GetInstance().GetModel(modelId);
      24            4 :     if (model == nullptr) {
      25            2 :         aicpusd_err("Receive model[%u] EndGraph msg, but no model found.", modelId);
      26            2 :         return AICPU_SCHEDULE_ERROR_MODEL_NOT_FOUND;
      27              :     }
      28              :  
      29            2 :     auto ret = model->EndGraph();
      30            2 :     if (ret != AICPU_SCHEDULE_OK) {
      31            0 :         aicpusd_run_warn("model[%u] endGraph failed, ret[%d].", modelId, ret);
      32              :     }
      33              :  
      34            2 :     bool hasWait = false;
      35            2 :     uint32_t waitStreamId = 0U;
      36            2 :     EventWaitManager::EndGraphWaitManager().Event(static_cast<size_t>(modelId), hasWait, waitStreamId);
      37            2 :     if (hasWait) {
      38              :         // use event to avoid pending ts response
      39            1 :         AICPUSubEventInfo subEventInfo = {};
      40            1 :         subEventInfo.modelId = modelId;
      41            1 :         subEventInfo.para.streamInfo.streamId = waitStreamId;
      42            1 :         ret = AicpuMsgSend::SendAICPUSubEvent(PtrToPtr<AICPUSubEventInfo, const char_t>(&subEventInfo),
      43              :             static_cast<uint32_t>(sizeof(AICPUSubEventInfo)),
      44              :             AICPU_SUB_EVENT_RECOVERY_STREAM,
      45              :             CP_DEFAULT_GROUP_ID,
      46              :             false);
      47            1 :         if (ret != AICPU_SCHEDULE_OK) {
      48            0 :             aicpusd_err("Failed to process end graph, ret[%d].", ret);
      49              :         }
      50              :     }
      51            2 :     return AICPU_SCHEDULE_OK;
      52              : }
      53              : 
      54              : }  // namespace AicpuSchedule
        

Generated by: LCOV version 2.0-1