CLGETMEMOBJECTINFO(3clc)

πŸ“¦
version 1.0~svn33624 Β· 3 versions
, in ubuntu jammy, ubuntu noble

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_FLAGS β€” return type: cl_mem_flags. Hands back the flags argument value you specified back when memobj got created, whether that was with clCreateBuffer(3clc), clCreateSubBuffer(3clc), or clCreateImage(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) or clCreateImage(3clc) and CL_MEM_USE_HOST_PTR was specified in mem_flags, you get back the host_ptr argument value that was specified when memobj was created. Otherwise? A NULL value. tragic but true 😭
    • If memobj was created with clCreateSubBuffer(3clc), you get back the host_ptr + origin value specified when memobj was created. Here host_ptr is the argument value specified to clCreateBuffer(3clc), and CL_MEM_USE_HOST_PTR is specified in mem_flags for the memory object from which memobj was created. Otherwise a NULL value is returned. yeah. same energy.
  • 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 using clCreateSubBuffer(3clc), the context associated with the memory object specified as the buffer argument 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:


🫢 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:


πŸ“œ SPECIFICATION πŸ“œ

OpenCL Specification[1] 🌈


πŸ‘€ SEE ALSO πŸ‘€


πŸ‘‘ AUTHORS πŸ‘‘

The Khronos Group πŸ’…


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 πŸ“

  1. 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