C Specification
To get information that is common to all memory objects (buffer and image objects), call the function
// Provided by CL_VERSION_1_0
cl_int clGetMemObjectInfo(
    cl_mem memobj,
    cl_mem_info param_name,
    size_t param_value_size,
    void* param_value,
    size_t* param_value_size_ret);
Parameters
- 
memobj specifies the memory object being queried.
 - 
param_name specifies the information to query. The list of supported param_name types and the information returned in param_value by clGetMemObjectInfo is described in the Memory Object Queries table.
 - 
param_value is a pointer to memory where the appropriate result being queried is returned. If param_value is
NULL, it is ignored. - 
param_value_size specifies the size in bytes of memory pointed to by param_value. This size must be greater than or equal to the size of the return type specified in the Memory Object Queries table. If param_value is
NULL, it is ignored. - 
param_value_size_ret returns the actual size in bytes of data being queried by param_name. If param_value_size_ret is
NULL, it is ignored. 
Description
| Memory Object Info | Return type | Description | 
|---|---|---|
  | 
  | 
Returns one of the following values:                            The value of image_desc→image_type if memobj is created with clCreateImage or clCreateImageWithProperties.           | 
  | 
  | 
Return the flags argument value specified when memobj is created
        with clCreateBuffer, If memobj is a sub-buffer the memory access qualifiers inherited from parent buffer is also returned.  | 
  | 
  | 
Return actual size of the data store associated with memobj in bytes.  | 
  | 
  | 
If memobj is created with clCreateBuffer, clCreateBufferWithProperties,
        clCreateImage, clCreateImageWithProperties, clCreateImage2D, or
        clCreateImage3D, and          Otherwise, if memobj is created with clCreateSubBuffer, and
        memobj is created from a buffer that was created with
                 Otherwise, returns   | 
  | 
  | 
Map count.  | 
  | 
  | 
Return memobj reference count.  | 
  | 
  | 
Return context specified when memory object is created. If memobj is created using clCreateSubBuffer, the context associated with the memory object specified as the buffer argument to clCreateSubBuffer is returned.  | 
 missing before version 1.1.  | 
  | 
Return memory object from which memobj is created. This returns the memory object specified as buffer argument to clCreateSubBuffer if memobj is a subbuffer object created using clCreateSubBuffer. This returns image_desc→mem_object if memobj is an image object created using clCreateImage or clCreateImageWithProperties.         Otherwise, returns   | 
 missing before version 1.1.  | 
  | 
Return offset if memobj is a sub-buffer object created using clCreateSubBuffer. This return 0 if memobj is not a subbuffer object.  | 
 missing before version 2.0.  | 
  | 
Return   | 
 missing before version 3.0.  | 
  | 
Return the properties argument specified in clCreateBufferWithProperties or clCreateImageWithProperties.         If the properties argument specified in
        clCreateBufferWithProperties or clCreateImageWithProperties
        used to create memobj was not          If memobj was created using clCreateBuffer,
        clCreateSubBuffer, clCreateImage, clCreateImage2D, or
        clCreateImage3D, or if the properties argument specified
        in clCreateBufferWithProperties or
        clCreateImageWithProperties was   | 
 provided by the   | 
  | 
If memobj was created using clCreateFromDX9MediaSurfaceKHR, returns the adapter_type argument specified when memobj was created.  | 
 provided by the   | 
  | 
If memobj was created using clCreateFromDX9MediaSurfaceKHR, returns the surface_info argument specified when memobj was created.  | 
 provided by the   | 
  | 
If memobj was created using clCreateFromD3D10BufferKHR, clCreateFromD3D10Texture2DKHR, or clCreateFromD3D10Texture3DKHR, returns the resource argument specified when memobj was created.  | 
 provided by the   | 
  | 
If memobj was created using clCreateFromD3D11BufferKHR, clCreateFromD3D11Texture2DKHR, or clCreateFromD3D11Texture3DKHR, returns the resource argument specified when memobj was created.  | 
 provided by the   | 
  | 
If memobj was created using clCreateBufferWithProperties with
      the   | 
clGetMemObjectInfo returns  CL_SUCCESS if the function is executed
successfully.
Otherwise, it returns one of the following errors:
- 
CL_INVALID_if memobj is a not a valid memory object.MEM_ OBJECT  - 
CL_INVALID_is returned for theOPERATION CL_MEM_query if theDEVICE_ ADDRESS_ EXT cl_ext_is not supported or if the buffer was not allocated withbuffer_ device_ address CL_MEM_.DEVICE_ PRIVATE_ ADDRESS_ EXT  - 
CL_INVALID_if param_name is not one of the supported values, or if the size in bytes specified by param_value_size is less than size of the return type specified in the Memory Object Queries table and param_value is notVALUE NULL. - 
CL_OUT_if there is a failure to allocate resources required by the OpenCL implementation on the device.OF_ RESOURCES  - 
CL_OUT_if there is a failure to allocate resources required by the OpenCL implementation on the host.OF_ HOST_ MEMORY  
The following errors may be returned if the cl_khr_
extension is supported:
- 
CL_INVALID_if param_name isDX9_ MEDIA_ SURFACE_ KHR CL_MEM_and memobj was not created by calling clCreateFromDX9MediaSurfaceKHR from a Direct3D9 surface.DX9_ MEDIA_ SURFACE_ INFO_ KHR  
The following errors may be returned if the cl_khr_
extension is supported:
- 
CL_INVALID_if param_name isD3D10_ RESOURCE_ KHR CL_MEM_and memobj was not created by calling clCreateFromD3D10BufferKHR, clCreateFromD3D10Texture2DKHR, or clCreateFromD3D10Texture3DKHR.D3D10_ RESOURCE_ KHR  
The following errors may be returned if the cl_khr_
extension is supported:
- 
CL_INVALID_if param_name isD3D11_ RESOURCE_ KHR CL_MEM_and memobj was not created by calling clCreateFromD3D11BufferKHR, clCreateFromD3D11Texture2DKHR, or clCreateFromD3D11Texture3DKHR.D3D11_ RESOURCE_ KHR  
Document Notes
For more information, see the OpenCL Specification
This page is extracted from the OpenCL Specification. Fixes and changes should be made to the Specification, not directly.