diff options
author | Zhigang Gong <zhigang.gong@intel.com> | 2014-12-12 18:16:59 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@intel.com> | 2014-12-18 15:42:17 +0800 |
commit | 45ca4e85389e7063ced6ae469a4f29c8181abe04 (patch) | |
tree | b40822669e4f21c0b994fffc632e5fee847ce494 /src | |
parent | 7ae159dfd17089e04991617cfc2e021f498c6e61 (diff) |
GBE: switch to CLANG native sampler_t.
CLANG has sampler_t support since LLVM 3.3, let's switch to that type
rather than the old hacky way. One major problem is the sampler static
checking. As Gen platform has some hardware restrication and if the
sampler value is a const defined at kernel side, we need to use the
value to optimize the code path. Now the sampler_t becomes an obaque
type now, the CLANG doesn't support any arithmatic operations on it.
So we have to introduce a new pass to do this optimization.
v2:
fix comments.
Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>
Reviewed-by: "Yang, Rong R" <rong.r.yang@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/cl_kernel.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/cl_kernel.c b/src/cl_kernel.c index a869515a..177cb008 100644 --- a/src/cl_kernel.c +++ b/src/cl_kernel.c @@ -114,11 +114,8 @@ cl_kernel_set_arg(cl_kernel k, cl_uint index, size_t sz, const void *value) arg_sz = interp_kernel_get_arg_size(k->opaque, index); if (UNLIKELY(arg_type != GBE_ARG_LOCAL_PTR && arg_sz != sz)) { - if (arg_sz == 2 && arg_type == GBE_ARG_VALUE && sz == sizeof(cl_sampler)) { - /* FIXME, this is a workaround for the case when a kernel arg - defined a sampler_t but doesn't use it.*/ - arg_type = GBE_ARG_SAMPLER; - } else + if (arg_type != GBE_ARG_SAMPLER || + (arg_type == GBE_ARG_SAMPLER && sz != sizeof(cl_sampler))) return CL_INVALID_ARG_SIZE; } @@ -182,8 +179,9 @@ cl_kernel_set_arg(cl_kernel k, cl_uint index, size_t sz, const void *value) k->args[index].sampler = sampler; cl_set_sampler_arg_slot(k, index, sampler); offset = interp_kernel_get_curbe_offset(k->opaque, GBE_CURBE_KERNEL_ARGUMENT, index); - assert(offset + 2 <= k->curbe_sz); - memcpy(k->curbe + offset, &sampler->clkSamplerValue, 2); + //assert(arg_sz == 4); + assert(offset + 4 <= k->curbe_sz); + memcpy(k->curbe + offset, &sampler->clkSamplerValue, 4); return CL_SUCCESS; } |