asc_dump
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
√ |
|
√ |
|
x |
|
x |
|
x |
|
x |
Function Usage
Prints data from the corresponding memory and supports printing custom additional information (only of type uint32_t), such as the current line number.
To use this API, the utils/debug/asc_dump.h header file must be included.
This function is mainly used for debugging and performance analysis. Enabling this function will affect the operator performance. This function is usually used in the debugging phase. You are advised to disable this function in the production environment.
By default, this function is disabled. To enable the dump function, developers need to define the following macro outside the kernel core function: #define ASCENDC_DUMP 1.
Prototype
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | // Print data from global memory. template<typename T> asc_dump_gm(__gm__ T* input, uint32_t desc, uint32_t dump_size) // Print data from the UB. template<typename T> asc_dump_ubuf(__ubuf__ T* input, uint32_t desc, uint32_t dump_size) // Print data from the L1 memory. template<typename T> asc_dump_l1buf(__cbuf__ T* input, uint32_t desc, uint32_t dump_size) // Print data from the L0C memory. template<typename T> asc_dump_cbuf(__cc__ T* input, uint32_t desc, uint32_t dump_size) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
T |
Input |
Type of the data to be dumped |
input |
Input |
Start address of the memory block to be printed |
desc |
Input |
Custom information. The value is of the uint32_t type. The supported data range is [0, 2^32 – 1]. |
dump_size |
Input |
Number of elements to be printed |
Returns
None
Restrictions
- Ascend 950PR/Ascend 950DT currently do not support memory dump on L1.
- When using this API, the total dump data per core must not exceed 1 MB; excess data will not be printed, and developers should control the output size.
- When calculating data size, if the dump length is not aligned, padding must be considered. For unaligned dumps, if the actual element length does not meet 32-byte alignment, the system automatically appends padding data at the end to satisfy alignment requirements.
- To enable the dump function, define the following macro outside the kernel function: #define ASCENDC_DUMP 1.
Examples
1 2 3 4 | __gm__ half* src; uint32_t desc = 1; uint32_t dump_size = 32; asc_dump_gm<half>(src, desc, dump_size); |