LCOV - code coverage report
Current view: top level - aicpu_schedule/core/dfx - datadump_kfc_interface.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 9 9
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              : #ifndef DATADUMP_KFC_INTERFACE_H
      11              : #define DATADUMP_KFC_INTERFACE_H
      12              : 
      13              : namespace KfcDump {
      14              :     constexpr uint32_t INVALID = 65535U;
      15              : }
      16              : 
      17              : struct KfcDumpTask {
      18            1 :     KfcDumpTask() : KfcDumpTask(KfcDump::INVALID, KfcDump::INVALID, KfcDump::INVALID) {};
      19           67 :     KfcDumpTask(const uint32_t streamId, const uint32_t taskId, const uint32_t index)
      20           67 :                 : streamId_(streamId), taskId_(taskId), index_(index) {};
      21              :     uint32_t streamId_ = KfcDump::INVALID;
      22              :     uint32_t taskId_ = KfcDump::INVALID;
      23              :     uint32_t index_ = KfcDump::INVALID;
      24              :     friend bool operator < (const KfcDumpTask &item1, const KfcDumpTask &item2);
      25              : };
      26              : 
      27          118 : inline bool operator < (const KfcDumpTask &item1, const KfcDumpTask &item2)
      28              : {
      29          118 :     if (item1.streamId_ != item2.streamId_) {
      30           30 :         return item1.streamId_ < item2.streamId_;
      31              :     }
      32           88 :     if (item1.taskId_ != item2.taskId_) {
      33           17 :         return item1.taskId_ < item2.taskId_;
      34              :     }
      35           71 :     return item1.index_ < item2.index_;
      36              : }
      37              : enum SpaceType {
      38              :     LOG = 0,
      39              : };
      40              : 
      41              : struct Workspace {
      42              :     SpaceType type;
      43              :     uint64_t data_addr;
      44              :     uint64_t size;
      45              : };
      46              : 
      47              : struct InputOutputKfcDumpInfo {
      48              :     int32_t index;                     // input or output index info of op 
      49              :     int32_t data_type;                 // input or output type info of op
      50              :     int32_t format;                    // input or output format info of op
      51              :     uint64_t address;                  // input or output address info of op
      52              :     uint64_t size;                     // input or output size info of op
      53              :     std::vector<uint64_t> shape;       // input or output shape info of op
      54              :     std::vector<uint64_t> origin_shape;// input or output origin_shape info of op
      55              :     void *reserve;
      56              : };
      57              : 
      58              : struct KfcDumpInfo {
      59              :     std::string opName;
      60              :     std::string opType;
      61              :     std::vector<Workspace> workspace;
      62              :     std::vector<struct InputOutputKfcDumpInfo> inputDumpInfo;  // op input info
      63              :     std::vector<struct InputOutputKfcDumpInfo> outputDumpInfo; // op output info
      64              :     void *reserve;
      65              : };
      66              : 
      67              : #ifdef __cplusplus
      68              : extern "C" {
      69              : #endif // __cplusplus
      70              : 
      71              : __attribute__((weak)) __attribute__((visibility("default"))) int32_t AicpuGetOpTaskInfo(const KfcDumpTask &taskKey, KfcDumpInfo **ptr);
      72              : 
      73              : __attribute__((weak)) __attribute__((visibility("default"))) int32_t AicpuDumpOpTaskData(const KfcDumpTask &taskKey, void *dumpPtr, uint32_t length);
      74              : 
      75              : #ifdef __cplusplus
      76              : }
      77              : #endif
      78              : #endif // DATADUMP_KFC_INTERFACE_H
        

Generated by: LCOV version 2.0-1