Forum Discussion
Emulation of autorun kernels is not properly supported in AOC up to v16.1.2. For emulation of such kernels in v16.1.2 and below, you have to create a separate queue and explicitly call the autorun kernel from the host (without any arguments). However, these kernels work correctly on the FPGA itself without needing to be called from the host. Even if the autorun kernel is replicated using num_compute_units, you only need to call it once in the host code for emulation. Note that even though such kernels will automatically restart on the FPGA if their execution finishes, this will not happen in the emulator, and if your code expects the kernel to restart automatically, you have to call it again in the host for emulation. What I do is that I add the necessary code for explicitly calling the autorun kernels during emulation in an "#ifdef EMULATION" block, and use the "EMULATION" variable at compile-time to control whether I want to compile for emulation or FPGA execution.
I reported this discrepancy between emulation and FPGA execution to Altera a couple months ago, and they implemented a fix in v17.0; however, the fix is not complete since autorun kernels still do not restart on their own after their execution finishes. I have reported this remaining issue, too, and they will hopefully fix it in the upcoming versions.