C Specification
To return information about the arguments of a kernel, call the function
// Provided by CL_VERSION_1_2
cl_int clGetKernelArgInfo(
cl_kernel kernel,
cl_uint arg_index,
cl_kernel_arg_info param_name,
size_t param_value_size,
void* param_value,
size_t* param_value_size_ret);
| clGetKernelArgInfo is missing before version 1.2. |
Parameters
-
kernel specifies the kernel object being queried.
-
arg_index is the argument index. Arguments to the kernel are referred by indices that go from 0 for the leftmost argument to n - 1, where n is the total number of arguments declared by a kernel.
-
param_name specifies the argument information to query. The list of supported param_name types and the information returned in param_value by clGetKernelArgInfo is described in the Kernel Argument Queries table.
-
param_value is a pointer to memory where the appropriate result being queried is returned. If param_value is
NULL, it is ignored. -
param_value_size specifies the size in bytes of memory pointed to by param_value. This size must be greater than or equal to the size of the return type specified in the Kernel Argument Queries table. If param_value is
NULL, it is ignored. -
param_value_size ret returns the actual size in bytes of data being queried by param_name. If param_value_size_ret is
NULL, it is ignored.
Description
Kernel argument information is only available if the program object associated with kernel:
-
is created with clCreateProgramWithBinary and the program executable is built with the
-cl-kernel-arg-infoand-x spiroptions specified in the options argument to clBuildProgram or clCompileProgram, if thecl_khr_extension is supported; or,spir -
is created with clCreateProgramWithSource and the program executable is built with the
-cl-kernel-arg-info optionspecified in the options argument to clBuildProgram or clCompileProgram,
| Kernel Arg Info | Return Type | Description |
|---|---|---|
missing before version 1.2. |
|
Returns the address qualifier specified for the argument given by arg_index. This can be one of the following values: If no address qualifier is specified, the default address qualifier
which is |
missing before version 1.2. |
|
Returns the access qualifier specified for the argument given by arg_index. This can be one of the following values: If argument is not an image type and is not declared with the pipe
qualifier, |
missing before version 1.2. |
|
Returns the type name specified for the argument given by arg_index. The type name returned will be the argument type name as it was declared with any whitespace removed. If argument type name is an unsigned scalar type (i.e. unsigned char, unsigned short, unsigned int, unsigned long), uchar, ushort, uint and ulong will be returned. The argument type name returned does not include any type qualifiers. |
missing before version 1.2. |
|
Returns a bitfield describing one or more type qualifiers specified for the argument given by arg_index. The returned values can be: |
missing before version 1.2. |
|
Returns the name specified for the argument given by arg_index. |
clGetKernelArgInfo returns CL_SUCCESS if the function is executed
successfully.
Otherwise, it returns one of the following errors:
-
CL_INVALID_if kernel is a not a valid kernel object.KERNEL -
CL_INVALID_if arg_index is not a valid argument index.ARG_ INDEX -
CL_INVALID_if param_name is not one of the supported values, or if the size in bytes specified by param_value_size is less than size of the return type specified in the Kernel Argument Queries table and param_value is notVALUE NULL. -
CL_KERNEL_if the argument information is not available for kernel.ARG_ INFO_ NOT_ AVAILABLE -
CL_OUT_if there is a failure to allocate resources required by the OpenCL implementation on the device.OF_ RESOURCES -
CL_OUT_if there is a failure to allocate resources required by the OpenCL implementation on the host.OF_ HOST_ MEMORY
Document Notes
For more information, see the OpenCL Specification
This page is extracted from the OpenCL Specification. Fixes and changes should be made to the Specification, not directly.