Re: [Piglit] [PATCH 03/10] cl: Add tests for different versions of fmin / fmax.

2016-12-06 Thread Matt Arsenault

> On Dec 5, 2016, at 13:35, Jan Vesely  wrote:
> 
> On Mon, 2016-12-05 at 09:48 -0800, arse...@gmail.com 
>  wrote:
>> From: Matt Arsenault 
>> 
>> These do not use the normal simple format because the number
>> of combinations that need to be tested is simply too large,
>> especially when tests for min3/max3 are added.
>> 
>> The unordered compare tests could be improved. Currently they truly
>> test the unordered compare because of LLVM bug 21610, but
>> ideally that would be fixed.
>> ---
>> tests/cl/program/CMakeLists.cl.txt |   1 +
>> .../cl/program/execute/scalar-comparison-float.cl  | 105 +
>> tests/cl/program/float-min-max-kernels.cl  | 492 
>> +
>> tests/cl/program/float-min-max.cpp | 475 
>> 4 files changed, 1073 insertions(+)
>> create mode 100644 tests/cl/program/float-min-max-kernels.cl
>> create mode 100644 tests/cl/program/float-min-max.cpp
>> 
>> diff --git a/tests/cl/program/CMakeLists.cl.txt 
>> b/tests/cl/program/CMakeLists.cl.txt
>> index c8d7307..5ef0f6b 100644
>> --- a/tests/cl/program/CMakeLists.cl.txt
>> +++ b/tests/cl/program/CMakeLists.cl.txt
>> @@ -2,3 +2,4 @@ piglit_cl_add_program_test (tester program-tester.c)
>> piglit_cl_add_program_test (max-work-item-sizes max-work-item-sizes.c)
>> piglit_cl_add_program_test (bitcoin-phatk bitcoin-phatk.c)
>> piglit_cl_add_program_test (predefined-macros predefined-macros.c)
>> +piglit_cl_add_program_test (float-min-max float-min-max.cpp)
>> diff --git a/tests/cl/program/execute/scalar-comparison-float.cl 
>> b/tests/cl/program/execute/scalar-comparison-float.cl
>> index 4891fc5..598fae0 100644
>> --- a/tests/cl/program/execute/scalar-comparison-float.cl
>> +++ b/tests/cl/program/execute/scalar-comparison-float.cl
>> @@ -148,6 +148,71 @@ arg_in:  1 float -3.5
>> arg_in:  2 float 4.5
>> arg_out: 0 buffer int[1] 1
>> 
>> +
>> +[test]
>> +name: select_max_gt
>> +kernel_name: select_max_gt
>> +global_size: 24 0 0
>> +
>> +arg_out: 0 buffer float[24]\
>> +  0.0  1.0  2.0  2.0  0.0  0.0 \
>> +  NAN  NAN  1.0  NAN -1.0  NAN \
>> +  0.0  0.0 97.0  INF  INF  INF \
>> +  NAN  NAN  INF  NAN -INF  INF
>> +
>> +arg_in: 1 buffer float[24] \
>> +  0.0  1.0  1.0  2.0  0.0 -1.0 \
>> +  NAN  1.0  NAN -1.0  NAN  0.0 \
>> +  0.0 -0.0 37.0  INF  INF -INF \
>> + -INF  INF  NAN -INF  NAN  0.0
>> +
>> +arg_in: 2 buffer float[24] \
>> +  0.0  1.0  2.0  1.0 -1.0  0.0 \
>> +  NAN  NAN  1.0  NAN -1.0  NAN \
>> + -0.0  0.0 97.0  INF -INF  INF \
>> + -INF  NAN  INF  NAN -INF  INF
>> +
>> +[test]
>> +name: select_max_gte
>> +kernel_name: select_max_gte
>> +global_size: 15 0 0
>> +
>> +arg_out: 0 buffer float[15]\
>> +  0.0  1.0  2.0  2.0  0.0  0.0 \
>> +  NAN  NAN  1.0  NAN -1.0  NAN \
>> +  0.0  0.0 97.0
>> +
>> +arg_in: 1 buffer float[15] \
>> +  0.0  1.0  1.0  2.0  0.0 -1.0 \
>> +  NAN  1.0  NAN -1.0  NAN  0.0 \
>> +  0.0 -0.0 37.0
>> +
>> +arg_in: 2 buffer float[15] \
>> +  0.0  1.0  2.0  1.0 -1.0  0.0 \
>> +  NAN  NAN  1.0  NAN -1.0  NAN \
>> + -0.0  0.0 97.0
>> +
>> +[test]
>> +name: select_min_gt
>> +kernel_name: select_min_gt
>> +global_size: 15 0 0
>> +
>> +arg_out: 0 buffer float[15]\
>> +  0.0  1.0  1.0  1.0 -1.0 -1.0 \
>> +  NAN  NAN  NAN  NAN NAN  NAN  \
>> +  0.0  0.0 37.0
>> +
>> +arg_in: 1 buffer float[15] \
>> +  0.0  1.0  1.0  2.0  0.0 -1.0 \
>> +  NAN  1.0  NAN -1.0  NAN  0.0 \
>> +  0.0 -0.0  37.0
>> +
>> +arg_in: 2 buffer float[15] \
>> +  0.0  1.0  2.0  1.0 -1.0  0.0 \
>> +  NAN  NAN  1.0  NAN -1.0  NAN \
>> + -0.0  0.0 97.0
>> +
>> +
>> !*/
>> 
>> kernel void eq(global int* out, float a, float b) {
>> @@ -173,3 +238,43 @@ kernel void lt(global int* out, float a, float b) {
>> kernel void lte(global int* out, float a, float b) {
>>  out[0] = a <= b;
>> }
>> +
>> +kernel void select_max_gt(global float* restrict out, global float* 
>> restrict a, global float* restrict b) {
>> +int id = get_global_id(0);
>> +out[id] = (a[id] > b[id]) ? a[id] : b[id];
>> +}
>> +
>> +kernel void select_max_gte(global float* restrict out, global float* 
>> restrict a, global float* restrict b) {
>> +int id = get_global_id(0);
>> +out[id] = (a[id] >= b[id]) ? a[id] : b[id];
>> +}
>> +
>> +kernel void select_min_gt(global float* restrict out, global float* 
>> restrict a, global float* restrict b) {
>> +int id = get_global_id(0);
>> +out[id] = (a[id] > b[id]) ? b[id] : a[id];
>> +}
>> +
>> +kernel void select_min_gte(global float* restrict out, global float* 
>> restrict a, global float* restrict b) {
>> +int id = get_global_id(0);
>> +out[id] = (a[id] >= b[id]) ? b[id] : a[id];
>> +}
>> +
>> +kernel void select_min_lt(global float* restrict out, global float* 
>> restrict a, global float* restrict b) {
>> +int id = get_global_id(0);
>> +out[id] = (a[id] < b[id]) ? a[id] : b[id];
>> +}
>> +
>> +kernel void select_max_lt(global float* restrict out, global float* 
>> restrict a, global floa

Re: [Piglit] [PATCH 03/10] cl: Add tests for different versions of fmin / fmax.

2016-12-06 Thread Jan Vesely
On Tue, 2016-12-06 at 11:12 -0800, Matt Arsenault wrote:
> > On Dec 5, 2016, at 13:35, Jan Vesely  wrote:
> > 
> > On Mon, 2016-12-05 at 09:48 -0800, arse...@gmail.com 
> >  wrote:
> > > From: Matt Arsenault 
> > > 
> > > These do not use the normal simple format because the number
> > > of combinations that need to be tested is simply too large,
> > > especially when tests for min3/max3 are added.
> > > 
> > > The unordered compare tests could be improved. Currently they truly
> > > test the unordered compare because of LLVM bug 21610, but
> > > ideally that would be fixed.
> > > ---
> > > tests/cl/program/CMakeLists.cl.txt |   1 +
> > > .../cl/program/execute/scalar-comparison-float.cl  | 105 +
> > > tests/cl/program/float-min-max-kernels.cl  | 492 
> > > +
> > > tests/cl/program/float-min-max.cpp | 475 
> > > 
> > > 4 files changed, 1073 insertions(+)
> > > create mode 100644 tests/cl/program/float-min-max-kernels.cl
> > > create mode 100644 tests/cl/program/float-min-max.cpp
> > > 
> > > diff --git a/tests/cl/program/CMakeLists.cl.txt 
> > > b/tests/cl/program/CMakeLists.cl.txt
> > > index c8d7307..5ef0f6b 100644
> > > --- a/tests/cl/program/CMakeLists.cl.txt
> > > +++ b/tests/cl/program/CMakeLists.cl.txt
> > > @@ -2,3 +2,4 @@ piglit_cl_add_program_test (tester program-tester.c)
> > > piglit_cl_add_program_test (max-work-item-sizes max-work-item-sizes.c)
> > > piglit_cl_add_program_test (bitcoin-phatk bitcoin-phatk.c)
> > > piglit_cl_add_program_test (predefined-macros predefined-macros.c)
> > > +piglit_cl_add_program_test (float-min-max float-min-max.cpp)
> > > diff --git a/tests/cl/program/execute/scalar-comparison-float.cl 
> > > b/tests/cl/program/execute/scalar-comparison-float.cl
> > > index 4891fc5..598fae0 100644
> > > --- a/tests/cl/program/execute/scalar-comparison-float.cl
> > > +++ b/tests/cl/program/execute/scalar-comparison-float.cl
> > > @@ -148,6 +148,71 @@ arg_in:  1 float -3.5
> > > arg_in:  2 float 4.5
> > > arg_out: 0 buffer int[1] 1
> > > 
> > > +
> > > +[test]
> > > +name: select_max_gt
> > > +kernel_name: select_max_gt
> > > +global_size: 24 0 0
> > > +
> > > +arg_out: 0 buffer float[24]\
> > > +  0.0  1.0  2.0  2.0  0.0  0.0 \
> > > +  NAN  NAN  1.0  NAN -1.0  NAN \
> > > +  0.0  0.0 97.0  INF  INF  INF \
> > > +  NAN  NAN  INF  NAN -INF  INF
> > > +
> > > +arg_in: 1 buffer float[24] \
> > > +  0.0  1.0  1.0  2.0  0.0 -1.0 \
> > > +  NAN  1.0  NAN -1.0  NAN  0.0 \
> > > +  0.0 -0.0 37.0  INF  INF -INF \
> > > + -INF  INF  NAN -INF  NAN  0.0
> > > +
> > > +arg_in: 2 buffer float[24] \
> > > +  0.0  1.0  2.0  1.0 -1.0  0.0 \
> > > +  NAN  NAN  1.0  NAN -1.0  NAN \
> > > + -0.0  0.0 97.0  INF -INF  INF \
> > > + -INF  NAN  INF  NAN -INF  INF
> > > +
> > > +[test]
> > > +name: select_max_gte
> > > +kernel_name: select_max_gte
> > > +global_size: 15 0 0
> > > +
> > > +arg_out: 0 buffer float[15]\
> > > +  0.0  1.0  2.0  2.0  0.0  0.0 \
> > > +  NAN  NAN  1.0  NAN -1.0  NAN \
> > > +  0.0  0.0 97.0
> > > +
> > > +arg_in: 1 buffer float[15] \
> > > +  0.0  1.0  1.0  2.0  0.0 -1.0 \
> > > +  NAN  1.0  NAN -1.0  NAN  0.0 \
> > > +  0.0 -0.0 37.0
> > > +
> > > +arg_in: 2 buffer float[15] \
> > > +  0.0  1.0  2.0  1.0 -1.0  0.0 \
> > > +  NAN  NAN  1.0  NAN -1.0  NAN \
> > > + -0.0  0.0 97.0
> > > +
> > > +[test]
> > > +name: select_min_gt
> > > +kernel_name: select_min_gt
> > > +global_size: 15 0 0
> > > +
> > > +arg_out: 0 buffer float[15]\
> > > +  0.0  1.0  1.0  1.0 -1.0 -1.0 \
> > > +  NAN  NAN  NAN  NAN NAN  NAN  \
> > > +  0.0  0.0 37.0
> > > +
> > > +arg_in: 1 buffer float[15] \
> > > +  0.0  1.0  1.0  2.0  0.0 -1.0 \
> > > +  NAN  1.0  NAN -1.0  NAN  0.0 \
> > > +  0.0 -0.0  37.0
> > > +
> > > +arg_in: 2 buffer float[15] \
> > > +  0.0  1.0  2.0  1.0 -1.0  0.0 \
> > > +  NAN  NAN  1.0  NAN -1.0  NAN \
> > > + -0.0  0.0 97.0
> > > +
> > > +
> > > !*/
> > > 
> > > kernel void eq(global int* out, float a, float b) {
> > > @@ -173,3 +238,43 @@ kernel void lt(global int* out, float a, float b) {
> > > kernel void lte(global int* out, float a, float b) {
> > >   out[0] = a <= b;
> > > }
> > > +
> > > +kernel void select_max_gt(global float* restrict out, global float* 
> > > restrict a, global float* restrict b) {
> > > + int id = get_global_id(0);
> > > + out[id] = (a[id] > b[id]) ? a[id] : b[id];
> > > +}
> > > +
> > > +kernel void select_max_gte(global float* restrict out, global float* 
> > > restrict a, global float* restrict b) {
> > > + int id = get_global_id(0);
> > > + out[id] = (a[id] >= b[id]) ? a[id] : b[id];
> > > +}
> > > +
> > > +kernel void select_min_gt(global float* restrict out, global float* 
> > > restrict a, global float* restrict b) {
> > > + int id = get_global_id(0);
> > > + out[id] = (a[id] > b[id]) ? b[id] : a[id];
> > > +}
> > > +
> > > +kernel void select_min_gte(global float* restrict out, global float* 
> > > restric

Re: [Piglit] [PATCH 03/10] cl: Add tests for different versions of fmin / fmax.

2016-12-05 Thread Jan Vesely
On Mon, 2016-12-05 at 09:48 -0800, arse...@gmail.com wrote:
> From: Matt Arsenault 
> 
> These do not use the normal simple format because the number
> of combinations that need to be tested is simply too large,
> especially when tests for min3/max3 are added.
> 
> The unordered compare tests could be improved. Currently they truly
> test the unordered compare because of LLVM bug 21610, but
> ideally that would be fixed.
> ---
>  tests/cl/program/CMakeLists.cl.txt |   1 +
>  .../cl/program/execute/scalar-comparison-float.cl  | 105 +
>  tests/cl/program/float-min-max-kernels.cl  | 492 
> +
>  tests/cl/program/float-min-max.cpp | 475 
>  4 files changed, 1073 insertions(+)
>  create mode 100644 tests/cl/program/float-min-max-kernels.cl
>  create mode 100644 tests/cl/program/float-min-max.cpp
> 
> diff --git a/tests/cl/program/CMakeLists.cl.txt 
> b/tests/cl/program/CMakeLists.cl.txt
> index c8d7307..5ef0f6b 100644
> --- a/tests/cl/program/CMakeLists.cl.txt
> +++ b/tests/cl/program/CMakeLists.cl.txt
> @@ -2,3 +2,4 @@ piglit_cl_add_program_test (tester program-tester.c)
>  piglit_cl_add_program_test (max-work-item-sizes max-work-item-sizes.c)
>  piglit_cl_add_program_test (bitcoin-phatk bitcoin-phatk.c)
>  piglit_cl_add_program_test (predefined-macros predefined-macros.c)
> +piglit_cl_add_program_test (float-min-max float-min-max.cpp)
> diff --git a/tests/cl/program/execute/scalar-comparison-float.cl 
> b/tests/cl/program/execute/scalar-comparison-float.cl
> index 4891fc5..598fae0 100644
> --- a/tests/cl/program/execute/scalar-comparison-float.cl
> +++ b/tests/cl/program/execute/scalar-comparison-float.cl
> @@ -148,6 +148,71 @@ arg_in:  1 float -3.5
>  arg_in:  2 float 4.5
>  arg_out: 0 buffer int[1] 1
>  
> +
> +[test]
> +name: select_max_gt
> +kernel_name: select_max_gt
> +global_size: 24 0 0
> +
> +arg_out: 0 buffer float[24]\
> +  0.0  1.0  2.0  2.0  0.0  0.0 \
> +  NAN  NAN  1.0  NAN -1.0  NAN \
> +  0.0  0.0 97.0  INF  INF  INF \
> +  NAN  NAN  INF  NAN -INF  INF
> +
> +arg_in: 1 buffer float[24] \
> +  0.0  1.0  1.0  2.0  0.0 -1.0 \
> +  NAN  1.0  NAN -1.0  NAN  0.0 \
> +  0.0 -0.0 37.0  INF  INF -INF \
> + -INF  INF  NAN -INF  NAN  0.0
> +
> +arg_in: 2 buffer float[24] \
> +  0.0  1.0  2.0  1.0 -1.0  0.0 \
> +  NAN  NAN  1.0  NAN -1.0  NAN \
> + -0.0  0.0 97.0  INF -INF  INF \
> + -INF  NAN  INF  NAN -INF  INF
> +
> +[test]
> +name: select_max_gte
> +kernel_name: select_max_gte
> +global_size: 15 0 0
> +
> +arg_out: 0 buffer float[15]\
> +  0.0  1.0  2.0  2.0  0.0  0.0 \
> +  NAN  NAN  1.0  NAN -1.0  NAN \
> +  0.0  0.0 97.0
> +
> +arg_in: 1 buffer float[15] \
> +  0.0  1.0  1.0  2.0  0.0 -1.0 \
> +  NAN  1.0  NAN -1.0  NAN  0.0 \
> +  0.0 -0.0 37.0
> +
> +arg_in: 2 buffer float[15] \
> +  0.0  1.0  2.0  1.0 -1.0  0.0 \
> +  NAN  NAN  1.0  NAN -1.0  NAN \
> + -0.0  0.0 97.0
> +
> +[test]
> +name: select_min_gt
> +kernel_name: select_min_gt
> +global_size: 15 0 0
> +
> +arg_out: 0 buffer float[15]\
> +  0.0  1.0  1.0  1.0 -1.0 -1.0 \
> +  NAN  NAN  NAN  NAN NAN  NAN  \
> +  0.0  0.0 37.0
> +
> +arg_in: 1 buffer float[15] \
> +  0.0  1.0  1.0  2.0  0.0 -1.0 \
> +  NAN  1.0  NAN -1.0  NAN  0.0 \
> +  0.0 -0.0  37.0
> +
> +arg_in: 2 buffer float[15] \
> +  0.0  1.0  2.0  1.0 -1.0  0.0 \
> +  NAN  NAN  1.0  NAN -1.0  NAN \
> + -0.0  0.0 97.0
> +
> +
>  !*/
>  
>  kernel void eq(global int* out, float a, float b) {
> @@ -173,3 +238,43 @@ kernel void lt(global int* out, float a, float b) {
>  kernel void lte(global int* out, float a, float b) {
>   out[0] = a <= b;
>  }
> +
> +kernel void select_max_gt(global float* restrict out, global float* restrict 
> a, global float* restrict b) {
> + int id = get_global_id(0);
> + out[id] = (a[id] > b[id]) ? a[id] : b[id];
> +}
> +
> +kernel void select_max_gte(global float* restrict out, global float* 
> restrict a, global float* restrict b) {
> + int id = get_global_id(0);
> + out[id] = (a[id] >= b[id]) ? a[id] : b[id];
> +}
> +
> +kernel void select_min_gt(global float* restrict out, global float* restrict 
> a, global float* restrict b) {
> + int id = get_global_id(0);
> + out[id] = (a[id] > b[id]) ? b[id] : a[id];
> +}
> +
> +kernel void select_min_gte(global float* restrict out, global float* 
> restrict a, global float* restrict b) {
> + int id = get_global_id(0);
> + out[id] = (a[id] >= b[id]) ? b[id] : a[id];
> +}
> +
> +kernel void select_min_lt(global float* restrict out, global float* restrict 
> a, global float* restrict b) {
> + int id = get_global_id(0);
> + out[id] = (a[id] < b[id]) ? a[id] : b[id];
> +}
> +
> +kernel void select_max_lt(global float* restrict out, global float* restrict 
> a, global float* restrict b) {
> + int id = get_global_id(0);
> + out[id] = (a[id] < b[id]) ? b[id] : a[id];
> +}
> +
> +kernel void select_min_lte(global float* restrict out, global float* 
> restrict a