CLCREATEKERNELSINPRO(3clc)
π clCreateKernelsInProgram β OpenCL Manual (3clc) π
okay bestie, welcome to the clCreateKernelsInProgram page, straight outta the OpenCL Manual. this one is giving "make me ALL the kernels at once" energy and honestly? iconic. let's get into it π«Ά
β¨ NAME β¨
clCreateKernelsInProgram β creates kernel objects for all kernel functions in a program object. not one. not two. all of them. slay. π
πΈ SYNOPSIS πΈ
cl_int clCreateKernelsInProgram(cl_program program, cl_uint num_kernels,
cl_kernel *kernels,
cl_uint *num_kernels_ret);
π PARAMETERS π
programβ a program object that has a successfully built executable, like it graduated and everything π. if it hasn't been built, we're not doing this.num_kernelsβ the size of the memory thatkernelspoints at, measured as the number ofcl_kernelentries. basically: how much room did you leave in the box π¦kernelsβ the buffer where the kernel objects for the kernels inprogramget returned. ifkernelsisNULL, it's just... ignored, no thoughts, head empty π. but ifkernelsis notNULL, thennum_kernelsmust be greater than or equal to the number of kernels inprogram. no cramming, bestie.num_kernels_retβ the number of kernels inprogram. ifnum_kernels_retisNULL, it is ignored. (yes you can passNULLand just vibe.)
π¦ NOTES π¦
So here's the tea β β this function creates kernel objects for all kernel functions in program. but heads up: kernel objects are not created for any functionQualifiers(3clc) functions in program that don't have the same function definition across all devices for which a program executable has been successfully built. so if the devices can't agree, that function gets left on read. π
Kernel objects can only be created once you've got a program object with a valid program source or binary loaded into it, and the program executable has been successfully built for one or more devices associated with program. both boxes checked, or it's not happening.
Also, and this is the big one: no changes to the program executable are allowed while there are kernel objects associated with a program object. periodt. that means calls to clBuildProgram(3clc) and clCompileProgram(3clc) return CL_INVALID_OPERATION if there are kernel objects attached to a program object. it's giving locked-in π
The OpenCL context associated with program will be the context associated with kernel. and the list of devices associated with program are the devices associated with kernel. they're matching, they're coordinated, they're a unit π―
Devices associated with a program object for which a valid program executable has been built can be used to execute kernels declared in the program object. β¨
π₯ ERRORS π₯
Returns CL_SUCCESS if the kernel objects are successfully allocated π. Otherwise, it returns one of the following errors:
CL_INVALID_PROGRAMifprogramis not a valid program object. (fake program, blocked.)CL_INVALID_PROGRAM_EXECUTABLEif there is no successfully built executable for any device inprogram. (nothing built, nothing to see.)CL_INVALID_VALUEifkernelsis notNULLandnum_kernelsis less than the number of kernels inprogram. (too small a box for too many kernels, math is not mathing.)CL_OUT_OF_RESOURCESif there is a failure to allocate resources required by the OpenCL implementation on the device. πCL_OUT_OF_HOST_MEMORYif there is a failure to allocate resources required by the OpenCL implementation on the host. π
π SPECIFICATION π
OpenCL Specification[1]
π SEE ALSO π
clCreateKernel(3clc), clRetainKernel(3clc), clReleaseKernel(3clc), clSetKernelArg(3clc), clGetKernelInfo(3clc), clGetKernelWorkGroupInfo(3clc), classDiagram(3clc)
go read the whole friend group, they all hang out together π«Ά
π 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 condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.
π§ NOTES π§
- OpenCL Specification β page 158, section 5.7.1 - Creating Kernel Objects
and that's the whole page, bestie!! π this one came to you from The Khronos Group, dated 01/14/2021, page CLCREATEKERNELSINPRO(3clc) β go build your program, then come back and grab all your kernels at once. no cap. πβ¨
π¦ 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