Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16597 Discussions

How to declare a static array in OpenCL kernel?

CLiu18
Beginner
1,804 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 III
1,060 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.

0 Kudos
CLiu18
Beginner
1,060 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.

0 Kudos
Reply