CLRETAINKERNEL(3clc)

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

πŸ’… CLRETAINKERNEL β€” bestie, we're doing reference counting today

okay so this is from the OpenCL Manual, and it's page CLRETAINKERNEL(3clc) energy. sit with me for a sec 🫢

✨ NAME ✨

clRetainKernel β€” it bumps the kernel object's reference count. that's it. that's the whole job. and it slays at it. πŸ‘‘

cl_int clRetainKernel(cl_kernel kernel);

πŸŽ€ NOTES πŸŽ€

fr fr, here's the tea: clCreateKernel(3clc) and clCreateKernelsInProgram(3clc) already do an implicit retain for you. so if you were sitting there like "wait do i need to retain this myself" β€” no bestie, they got you. 😌


🌸 ERRORS 🌸

if everything goes right it hands you CL_SUCCESS back, iconic behavior, no notes. but if it doesn't, you're getting one of these:

  • CL_INVALID_KERNEL β€” if kernel is not a valid kernel object. like, that's not a kernel, bestie. πŸ’€
  • 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.
not me checking the return value every single time because ignoring it is how you end up crying at 3am 😭

πŸ“– SPECIFICATION πŸ“–

OpenCL Specification[1]


πŸ¦‹ SEE ALSO πŸ¦‹

the whole friend group, basically. go read them too, iykyk πŸ’œ


πŸ‘‘ 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 condition being that this copyright notice and this permission notice shall be included in all copies or substantial portions of the Materials. yes, all of them. no skipping. πŸ“Ž


πŸ“ NOTES (the footnote one, stay with me) πŸ“

  1. OpenCL Specification β€” page 159, section 5.7.1 - Creating Kernel Objects

and that's the whole page, babe 🌈 this one's from The Khronos Group, dated 01/14/2021, and it lives under CLRETAINKERNEL(3clc). go forth and retain responsibly, mwah πŸ’…πŸŽ€

πŸ“¦ where this page comes from