Refine error check in SetKernelArg() and support NULL buffer argument
authorRuiling Song <ruiling.song@intel.com>
Fri, 14 Jun 2013 08:32:53 +0000 (16:32 +0800)
committerZhigang Gong <zhigang.gong@linux.intel.com>
Fri, 14 Jun 2013 09:01:13 +0000 (17:01 +0800)
commitb8e88ff296308072986841bbf4a8143e1af6236e
treef3d375c1af25ecf12d4aebfa17e4b61838002f46
parent8a6f1bfc48317a15faa2dd111df0d2566f73801a
Refine error check in SetKernelArg() and support NULL buffer argument

1. refine error check in clSetKernelArg() to follow spec.
2. add support NULL buffer as argument, so user could write like below:
    __kernel void func(__global int * p1, constant int* p2) {
      if(p1) {
        //do some thing if p1 is not NULL.
      } else {
        //do other things if p1 is NULL
      }
    }
    Then calling clSetKernelArg(k, 0, sizeof(cl_mem), NULL);
3. as there maybe small possibility that we get a 0 starting address for bo,
   we add an assert() to make sure we do not get a 0 addressed bo.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
backend/src/llvm/llvm_gen_backend.cpp
src/cl_command_queue.c
src/cl_kernel.c
src/intel/intel_gpgpu.c