Get information about an OpenCL device.
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)
device
-
A device returned by
clGetDeviceIDs
.May be a device returned by
clGetDeviceIDs
or a sub-device created byclCreateSubDevices
. Ifdevice
is a sub-device, the specific information for the sub-device will be returned. The information that can be queried usingclGetDeviceInfo
is specified in the table below (Table 4.3). param_value
-
A pointer to memory location where appropriate values for a given
param_name
as specified in the table below will be returned. Ifparam_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 table below. param_value_size_ret
-
Returns the actual size in bytes of data being queried by
param_value
. Ifparam_value_size_ret
is NULL, it is ignored. param_name
-
An enumeration constant that identifies the device information being queried. It can be one of the values as specified in the table below.
::
+
Table 4.3:
cl_device_info | Return Type | Description |
---|---|---|
|
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_bool |
Is |
|
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_bool |
Is |
|
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:
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 must be: |
|
cl_bool |
Is |
|
cl_bool |
Is |
|
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:
The mandated minimum capability is |
|
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 returned can be vendor supported extension names and one or more of the following Khronos approved extension names: cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_fp16 cl_khr_gl_sharing cl_khr_gl_event cl_khr_d3d10_sharing cl_khr_dx9_media_sharing cl_khr_d3d11_sharing cl_khr_gl_depth_images cl_khr_gl_msaa_sharing cl_khr_initialize_memory cl_khr_context_abort cl_khr_spir cl_khr_srgb_image_writes The following approved Khronos extension names must be returned by all device that support OpenCL C 2.0: cl_khr_byte_addressable_store cl_khr_fp64 (for backward compatibility if double precision is supported) cl_khr_3d_image_writes cl_khr_image2d_from_buffer cl_khr_depth_images Please refer to the OpenCL 2.0 Extension Specification for a detailed description of these extensions. |
|
cl_ulong |
Size of global memory cache in bytes. |
|
cl_device_mem- _cache_type |
Type of global memory cache supported.
Valid values are: |
|
cl_uint |
Size of global memory cache line in bytes. |
|
cl_ulong |
Size of global device memory in bytes. |
|
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. |
|
char [] |
The intermediate languages that can be supported by |
|
size_t |
Max height of 2D image in pixels.
The minimum value is 16384 if |
|
size_t |
Max width of 2D image or 1D image not created from a buffer object in pixels.
The minimum value is 16384 if |
|
size_t |
Max depth of 3D image in pixels.
The minimum value is 2048 if |
|
size_t |
Max height of 3D image in pixels.
The minimum value is 2048 if |
|
size_t |
Max width of 3D image in pixels.
The minimum value is 2048 if |
|
cl_uint |
This query should be used when a 2D image is created from a buffer which was created using |
|
size_t |
Max number of images in a 1D or 2D image array.
The minimum value is 2048 if |
|
size_t |
Max number of pixels for a 1D image created from a buffer object.
The minimum value is 65536 if |
|
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. If the device does not support images, this value must be 0. |
|
cl_bool |
Is |
|
cl_bool |
Is |
|
cl_ulong |
Size of local memory region in bytes.
The minimum value is 32 KB for devices that are not of type |
|
cl_device_- local_mem_type |
Type of local memory supported.
This can be set to |
|
cl_uint |
Maximum configured clock frequency of the device in MHz. |
|
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_uint |
Max number of arguments declared with the |
|
cl_ulong |
Max size in bytes of a constant buffer allocation.
The minimum value is 64 KB for devices that are not of type |
|
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 OpenCL C declared in the global address space. The minimum value is 64 KB. |
|
cl_ulong |
Max size of memory object allocation in bytes.
The minimum value is max(min(1024*1024*1024, 1/4th of |
|
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. (Refer also to |
|
cl_uint |
The maximum number of events in use by a device queue.
These refer to events returned by the |
|
cl_uint |
The maximum number of device queues that can be created per context. The minimum value is 1. |
|
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_uint |
The maximum number of pipe objects that can be passed as arguments to a kernel. The minimum value is 16. |
|
cl_uint |
Max number of image objects arguments of a kernel declared with the |
|
cl_uint |
Max number of image objects arguments of a kernel declared with the |
|
cl_uint |
Maximum number of samplers that can be used in a kernel.
The minimum value is 16 if |
|
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 |
|
cl_uint |
Maximum dimensions that specify the global and local work-item IDs used by the data parallel execution model. (Refer to |
|
size_t[] |
Maximum number of work-items that can be specified in each dimension of the work-group to Returns The minimum value is (1, 1, 1) for devices that are not of type |
|
cl_uint |
Max number of image objects arguments of a kernel declared with the |
|
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 ( |
|
char[] |
Device name string. |
|
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, If the |
|
char[] |
OpenCL C version string.
Returns the highest OpenCL C version supported by the compiler for this device that is not of type
The The The The |
|
cl_device_id |
Returns the |
|
cl_device_aff- inity_domain |
Returns the list of supported affinity domains for partitioning the
If the device does not support any affinity domains, a value of 0 will be returned. |
|
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_partit- ion_property[] |
Returns the list of partition types supported by
If the device cannot be partitioned (i.e. there is no partitioning scheme supported by the device that will return at least two subdevices), a value of 0 will be returned. |
|
cl_device_part- ition_property[] |
Returns the
Otherwise the implementation may either return a |
|
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. |
|
cl_uint |
The maximum size of pipe packet in bytes. The minimum value is 1024 bytes. |
|
The platform associated with this device. |
|
|
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_bool |
Is |
|
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_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_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, If the |
|
size_t |
Maximum size in bytes of the internal buffer that holds the output of |
|
char[] |
OpenCL profile string. Returns the profile name supported by the device (see note). 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. The platform profile returns the profile that is implemented by the OpenCL framework.
If the platform profile returned is |
|
size_t |
Describes the resolution of device timer. This is measured in nanoseconds. |
|
cl_uint |
The max. size of the device queue in bytes. The minimum value is 256 KB for the full profile and 64 KB for the embedded profile |
|
cl_uint |
The size of the device queue in bytes preferred by the implementation. Applications should use this size for the device queue to ensure good performance. The minimum value is 16 KB. |
|
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:
These properties are described in the table for |
|
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:
These properties are described in the table for |
|
cl_uint |
Returns the |
|
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:
For the full profile, the mandated minimum floating-point capability for devices that are not of type |
|
char [] |
If the |
|
cl_bool |
Is |
|
cl_device_svm_- capabilities |
Describes the various shared virtual memory (a.k.a. SVM) memory allocation types the device supports. Coarse-grain SVM allocations are required to be supported by all OpenCL 2.0 devices. This is a bit-field that describes a combination of the following values:
The mandated minimum capability is |
|
cl_device_terminate- _capability_khr |
If the |
|
cl_device_type |
The OpenCL device type.
Currently supported values are: |
|
char[] |
Vendor name string. |
|
cl_uint |
A unique device vendor identifier. An example of a unique device identifier could be the PCIe ID. |
|
char[] |
OpenCL version string. Returns the OpenCL version supported by the device. This version string has the following format:
The |
|
char[] |
OpenCL software driver version string in the form |
CL_DEVICE_PROFILE
: The platform profile returns the profile that is implemented by the OpenCL framework.
If the platform profile returned is FULL_PROFILE
, the OpenCL framework will support devices that are FULL_PROFILE
and may also support devices that are EMBEDDED_PROFILE
.
The compiler must be available for all devices i.e.
CL_DEVICE_COMPILER_AVAILABLE
is CL_TRUE
.
If the platform profile returned is EMBEDDED_PROFILE
, then devices that are only EMBEDDED_PROFILE
are supported.
The device queries described in the table above 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
clGetDeviceInfo
returns CL_SUCCESS
if the function is executed successfully.
Otherwise, it returns the following:
-
CL_INVALID_DEVICE
ifdevice
is not valid. -
CL_INVALID_VALUE
ifparam_name
is not one of the supported values or if size in bytes specified byparam_value_size
is less than size of return type as shown in the table above andparam_value
is not aNULL
value or ifparam_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.