diff options
author | Zhigang Gong <zhigang.gong@intel.com> | 2015-04-10 09:54:49 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@intel.com> | 2015-04-10 16:21:38 +0800 |
commit | 4c530f94ee4e016e32997bb60f7f74589301b412 (patch) | |
tree | f1abd2bb2e14216efeeda9b5c75dd5af83dc208c /src/cl_command_queue.c | |
parent | ee2c51cddd03c8d22c38612ec1bc40637d84b22d (diff) | |
download | beignet-4c530f94ee4e016e32997bb60f7f74589301b412.tar.gz |
runtime: Enhance the error handling when flush gpgpu command queue.
Beignet uses drm_intel_gem_bo_context_exec() to flush command queue to
linux drm driver layer. We need to check the return value of that function,
as it may fail when the application uses very large array.
Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>
Reviewed-by: "Yang, Rong R" <rong.r.yang@intel.com>
Diffstat (limited to 'src/cl_command_queue.c')
-rw-r--r-- | src/cl_command_queue.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/cl_command_queue.c b/src/cl_command_queue.c index be6def15..da71fb70 100644 --- a/src/cl_command_queue.c +++ b/src/cl_command_queue.c @@ -216,14 +216,15 @@ error: return err; } -LOCAL void +LOCAL int cl_command_queue_flush_gpgpu(cl_command_queue queue, cl_gpgpu gpgpu) { size_t global_wk_sz[3]; size_t outbuf_sz = 0; void* printf_info = cl_gpgpu_get_printf_info(gpgpu, global_wk_sz, &outbuf_sz); - cl_gpgpu_flush(gpgpu); + if (cl_gpgpu_flush(gpgpu) < 0) + return CL_OUT_OF_RESOURCES; if (printf_info && interp_get_printf_num(printf_info)) { void *index_addr = cl_gpgpu_map_printf_buffer(gpgpu, 0); @@ -244,13 +245,15 @@ cl_command_queue_flush_gpgpu(cl_command_queue queue, cl_gpgpu gpgpu) global_wk_sz[0] = global_wk_sz[1] = global_wk_sz[2] = 0; cl_gpgpu_set_printf_info(gpgpu, NULL, global_wk_sz); } + return CL_SUCCESS; } LOCAL cl_int cl_command_queue_flush(cl_command_queue queue) { + int err; GET_QUEUE_THREAD_GPGPU(queue); - cl_command_queue_flush_gpgpu(queue, gpgpu); + err = cl_command_queue_flush_gpgpu(queue, gpgpu); // As we don't have a deadicate timer thread to take care the possible // event which has a call back function registerred and the event will // be released at the call back function, no other function will access @@ -258,10 +261,10 @@ cl_command_queue_flush(cl_command_queue queue) // and all the corresponding buffers which is really bad. if (queue->last_event && queue->last_event->user_cb) cl_event_update_status(queue->last_event, 1); - if (queue->current_event) - cl_event_flush(queue->current_event); + if (queue->current_event && err == CL_SUCCESS) + err = cl_event_flush(queue->current_event); cl_invalid_thread_gpgpu(queue); - return CL_SUCCESS; + return err; } LOCAL cl_int |