C Specification

To return information about an event object, call the function

// Provided by CL_VERSION_1_0
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 specifies the size in bytes of memory pointed to by param_value. This size must be greater than or equal to the size of the return type specified in the Event Object Queries table. If param_value is NULL, it is ignored.

  • 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 clGetEventInfo
Event Info Return Type Description

CL_EVENT_COMMAND_QUEUE

cl_command_queue

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

If the cl_khr_command_buffer_multi_device extension is supported, for events returned by a command-buffer enqueue operation to multiple command-queues, NULL 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 type associated with event as described in the Event Command Types table.

CL_EVENT_COMMAND_EXECUTION_STATUS [1]

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

If the cl_khr_command_buffer_multi_device extension is supported, for events returned by a command-buffer enqueue operation to multiple command-queues the semantics of execution status is as follows:

CL_QUEUED - Command-buffer has been enqueued across the command-queues.

CL_SUBMITTED - Commands from the command-buffer have been submitted by the host to any device associated with one of the command-queues.

CL_RUNNING - Any command from the command-buffer has started execution on a device.

CL_COMPLETE - All commands have completed on all devices.

CL_EVENT_REFERENCE_COUNT [2]

cl_uint

Return the event reference count.

Table 2. List of supported event command types
Events Created By Event Command Type

clEnqueueNDRangeKernel

CL_COMMAND_NDRANGE_KERNEL

clEnqueueTask

CL_COMMAND_TASK

clEnqueueNativeKernel

CL_COMMAND_NATIVE_KERNEL

clEnqueueReadBuffer

CL_COMMAND_READ_BUFFER

clEnqueueWriteBuffer

CL_COMMAND_WRITE_BUFFER

clEnqueueCopyBuffer

CL_COMMAND_COPY_BUFFER

clEnqueueReadImage

CL_COMMAND_READ_IMAGE

clEnqueueWriteImage

CL_COMMAND_WRITE_IMAGE

clEnqueueCopyImage

CL_COMMAND_COPY_IMAGE

clEnqueueCopyBufferToImage

CL_COMMAND_COPY_BUFFER_TO_IMAGE

clEnqueueCopyImageToBuffer

CL_COMMAND_COPY_IMAGE_TO_BUFFER

clEnqueueMapBuffer

CL_COMMAND_MAP_BUFFER

clEnqueueMapImage

CL_COMMAND_MAP_IMAGE

clEnqueueUnmapMemObject

CL_COMMAND_UNMAP_MEM_OBJECT

clEnqueueMarker,
clEnqueueMarkerWithWaitList

CL_COMMAND_MARKER

clEnqueueReadBufferRect

CL_COMMAND_READ_BUFFER_RECT

missing before version 1.1.

clEnqueueWriteBufferRect

CL_COMMAND_WRITE_BUFFER_RECT

missing before version 1.1.

clEnqueueCopyBufferRect

CL_COMMAND_COPY_BUFFER_RECT

missing before version 1.1.

clCreateUserEvent

CL_COMMAND_USER

missing before version 1.1.

clEnqueueBarrier,
clEnqueueBarrierWithWaitList

CL_COMMAND_BARRIER

missing before version 1.2.

clEnqueueMigrateMemObjects

CL_COMMAND_MIGRATE_MEM_OBJECTS

missing before version 1.2.

clEnqueueFillBuffer

CL_COMMAND_FILL_BUFFER

missing before version 1.2.

clEnqueueFillImage

CL_COMMAND_FILL_IMAGE

missing before version 1.2.

clEnqueueSVMFree

CL_COMMAND_SVM_FREE

missing before version 2.0.

clEnqueueSVMMemcpy

CL_COMMAND_SVM_MEMCPY

missing before version 2.0.

clEnqueueSVMMemFill

CL_COMMAND_SVM_MEMFILL

missing before version 2.0.

clEnqueueSVMMap

CL_COMMAND_SVM_MAP

missing before version 2.0.

clEnqueueSVMUnmap

CL_COMMAND_SVM_UNMAP

missing before version 2.0.

clEnqueueSVMMigrateMem

CL_COMMAND_SVM_MIGRATE_MEM

missing before version 3.0.

Prior to OpenCL 3.0, implementations should return CL_COMMAND_MIGRATE_MEM_OBJECTS, but may return an implementation-defined event command type for clEnqueueSVMMigrateMem.

clEnqueueCommandBufferKHR

CL_COMMAND_COMMAND_BUFFER_KHR

provided by the cl_khr_command_buffer extension.

clEnqueueAcquireDX9MediaSurfacesKHR

CL_COMMAND_ACQUIRE_DX9_MEDIA_SURFACES_KHR

provided by the cl_khr_dx9_media_sharing extension.

clEnqueueReleaseDX9MediaSurfacesKHR

CL_COMMAND_RELEASE_DX9_MEDIA_SURFACES_KHR

provided by the cl_khr_dx9_media_sharing extension.

clEnqueueAcquireD3D10ObjectsKHR

CL_COMMAND_ACQUIRE_D3D10_OBJECTS_KHR

provided by the cl_khr_d3d10_sharing extension.

clEnqueueReleaseD3D10ObjectsKHR

CL_COMMAND_RELEASE_D3D10_OBJECTS_KHR

provided by the cl_khr_d3d10_sharing extension.

clEnqueueAcquireD3D11ObjectsKHR

CL_COMMAND_ACQUIRE_D3D11_OBJECTS_KHR

provided by the cl_khr_d3d11_sharing extension.

clEnqueueReleaseD3D11ObjectsKHR

CL_COMMAND_RELEASE_D3D11_OBJECTS_KHR

provided by the cl_khr_d3d11_sharing extension.

clEnqueueAcquireEGLObjectsKHR

CL_COMMAND_ACQUIRE_EGL_OBJECTS_KHR

provided by the cl_khr_egl_image extension.

clEnqueueReleaseEGLObjectsKHR

CL_COMMAND_RELEASE_EGL_OBJECTS_KHR

provided by the cl_khr_egl_image extension.

clCreateEventFromEGLSyncKHR

CL_COMMAND_EGL_FENCE_SYNC_OBJECT_KHR

provided by the cl_khr_egl_image extension.

clEnqueueAcquireExternalMemObjectsKHR

CL_COMMAND_ACQUIRE_EXTERNAL_MEM_OBJECTS_KHR

provided by the cl_khr_external_memory extension.

clEnqueueReleaseExternalMemObjectsKHR

CL_COMMAND_RELEASE_EXTERNAL_MEM_OBJECTS_KHR

provided by the cl_khr_external_memory extension.

clEnqueueAcquireGLObjects

CL_COMMAND_ACQUIRE_GL_OBJECTS

clEnqueueReleaseGLObjects

CL_COMMAND_RELEASE_GL_OBJECTS

clCreateEventFromGLsyncKHR

CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR

provided by the cl_khr_gl_event extension.

clEnqueueSignalSemaphoresKHR

CL_COMMAND_SEMAPHORE_SIGNAL_KHR

provided by the cl_khr_semaphore extension.

clEnqueueWaitSemaphoresKHR

CL_COMMAND_SEMAPHORE_WAIT_KHR

provided by the cl_khr_semaphore extension.

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_EVENT if event is a not a valid event object.

  • CL_INVALID_VALUE if param_name is not one of the supported values, or if the size in bytes specified by param_value_size is less than size of the return type specified in the Event Object Queries table and param_value is not NULL.

  • CL_INVALID_VALUE if the information to query given in param_name cannot be queried for event.

  • 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


1. 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.
2. 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.