The generic address space requires support for OpenCL C 2.0 or OpenCL C 3.0 with the __opencl_c_generic_address_space feature. It can be used with pointer types and it represents a placeholder for any of the named address spaces - global, local or private. It signals that a pointer points to an object in one of these concrete named address spaces. The exact address space resolution can occur dynamically during the kernel execution.

kernel void foo(int a)
    private int b;
    local int c;
    int* p =  a ? &b : &c; // p points to the local or private address space.

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