Contact
Sreelakshmi Haridas Maruthur, Qualcomm Innovation Center, Inc. (sharidas at quicinc dot com)
Dependencies
OpenCL 1.1 or later is required.
This extension is written against the OpenCL API specification Version 3.0.17.
Overview
This extension allows applications to request the performance level desired for device(s) on an OpenCL context.
Higher performance implies higher frequencies on the device.
The hint may be provided at context creation as a context property and/or updated using a separate API at any point during the context’s lifetime.
New API Enums
Added to the list of supported properties by clCreateContext
#define CL_CONTEXT_PERF_HINT_QCOM 0x40C2
New list of supported values for CL_CONTEXT_PERF_HINT_QCOM property
#define CL_PERF_HINT_HIGH_QCOM 0x40C3
#define CL_PERF_HINT_NORMAL_QCOM 0x40C4
#define CL_PERF_HINT_LOW_QCOM 0x40C5
Modifications to the OpenCL API Specification
Additions to Section 4.4 - "Contexts"
- Add to Table 13. List of supported context creation properties by clCreateContext
-
Context Property Property Value Description CL_CONTEXT_PERF_HINT_QCOMcl_perf_hint_qcomSpecifies the performance hint for this context.
- Table 13a List of supported performance hint values and their effect on performance
|
Description |
|
Requests the highest performance level from device. This is the default setting for devices in an OpenCL context. |
|
Requests a balanced performance setting that is set dynamically by the GPU frequency and power management. |
|
Requests a performance setting that prioritizes lower power consumption |
- Add the following error descriptions for clCreateContext
-
CL_INVALID_PROPERTY if the the context property
CL_CONTEXT_PERF_HINT_QCOMis specified and at least one of the devices in <devices> does not support the performance hint property - Add to Table 14. List of supported param_names by clGetContextInfo append to the entry for CL_CONTEXT_PROPERTIES
| cl_context_info | Return Type | Information returned in param_value |
|---|---|---|
|
|
If a |
- Add the following new function
-
The function
cl_int clSetPerfHintQCOM(cl_context context, cl_perf_hint_qcom perf_hint);can be used to set the value of CL_CONTEXT_PERF_HINT_QCOM property on a context This function can be used to set or update the CL_CONTEXT_PERF_HINT_QCOM property irrespective of whether it was specified at context time as one of the context properties.
-
context must be a valid OpenCL context
-
perf_hint identifies the hint being set. It has to be one of the values in Table 13a
clSetPerfHintQCOMreturnsCL_SUCCESSif the propertyCL_CONTEXT_PERF_HINT_QCOMwas set to the provided value. Otherwise, it returns one of the following errors:-
CL_INVALID_CONTEXTif context is not a valid context -
CL_INVALID_PROPERTYif least one of the devices in the context does not support the performance hint property -
CL_INVALID_VALUEif the value of perf_hint is not one of the supported values as specified in Table 13a. -
CL_OUT_OF_RESOURCESif there is a failure to set the perf-hint on any device in the context -
CL_OUT_OF_HOST_MEMORYif there is a failure to allocate resources required by the OpenCL implementation on the host
The effect of
clSetPerfHintQCOMon commands that are in flight is undefined. These commands may be executed at either of the existing or new performance levels. If the user desires to complete all pending work at the existing level and execute all subsequent commands at the new level, a clFinish must be added before callingclSetPerfHintQCOMto set the new level. -
Sample Code
1) Set performance hint at time of CL context creation:
cl_context_properties properties[] = {CL_CONTEXT_PERF_HINT_QCOM,
CL_PERF_HINT_LOW_QCOM, 0};
clCreateContext(properties, 1, &device_id, NULL, NULL, NULL);
2) Set performance hint for an existing CL context:
clSetPerfHintQCOM(context, CL_PERF_HINT_NORMAL_QCOM);