C Specification

To set additional execution information for a kernel, call the function

// Provided by CL_VERSION_2_0
cl_int clSetKernelExecInfo(
    cl_kernel kernel,
    cl_kernel_exec_info param_name,
    size_t param_value_size,
    const void* param_value);
clSetKernelExecInfo is missing before version 2.0.

Parameters

  • kernel is a valid kernel object.

  • param_name specifies the type of information to set. The list of supported param_name types and the corresponding values passed in param_value is described in the Kernel Execution Properties table.

  • param_value_size specifies the size in bytes of the memory pointed to by param_value.

  • param_value is a pointer to memory where the appropriate values determined by param_name are specified.

Description

Table 1. List of supported param_names by clSetKernelExecInfo
Kernel Exec Info Type Description

CL_KERNEL_EXEC_INFO_SVM_PTRS

missing before version 2.0.

void*[]

Specifies a set of pointers to SVM allocations that may be accessed by the kernel in addition to those set directly as kernel arguments. Each of the pointers can be the pointer returned by clSVMAlloc or can be a pointer to the middle of an SVM allocation. It is sufficient to specify one pointer for each SVM allocation.

Behavior is undefined if the kernel accesses a coarse-grain or fine-grain buffer SVM allocation that is not set as a kernel argument and is not in the set specified by CL_KERNEL_EXEC_INFO_SVM_PTRS.

The complete set of pointers is specified by each call to clSetKernelExecInfo and replaces any previously specified set of pointers. To specify that no SVM allocations will be accessed by a kernel other than those set as kernel arguments, specify an empty set by passing param_value_size equal to zero and param_value equal to NULL.

Non-argument pointers to SVM allocations must be specified 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

missing before version 2.0.

cl_bool

Specifies whether the kernel may use pointers to system allocations that are not set directly as kernel arguments on devices that support fine-grain system SVM allocations.

When a device supports fine-grain system SVM allocations and CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM is CL_TRUE, the kernel may access system allocations that are not set directly as kernel arguments.

Otherwise, if a device does not support fine-grain system SVM allocations or when CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM is CL_FALSE, behavior is undefined if the kernel accesses a system allocation that is not set as a kernel argument.

If clSetKernelExecInfo has not been called with a value for CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM, the default value is CL_TRUE.

CL_KERNEL_EXEC_INFO_DEVICE_PTRS_EXT

provided by the cl_ext_buffer_device_address extension.

cl_mem_device_address_ext[]

Device pointers must reference locations contained entirely within buffers that are passed to kernel as arguments, or that are passed through the execution information. Non-argument device pointers accessed by the kernel must be specified by passing pointers to those buffers via this clSetKernelExecInfo option.

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

  • CL_INVALID_KERNEL if kernel is a not a valid kernel object.

  • CL_INVALID_OPERATION for CL_KERNEL_EXEC_INFO_SVM_PTRS and CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM if no devices in the context associated with kernel support SVM.

  • CL_INVALID_OPERATION for CL_KERNEL_EXEC_INFO_DEVICE_PTRS_EXT if no device in the context associated with kernel support the cl_ext_buffer_device_address extension.

  • 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 is CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM and param_value is CL_TRUE and no devices in the context associated with kernel support fine-grain system SVM allocations.

  • CL_INVALID_VALUE if param_name is not valid, if param_value is NULL and param_value_size is greater than zero, or if the size specified by param_value_size is not valid.

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

See Also

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.

Copyright 2014-2025 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0