[Beignet] [PATCH 2/2] Backend: refine the geometry function

Song, Ruiling ruiling.song at intel.com
Tue Mar 7 05:53:55 UTC 2017


> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of
> rander
> Sent: Monday, March 6, 2017 10:20 AM
> To: beignet at lists.freedesktop.org
> Cc: Wang, Rander <rander.wang at intel.com>
> Subject: [Beignet] [PATCH 2/2] Backend: refine the geometry function
> 
> Signed-off-by: rander <rander.wang at intel.com>
> ---
>  backend/src/libocl/src/ocl_geometric.cl | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/backend/src/libocl/src/ocl_geometric.cl
> b/backend/src/libocl/src/ocl_geometric.cl
> index af39ed3..1f66daa 100644
> --- a/backend/src/libocl/src/ocl_geometric.cl
> +++ b/backend/src/libocl/src/ocl_geometric.cl
> @@ -100,10 +100,10 @@ OVERLOADABLE float fast_length(float x) { return
> __gen_ocl_fabs(x); }
>  OVERLOADABLE float fast_length(float2 x) { return sqrt(dot(x,x)); }
>  OVERLOADABLE float fast_length(float3 x) { return sqrt(dot(x,x)); }
>  OVERLOADABLE float fast_length(float4 x) { return sqrt(dot(x,x)); }
> -OVERLOADABLE float fast_distance(float x, float y) { return length(x-y); }
> -OVERLOADABLE float fast_distance(float2 x, float2 y) { return length(x-y); }
> -OVERLOADABLE float fast_distance(float3 x, float3 y) { return length(x-y); }
> -OVERLOADABLE float fast_distance(float4 x, float4 y) { return length(x-y); }
> +OVERLOADABLE float fast_distance(float x, float y) { return fast_length(x-y); }
> +OVERLOADABLE float fast_distance(float2 x, float2 y) { return fast_length(x-y); }
> +OVERLOADABLE float fast_distance(float3 x, float3 y) { return fast_length(x-y); }
> +OVERLOADABLE float fast_distance(float4 x, float4 y) { return fast_length(x-y); }
>  OVERLOADABLE float fast_normalize(float x) { return x > 0 ? 1.f : (x < 0 ? -1.f :
> 0.f); }
>  OVERLOADABLE float2 fast_normalize(float2 x) { return x * rsqrt(dot(x, x)); }
>  OVERLOADABLE float3 fast_normalize(float3 x) { return x * rsqrt(dot(x, x)); }
> --
> 2.7.4

The patch looks good.

- Ruiling


More information about the Beignet mailing list