DumpAccChkPoint
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
√ |
|
√ |
|
x |
|
√ |
|
x |
|
x |
Function Usage
Dumps the content of specified tensors for operators developed based on operator projects and supports the printing of user-defined additional information (limited to the uint32_t data type), for example, the current line number. Unlike DumpTensor, this API can be used to print tensors with specified offset.
1 | AscendC::DumpAccChkPoint(srcLocal, 5, 32, dataLen); |
The printing function of DumpAccChkPoint affects the actual running performance of the operator. Therefore, this function is usually used in the debugging phase. Developers can disable the printing function by setting ASCENDC_DUMP to 0.
Prototype
1 2 3 4 | template <typename T> __aicore__ inline void DumpAccChkPoint(const LocalTensor<T> &tensor, uint32_t index, uint32_t countOff, uint32_t dumpSize) template <typename T> __aicore__ inline void DumpAccChkPoint(const GlobalTensor<T> &tensor, uint32_t index, uint32_t countOff, uint32_t dumpSize) |
Parameters
Parameter |
Description |
|---|---|
T |
Data type of a tensor to be dumped. For the Atlas 350 Accelerator Card, the supported data types are bool, uint8_t, int8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t, float, half, and bfloat16_t. For the For the For the |
Parameter |
Input/Output |
Description |
|---|---|---|
tensor |
Input |
Tensor to be dumped. If the tensor to be dumped is stored in Unified Buffer/L1 Buffer/L0C Buffer, use the tensor parameter input of the LocalTensor type. If the tensor to be dumped is stored in Global Memory, use the tensor parameter input of the GlobalTensor type. |
index |
Input |
User-defined additional information (line numbers or other user-defined numbers). |
countOff |
Input |
Number of offset elements. The tensor address after the offset is applied must meet the alignment requirements of the physical location. For details, see General Description and Restrictions. |
dumpSize |
Input |
Number of elements to be dumped. |
Returns
None
Restrictions
- This function is used only for board debugging on the NPU.
- Currently, printing is not supported in the scenario of operator integration into a graph.
- Currently, only information about tensors stored in Unified Buffer/L1 Buffer/L0C Buffer/Global Memory can be printed. For the Atlas 350 Accelerator Card, tensor information on the L1 Buffer cannot be printed.
- For details about the operand address alignment requirements, see General Address Alignment Restrictions.
- The total amount of data printed by a single DumpTensor call cannot exceed 1 MB (including a small amount of header and footer information required by the framework, which can usually be ignored). If this limit is exceeded, no data will be printed.
- During data volume calculation, if the total length of the dump data is not aligned, the impact of padding data needs to be considered. During unaligned dump, if the length of the dumped elements is not 32-byte aligned, the system automatically adds a certain amount of padding data to the end of the elements to meet the alignment requirement. For example, if the length of the element to be dumped in tensor 1 is 30 bytes, the system adds 2-byte padding to the end of the element to align the total length to 32 bytes. However, only the original 30-byte data is parsed, and the padding part is not used.
- When a custom operator project is used for operator development, the API output is different from the preceding description.
During dump, the corresponding information header DumpHead is added before the dump information of each block core to record the core ID and resource usage information. The information header DumpTensorHead is also added before the tensor data to be dumped each time to record tensor information. The information structure in the multi-core printing scenario is illustrated in the figure below.

The specific DumpHead information is as follows:
- opType: type of the running operator.
- CoreType: type of the running core.
- block dim: number of cores for operator execution set by the developer.
- total_block_num: number of cores to be dumped.
- block_remain_len: available dump space in the current core.
- block_initial_space: initial dump space allocated in the current core.
- rsv: reserved field.
- magic: magic number for memory verification.
During DumpHead printing, the type of the running core and the corresponding core index (for example, AIV-0) are automatically printed in addition to the preceding information.
The specific DumpTensorHead information is as follows:
- desc: user-defined additional information.
- addr: tensor address.
- data_type: tensor data type.
- position: physical storage position of the tensor, which can only be Unified Buffer/L1 Buffer/L0C Buffer/Global Memory.
- dump_size: number of elements to be dumped.
The values of CANN_VERSION_STR and CANN_TIMESTAMP are automatically printed at the beginning of the DumpAccChkPoint printing result. CANN_VERSION_STR and CANN_TIMESTAMP are macro definitions. CANN_VERSION_STR indicates the version number of the CANN package in the form of a string. CANN_TIMESTAMP indicates the timestamp when the CANN package is released, the value is in the format of uint64_t. Developers can directly use the two macros in the code.
An example of the printing result is as follows:
1 2 3 4 5 6 7
opType=AddCustom, DumpHead: AIV-0, CoreType=AIV, block dim=8, total_block_num=8, block_remain_len=1046912, block_initial_space=1048576, rsv=0, magic=5aa5bccd CANN Version: XX.XX,TimeStamp: XXXXXX DumpTensor: desc=5, addr=40, data_type=float16, position=UB, dump_size=32 [16.000000, 22.000000, 2.000000, 3.000000, 58.000000, 62.000000, 33.000000, 74.000000, 51.000000, 69.000000, 61.000000, 9.000000, 53.000000, 35.000000, 14.000000, 43.000000, 20.000000, 43.000000, 92.000000, 84.000000, 9.000000, 6.000000, 78.000000, 53.000000, 52.000000, 33.000000, 51.000000, 61.000000, 92.000000, 45.000000, 39.000000,34.000000] ... DumpTensor: desc=5, addr=140, data_type=float16, position=UB, dump_size=32 [41.000000, 91.000000, 12.000000, 32.000000, 28.000000, 49.000000, 2.000000, 75.000000, 11.000000, 32.000000, 17.000000, 31.000000, 70.000000, 38.000000, 76.000000, 87.000000, 61.000000, 8.000000, 55.000000, 70.000000, 17.000000, 37.000000, 35.000000, 58.000000, 94.000000, 31.000000, 50.000000, 29.000000, 13.000000, 37.000000, 79.000000,29.000000]
This API uses the dump function. The total amount of data dumped by all APIs that use the dump function for an operator on each core cannot exceed 1 MB. Developers need to control the amount of data to be printed. If the limit is exceeded, no content will be printed.
Example
1 2 3 4 5 6 7 8 | constexpr uint32_t totalLength = 256; // Number of elements involved in transfer AscendC::LocalTensor<half> srcLocal; AscendC::GlobalTensor<half> srcGlobal; AscendC::DataCopy(srcLocal, srcGlobal, totalLength * sizeof(half)); uint32_t index = 8; // Additional user-defined information. Here, the line number of the DumpAccChkPoint instruction is passed. uint32_t countOff = 32; // Number of offset elements. Elements are printed from srcLocal[32]. uint32_t dumpSize = 128; // Number of elements to be dumped. 128 elements are printed from srcLocal[32]. AscendC::DumpAccChkPoint(srcLocal, index, countOff, dumpSize); |