C Specification

To get specific information about an OpenCL device, call the function:

cl_int clGetDeviceInfo(
    cl_device_id device,
    cl_device_info param_name,
    size_t param_value_size,
    void* param_value,
    size_t* param_value_size_ret);

Parameters

  • device may be a device returned by clGetDeviceIDs or a sub-device created by clCreateSubDevices. If device is a sub-device, the specific information for the sub-device will be returned. The information that can be queried using clGetDeviceInfo is specified in the Device Queries table.

  • param_name is an enumeration constant that identifies the device information being queried. It can be one of the following values as specified in the Device Queries table.

  • param_value is a pointer to memory location where appropriate values for a given param_name, as specified in the Device Queries table, will be 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 in bytes must be ≥ size of return type specified in the Device Queries table.

  • 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

The device queries described in the Device Queries table should return the same information for a root-level device i.e. a device returned by clGetDeviceIDs and any sub-devices created from this device except for the following queries:

  • CL_DEVICE_GLOBAL_MEM_CACHE_SIZE

  • CL_DEVICE_BUILT_IN_KERNELS

  • CL_DEVICE_PARENT_DEVICE

  • CL_DEVICE_PARTITION_TYPE

  • CL_DEVICE_REFERENCE_COUNT

Table 1. List of supported param_names by clGetDeviceInfo
Device Info Return Type Description

CL_DEVICE_TYPE

cl_device_type

The type or types of the OpenCL device.

Please see the Device Types table for supported device types and device type combinations.

CL_DEVICE_VENDOR_ID [1]

cl_uint

A unique device vendor identifier.

If the vendor has a PCI vendor ID, the low 16 bits must contain that PCI vendor ID, and the remaining bits must be set to zero. Otherwise, the value returned must be a valid Khronos vendor ID represented by type cl_khronos_vendor_id. Khronos vendor IDs are allocated starting at 0x10000, to distinguish them from the PCI vendor ID namespace.

CL_DEVICE_MAX_COMPUTE_UNITS

cl_uint

The number of parallel compute units on the OpenCL device. A work-group executes on a single compute unit. The minimum value is 1.

CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS

cl_uint

Maximum dimensions that specify the global and local work-item IDs used by the data parallel execution model. (Refer to clEnqueueNDRangeKernel). The minimum value is 3 for devices that are not of type CL_DEVICE_TYPE_CUSTOM.

CL_DEVICE_MAX_WORK_ITEM_SIZES

size_t[]

Maximum number of work-items that can be specified in each dimension of the work-group to clEnqueueNDRangeKernel.

Returns n size_t entries, where n is the value returned by the query for CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS.

The minimum value is (1, 1, 1) for devices that are not of type CL_DEVICE_TYPE_CUSTOM.

CL_DEVICE_MAX_WORK_GROUP_SIZE

size_t

Maximum number of work-items in a work-group that a device is capable of executing on a single compute unit, for any given kernel-instance running on the device. (Refer also to clEnqueueNDRangeKernel and CL_KERNEL_WORK_GROUP_SIZE ). The minimum value is 1. The returned value is an upper limit and will not necessarily maximize performance. This maximum may be larger than supported by a specific kernel (refer to the CL_KERNEL_WORK_GROUP_SIZE query of clGetKernelWorkGroupInfo).

CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR
CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT
CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT
CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG
CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT
CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE
CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF

CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF is missing before version 1.1.

cl_uint

Preferred native vector width size for built-in scalar types that can be put into vectors. The vector width is defined as the number of scalar elements that can be stored in the vector.

If double precision is not supported, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE must return 0.

If the cl_khr_fp16 extension is not supported, CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF must return 0.

CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR
CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT
CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT
CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE
CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF

missing before version 1.1.

cl_uint

Returns the native ISA vector width. The vector width is defined as the number of scalar elements that can be stored in the vector.

If double precision is not supported, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE must return 0.

If the cl_khr_fp16 extension is not supported, CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF must return 0.

CL_DEVICE_MAX_CLOCK_FREQUENCY

cl_uint

Clock frequency of the device in MHz. The meaning of this value is implementation-defined. For devices with multiple clock domains, the clock frequency for any of the clock domains may be returned. For devices that dynamically change frequency for power or thermal reasons, the returned clock frequency may be any valid frequency. Note: This definition is missing before version 2.2.

Maximum configured clock frequency of the device in MHz. Note: This definition is deprecated by version 2.2.

CL_DEVICE_ADDRESS_BITS

cl_uint

The default compute device address space size of the global address space specified as an unsigned integer value in bits. Currently supported values are 32 or 64 bits.

CL_DEVICE_MAX_MEM_ALLOC_SIZE

cl_ulong

Max size of memory object allocation in bytes. The minimum value is max(min(1024 × 1024 × 1024, 1/4th of CL_DEVICE_GLOBAL_MEM_SIZE), 32 × 1024 × 1024) for devices that are not of type CL_DEVICE_TYPE_CUSTOM.

CL_DEVICE_IMAGE_SUPPORT

cl_bool

Is CL_TRUE if images are supported by the OpenCL device and CL_FALSE otherwise.

CL_DEVICE_MAX_READ_IMAGE_ARGS [2]

cl_uint

Max number of image objects arguments of a kernel declared with the read_only qualifier. The minimum value is 128 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE, the value is 0 otherwise.

CL_DEVICE_MAX_WRITE_IMAGE_ARGS

cl_uint

Max number of image objects arguments of a kernel declared with the write_only qualifier. The minimum value is 64 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE, the value is 0 otherwise.

CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS

missing before version 2.0.

cl_uint

Max number of image objects arguments of a kernel declared with the write_only or read_write qualifier.

Support for read-write image arguments is required for an OpenCL 2.0, 2.1, or 2.2 device if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE.

The minimum value is 64 if the device supports read-write images arguments, and must be 0 for devices that do not support read-write images.

CL_DEVICE_IL_VERSION

missing before version 2.1. Also see extension cl_khr_il_program.

char[]

The intermediate languages that can be supported by clCreateProgramWithIL for this device. Returns a space-separated list of IL version strings of the form <IL_Prefix>_<Major_Version>.<Minor_Version>.

For an OpenCL 2.1 or 2.2 device, SPIR-V is a required IL prefix.

If the device does not support intermediate language programs, the value must be "" (an empty string).

CL_DEVICE_ILS_WITH_VERSION

missing before version 3.0. Also see extension cl_khr_il_program.

cl_name_version[]

Returns an array of descriptions (name and version) for all supported intermediate languages. Intermediate languages with the same name may be reported more than once but each name and major/minor version combination may only be reported once. The list of intermediate languages reported must match the list reported via CL_DEVICE_IL_VERSION.

For an OpenCL 2.1 or 2.2 device, at least one version of SPIR-V must be reported.

CL_DEVICE_IMAGE2D_MAX_WIDTH

size_t

Max width of 2D image or 1D image not created from a buffer object in pixels.

The minimum value is 16384 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE, the value is 0 otherwise.

CL_DEVICE_IMAGE2D_MAX_HEIGHT

size_t

Max height of 2D image in pixels.

The minimum value is 16384 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE, the value is 0 otherwise.

CL_DEVICE_IMAGE3D_MAX_WIDTH

size_t

Max width of 3D image in pixels.

The minimum value is 2048 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE, the value is 0 otherwise.

CL_DEVICE_IMAGE3D_MAX_HEIGHT

size_t

Max height of 3D image in pixels.

The minimum value is 2048 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE, the value is 0 otherwise.

CL_DEVICE_IMAGE3D_MAX_DEPTH

size_t

Max depth of 3D image in pixels.

The minimum value is 2048 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE, the value is 0 otherwise.

CL_DEVICE_IMAGE_MAX_BUFFER_SIZE

missing before version 1.2.

size_t

Max number of pixels for a 1D image created from a buffer object.

The minimum value is 65536 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE, the value is 0 otherwise.

CL_DEVICE_IMAGE_MAX_ARRAY_SIZE

missing before version 1.2.

size_t

Max number of images in a 1D or 2D image array.

The minimum value is 2048 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE, the value is 0 otherwise.

CL_DEVICE_MAX_SAMPLERS

cl_uint

Maximum number of samplers that can be used in a kernel.

The minimum value is 16 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE, the value is 0 otherwise.

CL_DEVICE_IMAGE_PITCH_ALIGNMENT

missing before version 2.0.

cl_uint

The row pitch alignment size in pixels for 2D images created from a buffer. The value returned must be a power of 2.

Support for 2D images created from a buffer is required for an OpenCL 2.0, 2.1, or 2.2 device if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE.

This value must be 0 for devices that do not support 2D images created from a buffer.

CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT

missing before version 2.0.

cl_uint

This query specifies the minimum alignment in pixels of the host_ptr specified to clCreateBuffer or clCreateBufferWithProperties when a 2D image is created from a buffer which was created using CL_MEM_USE_HOST_PTR. The value returned must be a power of 2.

Support for 2D images created from a buffer is required for an OpenCL 2.0, 2.1, or 2.2 device if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE.

This value must be 0 for devices that do not support 2D images created from a buffer.

CL_DEVICE_MAX_PIPE_ARGS

missing before version 2.0.

cl_uint

The maximum number of pipe objects that can be passed as arguments to a kernel. The minimum value is 16 for devices supporting pipes, and must be 0 for devices that do not support pipes.

CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS

missing before version 2.0.

cl_uint

The maximum number of reservations that can be active for a pipe per work-item in a kernel. A work-group reservation is counted as one reservation per work-item. The minimum value is 1 for devices supporting pipes, and must be 0 for devices that do not support pipes.

CL_DEVICE_PIPE_MAX_PACKET_SIZE

missing before version 2.0.

cl_uint

The maximum size of pipe packet in bytes.

Support for pipes is required for an OpenCL 2.0, 2.1, or 2.2 device. The minimum value is 1024 bytes if the device supports pipes, and must be 0 for devices that do not support pipes.

CL_DEVICE_MAX_PARAMETER_SIZE

size_t

Max size in bytes of all arguments that can be passed to a kernel.

The minimum value is 1024 for devices that are not of type CL_DEVICE_TYPE_CUSTOM. For this minimum value, only a maximum of 128 arguments can be passed to a kernel. For all other values, a maximum of 255 arguments can be passed to a kernel.

CL_DEVICE_MEM_BASE_ADDR_ALIGN

cl_uint

Alignment requirement (in bits) for sub-buffer offsets. The minimum value is the size (in bits) of the largest OpenCL built-in data type supported by the device (long16 in FULL profile, long16 or int16 in EMBEDDED profile) for devices that are not of type CL_DEVICE_TYPE_CUSTOM.

CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE

deprecated by version 1.2.

cl_uint

The minimum value is the size (in bytes) of the largest OpenCL data type supported by the device (long16 in FULL profile, long16 or int16 in EMBEDDED profile).

CL_DEVICE_SINGLE_FP_CONFIG [3]

cl_device_fp_config

Describes single precision floating-point capability of the device. This is a bit-field that describes one or more of the following values:

CL_FP_DENORM - denorms are supported
CL_FP_INF_NAN - INF and quiet NaNs are supported
CL_FP_ROUND_TO_NEAREST-- round to nearest even rounding mode supported
CL_FP_ROUND_TO_ZERO - round to zero rounding mode supported
CL_FP_ROUND_TO_INF - round to positive and negative infinity rounding modes supported
CL_FP_FMA - IEEE754-2008 fused multiply-add is supported
CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT - divide and sqrt are correctly rounded as defined by the IEEE754 specification
CL_FP_SOFT_FLOAT - Basic floating-point operations (such as addition, subtraction, multiplication) are implemented in software

For the full profile, the mandated minimum floating-point capability for devices that are not of type CL_DEVICE_TYPE_CUSTOM is:

CL_FP_ROUND_TO_NEAREST |
CL_FP_INF_NAN.

For the embedded profile, see the dedicated table.

CL_DEVICE_DOUBLE_FP_CONFIG [3]

missing before version 1.2. Also see extension cl_khr_fp64.

cl_device_fp_config

Describes double precision floating-point capability of the OpenCL device. This is a bit-field that describes one or more of the following values:

CL_FP_DENORM - denorms are supported
CL_FP_INF_NAN - INF and NaNs are supported
CL_FP_ROUND_TO_NEAREST - round to nearest even rounding mode supported
CL_FP_ROUND_TO_ZERO - round to zero rounding mode supported
CL_FP_ROUND_TO_INF - round to positive and negative infinity rounding modes supported
CL_FP_FMA - IEEE754-2008 fused multiply-add is supported
CL_FP_SOFT_FLOAT - Basic floating-point operations (such as addition, subtraction, multiplication) are implemented in software

Double precision is an optional feature so the mandated minimum double precision floating-point capability is 0.

If double precision is supported by the device, then the minimum double precision floating-point capability for OpenCL 2.0 or newer devices is:

CL_FP_FMA |
CL_FP_ROUND_TO_NEAREST |
CL_FP_INF_NAN |
CL_FP_DENORM.

or for OpenCL 1.0, OpenCL 1.1 or OpenCL 1.2 devices:

CL_FP_FMA |
CL_FP_ROUND_TO_NEAREST |
CL_FP_ROUND_TO_ZERO |
CL_FP_ROUND_TO_INF |
CL_FP_INF_NAN |
CL_FP_DENORM.

CL_DEVICE_GLOBAL_MEM_CACHE_TYPE

cl_device_mem_cache_type

Type of global memory cache supported. Valid values are: CL_NONE, CL_READ_ONLY_CACHE, and CL_READ_WRITE_CACHE.

CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE

cl_uint

Size of global memory cache line in bytes.

CL_DEVICE_GLOBAL_MEM_CACHE_SIZE

cl_ulong

Size of global memory cache in bytes.

CL_DEVICE_GLOBAL_MEM_SIZE

cl_ulong

Size of global device memory in bytes.

CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE

cl_ulong

Max size in bytes of a constant buffer allocation. The minimum value is 64 KB for devices that are not of type CL_DEVICE_TYPE_CUSTOM.

CL_DEVICE_MAX_CONSTANT_ARGS

cl_uint

Max number of arguments declared with the __constant qualifier in a kernel. The minimum value is 8 for devices that are not of type CL_DEVICE_TYPE_CUSTOM.

CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE

missing before version 2.0.

size_t

The maximum number of bytes of storage that may be allocated for any single variable in program scope or inside a function in an OpenCL kernel language declared in the global address space.

Support for program scope global variables is required for an OpenCL 2.0, 2.1, or 2.2 device. The minimum value is 64 KB if the device supports program scope global variables, and must be 0 for devices that do not support program scope global variables.

CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE

missing before version 2.0.

size_t

Maximum preferred total size, in bytes, of all program variables in the global address space. This is a performance hint. An implementation may place such variables in storage with optimized device access. This query returns the capacity of such storage. The minimum value is 0.

CL_DEVICE_LOCAL_MEM_TYPE

cl_device_local_mem_type

Type of local memory supported. This can be set to CL_LOCAL implying dedicated local memory storage such as SRAM , or CL_GLOBAL.

For custom devices, CL_NONE can also be returned indicating no local memory support.

CL_DEVICE_LOCAL_MEM_SIZE

cl_ulong

Size of local memory region in bytes. The minimum value is 32 KB for devices that are not of type CL_DEVICE_TYPE_CUSTOM.

CL_DEVICE_ERROR_CORRECTION_SUPPORT

cl_bool

Is CL_TRUE if the device implements error correction for all accesses to compute device memory (global and constant). Is CL_FALSE if the device does not implement such error correction.

CL_DEVICE_HOST_UNIFIED_MEMORY

missing before version 1.1 and deprecated by version 2.0.

cl_bool

Is CL_TRUE if the device and the host have a unified memory subsystem and is CL_FALSE otherwise.

CL_DEVICE_PROFILING_TIMER_RESOLUTION

size_t

Describes the resolution of device timer. This is measured in nanoseconds. Refer to Profiling Operations for details.

CL_DEVICE_ENDIAN_LITTLE

cl_bool

Is CL_TRUE if the OpenCL device is a little endian device and CL_FALSE otherwise

CL_DEVICE_AVAILABLE

cl_bool

Is CL_TRUE if the device is available and CL_FALSE otherwise. A device is considered to be available if the device can be expected to successfully execute commands enqueued to the device.

CL_DEVICE_COMPILER_AVAILABLE

cl_bool

Is CL_FALSE if the implementation does not have a compiler available to compile the program source.

Is CL_TRUE if the compiler is available. This can be CL_FALSE for the embedded platform profile only.

CL_DEVICE_LINKER_AVAILABLE

missing before version 1.2.

cl_bool

Is CL_FALSE if the implementation does not have a linker available. Is CL_TRUE if the linker is available.

This can be CL_FALSE for the embedded platform profile only.

This must be CL_TRUE if CL_DEVICE_COMPILER_AVAILABLE is CL_TRUE.

CL_DEVICE_EXECUTION_CAPABILITIES

cl_device_exec_capabilities

Describes the execution capabilities of the device. This is a bit-field that describes one or more of the following values:

CL_EXEC_KERNEL - The OpenCL device can execute OpenCL kernels.
CL_EXEC_NATIVE_KERNEL - The OpenCL device can execute native kernels.

The mandated minimum capability is: CL_EXEC_KERNEL.

CL_DEVICE_QUEUE_PROPERTIES

deprecated by version 2.0.

cl_command_queue_properties

See description of CL_DEVICE_QUEUE_ON_HOST_PROPERTIES.

CL_DEVICE_QUEUE_ON_HOST_PROPERTIES

missing before version 2.0.

cl_command_queue_properties

Describes the on host command-queue properties supported by the device. This is a bit-field that describes one or more of the following values:

CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE
CL_QUEUE_PROFILING_ENABLE

These properties are described in the Queue Properties table.

The mandated minimum capability is: CL_QUEUE_PROFILING_ENABLE.

CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES

missing before version 2.0.

cl_command_queue_properties

Describes the on device command-queue properties supported by the device. This is a bit-field that describes one or more of the following values:

CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE
CL_QUEUE_PROFILING_ENABLE

These properties are described in the Queue Properties table.

Support for on-device queues is required for an OpenCL 2.0, 2.1, or 2.2 device. When on-device queues are supported, the mandated minimum capability is:

CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE |
CL_QUEUE_PROFILING_ENABLE.

Must be 0 for devices that do not support on-device queues.

CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE

missing before version 2.0.

cl_uint

The preferred size of the device queue, in bytes. Applications should use this size for the device queue to ensure good performance.

The minimum value is 16 KB for devices supporting on-device queues, and must be 0 for devices that do not support on-device queues.

CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE

missing before version 2.0.

cl_uint

The maximum size of the device queue in bytes.

The minimum value is 256 KB for the full profile and 64 KB for the embedded profile for devices supporting on-device queues, and must be 0 for devices that do not support on-device queues.

CL_DEVICE_MAX_ON_DEVICE_QUEUES

missing before version 2.0.

cl_uint

The maximum number of device queues that can be created for this device in a single context.

The minimum value is 1 for devices supporting on-device queues, and must be 0 for devices that do not support on-device queues.

CL_DEVICE_MAX_ON_DEVICE_EVENTS

missing before version 2.0.

cl_uint

The maximum number of events in use by a device queue. These refer to events returned by the enqueue_ built-in functions to a device queue or user events returned by the create_user_event built-in function that have not been released.

The minimum value is 1024 for devices supporting on-device queues, and must be 0 for devices that do not support on-device queues.

CL_DEVICE_BUILT_IN_KERNELS

missing before version 1.2.

char[]

A semi-colon separated list of built-in kernels supported by the device. An empty string is returned if no built-in kernels are supported by the device.

CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION

missing before version 3.0.

cl_name_version[]

Returns an array of descriptions for the built-in kernels supported by the device. Each built-in kernel may only be reported once. The list of reported kernels must match the list returned via CL_DEVICE_BUILT_IN_KERNELS.

CL_DEVICE_PLATFORM

cl_platform_id

The platform associated with this device.

CL_DEVICE_NAME

char[]

Device name string.

CL_DEVICE_VENDOR

char[]

Vendor name string.

CL_DRIVER_VERSION

char[]

OpenCL software driver version string. Follows a vendor-specific format.

CL_DEVICE_PROFILE

char[]

OpenCL profile string. Returns the profile name supported by the device. The profile name returned can be one of the following strings:

FULL_PROFILE - if the device supports the OpenCL specification (functionality defined as part of the core specification and does not require any extensions to be supported).

EMBEDDED_PROFILE - if the device supports the OpenCL embedded profile.

CL_DEVICE_VERSION

char[]

OpenCL version string. Returns the OpenCL version supported by the device. This version string has the following format:

OpenCL<space><major_version.minor_version><space><vendor-specific information>

The major_version.minor_version value returned will be one of 1.0, 1.1, 1.2, 2.0, 2.1, 2.2, or 3.0.

CL_DEVICE_NUMERIC_VERSION

missing before version 3.0.

cl_version

Returns the detailed (major, minor, patch) version supported by the device. The major and minor version numbers returned must match those returned via CL_DEVICE_VERSION.

CL_DEVICE_OPENCL_C_VERSION

missing before version 1.1 and deprecated by version 3.0.

char[]

Returns the highest fully backwards compatible OpenCL C version supported by the compiler for the device. For devices supporting compilation from OpenCL C source, this will return a version string with the following format:

OpenCL<space>C<space><major_version.minor_version><space><vendor-specific information>

For devices that support compilation from OpenCL C source:

Because OpenCL 3.0 is backwards compatible with OpenCL C 1.2, an OpenCL 3.0 device must support at least OpenCL C 1.2. An OpenCL 3.0 device may return an OpenCL C version newer than OpenCL C 1.2 if and only if all optional OpenCL C features are supported by the device for the newer version.

Support for OpenCL C 2.0 is required for an OpenCL 2.0, OpenCL 2.1, or OpenCL 2.2 device.

Support for OpenCL C 1.2 is required for an OpenCL 1.2 device.

Support for OpenCL C 1.1 is required for an OpenCL 1.1 device.

Support for either OpenCL C 1.0 or OpenCL C 1.1 is required for an OpenCL 1.0 device.

For devices that do not support compilation from OpenCL C source, such as when CL_DEVICE_COMPILER_AVAILABLE is CL_FALSE, this query may return an empty string.

This query has been superseded by the CL_DEVICE_OPENCL_C_ALL_VERSIONS query, which returns a set of OpenCL C versions supported by a device.

CL_DEVICE_OPENCL_C_ALL_VERSIONS

missing before version 3.0.

cl_name_version[]

Returns an array of name, version descriptions listing all the versions of OpenCL C supported by the compiler for the device. In each returned description structure, the name field is required to be "OpenCL C". The list may include both newer non-backwards compatible OpenCL C versions, such as OpenCL C 3.0, and older OpenCL C versions with mandatory backwards compatibility. The version returned by CL_DEVICE_OPENCL_C_VERSION is required to be present in the list.

For devices that support compilation from OpenCL C source:

Because OpenCL 3.0 is backwards compatible with OpenCL C 1.2, and OpenCL C 1.2 is backwards compatible with OpenCL C 1.1 and OpenCL C 1.0, support for at least OpenCL C 3.0, OpenCL C 1.2, OpenCL C 1.1, and OpenCL C 1.0 is required for an OpenCL 3.0 device.

Support for OpenCL C 2.0, OpenCL C 1.2, OpenCL C 1.1, and OpenCL C 1.0 is required for an OpenCL 2.0, OpenCL 2.1, or OpenCL 2.2 device.

Support for OpenCL C 1.2, OpenCL C 1.1, and OpenCL C 1.0 is required for an OpenCL 1.2 device.

Support for OpenCL C 1.1 and OpenCL C 1.0 is required for an OpenCL 1.1 device.

Support for at least OpenCL C 1.0 is required for an OpenCL 1.0 device.

For devices that do not support compilation from OpenCL C source, this query may return an empty array.

CL_DEVICE_OPENCL_C_FEATURES

missing before version 3.0.

cl_name_version[]

Returns an array of optional OpenCL C features supported by the compiler for the device alongside the OpenCL C version that introduced the feature macro. For example, if a compiler supports an OpenCL C 3.0 feature, the returned name will be the full name of the OpenCL C feature macro, and the returned version will be 3.0.0.

For devices that do not support compilation from OpenCL C source, this query may return an empty array.

CL_DEVICE_EXTENSIONS

char[]

Returns a space separated list of extension names (the extension names themselves do not contain any spaces) supported by the device. The list of extension names may include Khronos approved extension names and vendor specified extension names.

The following Khronos extension names must be returned by all devices that support OpenCL 1.1:

cl_khr_byte_addressable_store
cl_khr_global_int32_base_atomics
cl_khr_global_int32_extended_atomics
cl_khr_local_int32_base_atomics
cl_khr_local_int32_extended_atomics

Additionally, the following Khronos extension names must be returned by all devices that support OpenCL 1.2 when and only when the optional feature is supported:

cl_khr_fp64

Additionally, the following Khronos extension names must be returned by all devices that support OpenCL 2.0, OpenCL 2.1, or OpenCL 2.2. For devices that support OpenCL 3.0, these extension names must be returned when and only when the optional feature is supported:

cl_khr_3d_image_writes
cl_khr_depth_images
cl_khr_image2d_from_buffer

Please refer to the OpenCL Extension Specification or vendor provided documentation for a detailed description of these extensions.

CL_DEVICE_EXTENSIONS_WITH_VERSION

missing before version 3.0.

cl_name_version[]

Returns an array of description (name and version) structures. The same extension name must not be reported more than once. The list of extensions reported must match the list reported via CL_DEVICE_EXTENSIONS.

See CL_DEVICE_EXTENSIONS for a list of extensions that are required to be reported for a given OpenCL version.

CL_DEVICE_PRINTF_BUFFER_SIZE

missing before version 1.2.

size_t

Maximum size in bytes of the internal buffer that holds the output of printf calls from a kernel. The minimum value for the FULL profile is 1 MB.

CL_DEVICE_PREFERRED_INTEROP_USER_SYNC

missing before version 1.2.

cl_bool

Is CL_TRUE if the devices preference is for the user to be responsible for synchronization, when sharing memory objects between OpenCL and other APIs such as DirectX, CL_FALSE if the device / implementation has a performant path for performing synchronization of memory object shared between OpenCL and other APIs such as DirectX.

CL_DEVICE_PARENT_DEVICE

missing before version 1.2.

cl_device_id

Returns the cl_device_id of the parent device to which this sub-device belongs. If device is a root-level device, a NULL value is returned.

CL_DEVICE_PARTITION_MAX_SUB_DEVICES

missing before version 1.2.

cl_uint

Returns the maximum number of sub-devices that can be created when a device is partitioned.

The value returned cannot exceed CL_DEVICE_MAX_COMPUTE_UNITS.

CL_DEVICE_PARTITION_PROPERTIES

missing before version 1.2.

cl_device_partition_property[]

Returns the list of partition types supported by device. This is an array of cl_device_partition_property values drawn from the following list:

CL_DEVICE_PARTITION_EQUALLY
CL_DEVICE_PARTITION_BY_COUNTS
CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN

If the device cannot be partitioned (i.e. there is no partitioning scheme supported by the device that will return at least two sub-devices), a value of 0 will be returned.

CL_DEVICE_PARTITION_AFFINITY_DOMAIN

missing before version 1.2.

cl_device_affinity_domain

Returns the list of supported affinity domains for partitioning the device using CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN. This is a bit-field that describes one or more of the following values:

CL_DEVICE_AFFINITY_DOMAIN_NUMA
CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE
CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE
CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE
CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE
CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE

If the device does not support any affinity domains, a value of 0 will be returned.

CL_DEVICE_PARTITION_TYPE

missing before version 1.2.

cl_device_partition_property[]

Returns the properties argument specified in clCreateSubDevices if device is a sub-device. In the case where the properties argument to clCreateSubDevices is CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE, the affinity domain used to perform the partition will be returned. This can be one of the following values:

CL_DEVICE_AFFINITY_DOMAIN_NUMA
CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE
CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE
CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE
CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE

Otherwise the implementation may either return a param_value_size_ret of 0 i.e. there is no partition type associated with device or can return a property value of 0 (where 0 is used to terminate the partition property list) in the memory that param_value points to.

CL_DEVICE_REFERENCE_COUNT [4]

missing before version 1.2.

cl_uint

Returns the device reference count. If the device is a root-level device, a reference count of one is returned.

CL_DEVICE_SVM_CAPABILITIES

missing before version 2.0.

cl_device_svm_capabilities

Describes the various shared virtual memory (SVM) memory allocation types the device supports. This is a bit-field that describes a combination of the following values:

CL_DEVICE_SVM_COARSE_GRAIN_BUFFER - Support for coarse-grain buffer sharing using clSVMAlloc. Memory consistency is guaranteed at synchronization points and the host must use calls to clEnqueueMapBuffer and clEnqueueUnmapMemObject.
CL_DEVICE_SVM_FINE_GRAIN_BUFFER - Support for fine-grain buffer sharing using clSVMAlloc. Memory consistency is guaranteed at synchronization points without need for clEnqueueMapBuffer and clEnqueueUnmapMemObject.
CL_DEVICE_SVM_FINE_GRAIN_SYSTEM - Support for sharing the host’s entire virtual memory including memory allocated using malloc. Memory consistency is guaranteed at synchronization points.
CL_DEVICE_SVM_ATOMICS - Support for the OpenCL 2.0 atomic operations that provide memory consistency across the host and all OpenCL devices supporting fine-grain SVM allocations.

The mandated minimum capability for an OpenCL 2.0, 2.1, or 2.2 device is CL_DEVICE_SVM_COARSE_GRAIN_BUFFER.

For other device versions there is no mandated minimum capability.

CL_DEVICE_PREFERRED_PLATFORM_ATOMIC_ALIGNMENT

missing before version 2.0.

cl_uint

Returns the value representing the preferred alignment in bytes for OpenCL 2.0 fine-grained SVM atomic types. This query can return 0 which indicates that the preferred alignment is aligned to the natural size of the type.

CL_DEVICE_PREFERRED_GLOBAL_ATOMIC_ALIGNMENT

missing before version 2.0.

cl_uint

Returns the value representing the preferred alignment in bytes for OpenCL 2.0 atomic types to global memory. This query can return 0 which indicates that the preferred alignment is aligned to the natural size of the type.

CL_DEVICE_PREFERRED_LOCAL_ATOMIC_ALIGNMENT

missing before version 2.0.

cl_uint

Returns the value representing the preferred alignment in bytes for OpenCL 2.0 atomic types to local memory. This query can return 0 which indicates that the preferred alignment is aligned to the natural size of the type.

CL_DEVICE_MAX_NUM_SUB_GROUPS

missing before version 2.1.

cl_uint

Maximum number of sub-groups in a work-group that a device is capable of executing on a single compute unit, for any given kernel-instance running on the device.

The minimum value is 1 if the device supports sub-groups, and must be 0 for devices that do not support sub-groups. Support for sub-groups is required for an OpenCL 2.1 or 2.2 device.

(Refer also to clGetKernelSubGroupInfo.)

CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS

missing before version 2.1.

cl_bool

Is CL_TRUE if this device supports independent forward progress of sub-groups, CL_FALSE otherwise.

This query must return CL_TRUE for devices that support the cl_khr_subgroups extension, and must return CL_FALSE for devices that do not support sub-groups.

CL_DEVICE_ATOMIC_MEMORY_CAPABILITIES

missing before version 3.0.

cl_device_atomic_capabilities

Describes the various memory orders and scopes that the device supports for atomic memory operations. This is a bit-field that describes a combination of the following values:

CL_DEVICE_ATOMIC_ORDER_RELAXED - Support for the relaxed memory order.
CL_DEVICE_ATOMIC_ORDER_ACQ_REL - Support for the acquire, release, and acquire-release memory orders.
CL_DEVICE_ATOMIC_ORDER_SEQ_CST - Support for the sequentially consistent memory order.

Because atomic memory orders are hierarchical, a device that supports a strong memory order must also support all weaker memory orders.

CL_DEVICE_ATOMIC_SCOPE_WORK_ITEM [5] - Support for memory ordering constraints that apply to a single work-item.
CL_DEVICE_ATOMIC_SCOPE_WORK_GROUP - Support for memory ordering constraints that apply to all work-items in a work-group.
CL_DEVICE_ATOMIC_SCOPE_DEVICE - Support for memory ordering constraints that apply to all work-items executing on the device.
CL_DEVICE_ATOMIC_SCOPE_ALL_DEVICES - Support for memory ordering constraints that apply to all work-items executing across all devices that can share SVM memory with each other and the host process.

Because atomic scopes are hierarchical, a device that supports a wide scope must also support all narrower scopes, except for the work-item scope, which is a special case.

The mandated minimum capability is:

CL_DEVICE_ATOMIC_ORDER_RELAXED |
CL_DEVICE_ATOMIC_SCOPE_WORK_GROUP

CL_DEVICE_ATOMIC_FENCE_CAPABILITIES

missing before version 3.0.

cl_device_atomic_capabilities

Describes the various memory orders and scopes that the device supports for atomic fence operations. This is a bit-field that has the same set of possible values as described for CL_DEVICE_ATOMIC_MEMORY_CAPABILITIES.

The mandated minimum capability is:

CL_DEVICE_ATOMIC_ORDER_RELAXED |
CL_DEVICE_ATOMIC_ORDER_ACQ_REL |
CL_DEVICE_ATOMIC_SCOPE_WORK_GROUP

CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT

missing before version 3.0.

cl_bool

Is CL_TRUE if the device supports non-uniform work-groups, and CL_FALSE otherwise.

CL_DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT

missing before version 3.0.

cl_bool

Is CL_TRUE if the device supports work-group collective functions e.g. work_group_broadcast, work_group_reduce, and work_group_scan, and CL_FALSE otherwise.

CL_DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT

missing before version 3.0.

cl_bool

Is CL_TRUE if the device supports the generic address space and its associated built-in functions, and CL_FALSE otherwise.

CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES

missing before version 3.0.

cl_device_device_enqueue_capabilities

Describes device-side enqueue capabilities of the device. This is a bit-field that describes one or more of the following values:

CL_DEVICE_QUEUE_SUPPORTED - Device supports device-side enqueue and on-device queues.
CL_DEVICE_QUEUE_REPLACEABLE_DEFAULT - Device supports a replaceable default on-device queue.

If CL_DEVICE_QUEUE_REPLACEABLE_DEFAULT is set, CL_DEVICE_QUEUE_SUPPORTED must also be set.

Devices that set CL_DEVICE_QUEUE_SUPPORTED for CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES must also return CL_TRUE for CL_DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT.

CL_DEVICE_PIPE_SUPPORT

missing before version 3.0.

cl_bool

Is CL_TRUE if the device supports pipes, and CL_FALSE otherwise.

Devices that return CL_TRUE for CL_DEVICE_PIPE_SUPPORT must also return CL_TRUE for CL_DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT.

CL_DEVICE_PREFERRED_WORK_GROUP_SIZE_MULTIPLE

missing before version 3.0.

size_t

Returns the preferred multiple of work-group size for the given device. This is a performance hint intended as a guide when specifying the local work size argument to clEnqueueNDRangeKernel.

(Refer also to clGetKernelWorkGroupInfo where CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE can return a different value to CL_DEVICE_PREFERRED_WORK_GROUP_SIZE_MULTIPLE which may be more optimal.)

CL_DEVICE_LATEST_CONFORMANCE_VERSION_PASSED

missing before version 3.0.

char[]

Returns the latest version of the conformance test suite that this device has fully passed in accordance with the official conformance process.

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

  • CL_INVALID_DEVICE if device is not a valid device.

  • CL_INVALID_VALUE if param_name is not one of the supported values or if size in bytes specified by param_value_size is < size of return type as specified in the Device Queries table and param_value is not a NULL value or if param_name is a value that is available as an extension and the corresponding extension is not supported by the device.

  • 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-2023 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0


1. OpenCL adopters must report a valid vendor ID for their implementation. If there is no valid PCI vendor ID defined for the physical device, implementations must obtain a Khronos vendor ID. This is a unique identifier greater than the largest PCI vendor ID (0x10000) and is representable by a cl_uint. Khronos vendor IDs are synchronized across APIs by utilizing Vulkan’s vk.xml as the central Khronos vendor ID registry. An ID must be reserved here prior to use in OpenCL, regardless of whether a vendor implements Vulkan. Only once the ID has been allotted may it be exposed to OpenCL by proposing a merge request against cl.xml, in the main branch of the OpenCL-Docs project. The merge must define a new enumerant by adding an <enum> tag to the cl_khronos_vendor_id <enums> tag, with the <value> attribute set as the acquired Khronos vendor ID. The <name> attribute must identify the vendor/adopter, and be of the form CL_KHRONOS_VENDOR_ID_<vendor>.
2. A kernel that uses an image argument with the write_only or read_write image qualifier may result in additional read_only images resources being created internally by an implementation. The internally created read_only image resources will count against the max supported read image arguments given by CL_DEVICE_MAX_READ_IMAGE_ARGS. Enqueuing a kernel that requires more images than the implementation can support will result in a CL_OUT_OF_RESOURCES error being returned.
3. The optional rounding modes should be included as a device capability only if it is supported natively. All explicit conversion functions with specific rounding modes must still operate correctly.
4. The reference count returned should be considered immediately stale. It is unsuitable for general use in applications. This feature is provided for identifying memory leaks.
5. Note that this flag does not provide meaning for atomic memory operations, but only for atomic fence operations in certain circumstances, refer to the Memory Scope section of the OpenCL C specification.