CLCREATEKERNELSINPRO(3clc)

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

πŸ’– 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 that kernels points at, measured as the number of cl_kernel entries. basically: how much room did you leave in the box πŸ“¦
  • kernels β€” the buffer where the kernel objects for the kernels in program get returned. if kernels is NULL, it's just... ignored, no thoughts, head empty πŸ™ˆ. but if kernels is not NULL, then num_kernels must be greater than or equal to the number of kernels in program. no cramming, bestie.
  • num_kernels_ret β€” the number of kernels in program. if num_kernels_ret is NULL, it is ignored. (yes you can pass NULL and 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_PROGRAM if program is not a valid program object. (fake program, blocked.)
  • CL_INVALID_PROGRAM_EXECUTABLE if there is no successfully built executable for any device in program. (nothing built, nothing to see.)
  • CL_INVALID_VALUE if kernels is not NULL and num_kernels is less than the number of kernels in program. (too small a box for too many kernels, math is not mathing.)
  • 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. 😭

πŸ‘‘ 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 Β© 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 🧚

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