diff options
author | Wind Yuan <feng.yuan@intel.com> | 2017-11-23 19:46:40 +0800 |
---|---|---|
committer | windyuan <feng.yuan@intel.com> | 2017-11-24 09:59:59 +0800 |
commit | 8acce6e12644589b5e7046f56b17c504b32af3fb (patch) | |
tree | 9a12b9b1f7a10e7d86b848011026fb1decf084a1 | |
parent | 25b6737668ff90a1ada2b2d7beee6e4c13acfcdc (diff) | |
download | libxcam-8acce6e12644589b5e7046f56b17c504b32af3fb.tar.gz |
ocl: improve ocl log with error code
Signed-off-by: Wind Yuan <feng.yuan@intel.com>
-rw-r--r-- | modules/ocl/cl_context.cpp | 18 | ||||
-rw-r--r-- | modules/ocl/cl_device.cpp | 18 | ||||
-rw-r--r-- | modules/ocl/cl_device.h | 2 |
3 files changed, 25 insertions, 13 deletions
diff --git a/modules/ocl/cl_context.cpp b/modules/ocl/cl_context.cpp index 039449d..5ff47e2 100644 --- a/modules/ocl/cl_context.cpp +++ b/modules/ocl/cl_context.cpp @@ -94,7 +94,7 @@ CLContext::CLContext (SmartPtr<CLDevice> &device) , _device (device) { if (!init_context ()) { - XCAM_LOG_DEBUG ("CL init context failed"); + XCAM_LOG_ERROR ("CL init context failed"); } XCAM_LOG_DEBUG ("CLContext constructed"); @@ -164,7 +164,7 @@ CLContext::init_context () XCAM_ASSERT (_context_id == NULL); if (!_device->is_inited()) { - XCAM_LOG_DEBUG ("create cl context failed since device "); + XCAM_LOG_ERROR ("create cl context failed since device is not initialized"); return false; } @@ -297,7 +297,7 @@ CLContext::create_cmd_queue (SmartPtr<CLContext> &self) cmd_queue_id = clCreateCommandQueue (_context_id, device_id, 0, &err_code); #endif if (err_code != CL_SUCCESS) { - XCAM_LOG_WARNING ("create CL command queue failed."); + XCAM_LOG_WARNING ("create CL command queue failed, errcode:%d", err_code); return NULL; } @@ -371,14 +371,14 @@ CLContext::generate_kernel_id ( if (gen_binary != NULL && binary_size != NULL) { error_code = clGetProgramInfo (program.id, CL_PROGRAM_BINARY_SIZES, sizeof (size_t) * 1, binary_size, NULL); if (error_code != CL_SUCCESS) { - XCAM_LOG_WARNING ("CL query binary sizes failed on %s", name); + XCAM_LOG_WARNING ("CL query binary sizes failed on %s, errcode:%d", name, error_code); } *gen_binary = (uint8_t *) xcam_malloc0 (sizeof (uint8_t) * (*binary_size)); error_code = clGetProgramInfo (program.id, CL_PROGRAM_BINARIES, sizeof (uint8_t *) * 1, gen_binary, NULL); if (error_code != CL_SUCCESS) { - XCAM_LOG_WARNING ("CL query program binaries failed on %s", name); + XCAM_LOG_WARNING ("CL query program binaries failed on %s, errcode:%d", name, error_code); } } @@ -502,7 +502,7 @@ CLContext::import_dma_image (const cl_import_image_info_intel &import_info) WARNING, errcode == CL_SUCCESS, NULL, - "import cl memory from dma image failed"); + "import cl memory from dma image failed, errcode:%d", errcode); return mem_id; } @@ -524,7 +524,7 @@ CLContext::create_image ( WARNING, errcode == CL_SUCCESS, NULL, - "create cl image failed"); + "create cl image failed, errcode:%d", errcode); return mem_id; } @@ -552,7 +552,7 @@ CLContext::create_buffer (uint32_t size, cl_mem_flags flags, void *host_ptr) WARNING, errcode == CL_SUCCESS, NULL, - "create cl buffer failed"); + "create cl buffer failed, errcode:%d", errcode); return mem_id; } @@ -570,7 +570,7 @@ CLContext::create_sub_buffer ( WARNING, errcode == CL_SUCCESS, NULL, - "create sub buffer failed"); + "create sub buffer failed, errcode:%d", errcode); return sub_mem; } diff --git a/modules/ocl/cl_device.cpp b/modules/ocl/cl_device.cpp index fad10b8..948ce0e 100644 --- a/modules/ocl/cl_device.cpp +++ b/modules/ocl/cl_device.cpp @@ -120,16 +120,18 @@ CLDevice::init () //continue XCAM_LOG_WARNING ("cl get device info failed but continue"); } else { - XCAM_LOG_DEBUG ( + XCAM_LOG_INFO ( "cl get device info,\n" "\tmax_compute_unit:%" PRIu32 "\tmax_work_item_dims:%" PRIu32 "\tmax_work_item_sizes:{%" PRIuS ", %" PRIuS ", %" PRIuS "}" - "\tmax_work_group_size:%" PRIuS, + "\tmax_work_group_size:%" PRIuS + "\timage_pitch_alignment:%" PRIu32, device_info.max_compute_unit, device_info.max_work_item_dims, device_info.max_work_item_sizes[0], device_info.max_work_item_sizes[1], device_info.max_work_item_sizes[2], - device_info.max_work_group_size); + device_info.max_work_group_size, + device_info.image_pitch_alignment); } // get platform name string length @@ -172,6 +174,14 @@ CLDevice::query_device_info (cl_device_id device_id, CLDevieInfo &info) XCAM_CL_GET_DEVICE_INFO (CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, info.max_work_item_dims); XCAM_CL_GET_DEVICE_INFO (CL_DEVICE_MAX_WORK_ITEM_SIZES, info.max_work_item_sizes); XCAM_CL_GET_DEVICE_INFO (CL_DEVICE_MAX_WORK_GROUP_SIZE, info.max_work_group_size); + XCAM_CL_GET_DEVICE_INFO (CL_DEVICE_MAX_WORK_GROUP_SIZE, info.max_work_group_size); + + cl_uint alignment = 0; + XCAM_CL_GET_DEVICE_INFO (CL_DEVICE_IMAGE_PITCH_ALIGNMENT, alignment); + if (alignment) + info.image_pitch_alignment = alignment; + else + info.image_pitch_alignment = 4; return true; } @@ -184,7 +194,7 @@ CLDevice::create_default_context () // init first cmdqueue if (context->is_valid () && !context->init_cmd_queue (context)) { - XCAM_LOG_DEBUG ("CL context init cmd queue failed"); + XCAM_LOG_ERROR ("CL context init cmd queue failed"); } _default_context = context; return true; diff --git a/modules/ocl/cl_device.h b/modules/ocl/cl_device.h index fc0870f..06a8121 100644 --- a/modules/ocl/cl_device.h +++ b/modules/ocl/cl_device.h @@ -35,11 +35,13 @@ struct CLDevieInfo { uint32_t max_work_item_dims; size_t max_work_item_sizes [3]; size_t max_work_group_size; + uint32_t image_pitch_alignment; CLDevieInfo () : max_compute_unit (0) , max_work_item_dims (0) , max_work_group_size (0) + , image_pitch_alignment (4) { xcam_mem_clear (max_work_item_sizes); } |