Intel® SoC FPGA Embedded Development Suite
Support for SoC FPGA Software Development, SoC FPGA HPS Architecture, HPS SoC Boot and Configuration, Operating Systems
445 Discussions

opencl for intel fpga Local memories merging on compilation

JJaco16
Novice
1,194 Views

Hi,

I'm trying to implement a piece of code on an arria10 soc development board using openCL. The kernel code has declarations of two local memories as follows

 

local float __attribute__((memory, numbanks(8),bankwidth(4))) lmemA[1024][8];

local float __attribute__((memory, numbanks(2),bankwidth(4))) lmemB[1024][2];

 

The whole idea is to get a cumulative memory of size [1024][10]. since the compiler allows <numbanks> property to be in the powers of 2, (I don't want to use a numbank value of 16, when i only need 10 banks for 10 parallel accesses on the lowest dimension), I am declaring two different local memory instantiations such that overall my size requirement is satisfied as well as the compiler's need for power of 2 numbanks value.

Correspondingly the rest of the code was modified so as to accommodate two local memories instead of just the one of size [1024][10].

However, on compilation the compiler throws an error

"Compiler Error : Attempted to merge local memories but found conflicting memory attributes"

I don't want the compiler to merge the local memories, and there seems to be not much documentation regarding this problem.

Is there any other work around for this compilation to succeed?

 

0 Kudos
1 Solution
Nurina
Employee
1,141 Views

Hi,


Following the problem about "conflicting memory attributes", you need to set your bankwidth based on your array size. Refer to section 8.4.1 here: https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/hb/opencl-sdk/aocl-best-practices-guide.pdf#page=157


Regards,

Nurina


View solution in original post

5 Replies
Nurina
Employee
1,168 Views

Hi,


Thank you for using Intel Community Forum. We are currently investigating your problem and will get back to you.


Regards,

Nurina


0 Kudos
Nurina
Employee
1,159 Views

Hi,


There are a few ways for you to make sure the memory does not merge. This video lecture on Memory Optimization for OpenCL contains a few suggestions: https://www.youtube.com/watch?v=1zGpN28mXN4&t=1079s


You may find these documents to be useful:

  1. https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/hb/opencl-sdk/aocl-best-practices-guide.pdf
  2. https://www.intel.com/content/www/us/en/programmable/documentation/mwh1391807965224.html


Regards,

Nurina


0 Kudos
Nurina
Employee
1,142 Views

Hi,


Following the problem about "conflicting memory attributes", you need to set your bankwidth based on your array size. Refer to section 8.4.1 here: https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/hb/opencl-sdk/aocl-best-practices-guide.pdf#page=157


Regards,

Nurina


JJaco16
Novice
1,123 Views

Hi,

Thanks for the answer.

We found out one more way to prevent this from happening. By declaring one memory as local and another as private(since its a single work item kernel, both behave the same). It worked and the compiler doesnt merge them anymore.

Nurina
Employee
1,112 Views

Hi,

Thank you for sharing your solution. I'm glad your problem is solved, I now transition this thread to community support. If you have a new question, feel free to open a new thread to get the support from Intel experts. Otherwise, the community users will continue to help you on this thread. Thank you.

Regards,
Nurina

P/S: If you like my comment, feel free to give Kudos. If my comment solved your problem, feel free to accept my comment as solution!

0 Kudos
Reply