[Beignet] [PATCH] When local_work_size is null, try to choose a local_work_size.
Yang Rong
rong.r.yang at intel.com
Thu Nov 28 18:59:59 PST 2013
Signed-off-by: Yang Rong <rong.r.yang at intel.com>
---
src/cl_api.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/cl_api.c b/src/cl_api.c
index 6acc1a2..08f01d2 100644
--- a/src/cl_api.c
+++ b/src/cl_api.c
@@ -2361,7 +2361,7 @@ clEnqueueNDRangeKernel(cl_command_queue command_queue,
size_t fixed_global_sz[] = {1,1,1};
size_t fixed_local_sz[] = {1,1,1};
cl_int err = CL_SUCCESS;
- cl_uint i;
+ cl_uint i, j;
enqueue_data *data, no_wait_data = { 0 };
CHECK_QUEUE(command_queue);
@@ -2407,9 +2407,16 @@ clEnqueueNDRangeKernel(cl_command_queue command_queue,
//FATAL_IF(event_wait_list != NULL, "Events are not supported");
//FATAL_IF(event != NULL, "Events are not supported");
- if (local_work_size != NULL)
+ if (local_work_size != NULL) {
for (i = 0; i < work_dim; ++i)
fixed_local_sz[i] = local_work_size[i];
+ } else {
+ for (i = 0; i< work_dim; i++)
+ for (j = 64; j > 1; j--) { //check from 64?
+ if (global_work_size[i] % j == 0) //global_work_size always non null
+ fixed_local_sz[i] = j;
+ }
+ }
if (global_work_size != NULL)
for (i = 0; i < work_dim; ++i)
fixed_global_sz[i] = global_work_size[i];
--
1.8.1.2
More information about the Beignet
mailing list