summaryrefslogtreecommitdiff
path: root/src/cl_event.c
diff options
context:
space:
mode:
authorJunyan He <junyan.he@linux.intel.com>2013-10-18 10:19:51 +0800
committerZhigang Gong <zhigang.gong@intel.com>2013-10-18 10:57:35 +0800
commit2e3563456907193e042f9122c3ee33013dd2a9b1 (patch)
tree055e4b1b57f3e914fdd22a8687df4c54f138d4f2 /src/cl_event.c
parent8e054547c78ba37a87ef0b43457a777c87879431 (diff)
downloadbeignet-2e3563456907193e042f9122c3ee33013dd2a9b1.tar.gz
Using the PIPE_CONTROL to implement get time stamp in gen backend
We use PIPE_CONTROL to get the time stamps from GPU just after batch start and before batch flush. Using the first one the caculate the CL_PROFILING_COMMAND_START time and uing the second one to caculate the CL_PROFILING_COMMAND_END time. There are 2 limitations here: 1. Then end time stamp is just before the FLUSH, so the Flush time is not included, which will cause to lose the accuracy. Because the we do not know which event will be used to do the profling when it is created, adding another flush for end time stamp may add some overload. 2. The time of CPU and GPU can not be sync correctly now. So the time of CL_PROFILING_COMMAND_QUEUED and CL_PROFILING_COMMAND_SUBMIT which happens on CPU side can not be caculated correctly with the same base time of GPU. So we just simplely set them to CL_PROFILING_COMMAND_START now. For the Event not involving GPU operations such as ReadBuffer, all the times are 0 now. Signed-off-by: Junyan He <junyan.he@linux.intel.com> Reviewed-by: Yang Rong <rong.r.yang@intel.com>
Diffstat (limited to 'src/cl_event.c')
-rw-r--r--src/cl_event.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/cl_event.c b/src/cl_event.c
index 918e245a..212f1eec 100644
--- a/src/cl_event.c
+++ b/src/cl_event.c
@@ -490,3 +490,25 @@ cl_int cl_event_marker(cl_command_queue queue, cl_event* event)
cl_event_set_status(*event, CL_COMPLETE);
return CL_SUCCESS;
}
+
+cl_int cl_event_profiling(cl_event event, cl_profiling_info param_name, cl_ulong *ret_val)
+{
+ if (!event->gpgpu_event) {
+ /* Some event like read buffer do not need GPU involved, so
+ we just return all the profiling to 0 now. */
+ *ret_val = 0;
+ return CL_SUCCESS;
+ }
+
+ if(param_name == CL_PROFILING_COMMAND_START ||
+ param_name == CL_PROFILING_COMMAND_QUEUED ||
+ param_name == CL_PROFILING_COMMAND_SUBMIT) {
+ cl_gpgpu_event_get_timestamp(event->gpgpu_event, 0, ret_val);
+ return CL_SUCCESS;
+ } else if (param_name == CL_PROFILING_COMMAND_END) {
+ cl_gpgpu_event_get_timestamp(event->gpgpu_event, 1, ret_val);
+ return CL_SUCCESS;
+ } else {
+ return CL_INVALID_VALUE;
+ }
+}