summaryrefslogtreecommitdiff
path: root/utests/profiling_exec.cpp
diff options
context:
space:
mode:
authorPan Xiuli <xiuli.pan@intel.com>2015-11-03 11:29:26 +0800
committerYang Rong <rong.r.yang@intel.com>2015-11-03 19:51:35 +0800
commit9ecf64caf823eb92b2721bc5026dc0b4e769a464 (patch)
tree1750f6391afa8d803b304ce3c8ffb7519e2b1481 /utests/profiling_exec.cpp
parent96995ea2c9fcf1ddfc26f3cd911bca5df2841d83 (diff)
downloadbeignet-9ecf64caf823eb92b2721bc5026dc0b4e769a464.tar.gz
utests: fix multithread queue chaos
Utest profiling exec create a new queue and replace the global shared queue for no use. It will result in some strange segmeng fault. Fix by removing the replacment of the global queue. Signed-off-by: Pan Xiuli <xiuli.pan@intel.com> Reviewed-by: Ruiling Song <ruiling.song@intel.com>
Diffstat (limited to 'utests/profiling_exec.cpp')
-rw-r--r--utests/profiling_exec.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/utests/profiling_exec.cpp b/utests/profiling_exec.cpp
index 42327723..437a6285 100644
--- a/utests/profiling_exec.cpp
+++ b/utests/profiling_exec.cpp
@@ -45,7 +45,6 @@ static void profiling_exec(void)
const size_t n = 512;
cl_int status = CL_SUCCESS;
cl_command_queue profiling_queue = NULL;
- cl_command_queue tmp_queue = NULL;
float* cpu_src = (float *)malloc(n*sizeof(float));
float* cpu_dst = (float *)malloc(n*sizeof(float));
cl_event exec_event;
@@ -56,10 +55,6 @@ static void profiling_exec(void)
profiling_queue = clCreateCommandQueue(ctx, device, CL_QUEUE_PROFILING_ENABLE, &status);
OCL_ASSERT(status == CL_SUCCESS);
- /* save the default queue. */
- tmp_queue = queue;
- queue = profiling_queue;
-
OCL_CREATE_KERNEL("compiler_fabs");
OCL_CREATE_BUFFER(buf[0], 0, n * sizeof(float), NULL);
@@ -77,7 +72,7 @@ static void profiling_exec(void)
cpu_exec(n, cpu_src, cpu_dst);
// Run the kernel on GPU
- OCL_CALL(clEnqueueNDRangeKernel, queue, kernel, 1, NULL, globals, locals, 0, NULL, &exec_event);
+ OCL_CALL(clEnqueueNDRangeKernel, profiling_queue, kernel, 1, NULL, globals, locals, 0, NULL, &exec_event);
OCL_CALL(clWaitForEvents, 1, &exec_event);
OCL_CALL(clGetEventProfilingInfo, exec_event, CL_PROFILING_COMMAND_QUEUED, sizeof(cl_ulong), &time_queue, NULL);
@@ -94,7 +89,6 @@ static void profiling_exec(void)
OCL_ASSERT(((float *)buf_data[1])[i] == cpu_dst[i]);
OCL_UNMAP_BUFFER(1);
- queue = tmp_queue;
clReleaseCommandQueue(profiling_queue);
free(cpu_dst);
free(cpu_src);