CLGETMEMOBJECTINFO(3clc)
CLGETMEMOBJECTINFO π (3clc)
okay bestie, welcome to the OpenCL Manual β¨ this is the page for clGetMemObjectInfo, and it's the one that hands you all the tea that's common to every memory object β think buffer objects AND image objects, both of them, no favorites π
β¨ NAME β¨
clGetMemObjectInfo β get information that is common to all memory objects (buffer and image objects).
likeβ¦ it's giving "tell me everything, bestie" π«Ά
πΈ SYNOPSIS πΈ
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);
copy it EXACTLY, don't be cute with the spacing, i am watching π
π PARAMETERS π
memobjβ specifies the memory object being queried. π¦ that's the one you're asking about, bestie β point at it and it'll spill.
more coming, don't go anywhere π
So param_name is literally just picking which lil fact you wanna pull out of your memory object bestie. Here's the full menu of what you can ask for and what param_value hands back π
CL_MEM_TYPEβ return type:cl_mem_object_type. Gives you one of these:CL_MEM_OBJECT_BUFFERif memobj was made withclCreateBuffer(3clc)orclCreateSubBuffer(3clc).- the
cl_image_desc.image_typeargument value if memobj was made withclCreateImage(3clc).
CL_MEM_FLAGSβ return type:cl_mem_flags. Hands back theflagsargument value you specified back when memobj got created, whether that was withclCreateBuffer(3clc),clCreateSubBuffer(3clc), orclCreateImage(3clc). Oh and if memobj is a sub-buffer, the memory access qualifiers inherited from the parent buffer get returned too. extra info, we love that for you β¨CL_MEM_SIZEβ return type:size_t. Returns the actual size of the data store associated with memobj, in bytes. fr fr, bytes.CL_MEM_HOST_PTRβ return type:void *. Okay this one has layers, stay with me π«Ά- If memobj was created with
clCreateBuffer(3clc)orclCreateImage(3clc)andCL_MEM_USE_HOST_PTRwas specified in mem_flags, you get back thehost_ptrargument value that was specified when memobj was created. Otherwise? ANULLvalue. tragic but true π - If memobj was created with
clCreateSubBuffer(3clc), you get back thehost_ptr+originvalue specified when memobj was created. Herehost_ptris the argument value specified toclCreateBuffer(3clc), andCL_MEM_USE_HOST_PTRis specified in mem_flags for the memory object from which memobj was created. Otherwise aNULLvalue is returned. yeah. same energy.
- If memobj was created with
CL_MEM_MAP_COUNTβ return type:cl_uint. The map count. > Bestie listen: the map count returned should be considered immediately stale. It is unsuitable for general use in applications. This feature is provided for debugging. So likeβ¦ don't build your whole app on it, okay? πCL_MEM_REFERENCE_COUNTβ return type:cl_uint. Returns the memobj reference count. > Same warning, same drama: the reference count returned should be considered immediately stale, it's unsuitable for general use in applications, and it's provided for identifying memory leaks. Which is lowkey iconic of it honestly πCL_MEM_CONTEXTβ return type:cl_context. Returns the context specified when the memory object is created. If memobj is created usingclCreateSubBuffer(3clc), the context associated with the memory object specified as thebufferargument to
(wrapping up the row right above us) β¦clCreateSubBuffer(3clc) is returned.
Okay bestie, here's the rest of the table π every param_name left, its return type, and exactly what it hands back to you:
CL_MEM_ASSOCIATED_MEMOBJECTβ return typecl_mem. Returns the memory object that memobj was created from. This returns the memory object specified as thebufferargument toclCreateSubBuffer(3clc). Otherwise aNULLvalue is returned. β¨CL_MEM_OFFSETβ return typesize_t. Returns the offset if memobj is a sub-buffer object created usingclCreateSubBuffer(3clc). This returns0if memobj is not a subbuffer object. πCL_MEM_D3D10_RESOURCE_KHRβ return typeID3D10Resource *. The property being queried (if thecl_khr_d3d10_sharing(3clc)extension is enabled). If memobj was created usingclCreateFromD3D10BufferKHR(3clc),clCreateFromD3D10Texture2DKHR(3clc), orclCreateFromD3D10Texture3DKHR(3clc), returns theresourceargument specified when memobj was created. π¦CL_MEM_DX9_MEDIA_ADAPTER_TYPE_KHRβ return typecl_dx9_media_adapter_type_khr. Returns thecl_dx9_media_adapter_type_khrargument value specified when memobj is created usingclCreateFromDX9MediaSurfaceKHR(3clc)(if thecl_khr_dx9_media_sharing(3clc)extension is supported). πΈCL_MEM_DX9_MEDIA_SURFACE_INFO_KHRβ return typecl_dx9_surface_info_khr. Returns thecl_dx9_surface_info_khrargument value specified when memobj is created usingclCreateFromDX9MediaSurfaceKHR(3clc)(if thecl_khr_dx9_media_sharing(3clc)extension is supported). π§CL_MEM_D3D11_RESOURCE_KHRβ return typeID3D11Resource *. If thecl_khr_d3d11_sharingextension is supported, if memobj was created usingclCreateFromD3D11BufferKHR(3clc),clCreateFromD3D11Texture2DKHR(3clc), orclCreateFromD3D11Texture3DKHR(3clc), returns theresourceargument specified when memobj was created. π
π«Ά param_value
A pointer to memory where the appropriate result being queried is returned. If param_value is NULL, it is ignored. (Iconic behaviour, honestly β no notes.)
π«Ά param_value_size
Used to specify the size in bytes of memory pointed to by param_value. This size must be β₯ size of return type as described in the table above. Lowkey important, don't skip this one bestie π
π«Ά param_value_size_ret
Returns the actual size in bytes of data being queried by param_value. If param_value_size_ret is NULL, it is ignored.
π ERRORS π
Returns CL_SUCCESS if the function is executed successfully. Otherwise, it returns one of the following errors:
CL_INVALID_VALUEβ ifparam_nameis not valid, or if size in bytes specified byparam_value_sizeis < the size of return type as described in the table above andparam_valueis notNULL.CL_INVALID_MEM_OBJECTβ if memobj is a not a valid memory object.CL_OUT_OF_RESOURCESβ if there is a failure to allocate resources required by the OpenCL implementation on the device.CL_OUT_OF_HOST_MEMORYβ if there is a failure to allocate resources required by the OpenCL implementation on the host.CL_INVALID_D3D10_RESOURCE_KHRβ If thecl_khr_d3d10_sharing(3clc)extension is enabled and ifparam_nameisCL_MEM_D3D10_RESOURCE_KHRand memobj was not created by the functionclCreateFromD3D10BufferKHR(3clc),clCreateFromD3D10Texture2DKHR(3clc), orclCreateFromD3D10Texture3DKHR(3clc).CL_INVALID_DX9_MEDIA_SURFACE_KHRβ ifparam_nameisCL_MEM_DX9_MEDIA_SURFACE_INFO_KHRand memobj was not created by the functionclCreateFromDX9MediaSurfaceKHR(3clc)from a Direct3D9 surface. (If thecl_khr_dx9_media_sharing(3clc)extension is supported.)CL_INVALID_D3D11_RESOURCE_KHRβ If thecl_khr_d3d11_sharingextension is supported, ifparam_nameisCL_MEM_D3D11_RESOURCE_KHRand memobj was not created by the functionclCreateFromD3D11BufferKHR(3clc),clCreateFromD3D11Texture2DKHR(3clc), orclCreateFromD3D11Texture3DKHR(3clc)."
π SPECIFICATION π
OpenCL Specification[1] π
π SEE ALSO π
π AUTHORS π
The Khronos Group π
π COPYRIGHT π
Copyright Β© 2007-2011 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 following conditions: the copyright notice above and this permission notice shall be included in all copies or substantial portions of the Materials.
(Yes bestie, I'm keeping the legal bits verbatim β that's the one place we do NOT freestyle π)
π NOTES π
OpenCL Specificationβ page 125, section 5.4.5 - Memory Object Queries
and that's the whole page, bestie!! π«Ά This one came from The Khronos Group, dated 01/14/2021, and its manual page name is CLGETMEMOBJECTINFO(3clc) β go query those memory objects and slay, fr fr. πβ¨π
π¦ where this page comes from
- ubuntu jammy: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- ubuntu noble: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms