[ ]>
__local
__local
2007-2011y The Khronos Group Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.
3
__local Address Space Qualifier.

##

__local local

## Description

&qualifierInc;

## Notes

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. Pointers to the `__local` address space are allowed as arguments to functions (including `__kernel` functions). Variables allocated in the `__local` address space can also be defined inside a `__kernel` function scope.

## Example

&qualifierExampleInc;

// Examples of variables allocated in the __local address space // inside a __kernel function __kernel void my_func(...) { __local float a; // A single float allocated // in local address space __local float b[10]; // An array of 10 floats // allocated in local address space. if (...) { // example of variable in __local address space but not // declared at __kernel function scope. __local float c; // not allowed. } }

Variables allocated in the `__local` address space inside a `__kernel` function cannot be initialized.

         __kernel void my_func(...)
        {
           local float a = 1;    // not allowed __local float b; b = 1;                // allowed
        }

NOTE: Variables allocated in the `__local` address space inside a `__kernel` function are allocated for each work-group executing the kernel.

## Specification

OpenCL Specification

## Also see

__global, __constant, __private

##