Description

The OpenCL C programming language implements the following address space qualifier functions. We use the generic type name gentype to indicate any of the built-in data types supported by OpenCL C or a user defined type.

Table 1. Built-in Address Space Qualifier Functions

Function

Description

global gentype * to_global(gentype *ptr)
const global gentype * to_global(const gentype *ptr)

Returns a pointer that points to a region in the global address space if to_global can cast ptr to the global address space. Otherwise it returns NULL.

local gentype * to_local(gentype *ptr)
const local gentype * to_local(const gentype *ptr)

Returns a pointer that points to a region in the local address space if to_local can cast ptr to the local address space. Otherwise it returns NULL.

private gentype * to_private(gentype *ptr)
const private gentype * to_private(const gentype *ptr)

Returns a pointer that points to a region in the private address space if to_private can cast ptr to the private address space. Otherwise it returns NULL.

cl_mem_fence_flags get_fence(gentype *ptr)
cl_mem_fence_flags get_fence(const gentype *ptr)

Returns a valid memory fence value for ptr.

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 (c) 2014-2020 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.