Contact
Kevin Petit, kevin.petit@arm.com
Dependencies
This extension is written against the OpenCL Specification Version 3.0.6.
This extension requires OpenCL 1.0.
Overview
This extension enables the controlled termination of kernels using a built-in function. It also enables the termination reason to be queried on devices that support it. This makes it possible to end the execution of a successful search kernel early or implement assert-like functionnality using printf.
New API Types
typedef cl_uint cl_command_termination_reason_arm;
#define CL_COMMAND_TERMINATION_COMPLETION_ARM 0
#define CL_COMMAND_TERMINATION_CONTROLLED_SUCCESS_ARM 1
#define CL_COMMAND_TERMINATION_CONTROLLED_FAILURE_ARM 2
#define CL_COMMAND_TERMINATION_ERROR_ARM 3
New API Enums
Error code reported for the status of events:
CL_COMMAND_TERMINATED_ITSELF_WITH_FAILURE_ARM -1108
Accepted value for the param_name parameter to clGetEventInfo:
CL_EVENT_COMMAND_TERMINATION_REASON_ARM 0x41ED
Accepted value for the param_name parameter to clGetDeviceInfo:
CL_DEVICE_CONTROLLED_TERMINATION_CAPABILITIES_ARM 0x41EE
#define CL_DEVICE_CONTROLLED_TERMINATION_SUCCESS_ARM (1 << 0)
#define CL_DEVICE_CONTROLLED_TERMINATION_FAILURE_ARM (1 << 1)
#define CL_DEVICE_CONTROLLED_TERMINATION_QUERY_ARM (1 << 2)
New OpenCL C Types and Functions
typedef enum {
ARM_TERMINATION_SUCCESS,
ARM_TERMINATION_FAILURE
} arm_termination_reason;
void arm_terminate_kernel(arm_termination_reason reason);
Modifications to the OpenCL API Specification
- (Modify Section 4.2, Querying Devices)
-
- (Add the following to Table 5, List of supported param_names by *clGetDeviceInfo*)
cl_device_info | Return Type | Description |
---|---|---|
|
|
Returns a bitfield describing which features of this extension
are supported by the device. |
- (Modify Section 5.11, Event Objects)
-
- (Add the following to Table 36, List of supported param_names by *clGetEventInfo*)
cl_event_info | Return Type | Description |
---|---|---|
|
|
Returns the reason for a command’s execution having ended: |
|
|
Returns |
The following new error conditions are added for clGetEventInfo:
-
{CL_INVALID_EVENT} if event does not correspond to a
CL_COMMAND_NDRANGE_KERNEL
orCL_COMMAND_TASK
command. -
{CL_INVALID_OPERATION} if the
CL_EVENT_COMMAND_EXECUTION_STATUS
of event is neitherCL_COMPLETE
nor a negative value.
Modifications to the OpenCL C Specification
- (Add a new Section 6.15.X, Controlled kernel termination)
-
arm_terminate_kernel
void arm_terminate_kernel(arm_termination_reason reason);
Any work-item calling this function will provoke the early termination of the whole kernel instance. No guarantees are given as to how early the termination occurs. Implementations are expected to terminate the kernel as quickly as possible.