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

How does local memory behave when used in autorun kernels for FPGA-based OpenCL design ?

New Contributor I

I am using local memory in autorun kernels as buffers to hold data within the kernels. The autorun kernels are replicated multiple times by using pragma "__attribute__((num_compute_units(LANE_NUM)))



It turns out that the local memory in the first compute unit (get_compute_id(0)==0) will also be write multiple times by other compute units (get_compute_id(0)>0) during software emulation. But for hardware, the local memory will only be write one time by its own compute unit.


This is a bit strange and there is no clear defination of the behavior of how local memory works for autorun kernels.


1) Are they shared between the multiple compute instance decleared by "__attribute__((num_compute_units(LANE_NUM)))" ?

2) Do they hold previous data when restart automatically ?


0 Kudos
2 Replies
Valued Contributor III

Your observation with the emulator is very strange. It could be a bug in the emulator. Autorun kernels are completely separate modules with no connection between them other than on-chip channels; there is no way the same buffer could be shared between them. Regarding whether data stored in buffers local to a specific autorun copy are kept or not after the copy is restarted, there is nothing mentioned in the documents and I would assume the behavior will be undefined in this case. If you need such consistency, it is probably best if you wrap your autorun kernel in a while(1) loop to prevent it from reseting; of course this could come at the cost of significant area overhead.

0 Kudos
May I know if you have been able to try the same on latest OpenCL compiler version 19.1 ?
0 Kudos