Intel® High Level Design
Support for Intel® High Level Synthesis Compiler, DSP Builder, OneAPI for Intel® FPGAs, Intel® FPGA SDK for OpenCL™
655 Discussions

Autorun kernel stopped in emulation mode and never come back for FPGA OpenCL SDK v18.1.0

DongWang-BJTU
New Contributor I
1,626 Views

I have encountered a problem with the emulator of the OpenCL SDK for FPGA. The autorun kernels never come back after a few rounds of execution. I have used the following scheme to test:

---------------------------------------------------

__kernel

__attribute__((autorun))

__attribute__((max_global_work_dim(0)))

__attribute__((num_compute_units(4)))

void myKernel()

{

   int compute_id = get_compute_id(0);

// as the first statement

   printf("kernel-%d started ...\n", compute_id);

 

/// some other codes for computation

 

// as the last statement

   printf("kernel-%d finished !!!\n", compute_id);

}

-------------------------------------

after automatically restarted for a few times, one of the autorun kernel (surprisingly not all kernels stopped) never come back after printed out the "finishing" statement in software emulation mode.

 

When running on FPGA, everything is OK.

 

Is this possibly a bug ? how could find what really happend ?

 

I was using v18.1.0 and BSP for DE5net v18.0.

0 Kudos
2 Replies
DongWang-BJTU
New Contributor I
818 Views

I further used gdb to tracy the state of the autorun kernels as the following pic shows. Totally, six threads are running in the same time, one date loader, one consumer, four autorun kernels.

It can been seen that whenever the autorun kernel restarts, a new thread is created, and when it finishes, the corresponding thread will exits (as the blue and green markers shows).

It looks like that in the final round of execution, the red threads (two autorun kernels) successfully exits while the yellow threads restarted but did not exist (because in the last round of execution, they are not needed.)

 

And when I re-start the data loaders and consumer, only two threads are created for the two autorun kernels that have successfully existed (red ones) in previous computations. Two are already there running (the yellow ones). In this case, the simulation hang up waiting for the yellow ones to execute.

 

Inked捕获_LI.jpg

0 Kudos
MuhammadAr_U_Intel
818 Views
Hi, Since you are using SDK version 18.1, autorun kernel are supported. In hardware, autorun kernels never stop running, even without an infinite loop. The emulator replicates this behavior by re-executing the autorun kernel whenever it completes. Note: printf is not supported in autorun kernels. (You can try removing them from emulation code.) https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/hb/opencl-sdk/aocl_programming_guide.pdf Page 137 "In terms of ordering the printed lines, the output of the printf function might be ordered differently on the Emulator and hardware. This is because, in the hardware, printf data is stored in a global memory buffer and flushed from the buffer only when the kernel execution is complete, or when the buffer is full. In the Emulator, the printf function uses the x86 stdout" Thanks, Arslan
0 Kudos
Reply