Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
14943 Discussions

How to declare a static array in OpenCL kernel?

CLiu18
Beginner
911 Views

In the OpenCL kernel, I need to declare a static array (buffer) such that the data in the array (buffer) retains when the kernel gets launched iteratively. This is particularly useful for iterative algorithms. However, the compiler pops compilation error when the array is set static.

 

An alternative way is to dump the data in the buffer to DDR and read it from DDR in next iteration. This works but the kernel changes too much when doing software simulation.

 

Looking forward to suggestions on this.

 

Regards,

Cheng Liu

 

0 Kudos
2 Replies
HRZ
Valued Contributor II
167 Views

Can you post a code snippet of what you are trying to do? You have to copy the array to DDR memory to be able to transfer it to the FPGA anyway, and since the array is static, it can just reside on DDR and be re-read at each kernel invocation. If you are thinking about copying the array to FPGA on-chip memory and keep it consistent between different kernel invocations, that is not going to be possible since local memory is only consistent within each kernel invocation and not across different invocations. You can, however, create a separate kernel from your main kernel and read the static array from DDR memory inside that kernel and store it on-chip and keep feeding the data to the main kernel that gets re-invoked via on-chip channels.

CLiu18
Beginner
167 Views

Thanks for the reply. Yes, I am trying to make local memory in the kernel be consistent between different invocations, because this is the normal behavior in hardware. This is why I want to create a static array in the kernel.

 

Anyway, seems there is no simple way to keep the design code the same with the simulation code in this case.

Reply