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

Jan Vesely jan.vesely at rutgers.edu
Fri Jan 20 19:56:15 UTC 2017


On Fri, 2017-01-20 at 11:40 -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
> ---
>  .../cl/program/execute/scalar-arithmetic-double.cl | 34 ++++++++++++++++++++++
>  .../cl/program/execute/scalar-arithmetic-float.cl  | 30 +++++++++++++++++++
>  2 files changed, 64 insertions(+)
>  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..3b1f9e06e
> --- /dev/null
> +++ b/tests/cl/program/execute/scalar-arithmetic-double.cl
> @@ -0,0 +1,34 @@
> +/*!
> +[config]
> +name: fneg f64
> +clc_version_min: 10
> +require_device_extensions: cl_khr_fp64
> +
> +dimensions: 1
> +global_size: 15 0 0
> +
> +[test]
> +name: fneg
> +kernel_name: fneg
> +global_size: 15 0 0
> +
> +arg_out: 0 buffer double[15]   \
> +  -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
> +
> +arg_in: 1 buffer double[15]   \
> +  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
> +!*/
> +
> +#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> +
> +kernel void fneg(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..938b7d305 100644
> --- a/tests/cl/program/execute/scalar-arithmetic-float.cl
> +++ b/tests/cl/program/execute/scalar-arithmetic-float.cl
> @@ -316,6 +316,30 @@ kernel_name: minus
>  arg_in:  1 float -inf
>  arg_out: 0 buffer float[1] inf
>  
> +[config]
> +name: fneg f32
> +clc_version_min: 10
> +
> +dimensions: 1
> +global_size: 15 0 0

there can be only one config section per test file.

> +
> +[test]
> +name: fneg
> +kernel_name: fneg_f32
> +global_size: 15 0 0
> +
> +arg_out: 0 buffer float[15]   \
> +  -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
> +
> +arg_in: 1 buffer float[15]   \
> +  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

can you split the values between -pos and -neg tests?
sorry, I should have been more explicit the first time.

> +
>  !*/
>  
>  kernel void add(global float* out, float a, float b) {
> @@ -341,3 +365,9 @@ kernel void plus(global float* out, float in) {
>  kernel void minus(global float* out, float in) {
>  	out[0] = -in;
>  }
> +
> +kernel void fneg_f32(global float* out, global float* in)
> +{
> +    int id = get_global_id(0);
> +    out[id] = -in[id];
> +}

this should replace the "minus" kernel.


thanks,
Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20170120/3f32e4d0/attachment.sig>


More information about the Piglit mailing list