clSetKernelExecInfo

Used to pass additional information other than argument values to a kernel.

cl_int clSetKernelExecInfo ( cl_kernel  kernel ,
  cl_kernel_exec_info  param_name ,
  size_t  param_value_size ,
  const void  *param_value )

Parameters

kernel

Specifies the kernel object being queried.

param_name

Specifies the information to be passed to kernel. The list of supported param_name types and the corresponding values passed in param_value is described in the table below.

param_value_size

Specifies the size in bytes of the memory pointed to by param_value.

param_value

A pointer to memory where the appropriate values determined by param_name are specified.

cl_kernel_exec_info Type Description
CL_KERNEL_EXEC_INFO_SVM_PTRS void *[]

SVM pointers used by a kernel which are not passed as arguments to kernel. These addresses may be defined in SVM buffer(s) that are passed as arguments to kernel.

These non-argument SVM pointers must be specified using clSetKernelExecInfo for coarse-grain and fine-grain buffer SVM allocations but not for fine-grain system SVM allocations.

CL_KERNEL_EXEC_INFO_SVM_- FINE_GRAIN_SYSTEM cl_bool

This flag indicates whether the kernel uses pointers that are fine grain system SVM allocations. These fine grain system SVM pointers may be passed as arguments or defined in SVM buffers that are passed as argumentsto kernel.

Notes

1. Coarse-grain or fine-grain buffer SVM pointers used by a kernel which are not passed as a kernel arguments must be specified using clSetKernelExecInfo with CL_KERNEL_EXEC_INFO_SVM_PTRS. For example, if SVM buffer A contains a pointer to another SVM buffer B, and the kernel dereferences that pointer, then a pointer to B must either be passed as an argument in the call to that kernel or it must be made available to the kernel using clSetKernelExecInfo. For example, we might pass extra SVM pointers as follows:


clSetKernelExecInfo(kernel,
     CL_KERNEL_EXEC_INFO_SVM_PTRS,
     num_ptrs * sizeof(void *),
     extra_svm_ptr_list);

Here num_ptrs specifies the number of additional SVM pointers while extra_svm_ptr_list specifies a pointer to memory containing those SVM pointers.

When calling clSetKernelExecInfo with CL_KERNEL_EXEC_INFO_SVM_PTRS to specify pointers to non-argument SVM buffers as extra arguments to a kernel, each of these pointers can be the SVM pointer returned by clSVMAlloc or can be a pointer + offset into the SVM region. It is sufficient to provide one pointer for each SVM buffer used.

2. CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM is used to indicate whether SVM pointers used by a kernel will refer to system allocations or not.

CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM = CL_FALSE indicates that the OpenCL implementation may assume that system pointers are not passed as kernel arguments and are not stored inside SVM allocations passed as kernel arguments.

CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM = CL_TRUE indicates that the OpenCL implementation must assume that system pointers might be passed as kernel arguments and/or stored inside SVM allocations passed as kernel arguments. In this case, if the device to which the kernel is enqueued does not support system SVM pointers, clEnqueueNDRangeKernel will return a CL_INVALID_OPERATION error. If none of the devices in the context associated with kernel support fine-grain system SVM allocations, clSetKernelExecInfo will return a CL_INVALID_OPERATION error.

If clSetKernelExecInfo has not been called with a value for CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM the default value is used for this kernel attribute. The defaule value depends on whether the device on which the kernel is enqueued supports fine-grain system SVM allocations. If so, the default value used is CL_TRUE (system pointers might be passed); otherwise, the default is CL_FALSE.

Errors

Returns CL_SUCCESS if the function is executed successfully. Otherwise, it returns one of the following errors:

  • CL_INVALID_KERNEL if kernel is not a valid kernel object.
  • CL_INVALID_VALUE if param_name is not valid, if param_value is NULL or if the size specified by param_value_size is not valid.
  • CL_INVALID_OPERATION if param_name = CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM and param_value = CL_TRUE but no devices in context associated with kernel support fine-grain system SVM allocations.
  • 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

Also see

clCreateKernel, clGetKernelInfo, clGetKernelArgInfo, clCreateKernelsInProgram, clSetKernelArg, clGetKernelWorkGroupInfo, clEnqueueNDRangeKernel

Copyright © 2007-2013 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.