LCOV - code coverage report
Current view: top level - base_comm/resources/ccu/ccu_device/ccu_comp/ccu_channel - ccu_channel_ctx_mgr.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 25 25
Test Date: 2026-08-18 17:47:01 Functions: 100.0 % 4 4

            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 "ccu_channel_ctx_mgr.h"
      12              : 
      13              : #include "ccu_res_specs.h"
      14              : 
      15              : namespace hcomm {
      16              : 
      17          220 : static void DumpJettyCtxInfo(const JettyInfo& info)
      18              : {
      19          220 :     HCCL_RUN_INFO(
      20              :         "[CcuChannelCtxMgr][%s] local jetty context id[%u], ta jetty id[%u], "
      21              :         "ta jetty type[%s], sq depth[%u], wqe basic block start id[%u].",
      22              :         __func__, info.jettyCtxId, info.taJettyId, info.jettyType.Describe().c_str(), info.sqDepth, info.wqeBBStartId);
      23              : 
      24          220 :     if (info.jettyType == CcuJettyType::CCUM_CACHED_JETTY) {
      25          183 :         HCCL_RUN_INFO(
      26              :             "[CcuChannelCtxMgr][%s] sq buffer va[%llu], sq buffer size[%u].", __func__, info.sqBufVa, info.sqBufSize);
      27              :     }
      28          220 : }
      29              : 
      30          220 : void DumpChannelResInfo(const uint32_t feId, const ChannelInfo& info)
      31              : {
      32          220 :     const auto& jettyInfos = info.jettyInfos;
      33          220 :     HCCL_RUN_INFO(
      34              :         "[CcuChannelCtxMgr][%s]: fe id[%u], channel id[%u], die id[%u], "
      35              :         "used jetty num[%zu].",
      36              :         __func__, feId, info.channelId, info.dieId, jettyInfos.size());
      37              : 
      38          440 :     for (const auto& jettyInfo : jettyInfos) {
      39          220 :         DumpJettyCtxInfo(jettyInfo);
      40              :     }
      41          220 : }
      42              : 
      43          231 : bool IsEidEmpty(const uint8_t (&eidRaw)[URMA_EID_LEN])
      44              : {
      45          727 :     for (uint32_t i = 0; i < URMA_EID_LEN; i++) {
      46          696 :         if (eidRaw[i] != 0) {
      47          200 :             return false;
      48              :         }
      49              :     }
      50              : 
      51           31 :     return true;
      52              : }
      53              : 
      54          236 : bool CcuChannelCtxMgr::CheckIfChannelAllocated(const uint32_t channelId) const
      55              : {
      56          236 :     const uint32_t strategy = channelResInfos_.size();
      57          236 :     if (channelId >= strategy) {
      58            2 :         HCCL_ERROR(
      59              :             "[CcuChannelCtxMgr][%s] failed, channelId[%u] is invalid, "
      60              :             "should be less than the channel strategy[%u], devLogicId[%d], dieId[%u].",
      61              :             __func__, channelId, strategy, devLogicId_, dieId_);
      62            2 :         return false;
      63              :     }
      64              : 
      65          234 :     if (!channelResInfos_[channelId].allocated) {
      66            2 :         HCCL_ERROR(
      67              :             "[CcuChannelCtxMgr][%s] failed, channelId[%u] has not been "
      68              :             "allocated yet, devLogicId[%d], dieId[%u].",
      69              :             __func__, channelId, devLogicId_, dieId_);
      70            2 :         return false;
      71              :     }
      72              : 
      73          232 :     return true;
      74              : }
      75              : 
      76              : }; // namespace hcomm
        

Generated by: LCOV version 2.0-1