[Beignet] [PATCH 1/2] utests: use mad which will get better precision.

Zhigang Gong zhigang.gong at linux.intel.com
Tue Nov 5 20:00:12 PST 2013


LGTM, pushed, thanks.

On Tue, Nov 05, 2013 at 04:37:12PM +0800, Ruiling Song wrote:
> Normal mul/add could not met the precision requirement of this case.
> Previously it passed because we will do mad optimization in backend.
> Use mad directly, so the test case does not depend on backend optimization.
> 
> Signed-off-by: Ruiling Song <ruiling.song at intel.com>
> ---
>  kernels/compiler_menger_sponge_no_shadow.cl |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernels/compiler_menger_sponge_no_shadow.cl b/kernels/compiler_menger_sponge_no_shadow.cl
> index 4de6c10..27b059a 100644
> --- a/kernels/compiler_menger_sponge_no_shadow.cl
> +++ b/kernels/compiler_menger_sponge_no_shadow.cl
> @@ -15,7 +15,7 @@ typedef float4 vec4;
>  
>  // fmod is not like glsl mod!
>  inline __attribute__((always_inline, overloadable))
> -float glsl_mod(float x,float y) { return x-y*floor(x/y); }
> +float glsl_mod(float x,float y) { return mad( -y, floor(x/y), x); }
>  inline __attribute__((always_inline, overloadable))
>  float2 glsl_mod(float2 a,float2 b) { return (float2)(glsl_mod(a.x,b.x), glsl_mod(a.y,b.y)); }
>  inline __attribute__((always_inline, overloadable))
> -- 
> 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