[Beignet] [PATCH 1/2] GBE: fix some builtin math function

Zhigang Gong zhigang.gong at linux.intel.com
Mon Jun 23 02:02:25 PDT 2014


This patchset LGTM, just pushed, thanks.
On Mon, Jun 23, 2014 at 04:34:54PM +0800, Ruiling Song wrote:
> __gen_ocl_exp stands for 2^x. So, use __gen_ocl_pow to implement native_exp().
> Fix atanh implementation.
> 
> Signed-off-by: Ruiling Song <ruiling.song at intel.com>
> ---
>  backend/src/ocl_stdlib.tmpl.h |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/backend/src/ocl_stdlib.tmpl.h b/backend/src/ocl_stdlib.tmpl.h
> index fc6de25..6836de4 100755
> --- a/backend/src/ocl_stdlib.tmpl.h
> +++ b/backend/src/ocl_stdlib.tmpl.h
> @@ -2258,8 +2258,8 @@ INLINE_OVERLOADABLE float native_tan(float x) {
>  INLINE_OVERLOADABLE float __gen_ocl_internal_tanpi(float x) {
>    return native_tan(x * M_PI_F);
>  }
> -INLINE_OVERLOADABLE float native_exp(float x) { return __gen_ocl_exp(x); }
> -INLINE_OVERLOADABLE float native_exp2(float x) { return __gen_ocl_pow(2, x); }
> +INLINE_OVERLOADABLE float native_exp2(float x) { return __gen_ocl_exp(x); }
> +INLINE_OVERLOADABLE float native_exp(float x) { return __gen_ocl_pow(M_E_F, x); }
>  INLINE_OVERLOADABLE float native_exp10(float x) { return __gen_ocl_pow(10, x); }
>  INLINE_OVERLOADABLE float __gen_ocl_internal_cbrt(float x) {
>    /* copied from fdlibm */
> @@ -4863,7 +4863,7 @@ INLINE_OVERLOADABLE float __gen_ocl_internal_fastpath_asinh (float x)
>  
>  INLINE_OVERLOADABLE float __gen_ocl_internal_fastpath_atanh (float x)
>  {
> -    return 0.5f * native_sqrt((1 + x) / (1 - x));
> +    return 0.5f * native_log((1 + x) / (1 - x));
>  }
>  
>  INLINE_OVERLOADABLE float __gen_ocl_internal_fastpath_cbrt (float x)
> -- 
> 1.7.10.4
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list