OpenCL™规范 5.1. 命令队列

5.1. Command-Queues

5.1. 命令队列

OpenCL objects such as memory, program and kernel objects are created using a context. Operations on these objects are performed using a command-queue. The command-queue can be used to queue a set of operations (referred to as commands) in order. Having multiple command-queues allows applications to queue multiple independent commands without requiring synchronization. Note that this should work as long as these objects are not being shared. Sharing of objects across multiple command-queues will require the application to perform appropriate synchronization. This is described in Shared OpenCL Objects

​OpenCL对象(如内存、程序和内核对象)是使用上下文创建的。对这些对象的操作是使用命令队列执行的。命令队列可用于按顺序对一组操作(称为命令)进行排队。具有多个命令队列允许应用程序对多个独立的命令进行排队,而不需要同步。请注意,只要这些对象不被共享,这就应该有效。跨多个命令队列共享对象将要求应用程序执行适当的同步。这在Shared OpenCL Objects中有描述

To create a host or device command-queue on a specific device, call the function

要在特定设备上创建主机或设备命令队列,请调用函数

cl_command_queue clCreateCommandQueueWithProperties(
    cl_context context,
    cl_device_id device,
    const cl_queue_properties* properties,
    cl_int* errcode_ret);

clCreateCommandQueueWithProperties is missing before version 2.0. Also see extension cl_khr_create_command_queue.

版本2.0之前缺少clCreateCommandQueueWithProperties。另请参阅扩展cl_khr_create_command_queue。

  • context must be a valid OpenCL context.

  • 上下文必须是有效的OpenCL上下文。

  • device must be a device or sub-device associated with context. It can either be in the list of devices and sub-devices specified when context is created using clCreateContext or be a root device with the same device type as specified when context is created using clCreateContextFromType.

  • ​设备必须是与上下文关联的设备或子设备。它可以在使用clCreateContext创建上下文时指定的设备和子设备列表中,也可以是与使用clCreateContextFromType创建上下文时相同设备类型的根设备。

  • properties specifies a list of properties for the command-queue and their corresponding values. Each property name is immediately followed by the corresponding desired value. The list is terminated with 0. The list of supported properties is described in the table below. If a supported property and its value is not specified in properties, its default value will be used. properties can be NULL in which case the default values for supported command-queue properties will be used.

  • ​properties指定命令队列的属性列表及其相应的值。每个属性名称后面紧跟着相应的所需值。列表以0终止。下表中介绍了支持的属性列表。如果未在属性中指定受支持的属性及其值,则将使用其默认值。属性可以为NULL,在这种情况下,将使用支持的命令队列属性的默认值。

  • errcode_ret will return an appropriate error code. If errcode_ret is NULL, no error code is returned.

  • errcode_ret将返回相应的错误代码。如果errcode_ret为NULL,则不会返回任何错误代码。

Table 9. List of supported queue creation properties by clCreateCommandQueueWithProperties


表9 clCreateCommandQueueWithProperties支持的队列创建属性列表

Queue Property

队列属性

Property Value

属性值

Description

描述

CL_QUEUE_PROPERTIES

cl_command_queue_properties

This is a bitfield and can be set to a combination of the following values:

这是一个位字段,可以设置为以下值的组合:

CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE - Determines whether the commands queued in the command-queue are executed in-order or out-of-order. If set, the commands in the command-queue are executed out-of-order. Otherwise, commands are executed in-order.

CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE-确定命令队列中排队的命令是有序执行还是无序执行。如果设置,则命令队列中的命令将无序执行。否则,将有序执行命令。

CL_QUEUE_PROFILING_ENABLE - Enable or disable profiling of commands in the command-queue. If set, the profiling of commands is enabled. Otherwise profiling of commands is disabled.

CL_QUEUE_PROFILING_ENABLE-启用或禁用对命令队列中命令的分析。如果设置了,将启用命令的分析。否则,将禁用对命令的分析。

CL_QUEUE_ON_DEVICE - Indicates that this is a device queue. If CL_QUEUE_ON_DEVICE is set, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE [14] must also be set. missing before version 2.0.

CL_QUEUE_ON_DEVICE-表示这是一个设备队列。如果设置了CL_QUEUE_ON_DEVICE,则还必须设置CL_QUEUE _OUT_OF_ORDER_EXEC_MODE_ENABLE[14]。2.0版本之前丢失。

CL_QUEUE_ON_DEVICE_DEFAULT [15] - indicates that this is the default device queue. This can only be used with CL_QUEUE_ON_DEVICEmissing before version 2.0.

CL_QUEUE_ON_DEVICE_DEFAULT[15]-表示这是默认的设备队列。这只能与CL_QUEUE_ON_DEVICE一起使用。2.0版本之前丢失。

If CL_QUEUE_PROPERTIES is not specified an in-order host command-queue is created for the specified device

如果未指定CL_QUEUE_PROPERTIES,则会为指定的设备创建一个有序排列的主机命令队列

CL_QUEUE_SIZE

missing before version 2.0.

cl_uint

Specifies the size of the device queue in bytes.

指定设备队列的大小(以字节为单位)。

This can only be specified if CL_QUEUE_ON_DEVICE is set in CL_QUEUE_PROPERTIES. This must be a value ≤ CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE.

只有在CL_QUEUE_PROPERTIES中设置了CL_QUEUE _ON_DEVICE时,才能指定此选项。该值必须≤CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE。

For best performance, this should be ≤ CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE.

为获得最佳性能,此值应≤CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE。

If CL_QUEUE_SIZE is not specified, the device queue is created with CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE as the size of the queue.

​如果未指定CL_QUEUE_SIZE,则会使用CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE作为队列大小创建设备队列。

clCreateCommandQueueWithProperties returns a valid non-zero command-queue and errcode_ret is set to CL_SUCCESS if the command-queue is created successfully. Otherwise, it returns a NULL value with one of the following error values returned in errcode_ret:

clCreateCommandQueueWithProperties返回有效的非零命令队列,如果命令队列创建成功,则errcode_ret设置为CL_SUCCESS。否则,它将返回一个NULL值,并在errcode_ret中返回以下错误值之一:

  • CL_INVALID_CONTEXT if context is not a valid context.

  • CL_INVALID_CONTEXT(如果上下文不是有效上下文)。

  • CL_INVALID_DEVICE if device is not a valid device or is not associated with context.

  • CL_INVALID_DEVICE(如果设备不是有效设备或与上下文无关)。

  • CL_INVALID_VALUE if values specified in properties are not valid.

  • CL_INVALID_VALUE(如果属性中指定的值无效)。

  • CL_INVALID_QUEUE_PROPERTIES if values specified in properties are valid but are not supported by the device.

  • CL_INVALID_QUEUE_PROPERTIES(如果属性中指定的值有效但设备不支持)。

  • CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.

  • CL_OUT_OF_RESOURCES,如果在设备上分配OpenCL实现所需的资源失败。

  • CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

  • CL_OUT_OF_HOST_MEMORY,如果在主机上分配OpenCL实现所需的资源失败。

To create a host command-queue on a specific device, call the function

要在特定设备上创建主机命令队列,请调用函数

cl_command_queue clCreateCommandQueue(
    cl_context context,
    cl_device_id device,
    cl_command_queue_properties properties,
    cl_int* errcode_ret);

clCreateCommandQueue is deprecated by version 2.0.

clCreateCommandQueue已被2.0版本否决。

  • context must be a valid OpenCL context.

  • 上下文必须是有效的OpenCL上下文。

  • device must be a device or sub-device associated with context. It can either be in the list of devices and sub-devices specified when context is created using clCreateContext or be a root device with the same device type as specified when context is created using clCreateContextFromType.

  • 设备必须是与上下文关联的设备或子设备。它可以在使用clCreateContext创建上下文时指定的设备和子设备列表中,也可以是与使用clCreateContextFromType创建上下文时相同设备类型的根设备。

  • properties specifies a list of properties for the command-queue. This is a bit-field and the supported properties are described in the table below. Only command-queue properties specified in this table can be used, otherwise the value specified in properties is considered to be not valid. properties can be 0 in which case the default values for supported command-queue properties will be used.

  • ​properties指定命令队列的属性列表。这是一个位字段,支持的属性在下表中进行了描述。只能使用此表中指定的命令队列属性,否则属性中指定的值将被视为无效。属性可以是0,在这种情况下,将使用支持的命令队列属性的默认值。

Table 10. List of supported cl_command_queue_property values by clCreateCommandQueue

​表10 clCreateCommandQueue支持的cl_command_queue_property值的列表

Command-Queue Properties

命令队列属性

Description

描述

CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE

Determines whether the commands queued in the command-queue are executed in-order or out-of-order. If set, the commands in the command-queue are executed out-of-order. Otherwise, commands are executed in-order.

确定命令队列中排队的命令是有序执行还是无序执行。如果设置,则命令队列中的命令将无序执行。否则,将有序执行命令。

CL_QUEUE_PROFILING_ENABLE

Enable or disable profiling of commands in the command-queue. If set, the profiling of commands is enabled. Otherwise profiling of commands is disabled.

启用或禁用对命令队列中的命令的分析。如果设置了,将启用命令的分析。否则,将禁用对命令的分析。

  • errcode_ret will return an appropriate error code. If errcode_ret is NULL, no error code is returned.

  • errcode_ret将返回相应的错误代码。如果errcode_ret为NULL,则不会返回任何错误代码。

clCreateCommandQueue returns a valid non-zero command-queue and errcode_ret is set to CL_SUCCESS if the command-queue is created successfully. Otherwise, it returns a NULL value with one of the following error values returned in errcode_ret:

clCreateCommandQueue返回有效的非零命令队列,如果命令队列创建成功,则errcode_ret设置为CL_SUCCESS。否则,它将返回一个NULL值,并在errcode_ret中返回以下错误值之一:

  • CL_INVALID_CONTEXT if context is not a valid context.

  • CL_INVALID_CONTEXT(如果上下文不是有效上下文)。

  • CL_INVALID_DEVICE if device is not a valid device or is not associated with context.

  • CL_INVALID_DEVICE(如果设备不是有效设备或与上下文无关)。

  • CL_INVALID_VALUE if values specified in properties are not valid.

  • CL_INVALID_VALUE(如果属性中指定的值无效)。

  • CL_INVALID_QUEUE_PROPERTIES if values specified in properties are valid but are not supported by the device.

  • CL_INVALID_QUEUE_PROPERTIES(如果属性中指定的值有效但设备不支持)。

  • CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.

  • CL_OUT_OF_RESOURCES,如果在设备上分配OpenCL实现所需的资源失败。

  • CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

  • CL_OUT_OF_HOST_MEMORY,如果在主机上分配OpenCL实现所需的资源失败。

To replace the default command-queue on a device, call the function

要替换设备上的默认命令队列,请调用函数

cl_int clSetDefaultDeviceCommandQueue(
    cl_context context,
    cl_device_id device,
    cl_command_queue command_queue);

clSetDefaultDeviceCommandQueue is missing before version 2.1.

版本2.1之前缺少clSetDefaultDeviceCommandQueue。

  • context is the OpenCL context used to create command_queue.

  • context是用于创建command_queue的OpenCL上下文。

  • device is a valid OpenCL device associated with context.

  • 设备是与上下文相关联的有效OpenCL设备。

  • command_queue specifies a command-queue object which replaces the default device command-queue

  • command_queue指定替换默认设备命令队列的命令队列对象

clSetDefaultDeviceCommandQueue may be used to replace a default device command-queue created with clCreateCommandQueueWithProperties and the CL_QUEUE_ON_DEVICE_DEFAULT flag.

clSetDefaultDeviceCommandQueue可用于替换使用clCreateCommandQueueWithProperties和CL_QUEUE_ON_DEVICE_DEFAULT标志创建的默认设备命令队列。

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

如果函数执行成功,clSetDefaultDeviceCommandQueue将返回CL_SUCCESS。否则,它将返回以下错误之一:

  • CL_INVALID_CONTEXT if context is not a valid context.

  • CL_INVALID_CONTEXT(如果上下文不是有效上下文)。

  • CL_INVALID_DEVICE if device is not a valid device or is not associated with context.

  • CL_INVALID_DEVICE(如果设备不是有效设备或与上下文无关)。

  • CL_INVALID_OPERATION if device does not support a replaceable default on-device queue.

  • CL_INVALID_OPERATION(如果设备不支持设备队列上的可替换默认值)。

  • CL_INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue for device.

  • CL_INVALID_COMMAND_QUEUE(如果命令队列不是设备的有效命令队列)。

  • CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.

  • CL_OUT_OF_RESOURCES,如果在设备上分配OpenCL实现所需的资源失败。

  • CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

  • CL_OUT_OF_HOST_MEMORY,如果在主机上分配OpenCL实现所需的资源失败。

To retain a command-queue, call the function

要保留命令队列,请调用函数

cl_int clRetainCommandQueue(
    cl_command_queue command_queue);
  • command_queue specifies the command-queue to be retained.

  • command_queue指定要保留的命令队列。

The command_queue reference count is incremented.

command_queue引用计数递增。

clCreateCommandQueueWithProperties and clCreateCommandQueue perform an implicit retain. This is very helpful for 3rd party libraries, which typically get a command-queue passed to them by the application. However, it is possible that the application may delete the command-queue without informing the library. Allowing functions to attach to (i.e. retain) and release a command-queue solves the problem of a command-queue being used by a library no longer being valid.

clCreateCommandQueueWithProperties和clCreateCommandQueue执行隐式保留。这对第三方库非常有帮助,因为第三方程序库通常会获得应用程序传递给它们的命令队列。但是,应用程序可能会在不通知库的情况下删除命令队列。允许函数附加(即保留)和释放命令队列解决了库使用的命令队列不再有效的问题。

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

如果函数执行成功,clRetainCommandQueue将返回CL_SUCCESS。否则,它将返回以下错误之一:

  • CL_INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue.

  • CL_INVALID_COMMAND_QUEUE(如果命令队列不是有效的命令队列)。

  • CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.

  • CL_OUT_OF_RESOURCES,如果在设备上分配OpenCL实现所需的资源失败。

  • CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

  • CL_OUT_OF_HOST_MEMORY,如果在主机上分配OpenCL实现所需的资源失败。

To release a command-queue, call the function

要释放命令队列,请调用函数

cl_int clReleaseCommandQueue(
    cl_command_queue command_queue);
  • command_queue specifies the command-queue to be released.

  • command_queue指定要释放的命令队列。

The command_queue reference count is decremented.

command_queue引用计数递减。

After the command_queue reference count becomes zero and all commands queued to command_queue have finished (eg. kernel-instances, memory object updates etc.), the command-queue is deleted.

在command_queue引用计数变为零并且排队到command_queue的所有命令都已完成(例如内核实例、内存对象更新等)后,命令队列将被删除。

clReleaseCommandQueue performs an implicit flush to issue any previously queued OpenCL commands in command_queue. Using this function to release a reference that was not obtained by creating the object or by calling clRetainCommandQueue causes undefined behavior.

clReleaseCommandQueue执行隐式刷新,以发出command_queue中任何先前排队的OpenCL命令。使用此函数释放不是通过创建对象或调用clRetainCommandQueue获得的引用会导致未定义的行为。

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

如果函数执行成功,clReleaseCommandQueue将返回CL_SUCCESS。否则,它将返回以下错误之一:

  • CL_INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue.

  • CL_INVALID_COMMAND_QUEUE(如果命令队列不是有效的命令队列)。

  • CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.

  • CL_OUT_OF_RESOURCES,如果在设备上分配OpenCL实现所需的资源失败。

  • CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

  • CL_OUT_OF_HOST_MEMORY,如果在主机上分配OpenCL实现所需的资源失败。

To query information about a command-queue, call the function

要查询有关命令队列的信息,请调用函数

cl_int clGetCommandQueueInfo(
    cl_command_queue command_queue,
    cl_command_queue_info param_name,
    size_t param_value_size,
    void* param_value,
    size_t* param_value_size_ret);
  • command_queue specifies the command-queue being queried.

  • command_queue指定要查询的命令队列。

  • param_name specifies the information to query.

  • param_name指定要查询的信息。

  • 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是一个指向内存的指针,在内存中返回所查询的适当结果。如果param_value为NULL,则忽略它。

  • param_value_size is used to specify the size in bytes of memory pointed to by param_value. This size must be ≥ size of return type as described in the Command-Queue Parameter table. If param_value is NULL, it is ignored.

  • ​param_value_size用于指定param_value指向的内存大小(以字节为单位)。此大小必须≥命令队列参数表中所述的返回类型的大小。如果param_value为NULL,则忽略它。

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

  • param_value_size_ret返回param_name查询的数据的实际大小(以字节为单位)。如果param_value_size_ret为NULL,则忽略它。

The list of supported param_name values and the information returned in param_value by clGetCommandQueueInfo is described in the Command-Queue Parameter table.

​命令队列参数表中介绍了支持的param_name值列表以及clGetCommandQueueInfo在param_value中返回的信息。

Table 11. List of supported param_names by clGetCommandQueueInfo

​表11 clGetCommandQueueInfo支持的参数名称列表

Queue Info

队列信息

Return Type

返回类型

Description

描述

CL_QUEUE_CONTEXT

cl_context

Return the context specified when the command-queue is created.

返回创建命令队列时指定的上下文。

CL_QUEUE_DEVICE

cl_device_id

Return the device specified when the command-queue is created.

返回创建命令队列时指定的设备。

CL_QUEUE_REFERENCE_COUNT [16]

cl_uint

Return the command-queue reference count.

返回命令队列引用计数。

CL_QUEUE_PROPERTIES

cl_command_queue_properties

Return the currently specified properties for the command-queue. These properties are specified by the value associated with the CL_QUEUE_PROPERTIES passed in properties argument in clCreateCommandQueueWithProperties, or the value of the properties argument in clCreateCommandQueue.


返回命令队列的当前指定属性。这些属性由clCreateCommandQueueWithProperties中传递的属性参数中与CL_QUEUE_PROPERTIES相关联的值或clCreateCommandQueue中属性参数的值指定。

CL_QUEUE_PROPERTIES_ARRAY

missing before version 3.0.

cl_queue_properties[]

Return the properties argument specified in clCreateCommandQueueWithProperties.

返回clCreateCommandQueueWithProperties中指定的属性参数。

If the properties argument specified in clCreateCommandQueueWithProperties used to create command_queue was not NULL, the implementation must return the values specified in the properties argument in the same order and without including additional properties.

如果用于创建command_queue的clCreateCommandQueueWithProperties中指定的属性参数不为NULL,则实现必须以相同的顺序返回属性参数中指定的值,并且不包括其他属性。

If command_queue was created using clCreateCommandQueue, or if the properties argument specified in clCreateCommandQueueWithProperties was NULL, the implementation must return param_value_size_ret equal to 0, indicating that there are no properties to be returned.

​如果command_queue是使用clCreateCommandQueue创建的,或者如果clCreateCommandQueueWithProperties中指定的属性参数为NULL,则该实现必须返回等于0的param_value_size_ret,这表示没有要返回的属性。

CL_QUEUE_SIZE

missing before version 2.0.

cl_uint

Return the size of the device command-queue. To be considered valid for this query, command_queue must be a device command-queue.

返回设备命令队列的大小。若要对此查询有效,command_queue必须是设备命令队列。

CL_QUEUE_DEVICE_DEFAULT

missing before version 2.1.

cl_command_queue

Return the current default command-queue for the underlying device.

返回基础设备的当前默认命令队列。

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

如果函数执行成功,clGetCommandQueueInfo将返回CL_SUCCESS。否则,它将返回以下错误之一:

  • CL_INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue, or if command_queue is not a valid command-queue for param_name.

  • 如果命令队列不是有效的命令队列,或者命令队列不是param_name的有效命令队列,则CL_INVALID_COMMAND_QUEUE。

  • 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 Command-Queue Parameter table, and param_value is not a NULL value.

  • 如果param_name不是支持的值之一,或者param_value_size指定的字节大小小于命令队列参数表中指定的返回类型的大小,并且param_value不是NULL值,则CL_INVALID_VALUE。

  • CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.

  • CL_OUT_OF_RESOURCES,如果在设备上分配OpenCL实现所需的资源失败。

  • CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

  • CL_OUT_OF_HOST_MEMORY,如果在主机上分配OpenCL实现所需的资源失败。

To enable or disable the properties of a command-queue, call the function

要启用或禁用命令队列的属性,请调用函数

cl_int clSetCommandQueueProperty(
    cl_command_queue command_queue,
    cl_command_queue_properties properties,
    cl_bool enable,
    cl_command_queue_properties* old_properties);

clSetCommandQueueProperty is deprecated by version 1.1.

clSetCommandQueueProperty已被版本1.1废弃。

  • command_queue specifies the command-queue being modified.

  • command_queue指定要修改的命令队列。

  • properties specifies the new list of properties for the command-queue. This is a bit-field and the supported properties are described in the Command-Queue Properties table for clCreateCommandQueue. Only command-queue properties specified in this table can be used, otherwise the value specified in properties is considered to be not valid.

  • ​properties指定命令队列的新属性列表。这是一个位字段,clCreateCommandQueue的命令队列属性表中描述了支持的属性。只能使用此表中指定的命令队列属性,否则属性中指定的值将被视为无效。

  • enable determines whether the values specified by properties are enabled (if enable is CL_TRUE) or disabled (if enable is CL_FALSE) for the command-queue.

  • ​enable确定命令队列的属性指定的值是启用的(如果enable为CL_TRUE)还是禁用的(如果enable为CL_FALSE)。

  • old_properties returns the command-queue properties before they were changed by clSetCommandQueueProperty. If old_properties is NULL, it is ignored.

  • ​old_properties返回clSetCommandQueueProperty更改命令队列属性之前的命令队列属性。如果old_properties为NULL,则会忽略它。

clSetCommandQueueProperty may unconditionally return an error if no devices in the context associated with command_queue support modifying the properties of a command-queue. Support for modifying the properties of a command-queue is required only for OpenCL 1.0 devices.

如果与command_queue关联的上下文中没有设备支持修改命令队列的属性,则clSetCommandQueueProperty可能无条件返回错误。只有OpenCL 1.0设备才需要支持修改命令队列的属性。

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

如果函数执行成功,clSetCommandQueueProperty将返回CL_SUCCESS。否则,它将返回以下错误之一:

  • CL_INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue.

  • CL_INVALID_COMMAND_QUEUE(如果命令队列不是有效的命令队列)。

  • CL_INVALID_OPERATION if no devices in the context associated with command_queue support modifying the properties of a command-queue.

  • CL_INVALID_OPERATION如果与command_queue关联的上下文中没有设备支持修改命令队列的属性。

  • CL_INVALID_VALUE if values specified in properties are not valid.

  • CL_INVALID_VALUE(如果属性中指定的值无效)。

  • CL_INVALID_QUEUE_PROPERTIES if values specified in properties are valid but are not supported by the device.

  • CL_INVALID_QUEUE_PROPERTIES(如果属性中指定的值有效但设备不支持)。

  • CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.

  • CL_OUT_OF_RESOURCES,如果在设备上分配OpenCL实现所需的资源失败。

  • CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

  • CL_OUT_OF_HOST_MEMORY,如果在主机上分配OpenCL实现所需的资源失败。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值