When the tool is used for operator debugging, the printf and PRINTF functions are supported to print scalar data.
For CPU debugging, printf and PRINTF printing are supported. printf uses the native C++ printing, which is not controlled by the dump-mode parameter.
In the simulator debugging scenario, printf and PRINTF printing are supported, which is controlled by the dump mode parameter.
The maximum available space allocated to each core for printing data is fixed at 1 MB. If the printing size exceeds 1 MB, the printed content will not be displayed. Therefore, the amount of data to be printed needs to be controlled.
Add the printf or PRINTF statement to target positions in the kernel code as required. For details about the API description, see Table 1. The following uses PRINTF as an example:
PRINTF("1 fmt string d %d\n", 6666);
PRINTF("1 fmt string lf %lf\n", float(61.556)); In the simulator debugging scenario, run the following command to enable the dump function:
ascendebug kernel --backend simulator --dump-mode normal ... {other simulator debugging parameters} --Set dump-mode to normal to enable the general printing Scalar mode. Set other parameters by referring to NPU Debugging Parameters.
Check the command output. The following is an example:

The description of the printf/PRINTF API is as follows:
Prototype: template <class...Args>
Function usage: Prints scalar data.
Parameter (IN):
Parameter (OUT): N/A
Return value: N/A
Restrictions:
Calling example:
// Integer printing:
printf("fmt string %d", 0x123);
PRINTF("fmt string %d", 0x123);
// Pointer printing:
int *a;
printf("TEST %p", a);
PRINTF("TEST %p", a);