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

Generated by: LCOV version 2.0-1