We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Showing results for 
Search instead for 
Did you mean: 
Registered: ‎04-17-2012

OpenCL: __local variables inside non-kernel functions

My kernel function has some variables defined with __local qualifier, and it calls an auxiliary function.

My question: is it correct to define a __local variable inside the auxiliary function?


__kernel void krnl(...){
     __local float* var;
... aux_function(var); } // auxiliary function // void aux_function(__local float *arg){ __local float* im; ... }


I checked the standard, and this is what it mentions regarding to __local variables :

On page 151:

The __local or local address space name is used to describe variables that need to be allocated in local memory and are shared by all work-items of a work-group. This qualifier can be used with arguments to functions (including __kernel functions) declared as pointers, or with variables declared inside a __kernel function.


On page 154:

The following rules apply to functions that are declared with this qualifier: 


It is just a regular function call if a __kernel function is called by another kernel function.



The behavior of calling kernel functions with variables declared inside the function with the __local or local qualifier from other kernel functions is implementation-defined.


Any comments about this?

L30nardo SV
Tags (1)
0 Kudos
1 Reply
Xilinx Employee
Xilinx Employee
Registered: ‎08-17-2011

Re: OpenCL: __local variables inside non-kernel functions

hi @leonardo.solis


others may have better comments, but why do you really want to know / what is your concern?


are you having more than one work-item per work group? ie more than kernel __attribute__ ((reqd_work_group_size(1,1,1)))

- Hervé

* New Dedicated Vivado HLS forums* http://forums.xilinx.com/t5/High-Level-Synthesis-HLS/bd-p/hls
* Readme/Guidance* http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369

* Please mark the Answer as "Accept as solution" if information provided is helpful.
* Give Kudos to a post which you think is helpful and reply oriented.
0 Kudos