The __local or local address space name is used to describe variables that are allocated in local memory and shared by all work-items in a work-group.


kernel void my_func(...)
    local float a;     // A single float allocated
                       // in the local address space

    local float b[10]; // An array of 10 floats
                       // allocated in the local address space

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.

See Also

Document Notes

For more information, see the OpenCL C Specification

This page is extracted from the OpenCL C Specification. Fixes and changes should be made to the Specification, not directly.

Copyright 2014-2023 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0