CLRETAINKERNEL(3clc)
π 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β ifkernelis 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 π¦
clCreateKernel(3clc)clCreateKernelsInProgram(3clc)clReleaseKernel(3clc)clSetKernelArg(3clc)clGetKernelInfo(3clc)clGetKernelWorkGroupInfo(3clc)
the whole friend group, basically. go read them too, iykyk π
π 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 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) π
- 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
- 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