[Piglit] [PATCH] cl: Add tests for stored fneg

Jan Vesely jan.vesely at rutgers.edu
Fri Jan 27 04:01:12 UTC 2017


On Thu, 2017-01-26 at 15:09 -0800, arsenm2 at gmail.com wrote:
> From: Matt Arsenault <arsenm2 at gmail.com>
> 
> Make sure fneg that can't be folded into a use operand is
> executed correctly.
> 
> v2: Merge with other test
> v3: Remove other test

thanks.
Reviewed-by: Jan Vesely <jan.vesely at rutgers.edu>
I'll push these and the fdiv tests tomorrow, unless someone beats me to
it.

Jan

> ---
>  .../cl/program/execute/scalar-arithmetic-double.cl | 36 +++++++++++++++++++
>  .../cl/program/execute/scalar-arithmetic-float.cl  | 42 ++++++++++------------
>  2 files changed, 55 insertions(+), 23 deletions(-)
>  create mode 100644 tests/cl/program/execute/scalar-arithmetic-double.cl
> 
> diff --git a/tests/cl/program/execute/scalar-arithmetic-double.cl b/tests/cl/program/execute/scalar-arithmetic-double.cl
> new file mode 100644
> index 000000000..3c2cb6271
> --- /dev/null
> +++ b/tests/cl/program/execute/scalar-arithmetic-double.cl
> @@ -0,0 +1,36 @@
> +/*!
> +[config]
> +name: fneg f64
> +clc_version_min: 10
> +require_device_extensions: cl_khr_fp64
> +dimensions: 1
> +
> +## Unary minus ##
> +
> +[test]
> +name: minus
> +kernel_name: minus
> +global_size: 20 0 0
> +
> +arg_out: 0 buffer double[20]       \
> +   -0.0      0.0    -0.5    0.5    \
> +   -1.0      1.0    -2.0    2.0    \
> +   -4.0      4.0   -10.0    10.0   \
> +   -inf      inf     nan   -345.25 \
> + 345.25 -455.125  455.125  0.12345
> +
> +arg_in: 1 buffer double[20]          \
> +  0.0     -0.0           0.5     -0.5 \
> +  1.0     -1.0           2.0     -2.0 \
> +  4.0     -4.0          10.0    -10.0 \
> +  inf     -inf           nan   345.25 \
> + -345.25   455.125  -455.125 -0.12345
> +
> +!*/
> +
> +#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> +
> +kernel void minus(global double* out, global double* in) {
> +    int id = get_global_id(0);
> +    out[id] = -in[id];
> +}
> diff --git a/tests/cl/program/execute/scalar-arithmetic-float.cl b/tests/cl/program/execute/scalar-arithmetic-float.cl
> index 84c397030..3412e1b7b 100644
> --- a/tests/cl/program/execute/scalar-arithmetic-float.cl
> +++ b/tests/cl/program/execute/scalar-arithmetic-float.cl
> @@ -293,28 +293,23 @@ arg_out: 0 buffer float[1] -inf
>  ## Unary minus ##
>  
>  [test]
> -name: -pos
> +name: minus
>  kernel_name: minus
> -arg_in:  1 float 345.25
> -arg_out: 0 buffer float[1] -345.25
> -
> -[test]
> -name: -neg
> -kernel_name: minus
> -arg_in:  1 float -455.125
> -arg_out: 0 buffer float[1] 455.125
> -
> -[test]
> -name: -inf
> -kernel_name: minus
> -arg_in:  1 float inf
> -arg_out: 0 buffer float[1] -inf
> -
> -[test]
> -name: --inf
> -kernel_name: minus
> -arg_in:  1 float -inf
> -arg_out: 0 buffer float[1] inf
> +global_size: 20 0 0
> +
> +arg_out: 0 buffer float[20]        \
> +   -0.0      0.0    -0.5    0.5    \
> +   -1.0      1.0    -2.0    2.0    \
> +   -4.0      4.0   -10.0    10.0   \
> +   -inf      inf     nan   -345.25 \
> + 345.25 -455.125  455.125  0.12345
> +
> +arg_in: 1 buffer float[20]            \
> +  0.0     -0.0           0.5     -0.5 \
> +  1.0     -1.0           2.0     -2.0 \
> +  4.0     -4.0          10.0    -10.0 \
> +  inf     -inf           nan   345.25 \
> + -345.25   455.125  -455.125 -0.12345
>  
>  !*/
>  
> @@ -338,6 +333,7 @@ kernel void plus(global float* out, float in) {
>  	out[0] = +in;
>  }
>  
> -kernel void minus(global float* out, float in) {
> -	out[0] = -in;
> +kernel void minus(global float* out, global float* in) {
> +    int id = get_global_id(0);
> +    out[id] = -in[id];
>  }

-- 
Jan Vesely <jan.vesely at rutgers.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20170126/3065ddb9/attachment.sig>


More information about the Piglit mailing list