GBE: refine the sampler implementation to comply with spec.
authorZhigang Gong <zhigang.gong@linux.intel.com>
Tue, 7 May 2013 06:15:45 +0000 (14:15 +0800)
committerZhigang Gong <zhigang.gong@linux.intel.com>
Wed, 15 May 2013 09:09:50 +0000 (17:09 +0800)
commit54bd6e4dc706d85f5df81e55126865f7d7ad383d
treec7d4e776695d6a598d4a6bd333edc97aaefa41d1
parent19e9c58f29362151d0f3900ca5a7b12bbce3e2c2
GBE: refine the sampler implementation to comply with spec.

The previous implementation is to use a new address space pointer to
represent a sampler. The reason is that there is no specified data
type for sampler_t in LLVM front end thus we can't determine the
sampler argument type if we use a normal interger to represnet the
sampler. But that breaks the OCL spec, the spec allows the kernel
to define and initialize sampler variables in kernel side.

Now I use a little tricky way to fix this problem. First, I decide
to use normal unsigned interger to represent sampler_t in kernel side.
Then at compile time, I check read_imagexxx function's sampler
arguments. If the argument is a constant value, then it should be a
kernel side defined sampler, then I insert the sampler type into a
global sampler set for the current kernel function. If the argument
is not a constant value, then I will check whether it's a kernel
argument, if it is, then I fix up the corresponding kernel arg type
to SAMPLER there.

To unify the kernel side defined sampler and kernel argument sampler,
I add two new gbe API. To export all the kernel side defined sampler
data and size to the runtime library. Then latter, the runtime library
can use this information to append new sampler to the unified sampler
buffer and bind all the sampler at one time.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Tested-by: Lv, Meng <meng.lv@intel.com>
backend/src/CMakeLists.txt
backend/src/backend/program.cpp
backend/src/backend/program.h
backend/src/backend/program.hpp
backend/src/ir/function.cpp
backend/src/ir/function.hpp
backend/src/ir/sampler.cpp [new file with mode: 0644]
backend/src/ir/sampler.hpp [new file with mode: 0644]
backend/src/llvm/llvm_gen_backend.cpp
backend/src/ocl_stdlib.h