CLGETKERNELWORKGROUP(3clc)
π NAME π
clGetKernelWorkGroupInfo β bestie, this one hands you the tea about a kernel object that's specific to a device. Like, the deets that only make sense for one particular piece of hardware. From the OpenCL Manual, section 3clc. iykyk π
β¨ SYNOPSIS β¨
cl_int clGetKernelWorkGroupInfo(cl_kernel kernel, cl_device_id device,
cl_kernel_work_group_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret);
π PARAMETERS π
okay so here's who's who in this function's little friend group π«Ά
kernelβ this is the kernel object you're interrogating. The one being queried. πΈdeviceβ this points at one specific device out of the list of devices associated withkernel. And where does that list come from? It's the list of devices in the OpenCL context that's associated withkernel. β¨- π‘ little shortcut: if the list of devices associated with
kernelis just a single device, thendevicecan be aNULLvalue. no cap, you can just skip it.
- π‘ little shortcut: if the list of devices associated with
param_nameβ this is you telling it what you wanna know. The full list of supportedparam_nametypes, plus what info each one drops intoparam_valuewhen you callclGetKernelWorkGroupInfo, lives in the table below. πparam_valueβ a pointer to memory where the appropriate result you're querying gets returned. And ifparam_valueisNULL? It's ignored. literally just vibes, it does nothing. π
more coming, bestie, don't go anywhere π
β¨ param_value_size β¨
okay so bestie, param_value_size is literally just the size in bytes of the memory that param_value points at π
and this size must be β₯ the size of the return type β which return type? the one for your chosen cl_kernel_work_group_info value, bestie, as shown in the table below π
not me making a whole table into a bullet list because tables are not the vibe here, but every single detail is still present, no cap π«Ά
CL_KERNEL_GLOBAL_WORK_SIZEβ return type issize_t[3]β what you get back inparam_value: this provides a mechanism for the application to query the maximum global size that can be used to execute a kernel (i.e. theglobal_work_sizeargument toclEnqueueNDRangeKernel(3clc)) on a custom device given by device or a built-in kernel on an OpenCL device given by device β¨ If device is not a custom device or kernel is not a built-in kernel,clGetKernelArgInfo(3clc)returns the errorCL_INVALID_VALUEπ (yes, it saysclGetKernelArgInfo, notclGetKernelWorkGroupInfoβ that's literally what the original says, so I'm keeping it exactly, periodt).CL_KERNEL_WORK_GROUP_SIZEβ return type issize_tβ what you get back inparam_value: this provides a mechanism for the application to query the maximum work-group size that can be used to execute a kernel on a specific device given by device π The OpenCL implementation uses the resource requirements of the kernel (register usage etc.) to determine what this work-group size should be, slay πCL_KERNEL_COMPILE_WORK_GROUP_SIZEβ return type issize_t[3]β what you get back inparam_value: returns the work-group size specified by the__attribute__((reqd_work_group_size(X, Y, Z)))qualifier πΈ SeefunctionQualifiers(3clc). If the work-group size is not specified using the above attribute qualifier,(0, 0, 0)is returned. lowkey iconic that it tells you zero zero zero πCL_KERNEL_LOCAL_MEM_SIZEβ return type iscl_ulongβ what you get back inparam_value: returns the amount of local memory in bytes being used by a kernel π This includes local memory that may be needed by an implementation to execute the kernel, variables declared inside the kernel with thelocal(3clc)address qualifier and local memory to be allocated for arguments to the kernel declared as pointers with thelocal(3clc)address qualifier and whose size is specified withclSetKernelArg(3clc).
If the local memory size, for any pointer argument to the kernel declared with the local(3clc) address qualifier, is not specified, its size is assumed to be 0. noted bestie π
CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLEβ return type issize_tβ what you get back inparam_value: returns the preferred multiple of workgroup size for launch β¨ This is a performance hint. Specifying a workgroup size that is not a multiple of the value returned by this query as the value of the local work size argument toclEnqueueNDRangeKernel(3clc)will not fail to enqueue the kernel for execution unless the work-group size specified is larger than the device maximum. so like, it's giving suggestion energy, not requirement energy, iykyk πCL_KERNEL_PRIVATE_MEM_SIZEβ return type iscl_ulongβ what you get back inparam_value: returns the minimum amount of private memory, in bytes, used by each workitem in the kernel π This value may include any private memory needed by an implementation to execute the kernel, including that used by the language built-ins and variable declared inside the kernel with theprivate(3clc)qualifier. (yes, "variable" not "variables" β original said it that way, and I'm not about to change it, no cap π«Ά)
β¨ param_value_size_ret β¨
Returns the actual size in bytes of data copied to param_value. If param_value_size_ret is NULL, it is ignored. literally just ignored, bestie, no drama ππ
π ERRORS π
okay bestie, here's the tea on what this function hands back to you. It returns CL_SUCCESS when everything goes off without a hitch β¨ β the function executed successfully, we love to see it. Otherwise? She's returning one of these bad boys instead:
CL_INVALID_DEVICEβ this pops up if device isn't in the list of devices associated with kernel, OR if device isNULLbut there's more than one device chilling with kernel. like, pick a lane, we can't read minds πCL_INVALID_VALUEβ if param_name isn't valid, or if the size in bytes you gave as param_value_size is < the size of the return type (as described in that table above, you remember her) AND param_value isn'tNULL. so messy πCL_INVALID_VALUEβ yes she shows up TWICE, iconic behaviour actually. This time it's if param_name isCL_KERNEL_GLOBAL_WORK_SIZEand device is not a custom device, or kernel is not a built-in kernel. rules are rules πCL_INVALID_KERNELβ if kernel is not a valid kernel object. babe. that's not a kernel πCL_OUT_OF_RESOURCESβ there was a failure to allocate resources required by the OpenCL implementation on the device. she's going through it πCL_OUT_OF_HOST_MEMORYβ there was a failure to allocate resources required by the OpenCL implementation on the host. the host is also going through it ππ
π SPECIFICATION π
OpenCL Specification[1] β that's the source of truth, the blueprint, the main character document π
π SEE ALSO π
go read these next, they're all connected, it's giving cinematic universe fr fr π¦
clCreateKernel(3clc)clCreateKernelsInProgram(3clc)clReleaseKernel(3clc)clRetainKernel(3clc)clSetKernelArg(3clc)clGetKernelInfo(3clc)
π«Ά AUTHORS π«Ά
The Khronos Group β thank you for your service, kings and queens π
βοΈ 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.
ngl this is the legal stuff so imma keep it exactly as-is, no edits, no vibes, just facts π
π NOTES π
- OpenCL Specification β page 164, section 5.7.3 - Kernel Object Queries π―
and that's a wrap on CLGETKERNELWORKGROUP(3clc) bestie!! πΈ This page came to you from The Khronos Group, dated 01/14/2021 β go forth and query those kernel work-group things with confidence, you absolute legend π
β¨ slay, periodt, 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