LCOV - code coverage report
Current view: top level - adump/common/platform - cloud_v2_platform.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 40 40
Test Date: 2026-07-28 10:54:24 Functions: 100.0 % 14 14

            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 "cloud_v2_platform.h"
      11              : 
      12              : #include <string>
      13              : #include "runtime/base.h"
      14              : #include "log/adx_log.h"
      15              : #include "adump_platform_registry.h"
      16              : #include "kernel_pc_fixer.h"
      17              : #include "register_config.h"
      18              : #include "dump_common.h"
      19              : #include "dump_core.h"
      20              : #include "hccl_mc2_define.h"
      21              : 
      22              : namespace Adx {
      23              : 
      24              : ADUMP_PLATFORM_REGISTER(ExceptionDumpInterface, PlatformType::CHIP_CLOUD_TYPE, CloudLegacyException);
      25              : ADUMP_PLATFORM_REGISTER(FeaturesSupportInterface, PlatformType::CHIP_CLOUD_V2, CloudV2Features);
      26              : ADUMP_PLATFORM_REGISTER(CoredumpInterface, PlatformType::CHIP_CLOUD_V2, CloudV2Coredump);
      27              : ADUMP_PLATFORM_REGISTER(ExceptionDumpInterface, PlatformType::CHIP_CLOUD_V2, CloudV2Exception);
      28              : ADUMP_PLATFORM_REGISTER(DataDumpInterface, PlatformType::CHIP_CLOUD_V2, CloudV2DataDump);
      29              : 
      30              : namespace {
      31           17 : uint64_t GetAscend910Mc2StructSize()
      32              : {
      33           17 :     constexpr uint32_t socVersionLength = 128U;
      34           17 :     char version[socVersionLength] = {0};
      35           17 :     rtError_t ret = rtGetSocVersion(version, socVersionLength);
      36           17 :     if (ret != RT_ERROR_NONE) {
      37            3 :         IDE_LOGE("[AdumpPlatform] Get soc version failed for mc2 struct size.");
      38            3 :         return 0;
      39              :     }
      40           28 :     if (std::string(version).find("Ascend910_93") != std::string::npos) {
      41            7 :         return sizeof(HcclOpResParam);
      42              :     }
      43            7 :     return sizeof(HcclCombinOpParam);
      44              : }
      45              : } // namespace
      46              : 
      47            3 : bool CloudLegacyException::SupportMc2SpacesDump() const
      48              : {
      49            3 :     return true;
      50              : }
      51              : 
      52            6 : uint64_t CloudLegacyException::GetMc2StructSize() const
      53              : {
      54            6 :     return GetAscend910Mc2StructSize();
      55              : }
      56              : 
      57            4 : CloudV2Features::CloudV2Features()
      58              : {
      59            4 :     supported_ = {
      60              :         AdumpPlatformFeature::FEATURE_DATA_DUMP,
      61              :         AdumpPlatformFeature::FEATURE_OVERFLOW_DUMP,
      62              :         AdumpPlatformFeature::FEATURE_EXCEPTION_DUMP_L0,
      63              :         AdumpPlatformFeature::FEATURE_EXCEPTION_DUMP_L1,
      64              :         AdumpPlatformFeature::FEATURE_CORE_DUMP,
      65            4 :     };
      66            4 : }
      67              : 
      68            7 : std::unique_ptr<PcFixerInterface> CloudV2Coredump::CreatePcFixer() const
      69              : {
      70            7 :     return std::unique_ptr<PcFixerInterface>(new (std::nothrow) CloudV2PcFixer());
      71              : }
      72              : 
      73           10 : std::shared_ptr<RegisterInterface> CloudV2Coredump::CreateRegister() const
      74              : {
      75           10 :     return std::make_shared<CloudV2Register>();
      76              : }
      77              : 
      78           83 : void CloudV2Coredump::DumpRegister(DumpCore& core, uint8_t coreType, uint16_t coreId) const
      79              : {
      80           83 :     core.DumpV2Register(coreType, coreId);
      81           83 : }
      82              : 
      83          206 : uint16_t CloudV2Coredump::ConvertCoreId(uint8_t coreType, uint16_t coreId) const
      84              : {
      85          206 :     return (coreType == CORE_TYPE_AIC) ? coreId : static_cast<uint16_t>(CORE_SIZE_AIC + coreId);
      86              : }
      87              : 
      88            6 : bool CloudV2Exception::SupportMc2SpacesDump() const
      89              : {
      90            6 :     return true;
      91              : }
      92              : 
      93           11 : uint64_t CloudV2Exception::GetMc2StructSize() const
      94              : {
      95           11 :     return GetAscend910Mc2StructSize();
      96              : }
      97              : 
      98            6 : bool CloudV2Exception::IsArgsDataTypeSizeByByte() const
      99              : {
     100            6 :     return true;
     101              : }
     102              : 
     103            9 : uint64_t CloudV2DataDump::GetKfcStackSize() const
     104              : {
     105            9 :     constexpr uint32_t OP_STACK_910B = 75;
     106            9 :     return CalcKfcStackSize(OP_STACK_910B);
     107              : }
     108              : 
     109            6 : std::string CloudV2DataDump::GetKfcBinName() const
     110              : {
     111           12 :     return "kfc_dump_stat_ascend910B.o";
     112              : }
     113              : 
     114            6 : bool CloudV2DataDump::IsUbFromAiCore() const
     115              : {
     116            6 :     return true;
     117              : }
     118              : 
     119              : } // namespace Adx
        

Generated by: LCOV version 2.0-1