C Specification

To return information about an event object, call the function

cl_int clGetEventInfo(
    cl_event event,
    cl_event_info param_name,
    size_t param_value_size,
    void* param_value,
    size_t* param_value_size_ret);

Parameters

  • event specifies the event object being queried.

  • param_name specifies the information to query. The list of supported param_name types and the information returned in param_value by clGetEventInfo is described in the Event Object Queries table.

  • 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_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 Event Object 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

Table 1. List of supported param_names by https://www.khronos.org/registry/OpenCL/specs/2.2/html/OpenCL_API.html#clGetEventInfo
cl_event_info Return Type Info. returned in param_value

CL_​EVENT_​COMMAND_​QUEUE

cl_command_queue

Return the command-queue associated with event. For user event objects, a NULL value is returned.

CL_​EVENT_​CONTEXT

Missing before version 1.1.

cl_context

Return the context associated with event.

CL_​EVENT_​COMMAND_​TYPE

cl_command_type

Return the command associated with event. Can be one of the following values:

CL_​COMMAND_​NDRANGE_​KERNEL
CL_​COMMAND_​NATIVE_​KERNEL
CL_​COMMAND_​READ_​BUFFER
CL_​COMMAND_​WRITE_​BUFFER
CL_​COMMAND_​COPY_​BUFFER
CL_​COMMAND_​READ_​IMAGE
CL_​COMMAND_​WRITE_​IMAGE
CL_​COMMAND_​COPY_​IMAGE
CL_​COMMAND_​COPY_​BUFFER_​TO_​IMAGE
CL_​COMMAND_​COPY_​IMAGE_​TO_​BUFFER
CL_​COMMAND_​MAP_​BUFFER
CL_​COMMAND_​MAP_​IMAGE
CL_​COMMAND_​UNMAP_​MEM_​OBJECT
CL_​COMMAND_​MARKER
CL_​COMMAND_​ACQUIRE_​GL_​OBJECTS
CL_​COMMAND_​RELEASE_​GL_​OBJECTS
CL_​COMMAND_​READ_​BUFFER_​RECT
CL_​COMMAND_​WRITE_​BUFFER_​RECT
CL_​COMMAND_​COPY_​BUFFER_​RECT
CL_​COMMAND_​USER
CL_​COMMAND_​BARRIER
CL_​COMMAND_​MIGRATE_​MEM_​OBJECTS
CL_​COMMAND_​FILL_​BUFFER
CL_​COMMAND_​FILL_​IMAGE
CL_​COMMAND_​SVM_​FREE
CL_​COMMAND_​SVM_​MEMCPY
CL_​COMMAND_​SVM_​MEMFILL
CL_​COMMAND_​SVM_​MAP
CL_​COMMAND_​SVM_​UNMAP

CL_​EVENT_​COMMAND_​EXECUTION_​STATUS19

cl_int

Return the execution status of the command identified by event. Valid values are:

CL_​QUEUED (command has been enqueued in the command-queue),

CL_​SUBMITTED (enqueued command has been submitted by the host to the device associated with the command-queue),

CL_​RUNNING (device is currently executing this command),

CL_​COMPLETE (the command has completed), or

Error code given by a negative integer value. (command was abnormally terminated - this may be caused by a bad memory access etc.). These error codes come from the same set of error codes that are returned from the platform or runtime API calls as return values or errcode_ret values.

CL_​EVENT_​REFERENCE_​COUNT20

cl_uint

Return the event reference count.

19

The error code values are negative, and event state values are positive. The event state values are ordered from the largest value CL_​QUEUED for the first or initial state to the smallest value (CL_​COMPLETE or negative integer value) for the last or complete state. The value of CL_​COMPLETE and CL_​SUCCESS are the same.

20

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.

Using clGetEventInfo to determine if a command identified by event has finished execution (i.e. CL_​EVENT_​COMMAND_​EXECUTION_​STATUS returns CL_​COMPLETE) is not a synchronization point. There are no guarantees that the memory objects being modified by command associated with event will be visible to other enqueued commands.

clGetEventInfo returns CL_​SUCCESS if the function is executed successfully. Otherwise, it returns one of the following errors:

  • CL_​INVALID_​VALUE if param_name is not valid, or if size in bytes specified by param_value_size is < size of return type as described in the Kernel Argument Queries table and param_value is not NULL.

  • CL_​INVALID_​VALUE if information to query given in param_name cannot be queried for event.

  • CL_​INVALID_​EVENT if event is a not a valid event object.

  • 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 (c) 2014-2020 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.