Printf() Macros - 2023.1 English

AI Engine Tools and Flows User Guide (UG1076)

Document ID
UG1076
Release Date
2023-06-23
Version
2023.1 English

The x86 simulator executes multiple kernels in parallel on separate threads. This means that printf() debug messages can often be interleaved and non-deterministic when viewed in standard output. To help identify which kernel is printing which line the X86SIM_KERNEL_NAME macro can be useful. The following is an example showing how to combine it with printf().

Note: To use X86SIM_KERNEL_NAME you must include adf/x86sim/x86simDebug.h as shown in the following code.
#include <adf/x86sim/x86simDebug.h>

void simple(input_window_float * in, output_window_float * out) {
   for (unsigned i=0; i<NUM_SAMPLES;i++) {
       float val = window_readincr(in);
       window_writeincr(out,val+0.15);
   }
   static int count = 0;
   printf("%s: %s %d\n",__FILE__,X86SIM_KERNEL_NAME,++count);
}