Printf() Macros - 2023.2 English

AI Engine Tools and Flows User Guide (UG1076)

Document ID
Release Date
2023.2 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);
   static int count = 0;
   printf("%s: %s %d\n",__FILE__,X86SIM_KERNEL_NAME,++count);