diff options
author | Junyan He <junyan.he@linux.intel.com> | 2015-06-11 19:25:44 +0800 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2015-07-02 17:49:37 +0800 |
commit | 75a3bcc09b009d630771b149a469da34c6abe9bc (patch) | |
tree | 71a3ef63addf342739205608302218d1d384cff1 /kernels/compiler_half_math.cl | |
parent | ed5280350aeeeb73a3d5882ce35b2de9f340d4b1 (diff) |
utest: Add test cases for half.
Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Reviewed-by: "Yang, Rong R" <rong.r.yang@intel.com>
Diffstat (limited to 'kernels/compiler_half_math.cl')
-rw-r--r-- | kernels/compiler_half_math.cl | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/kernels/compiler_half_math.cl b/kernels/compiler_half_math.cl new file mode 100644 index 00000000..a11a9566 --- /dev/null +++ b/kernels/compiler_half_math.cl @@ -0,0 +1,28 @@ +#pragma OPENCL EXTENSION cl_khr_fp16 : enable + +#define MATH_KERNEL_ARG1(NAME) \ + kernel void compiler_half_math_##NAME(global half *src, global half *dst) { \ + int i = get_global_id(0); \ + dst[i] = NAME(src[i]); \ + } + +MATH_KERNEL_ARG1(sin); +MATH_KERNEL_ARG1(cos); +MATH_KERNEL_ARG1(sinh); +MATH_KERNEL_ARG1(cosh); +MATH_KERNEL_ARG1(tan); +MATH_KERNEL_ARG1(log10); +MATH_KERNEL_ARG1(log); +MATH_KERNEL_ARG1(trunc); +MATH_KERNEL_ARG1(exp); +MATH_KERNEL_ARG1(sqrt); +MATH_KERNEL_ARG1(ceil); + +#define MATH_KERNEL_ARG2(NAME) \ + kernel void compiler_half_math_##NAME(global half4 *src0, global half4 *src1, global half4 *dst) { \ + int i = get_global_id(0); \ + dst[i] = NAME(src0[i], src1[i]); \ + } +MATH_KERNEL_ARG2(fmod); +MATH_KERNEL_ARG2(fmax); +MATH_KERNEL_ARG2(fmin); |