Refine the cl thread implement for queue.
authorJunyan He <junyan.he@linux.intel.com>
Fri, 30 May 2014 06:28:30 +0000 (14:28 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Fri, 30 May 2014 06:55:22 +0000 (14:55 +0800)
commit1af480108c48e58f04126d195b413ab4c6552594
tree82c88a876c882573b88b4331e400a03c41f1122f
parent0db692659e4bc6ce25c19cb56ae07f2c46425d6e
Refine the cl thread implement for queue.

Because the cl_command_queue can be used in several threads simultaneously but
without add ref to it, we now handle it like this:
Keep one threads_slot_array, every time the thread get gpgpu or batch buffer, if it
does not have a slot, assign it.
The resources are keeped in queue private, and resize it if needed.
When the thread exit, the slot will be set invalid.
When queue released, all the resources will be released. If user still enqueue, flush
or finish the queue after it has been released, the behavior is undefined.
TODO: Need to shrink the slot map.

Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
src/cl_command_queue.c
src/cl_command_queue_gen7.c
src/cl_context.c
src/cl_device_id.c
src/cl_thread.c
src/cl_thread.h