CLGETKERNELARGINFO(3clc)
β¨ CLGETKERNELARGINFO β¨
okay so bestie, welcome to the clGetKernelArgInfo page of the OpenCL Manual π
this is a <3clc> girlie, section 3, and she is so ready to spill the tea about your kernel arguments. no cap.
πΈ NAME πΈ
clGetKernelArgInfo β Returns information about the arguments of a kernel.
like, literally that's the whole job. you hand her a kernel, she tells you about its args. iconic behaviour tbh π
π¦ SYNOPSIS π¦
cl_int clGetKernelArgInfo(cl_kernel kernel, cl_uint arg_indx,
cl_kernel_arg_info param_name,
size_t param_value_size, void *param_value,
size_t *param_value_size_ret);
she returns a cl_int, takes a cl_kernel called kernel, a cl_uint called arg_indx, a cl_kernel_arg_info called param_name, a size_t called param_value_size, a void * called param_value, and a size_t * called param_value_size_ret. six whole things. she's a busy girl π
more parts incoming, bestie β don't go anywhere π«Ά
π PARAMETERS π
okay bestie, here's everybody in the cast, one by one πΈ
kernelβ the kernel object we're poking at. the one getting queried, periodt.arg_indxβ the argument index, iykyk. args to the kernel get referred to by indices that start at0for the leftmost argument and run all the way ton - 1, wherenis the total number of arguments that kernel declared. so yeah, zero-indexed like everything else in this cursed lil world πparam_nameβ which piece of argument info you wanna query. the whole list of supportedparam_nametypes, plus whatclGetKernelArgInfohands back inparam_value, is laid out right below πparam_valueβ a pointer to the memory where the result you asked for gets dropped. ifparam_valueisNULL, it's just ignored. no drama. πparam_value_sizeβ how big (in bytes) the memory thatparam_valuepoints to is. this size must be > the size of the return type as described in the table below. lowkey non-negotiable bestie πparam_value_size_retβ returns the actual size in bytes of the data that got copied intoparam_value. ifparam_value_size_retisNULL, it gets ignored too. equal opportunity ignoring fr fr.
π¦ the cl_kernel_arg_info rundown π¦
CL_KERNEL_ARG_ADDRESS_QUALIFIER
return type: cl_kernel_arg_address_qualifier π
this one gives you back the address qualifier that was specified for the argument at arg_indx. and it can be any one of these:
CL_KERNEL_ARG_ADDRESS_GLOBALCL_KERNEL_ARG_ADDRESS_LOCALCL_KERNEL_ARG_ADDRESS_CONSTANTCL_KERNEL_ARG_ADDRESS_PRIVATE
and if no address qualifier was specified at all? then the default address qualifier gets returned, which is CL_KERNEL_ARG_ADDRESS_PRIVATE. so you're never left hanging, queen π
CL_KERNEL_ARG_ACCESS_QUALIFIER
return type: cl_kernel_arg_access_qualifier β¨
returns the access qualifier specified for the argument given by arg_indx. can be one of:
CL_KERNEL_ARG_ACCESS_READ_ONLYCL_KERNEL_ARG_ACCESS_WRITE_ONLYCL_KERNEL_ARG_ACCESS_READ_WRITECL_KERNEL_ARG_ACCESS_NONE
if the argument is not an image type, you get CL_KERNEL_ARG_ACCESS_NONE back. and if it is an image type, then you get the access qualifier that was specified, or the default access qualifier. either way, something comes home π
CL_KERNEL_ARG_TYPE_NAME
return type: char[] π
returns the type name that was specified for the argument at arg_indx. the type name you get back will be the argument type name exactly as it was declared, with any whitespace removed. if the argument type name is an unsigned scalar type (i.e. unsigned char, unsigned short, unsigned int, unsigned long), then uchar, ushort, uint and ulong will be returned instead. and the argument type name returned does not include any type qualifiers. so it's giving β¨cleanβ¨
CL_KERNEL_ARG_TYPE_QUALIFIER
return type: cl_kernel_arg_type_qualifier π
returns the type qualifier specified for the argument given by arg_indx. the returned value can be:
CL_KERNEL_ARG_TYPE_CONSTCL_KERNEL_ARG_TYPE_RESTRICTCL_KERNEL_ARG_TYPE_VOLATILE- a combination of the above enums
- or
CL_KERNEL_ARG_TYPE_NONE
NOTE:CL_KERNEL_ARG_TYPE_VOLATILEgets returned if the argument is a pointer and that pointer is declared with thevolatilequalifier. both conditions, bestie. don't forget the second one π«Ά
CL_KERNEL_ARG_NAME
return type: char[] π
returns the name that was specified for the argument given by arg_indx. that's it, that's the whole thing, and honestly? iconic. π
π NOTES π
okay bestie, listen up because this is the tea β and it matters so much:
kernel argument information is only available if the program object associated with kernel is created with clCreateProgramWithSource(3clc) AND the program executable is built with the -cl-kernel-arg-info option specified in the options argument to clBuildProgram(3clc) or clCompileProgram(3clc).
so basically: no source, no flag, no arg info. it's giving "you didn't do the homework so you don't get the notes" π do both or this whole query is a β¨nothing burgerβ¨.
π ERRORS π
Returns CL_SUCCESS if the function is executed successfully, which is the slay outcome obviously π«Ά. Otherwise, it returns one of the following errors β and bestie, it will pick one:
CL_INVALID_ARG_INDEXβ if arg_indx is not a valid argument index. (that index? not real. not a vibe. π)CL_INVALID_VALUEβ if param_name is not valid, or if size in bytes specified by param_value_size is<size of return type as described in the table above and param_value is notNULL. (short buffer + not-NULL pointer = caught lacking π)CL_KERNEL_ARG_INFO_NOT_AVAILABLEβ if the argument information is not available forkernel. (the info is simply not there. it's not hiding, it's absent.)CL_INVALID_KERNELβ ifkernelis not a valid kernel object. (who is she? we don't know her π)
π SPECIFICATION π
OpenCL Specification<sup>[1]</sup>
πΈ SEE ALSO πΈ
clCreateKernel(3clc), clGetKernelInfo(3clc), clCreateKernelsInProgram(3clc), clRetainKernel(3clc), clReleaseKernel(3clc), clSetKernelArg(3clc), clGetKernelWorkGroupInfo(3clc)
the whole friend group fr fr π«Ά go read them, they're all iconic.
β¨ AUTHORS β¨
The Khronos Group
π¦ COPYRIGHT π¦
Copyright Β© 2007-2011 The Khronos Group Inc.
and here's the legal bit, verbatim, because you never paraphrase a license (that's the one thing that would actually get you in trouble):
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 π
(sΓ, there are two NOTES sections. the manpage is quirky like that, we don't question it π)
- OpenCL Specification β page 166, section 5.7.3 - Kernel Object Queries (updated for 1.2 rev 14)
and that's a wrap bestie!! πβοΈ this page was brought to you by The Khronos Group, dated 01/14/2021, filed under CLGETKERNELARGINFO(3clc) β go forth and query those kernel args, you absolute main character πππ
π¦ 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