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 
            inside a kernel function must occur at kernel function scope. 
        
      OpenCL implements the following disjoint named address 
      spaces: __global,
      __local, __constant, and
      __private. The address space qualifier may be used in variable
      declarations to specify the region of memory that is used to allocate the object. The
      C syntax for type qualifiers is extended in OpenCL 
      to include an address space name as a valid type qualifier.
      If the type of an object is qualified by an address 
      space name, the object is allocated in the 
      specified address name; otherwise, the object is 
      allocated in the generic address space.
    
      The address space names without the  __  prefix i.e. global,
      local, constant 
      and private
      may be substituted for the corresponding address 
      space names with the  __  prefix.
    
        The address space name for arguments to a function 
        in a program, or local variables of a function 
        is __private. All function 
        arguments shall be in the __private address space.
        The address space for a variable at program scope 
        or a static variable inside a function can either 
        be __global or 
        __constant, but defaults to 
        __global if not specified.
    
        OpenCL 2.0 adds support for an unnamed generic 
        address space. Pointers that are declared 
        without pointing to a named address space point to the 
        generic address space. Before 
        referring to the region pointed to, the pointer 
        must be associated with a named address space.
        Functions may be written with arguments and return values that point to the 
        generic address space.
    
        kernel function arguments declared to be a pointer or 
        an array of a type must point to one of 
        the named address spaces __global, 
        __local or __constant.
    
        The named address spaces are a subset of the generic 
        address space except for the constant
        address space.
    
        A pointer to address space A can only be assigned to 
        a pointer to the same address space A or a 
        pointer to the generic address 
        space. Casting a pointer to address space A to a pointer to 
        address space B is illegal if A and B are named 
        address spaces and A is not the same as B.
    
        The __global, __constant, 
        __local, 
        __private, __generic, 
        global, 
        constant, local, 
        private and 
        generic names are reserved for use as address space 
        qualifiers and shall not be used otherwise.
    
        The size of pointers to different address spaces 
        may differ. It is not correct to assume
        that, for example, sizeof(__global int *) 
        always equals sizeof(__local int *).
    
| // 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 and exist only for the lifetime of the work-group 
            executing the kernel.
        
General qualifier examples follow:
| // declares a pointer p in the private address space that // points to an object in address space global global int *p; void foo (...) { // declares an array of 4 floats in the private address space float x[4]; ... } | 
Example:
| private int f() { ... } // should generate an error local int *f() { ... } // allowed local int * private f() { ... }; // should generate an error. | 
 Copyright © 2007-2013 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.
Copyright © 2007-2013 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.