[Beignet] [PATCH v2] add half math function support.

Zhigang Gong zhigang.gong at linux.intel.com
Fri Dec 19 00:56:52 PST 2014


This patch LGTM, just pushed, thanks.

On Fri, Dec 19, 2014 at 04:29:32PM +0800, xionghu.luo at intel.com wrote:
> From: Luo Xionghu <xionghu.luo at intel.com>
> 
> simply define the half_xxx functions to xxx.
> 
> v2: functions need be defined to native_xxx since they could pass under
> non-strict conformance mode except sin/cos/powr/tan.
> 
> Signed-off-by: Luo Xionghu <xionghu.luo at intel.com>
> ---
>  backend/src/libocl/tmpl/ocl_math.tmpl.h |   16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/backend/src/libocl/tmpl/ocl_math.tmpl.h b/backend/src/libocl/tmpl/ocl_math.tmpl.h
> index 69ee3f3..0075797 100644
> --- a/backend/src/libocl/tmpl/ocl_math.tmpl.h
> +++ b/backend/src/libocl/tmpl/ocl_math.tmpl.h
> @@ -117,4 +117,18 @@ OVERLOADABLE float native_sin(float x);
>  OVERLOADABLE float native_sqrt(float x);
>  OVERLOADABLE float native_tan(float x);
>  
> -// half  not supported now.
> +// half
> +#define half_cos cos
> +#define half_divide native_divide
> +#define half_exp native_exp
> +#define half_exp2 native_exp2
> +#define half_exp10 native_exp10
> +#define half_log native_log
> +#define half_log2 native_log2
> +#define half_log10 native_log10
> +#define half_powr powr
> +#define half_recip native_recip
> +#define half_rsqrt native_rsqrt
> +#define half_sin sin
> +#define half_sqrt native_sqrt
> +#define half_tan tan
> -- 
> 1.7.9.5
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list