Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

Constant Caching Query

Hi

I am currently dealing with optimizing Multikernel opencl app targetted to Altera FPGA.

I have two arguments acroos two kernels of type const _constant roughly taking 20 Kbytes each

I also have arguments of type const __global.

I did refer the documentation regarding this in the form of Optimization guide.

Is the constant cache optimization only for __constant type arguments or is it also for const __global type arguments ?

With my case should the value specified for the --const-cache-bytes be 40 or should it be more.

How should I decide on the value to be specified for ?

Is there any limit on it ?

Thanks

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --const-cache-bytes is only for __constant arguments of a kernel. Since cache misses have a large performance penalty you want to size the constant cache to be at least as large as the data set you want it to hold. In this case I would set it to be 64kB so that it can hold those two 20kB buffers using --const-cache-bytes 65536.

    The only limit on the size is hardware resources. Constant caches are built of on-chip RAM inside the FPGA so if you request too large of a cache the hardware will not compile because the FPGA will run out of memory resources.

    What type of data is this that you want to store in constant memory? There might be better alternatives depending on what you are doing.