Forum Discussion
Altera_Forum
Honored Contributor
9 years ago --- Quote Start --- I read Optimizing Local Memory Accesses of Altera SDK for OpenCL Best Prasctices Guides. and I can see that I can use local memory used by clSetKernelArg. so I write my source as below /////////kernel source//////// __kernel void test_kernel(__attribute __((local_mem_size(2048)))__local int const * restrict table) { ... } //////////////////////////////// /////////my source//////// status = clSetKernelArg(kernel, argi++, 256*sizeof(cl_mem), &table); ///////////////////////////// 1) I compile my kernel and I see warning massage as bellow. Compiler Warning: Pointer to local memory argument with no store to it. 2)and execute my program. I can see error massage as bellow. ERROR: CL_INVALID_ARG_VALUE How can I use local memory used clSetKernelArg???? thanks. --- Quote End --- It's not possible to transfer data from the host to local memory. You have to transfer it to global memory and have the kernel load the data into local memory. The only advantage to declaring local memory in a kernel parameter is that you get to choose the size at runtime instead of kernel compile time.