* Copyright (c) 2025-2026 Huawei Technologies Co., Ltd.
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
* CANN Open Software License Agreement Version 2.0 (the "License").
* Please refer to the License for details. You may not use this file except in compliance with the License.
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
* See LICENSE in the root of the software repository for the full text of the License.
*/
* \file adump_define.h
* \brief
*/
#pragma once
#include <cstdint>
#include <cstddef>
#include <vector>
#include "acl_define.h"
namespace npu::tile_fwk {
constexpr int32_t MAX_KERNEL_BUF_LEN = 1024;
constexpr int32_t MAX_TENSOR_NUM = 128;
enum class AdxDumpType : int32_t {
OPERATOR = 0x01,
EXCEPTION = 0x02,
ARGS_EXCEPTION = 0x03,
OP_OVERFLOW = 0x04,
AIC_ERR_DETAIL_DUMP = 0x05
};
enum class AdxTensorType : int32_t {
INPUT,
OUTPUT,
WORKSPACE
};
enum class AdxAddressType : int32_t {
TRADITIONAL,
NOTILING,
RAW
};
enum class AdxTensorPlacement : int32_t {
kOnDeviceHbm,
kOnHost,
kFollowing,
kOnDeviceP2p,
kTensorPlacementEnd
};
enum class AdxExceptionDumpMode : uint32_t {
ADX_DUMP_MODE_NONE = 0,
ADX_DUMP_MODE_OVERWRITE = 1,
ADX_DUMP_MODE_ADDITIONAL = 2,
};
struct AdxTensorInfoV2 {
AdxTensorType type;
size_t tensorSize;
int32_t format;
int32_t dataType;
int64_t *tensorAddr;
AdxAddressType addrType;
int32_t placement;
uint32_t argsOffSet;
std::vector<int64_t> shape;
std::vector<int64_t> originShape;
};
struct AdxTensorInfo {
AdxTensorType type;
size_t tensorSize;
int32_t format;
int32_t dataType;
int64_t *tensorAddr;
AdxAddressType addrType;
int32_t placement;
uint32_t argsOffSet;
std::vector<int64_t> shape;
std::vector<int64_t> originShape;
};
struct AdxExceptionDumpInfo {
uint32_t coreId;
RtCoreType coreType;
uint32_t argssize;
void* argAddr;
void *bin;
char kernelName[MAX_KERNEL_BUF_LEN];
char kernelDisplayName[MAX_KERNEL_BUF_LEN];
uint32_t extraTensorNum;
AdxTensorInfo tensorInfo[MAX_TENSOR_NUM];
};
typedef int32_t(*AdumpExceptionDumpCallback)(AclRtExceptionInfo *exceptionInfo, AdxExceptionDumpInfo *exceptionDumpInfo,
uint32_t exceptionDumpSize, uint32_t* exceptionDumpRealSize, AdxExceptionDumpMode *mode);
}