Re: [Piglit] [PATCH 1/4] cl: Add float type vstore test

2016-08-18 Thread Tom Stellard
On Sat, Jul 30, 2016 at 01:56:03PM -0400, Jan Vesely wrote:
> Passes on intel, clover(AMD Turks,Kaveri), beignet, CUDA
> 
> Signed-off-by: Jan Vesely 

For the series:

Acked-by: Tom Stellard 

Go ahead and commit.

> ---
>  tests/cl/program/execute/vstore-float.cl | 126 
> +++
>  1 file changed, 126 insertions(+)
>  create mode 100644 tests/cl/program/execute/vstore-float.cl
> 
> diff --git a/tests/cl/program/execute/vstore-float.cl 
> b/tests/cl/program/execute/vstore-float.cl
> new file mode 100644
> index 000..968d980
> --- /dev/null
> +++ b/tests/cl/program/execute/vstore-float.cl
> @@ -0,0 +1,126 @@
> +/*!
> +[config]
> +name: Vector store float2,3,4,8,16
> +clc_version_min: 10
> +
> +dimensions: 1
> +global_size: 1 0 0
> +
> +[test]
> +name: vector store float2
> +kernel_name: vstore2_test
> +arg_out: 0 buffer float[2] 56.0 65.0
> +arg_in: 1 buffer float[2] 56.0 65.0
> +
> +[test]
> +name: vector store float2 with offset
> +kernel_name: vstore2_offset
> +arg_out: 0 buffer float[4] 0 0 56.0 65.0
> +arg_in: 1 buffer float[2] 56.0 65.0
> +
> +[test]
> +name: vector store float3
> +kernel_name: vstore3_test
> +arg_out: 0 buffer float[3] 56.0 65.0 12.0
> +arg_in: 1 buffer float[3] 56.0 65.0 12.0
> +
> +[test]
> +name: vector store float3 with offset
> +kernel_name: vstore3_offset
> +arg_out: 0 buffer float[6] 0 0 0 56.0 65.0 12.0
> +arg_in: 1 buffer float[3] 56.0 65.0 12.0
> +
> +[test]
> +name: vector store float4
> +kernel_name: vstore4_test
> +arg_out: 0 buffer float[4] 56.0 65.0 18.0 81.0
> +arg_in: 1 buffer float[4] 56.0 65.0 18.0 81.0
> +
> +[test]
> +name: vector store float4 with offset
> +kernel_name: vstore4_offset
> +arg_out: 0 buffer float[8] 0 0 0 0 56.0 65.0 18.0 81.0
> +arg_in: 1 buffer float[4] 56.0 65.0 18.0 81.0
> +
> +[test]
> +name: vector store float8
> +kernel_name: vstore8_test
> +arg_out: 0 buffer float[8] 56.0 65.0 18.0 81.0 12.0 21.0 34.0 43.0
> +arg_in: 1 buffer float[8] 56.0 65.0 18.0 81.0 12.0 21.0 34.0 43.0
> +
> +[test]
> +name: vector store float8 with offset
> +kernel_name: vstore8_offset
> +arg_out: 0 buffer float[16] 0 0 0 0 0 0 0 0 56.0 65.0 18.0 81.0 12.0 21.0 
> 34.0 43.0
> +arg_in: 1 buffer float[8] 56.0 65.0 18.0 81.0 12.0 21.0 34.0 43.0
> +
> +[test]
> +name: vector store float16
> +kernel_name: vstore16_test
> +arg_out: 0 buffer float[16] 56.0 65.0 18.0 81.0 12.0 21.0 34.0 43.0 23.0 
> 32.0 67.0 76.0 78.0 87.0 89.0 98.0
> +arg_in: 1 buffer float[16] 56.0 65.0 18.0 81.0 12.0 21.0 34.0 43.0 23.0 32.0 
> 67.0 76.0 78.0 87.0 89.0 98.0
> +
> +[test]
> +name: vector store float16 with offset
> +kernel_name: vstore16_offset
> +arg_out: 0 buffer float[32] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \
> + 56.0 65.0 18.0 81.0 12.0 21.0 34.0 43.0 23.0 32.0 
> 67.0 76.0 78.0 87.0 89.0 98.0
> +arg_in: 1 buffer float[16] 56.0 65.0 18.0 81.0 12.0 21.0 34.0 43.0 23.0 32.0 
> 67.0 76.0 78.0 87.0 89.0 98.0
> +!*/
> +
> +kernel void vstore2_test(global float* out, global float* in) {
> +  float2 val = {in[0], in[1]};
> +  vstore2(val, 0, out);
> +}
> +
> +kernel void vstore2_offset(global float* out, global float* in) {
> +  float2 val = {in[0], in[1]};
> +  vstore2((float2)0, 0, out);
> +  vstore2(val, 1, out);
> +}
> +
> +kernel void vstore3_test(global float* out, global float* in) {
> +  float3 val = {in[0], in[1], in[2]};
> +  vstore3(val, 0, out);
> +}
> +
> +kernel void vstore3_offset(global float* out, global float* in) {
> +  float3 val = {in[0], in[1], in[2]};
> +  vstore3((float3)0, 0, out);
> +  vstore3(val, 1, out);
> +}
> +
> +kernel void vstore4_test(global float* out, global float* in) {
> +  float4 val = {in[0], in[1], in[2], in[3]};
> +  vstore4(val, 0, out);
> +}
> +
> +kernel void vstore4_offset(global float* out, global float* in) {
> +  float4 val = {in[0], in[1], in[2], in[3]};
> +  vstore4((float4)0, 0, out);
> +  vstore4(val, 1, out);
> +}
> +
> +kernel void vstore8_test(global float* out, global float* in) {
> +  float8 val = {in[0], in[1], in[2], in[3], in[4], in[5], in[6], in[7]};
> +  vstore8(val, 0, out);
> +}
> +
> +kernel void vstore8_offset(global float* out, global float* in) {
> +  float8 val = {in[0], in[1], in[2], in[3], in[4], in[5], in[6], in[7]};
> +  vstore8((float8)0, 0, out);
> +  vstore8(val, 1, out);
> +}
> +
> +kernel void vstore16_test(global float* out, global float* in) {
> +  float16 val = {in[0], in[1], in[2], in[3], in[4], in[5], in[6], in[7],
> +   in[8], in[9], in[10], in[11], in[12], in[13], in[14], in[15]};
> +  vstore16(val, 0, out);
> +

Re: [Piglit] [PATCH 1/1] cl: skip get image info test if there's no image support

2016-05-02 Thread Tom Stellard
On Mon, May 02, 2016 at 10:01:43AM -0400, Jan Vesely wrote:
> Signed-off-by: Jan Vesely 

Reviewed-by: Tom Stellard 
> ---
>  tests/cl/api/get-image-info.c | 25 +++--
>  1 file changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/cl/api/get-image-info.c b/tests/cl/api/get-image-info.c
> index 2d653b1..a8b5bec 100644
> --- a/tests/cl/api/get-image-info.c
> +++ b/tests/cl/api/get-image-info.c
> @@ -46,6 +46,22 @@ PIGLIT_CL_API_TEST_CONFIG_BEGIN
>  
>  PIGLIT_CL_API_TEST_CONFIG_END
>  
> +static bool context_has_image_support(const piglit_cl_context ctx)
> +{
> + int ret = 0;
> + unsigned i;
> + for(i = 0; i < ctx->num_devices; i++) {
> + int *image_support =
> + piglit_cl_get_device_info(ctx->device_ids[i],
> + CL_DEVICE_IMAGE_SUPPORT);
> + if (image_support)
> + ret |= *image_support;
> +
> + free(image_support);
> + }
> + return ret;
> +}
> +
>  
>  enum piglit_result
>  piglit_cl_test(const int argc,
> @@ -63,12 +79,17 @@ piglit_cl_test(const int argc,
>   .image_channel_data_type = CL_FLOAT,
>   };
>  
> + if (!context_has_image_support(env->context)) {
> + fprintf(stderr, "No device with image support found!\n");
> + return PIGLIT_SKIP;
> + }
> +
>   size_t param_value_size;
>   void* param_value;
> - 
> +
>   int num_image_infos = PIGLIT_CL_ENUM_NUM(cl_image_info, env->version);
>   const cl_image_info* image_infos = PIGLIT_CL_ENUM_ARRAY(cl_image_info);
> - 
> +
>  #if defined CL_VERSION_1_2
>   if(env->version >= 12) {
>   cl_image_desc image_desc = {
> -- 
> 2.5.5
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] oclconform: Encode regex with 'unicode_escape' instead for 'string_escape'

2016-02-10 Thread Tom Stellard
This fixes a run-time error with python 3.4.
---
 framework/test/oclconform.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/framework/test/oclconform.py b/framework/test/oclconform.py
index cad00dd..0a64499 100644
--- a/framework/test/oclconform.py
+++ b/framework/test/oclconform.py
@@ -87,7 +87,7 @@ def add_oclconform_tests(profile):
'list_subtests')
 subtest_regex = PIGLIT_CONFIG.get(test_section_name,
   'subtest_regex')
-subtest_regex.encode('string_escape')
+subtest_regex.encode('unicode_escape')
 run_subtests = PIGLIT_CONFIG.get(test_section_name, 'run_subtest')
 list_tests = list_tests.split()
 
-- 
2.0.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] framework/test/{opencv, oclconform}: fix subprocess returning bytes

2016-02-10 Thread Tom Stellard
On Wed, Feb 10, 2016 at 01:42:12PM -0800, Dylan Baker wrote:
> During the hybridization this little bit was missed, causing the to
> subprocess to return bytes, while the rest of the code expected unicode.
> 

This fixes most issues.  I sent another patch for the remaining one.

> cc: Tom Stellard 
> Signed-off-by: Dylan Baker 

Tested-by: Tom Stellard 

> ---
> 
> I think this hsould fix your issue Tom, but I'm not exactly sure how to
> set up opencv tests and oclconform to check.
> 
>  framework/test/oclconform.py | 4 ++--
>  framework/test/opencv.py | 3 ++-
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/framework/test/oclconform.py b/framework/test/oclconform.py
> index 48e4b72..cad00dd 100644
> --- a/framework/test/oclconform.py
> +++ b/framework/test/oclconform.py
> @@ -91,8 +91,8 @@ def add_oclconform_tests(profile):
>  run_subtests = PIGLIT_CONFIG.get(test_section_name, 
> 'run_subtest')
>  list_tests = list_tests.split()
>  
> -subtests = subprocess.check_output(args=list_tests,
> -   cwd=bindir).split('\n')
> +subtests = subprocess.check_output(
> +args=list_tests, cwd=bindir).decode('utf-8').split('\n')
>  for subtest in subtests:
>  m = re.match(subtest_regex, subtest)
>  if not m:
> diff --git a/framework/test/opencv.py b/framework/test/opencv.py
> index 3b9a12e..a31d562 100644
> --- a/framework/test/opencv.py
> +++ b/framework/test/opencv.py
> @@ -60,7 +60,8 @@ def add_opencv_tests(profile):
>  print('Warning: {} does not exist.\nSkipping OpenCV '
>'tests...'.format(opencv_test_ocl))
>  return
> -tests = subprocess.check_output([opencv_test_ocl, '--gtest_list_tests'])
> +tests = subprocess.check_output(
> +[opencv_test_ocl, '--gtest_list_tests']).decode('utf-8')
>  test_list = tests.splitlines()
>  group_name = ''
>  full_test_name = ''
> -- 
> 2.7.1
> 
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH RESEND 1/1] cl: Extend program scope arrays with more types

2016-01-27 Thread Tom Stellard
On Fri, Jan 15, 2016 at 05:41:08PM -0500, Jan Vesely wrote:
> Signed-off-by: Jan Vesely 
> ---
> 
> This used to trigger failure when LLVM put different types in different 
> .rodata sections. Now there are no .rodata sections for radeon, but I think 
> we should still test it.
> 
> Jan
> 

Reviewed-by: Tom Stellard 
>  tests/cl/program/execute/program-scope-arrays.cl | 102 
> ++-
>  1 file changed, 98 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/cl/program/execute/program-scope-arrays.cl 
> b/tests/cl/program/execute/program-scope-arrays.cl
> index b9a962c..a930da9 100644
> --- a/tests/cl/program/execute/program-scope-arrays.cl
> +++ b/tests/cl/program/execute/program-scope-arrays.cl
> @@ -6,6 +6,28 @@ global_size: 4 0 0
>  
>  
>  [test]
> +name: simple-constant-char
> +kernel_name: simple_constant_char
> +arg_out: 0 buffer char[4] 3 3 3 3
> +
> +[test]
> +name: given-constant-char
> +kernel_name: given_constant_char
> +arg_in: 1 int 2
> +arg_out: 0 buffer char[4] 2 2 2 2
> +
> +[test]
> +name: simple-gid-char
> +kernel_name: simple_gid_char
> +arg_out: 0 buffer char[4] 4 3 2 1
> +
> +[test]
> +name: indirection-char
> +kernel_name: indirection_char
> +arg_in: 1 buffer uchar[4] 3 2 1 0
> +arg_out: 0 buffer char[4] 1 2 3 4
> +
> +[test]
>  name: simple-constant
>  kernel_name: simple_constant
>  arg_out: 0 buffer float[4] 3.0 3.0 3.0 3.0
> @@ -13,8 +35,8 @@ arg_out: 0 buffer float[4] 3.0 3.0 3.0 3.0
>  [test]
>  name: given-constant
>  kernel_name: given_constant
> -arg_in: 1 int 1
> -arg_out: 0 buffer float[4] 3.0 3.0 3.0 3.0
> +arg_in: 1 int 2
> +arg_out: 0 buffer float[4] 2.0 2.0 2.0 2.0
>  
>  [test]
>  name: simple-gid
> @@ -24,8 +46,31 @@ arg_out: 0 buffer float[4] 4.0 3.0 2.0 1.0
>  [test]
>  name: indirection
>  kernel_name: indirection
> -arg_in: 1 buffer uchar[4] 0 1 2 3
> -arg_out: 0 buffer float[4] 4.0 3.0 2.0 1.0
> +arg_in: 1 buffer uchar[4] 3 2 1 0
> +arg_out: 0 buffer float[4] 1.0 2.0 3.0 4.0
> +
> +
> +[test]
> +name: simple-constant-2
> +kernel_name: simple_constant_2
> +arg_out: 0 buffer float[8] 3.0 5.0 3.0 5.0 3.0 5.0 3.0 5.0
> +
> +[test]
> +name: given-constant-2
> +kernel_name: given_constant_2
> +arg_in: 1 int 2
> +arg_out: 0 buffer float[8] 2.0 5.0 2.0 5.0 2.0 5.0 2.0 5.0
> +
> +[test]
> +name: simple-gid-2
> +kernel_name: simple_gid_2
> +arg_out: 0 buffer float[8] 4.0 5.0 3.0 5.0 2.0 5.0 1.0 5.0
> +
> +[test]
> +name: indirection-2
> +kernel_name: indirection_2
> +arg_in: 1 buffer uchar[4] 3 2 1 0
> +arg_out: 0 buffer float[8] 1.0 5.0 2.0 5.0 3.0 5.0 4.0 5.0
>  
>  !*/
>  
> @@ -55,3 +100,52 @@ __kernel void indirection(__global float *out, __global 
> uchar *in) {
>   int i = get_global_id(0);
>   out[i] = arr[in[i]];
>  }
> +
> +__constant char arrc[] = { 4, 3, 2, 1, };
> +
> +__kernel void simple_constant_char(__global char *out) {
> + int i = get_global_id(0);
> + out[i] = arrc[1];
> +}
> +
> +__kernel void given_constant_char(__global char *out, int c) {
> + int i = get_global_id(0);
> + out[i] = arrc[c];
> +}
> +
> +__kernel void simple_gid_char(__global char *out) {
> + int i = get_global_id(0);
> + out[i] = arrc[i];
> +}
> +
> +__kernel void indirection_char(__global char *out, __global uchar *in) {
> + int i = get_global_id(0);
> + out[i] = arrc[in[i]];
> +}
> +
> +__constant float2 arr2[] = {
> +{4.0f, 5.0f},
> +{3.0f, 5.0f},
> +{2.0f, 5.0f},
> +{1.0f, 5.0f}
> +};
> +
> +__kernel void simple_constant_2(__global float2 *out) {
> + int i = get_global_id(0);
> + out[i] = arr2[1];
> +}
> +
> +__kernel void given_constant_2(__global float2 *out, int c) {
> + int i = get_global_id(0);
> + out[i] = arr2[c];
> +}
> +
> +__kernel void simple_gid_2(__global float2 *out) {
> + int i = get_global_id(0);
> + out[i] = arr2[i];
> +}
> +
> +__kernel void indirection_2(__global float2 *out, __global uchar *in) {
> + int i = get_global_id(0);
> + out[i] = arr2[in[i]];
> +}
> -- 
> 2.5.0
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/1] cl: Don't warn when using deprecated functions.

2016-01-27 Thread Tom Stellard
On Fri, Jan 15, 2016 at 05:38:43PM -0500, Jan Vesely wrote:
> Deprecated features are required to be supported until they are removed.
> 
> Signed-off-by: Jan Vesely 
Reviewed-by: Tom Stellard 
> ---
>  tests/cl/api/get-image-info.c | 14 --
>  1 file changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/tests/cl/api/get-image-info.c b/tests/cl/api/get-image-info.c
> index b315ae9..2d653b1 100644
> --- a/tests/cl/api/get-image-info.c
> +++ b/tests/cl/api/get-image-info.c
> @@ -88,23 +88,17 @@ piglit_cl_test(const int argc,
> &image_desc,
> NULL,
> &errNo);
> - } else {
> - fprintf(stderr, "Could not create image. Piglit was compiled 
> against OpenCL version >= 1.2 and cannot run this test for versions < 1.2 
> because clCreateImage function is not present.\n");
> - return PIGLIT_WARN;
> - }
> -#else //CL_VERSION_1_2
> - if(env->version <= 11) {
> + } else
> +#endif //CL_VERSION_1_2
> + {
>   image = clCreateImage2D(env->context->cl_ctx,
>   CL_MEM_READ_WRITE,
>   &image_format,
>   128, 128, 0,
>   NULL,
>   &errNo);
> - } else {
> - fprintf(stderr, "Could not create image. Piglit was compiled 
> against OpenCL version < 1.2 and cannot run this test for versions >= 1.2 
> because clCreateImage2D function was deprecated.\n");
> - return PIGLIT_WARN;
>   }
> -#endif //CL_VERSION_1_2
> +
>   if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
>   fprintf(stderr,
>   "Failed (error code: %s): Create an image.\n",
> -- 
> 2.5.0
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/1] cl: Add scalar to constant load test

2016-01-27 Thread Tom Stellard
On Fri, Jan 15, 2016 at 05:37:42PM -0500, Jan Vesely wrote:
> Signed-off-by: Jan Vesely 

Reviewed-by: Tom Stellard 

> ---
>  tests/cl/program/execute/constant-load.cl | 18 ++
>  1 file changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/cl/program/execute/constant-load.cl 
> b/tests/cl/program/execute/constant-load.cl
> index 307ba68..ae1ebcd 100644
> --- a/tests/cl/program/execute/constant-load.cl
> +++ b/tests/cl/program/execute/constant-load.cl
> @@ -2,19 +2,29 @@
>  [config]
>  
>  [test]
> +kernel_name: constant_load_global_store_1
> +name: constant load global write int
> +arg_out: 0 buffer int[1] 1
> +arg_in:  1 buffer int[1] 1
> +
> +[test]
>  kernel_name: constant_load_global_store_2
>  name: constant load global write int2
> -arg_out: 0 buffer int2[1] 1 2
> -arg_in:  1 buffer int2[1] 1 2
> +arg_out: 0 buffer int2[1] 2 3
> +arg_in:  1 buffer int2[1] 2 3
>  
>  [test]
>  kernel_name: constant_load_global_store_4
>  name: constant load global write int4
> -arg_out: 0 buffer int4[1] 1 2 3 4
> -arg_in:  1 buffer int4[1] 1 2 3 4
> +arg_out: 0 buffer int4[1] 4 5 6 7
> +arg_in:  1 buffer int4[1] 4 5 6 7
>  
>  !*/
>  
> +kernel void constant_load_global_store_1(global int2 *out, constant int *in){
> +out[0] = *in;
> +}
> +
>  kernel void constant_load_global_store_2(global int2 *out, constant int2 
> *in){
>  out[0] = *in;
>  }
> -- 
> 2.5.0
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v2] cl: add clEnqueueFillImage

2015-09-29 Thread Tom Stellard
On Tue, Sep 29, 2015 at 10:05:41PM +0200, Serge Martin wrote:
> Hello
> 
> I think I will push it in a few days if no one objects
> 

Feel free to push it right away if you want.

-Tom

> On Saturday 12 September 2015 16:37:04 Serge Martin wrote:
> > ---
> > It' a little more than a ping so here is a v2.
> > Since amdocl and pocl failed to pass the test (they even crash)
> > I expend some of them to be more explicty about the error.
> > 
> > Also it have rebased so it will easier to apply
> > 
> > 
> >  tests/cl.py   |   1 +
> >  tests/cl/api/CMakeLists.cl.txt|   1 +
> >  tests/cl/api/enqueue-fill-image.c | 334
> > ++ 3 files changed, 336 insertions(+)
> >  create mode 100644 tests/cl/api/enqueue-fill-image.c
> > 
> > diff --git a/tests/cl.py b/tests/cl.py
> > index 161558b..34cf536 100644
> > --- a/tests/cl.py
> > +++ b/tests/cl.py
> > @@ -59,6 +59,7 @@ with profile.group_manager(PiglitCLTest, 'api') as g:
> >  g(['cl-api-enqueue-read_write-buffer'],
> >'clEnqueueReadBuffer and clEnqueueWriteBuffer')
> >  g(['cl-api-enqueue-fill-buffer'], 'clEnqueueFillBuffer')
> > +g(['cl-api-enqueue-fill-image'], 'clEnqueueFillImage')
> >  g(['cl-api-get-mem-object-info'], 'clGetMemObjectInfo')
> >  g(['cl-api-get-image-info'], 'clGetImageInfo')
> >  g(['cl-api-retain_release-mem-object'],
> > diff --git a/tests/cl/api/CMakeLists.cl.txt b/tests/cl/api/CMakeLists.cl.txt
> > index 4a90c58..73ccbe3 100644
> > --- a/tests/cl/api/CMakeLists.cl.txt
> > +++ b/tests/cl/api/CMakeLists.cl.txt
> > @@ -22,6 +22,7 @@ piglit_cl_add_api_test (enqueue-map-buffer
> > enqueue-map-buffer.c) piglit_cl_add_api_test (enqueue-copy-buffer-rect
> > enqueue-copy-buffer-rect.c) piglit_cl_add_api_test
> > (enqueue-read_write-buffer enqueue-read_write-buffer.c)
> > piglit_cl_add_api_test (enqueue-fill-buffer enqueue-fill-buffer.c)
> > +piglit_cl_add_api_test (enqueue-fill-image enqueue-fill-image.c)
> >  piglit_cl_add_api_test (retain_release-mem-object
> > retain_release-mem-object.c) piglit_cl_add_api_test (get-mem-object-info
> > get-mem-object-info.c) piglit_cl_add_api_test (get-image-info
> > get-image-info.c)
> > diff --git a/tests/cl/api/enqueue-fill-image.c
> > b/tests/cl/api/enqueue-fill-image.c new file mode 100644
> > index 000..ebcfba4
> > --- /dev/null
> > +++ b/tests/cl/api/enqueue-fill-image.c
> > @@ -0,0 +1,334 @@
> > +/*
> > + * Copyright © 2015 Serge Martin 
> > + *
> > + * Permission is hereby granted, free of charge, to any person obtaining a
> > + * copy of this software and associated documentation files (the
> > "Software"), + * to deal in the Software without restriction, including
> > without limitation + * the rights to use, copy, modify, merge, publish,
> > distribute, sublicense, + * and/or sell copies of the Software, and to
> > permit persons to whom the + * Software is furnished to do so, subject to
> > the following conditions: + *
> > + * The above copyright notice and this permission notice (including the
> > next + * paragraph) shall be included in all copies or substantial portions
> > of the + * Software.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
> > OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> > MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
> > IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
> > CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
> > TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE
> > SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE.
> > + */
> > +
> > +/**
> > + * @file enqueue-fill-image.c
> > + *
> > + * Test API function:
> > + *
> > + *   cl_int
> > + *   clEnqueueFillImage(cl_command_queue command_queue, cl_mem image,
> > + *  const void *fill_color, size_t *origin, size_t
> > *region + *  cl_uint num_events_in_wait_list,
> > + *  const cl_event *event_wait_list,
> > + *  cl_event *event )
> > + */
> > +
> > +#include "piglit-framework-cl-api.h"
> > +
> > +
> > +PIGLIT_CL_API_TEST_CONFIG_BEGIN
> > +
> > +   config.name = "clEnqueueFillImage";
> > +   config.version_min = 12;
> > +
> > +   config.run_per_device = true;
> > +   config.create_context = true;
> > +
> > +PIGLIT_CL_API_TEST_CONFIG_END
> > +
> > +
> > +#if defined(CL_VERSION_1_2)
> > +static bool
> > +test(cl_command_queue queue, cl_mem image,
> > + const void *fill_color, size_t *origin, size_t *region,
> > + cl_uint num_events_in_wait_list,
> > + const cl_event *event_wait_list,
> > + cl_event *event,
> > + cl_int expected_error, enum piglit_result* result,
> > + const char* test_str) {
> > +   cl_int errNo;
> > +
> > +   errNo = clEnqueueFillImage(queue, image,
> > +  fill_color, origin, region,
> > +  nu

Re: [Piglit] [PATCH] framework/summary.py: Always print number of changes in console mode

2015-09-09 Thread Tom Stellard
On Wed, Sep 09, 2015 at 01:23:22PM -0700, Dylan Baker wrote:
> On Wed, Sep 09, 2015 at 03:57:55PM -0400, Tom Stellard wrote:
> > On Wed, Sep 09, 2015 at 12:52:22PM -0700, Dylan Baker wrote:
> > > > I have a buildbot seti up to run piglit and the way it detects whether
> > > > or no there have been piglit regressions is by running piglit summary
> > > > console and then parsing the output.
> > > > 
> > > > The CSV summary seems to only accept a single result file, unless I'm
> > > > doing something wrong:
> > > > 
> > > > tstellar@localhost ~/piglit $ ./piglit summary csv  -o out.csv 
> > > > results/master--150727-/ results/master-BONAIRE-150223-/
> > > > usage: piglit [-h] [-o ] 
> > > > piglit: error: unrecognized arguments: results/master-BONAIRE-150223-/
> > > > 
> > > > -Tom
> > > 
> > > Are you just wanting to see if there are regressions, or do you want to
> > > get a count and the tests that regressed as well?
> > 
> > What I want is a list of changes, and yes/no for regressions.  The
> > number of regressions does not matter. `piglit/piglit summary console
> > -d` gives me a list of changes and prints the summary so I can check
> > if there were regressions.
> > 
> > Another solution I considered was to add an exit status to piglit
> > summary to indicate whether or not there were regressions.  This would
> > be the best solution, but I wasn't sure if this would break other
> > people's use cases.
> > 
> > -Tom
> 
> I think with my changes it would be trivial to add a '-r/--regressions'
> mode to piglit summary that would print only regressions in the change
> list, and could have an exit status for whether there were regressions
> or not.
> 

For me I would still like to see all changes: fixes and regressions but
have the exit code based on whether or not there are regressions.
So, I'm not sure a -r flag would be that useful for me.

-Tom

> I'll add an extra patch to my series.
> 
> Dylan


___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] framework/summary.py: Always print number of changes in console mode

2015-09-09 Thread Tom Stellard
On Wed, Sep 09, 2015 at 12:52:22PM -0700, Dylan Baker wrote:
> > I have a buildbot seti up to run piglit and the way it detects whether
> > or no there have been piglit regressions is by running piglit summary
> > console and then parsing the output.
> > 
> > The CSV summary seems to only accept a single result file, unless I'm
> > doing something wrong:
> > 
> > tstellar@localhost ~/piglit $ ./piglit summary csv  -o out.csv 
> > results/master--150727-/ results/master-BONAIRE-150223-/
> > usage: piglit [-h] [-o ] 
> > piglit: error: unrecognized arguments: results/master-BONAIRE-150223-/
> > 
> > -Tom
> 
> Are you just wanting to see if there are regressions, or do you want to
> get a count and the tests that regressed as well?

What I want is a list of changes, and yes/no for regressions.  The
number of regressions does not matter. `piglit/piglit summary console
-d` gives me a list of changes and prints the summary so I can check
if there were regressions.

Another solution I considered was to add an exit status to piglit
summary to indicate whether or not there were regressions.  This would
be the best solution, but I wasn't sure if this would break other
people's use cases.

-Tom
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] framework/summary.py: Always print number of changes in console mode

2015-09-09 Thread Tom Stellard
On Wed, Sep 09, 2015 at 11:05:55AM -0700, Dylan Baker wrote:
> Reviewed-by: Dylan Baker 
> 
> On a related note, I have a series that seriously overhauls the summary
> code, including fixing the console/text summary, producing a column for
> each result. It does include changes, fixes, and regressions in all
> cases like this patch. I'm hoping to have that cleaned up and on the
> list today.
> 
> On a tangent, why are you parsing the output of this, it seems like the
> CSV summary would be easier to pass to another script than this, which
> is volatile.
> 

I have a buildbot seti up to run piglit and the way it detects whether
or no there have been piglit regressions is by running piglit summary
console and then parsing the output.

The CSV summary seems to only accept a single result file, unless I'm
doing something wrong:

tstellar@localhost ~/piglit $ ./piglit summary csv  -o out.csv 
results/master--150727-/ results/master-BONAIRE-150223-/
usage: piglit [-h] [-o ] 
piglit: error: unrecognized arguments: results/master-BONAIRE-150223-/

-Tom


> Dylan
> 
> On Wed, Sep 09, 2015 at 12:28:21PM +, Tom Stellard wrote:
> > The counts for changes, fixes, and regressions are now reported as zero
> > when no changes are detect rather than being omitted from the output.
> > 
> > This makes it easier for scripts to parse the output of piglit summary
> > console, becuase now when there are no regressions piglit always
> > outputs:
> > 
> > regressions: 0
> > 
> > Before when there where no regressions, piglit would either print no
> > regression line or it would print 'regressions: 0'
> > ---
> >  framework/summary.py | 5 -
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/framework/summary.py b/framework/summary.py
> > index 80cb181..e56c0f2 100644
> > --- a/framework/summary.py
> > +++ b/framework/summary.py
> > @@ -604,7 +604,10 @@ class Summary:
> >"  fixes: {fixes}\n"
> >"regressions: {regressions}".format(
> >**{k: len(v) for k, v in 
> > self.tests.iteritems()}))
> > -
> > +else:
> > +print("changes: 0\n"
> > +  "  fixes: 0\n"
> > +  "regressions: 0")
> >  print("  total: {}".format(sum(self.totals.itervalues(
> >  
> >  # Print the name of the test and the status from each test run
> > -- 
> > 2.0.4
> > 
> > ___
> > Piglit mailing list
> > Piglit@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/piglit



> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] framework/summary.py: Always print number of changes in console mode

2015-09-09 Thread Tom Stellard
The counts for changes, fixes, and regressions are now reported as zero
when no changes are detect rather than being omitted from the output.

This makes it easier for scripts to parse the output of piglit summary
console, becuase now when there are no regressions piglit always
outputs:

regressions: 0

Before when there where no regressions, piglit would either print no
regression line or it would print 'regressions: 0'
---
 framework/summary.py | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/framework/summary.py b/framework/summary.py
index 80cb181..e56c0f2 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -604,7 +604,10 @@ class Summary:
   "  fixes: {fixes}\n"
   "regressions: {regressions}".format(
   **{k: len(v) for k, v in self.tests.iteritems()}))
-
+else:
+print("changes: 0\n"
+  "  fixes: 0\n"
+  "regressions: 0")
 print("  total: {}".format(sum(self.totals.itervalues(
 
 # Print the name of the test and the status from each test run
-- 
2.0.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: fix invalid platform test in create-context

2015-08-17 Thread Tom Stellard
On Fri, Aug 14, 2015 at 09:05:48PM +0200, Serge Martin (EdB) wrote:
> OpenCL objects are just pointers in the end, using random pointer value
> is likely to make an application crash.
> Also, all others tests use NULL as an invalid object.
> 

Reviewed-by: Tom Stellard 

> See also Francisco Jerez comments:
> http://lists.freedesktop.org/archives/mesa-dev/2014-November/070520.html
> http://lists.freedesktop.org/archives/mesa-dev/2013-October/046830.html
> ---
>  tests/cl/api/create-context.c | 16 +---
>  1 file changed, 1 insertion(+), 15 deletions(-)
> 
> diff --git a/tests/cl/api/create-context.c b/tests/cl/api/create-context.c
> index f4929f0..551f8a2 100644
> --- a/tests/cl/api/create-context.c
> +++ b/tests/cl/api/create-context.c
> @@ -139,7 +139,7 @@ piglit_cl_test(const int argc,
>   bool found_invalid_platform = false;
>   cl_platform_id* platform_ids;
>   unsigned int num_platform_ids;
> - cl_platform_id invalid_platform_id;
> + cl_platform_id invalid_platform_id = NULL;
>  
>   //TODO: test also CL_CONTEXT_INTEROP_USER_SYNC
>   cl_context_properties context_properties[] = {
> @@ -160,20 +160,6 @@ piglit_cl_test(const int argc,
>   0
>   };
>  
> - /* Find invalid platform_id */
> - invalid_platform_id = 0;
> - num_platform_ids = piglit_cl_get_platform_ids(&platform_ids);
> - while(!found_invalid_platform) {
> - found_invalid_platform = true;
> - invalid_platform_id = (cl_platform_id)1;
> - for(i = 0; i < num_platform_ids; i++) {
> - if(invalid_platform_id == platform_ids[i]) {
> - found_invalid_platform = false;
> - break;
> - }
> - }
> - }
> - free(platform_ids);
>   invalid_platform_context_properties[1] =
>   (cl_context_properties)invalid_platform_id;
>  
> -- 
> 2.5.0
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: test clEnqueueFillBuffer

2015-08-07 Thread Tom Stellard
On Fri, Aug 07, 2015 at 11:41:15PM +0200, Serge Martin (EdB) wrote:
> ---

Reviewed-by: Tom Stellard 

>  tests/cl.py|   1 +
>  tests/cl/api/CMakeLists.cl.txt |   1 +
>  tests/cl/api/enqueue-fill-buffer.c | 269 
> +
>  3 files changed, 271 insertions(+)
>  create mode 100644 tests/cl/api/enqueue-fill-buffer.c
> 
> diff --git a/tests/cl.py b/tests/cl.py
> index 4668ddc..6246ba1 100644
> --- a/tests/cl.py
> +++ b/tests/cl.py
> @@ -58,6 +58,7 @@ with profile.group_manager(PiglitCLTest, 'api') as g:
>  g(['cl-api-enqueue-copy-buffer-rect'], 'clEnqueueCopyBufferRect')
>  g(['cl-api-enqueue-read_write-buffer'],
>'clEnqueueReadBuffer and clEnqueueWriteBuffer')
> +g(['cl-api-enqueue-fill-buffer'], 'clEnqueueFillBuffer')
>  g(['cl-api-get-mem-object-info'], 'clGetMemObjectInfo')
>  g(['cl-api-get-image-info'], 'clGetImageInfo')
>  g(['cl-api-retain_release-mem-object'],
> diff --git a/tests/cl/api/CMakeLists.cl.txt b/tests/cl/api/CMakeLists.cl.txt
> index b598528..0af42d1 100644
> --- a/tests/cl/api/CMakeLists.cl.txt
> +++ b/tests/cl/api/CMakeLists.cl.txt
> @@ -21,6 +21,7 @@ piglit_cl_add_api_test (enqueue-copy-buffer 
> enqueue-copy-buffer.c)
>  piglit_cl_add_api_test (enqueue-map-buffer enqueue-map-buffer.c)
>  piglit_cl_add_api_test (enqueue-copy-buffer-rect enqueue-copy-buffer-rect.c)
>  piglit_cl_add_api_test (enqueue-read_write-buffer 
> enqueue-read_write-buffer.c)
> +piglit_cl_add_api_test (enqueue-fill-buffer enqueue-fill-buffer.c)
>  piglit_cl_add_api_test (retain_release-mem-object 
> retain_release-mem-object.c)
>  piglit_cl_add_api_test (get-mem-object-info get-mem-object-info.c)
>  piglit_cl_add_api_test (get-image-info get-image-info.c)
> diff --git a/tests/cl/api/enqueue-fill-buffer.c 
> b/tests/cl/api/enqueue-fill-buffer.c
> new file mode 100644
> index 000..af711de
> --- /dev/null
> +++ b/tests/cl/api/enqueue-fill-buffer.c
> @@ -0,0 +1,269 @@
> +/*
> + * Copyright © 2015 Serge Martin (EdB) 
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> + * DEALINGS IN THE SOFTWARE.
> + */
> +
> +/**
> + * @file enqueue-fill-buffer.c
> + *
> + * Test API function:
> + *
> + *   cl_int
> + *   clEnqueueFillBuffer(cl_command_queue command_queue, cl_mem buffer,
> + *   const void *pattern, size_t pattern_size,
> + *   size_t offset, size_t size,
> + *   cl_uint num_events_in_wait_list,
> + *   const cl_event *event_wait_list,
> + *   cl_event *event )
> + */
> +
> +#include "piglit-framework-cl-api.h"
> +
> +
> +PIGLIT_CL_API_TEST_CONFIG_BEGIN
> +
> + config.name = "clEnqueueFillBuffer";
> + config.version_min = 12;
> +
> + config.run_per_device = true;
> + config.create_context = true;
> +
> +PIGLIT_CL_API_TEST_CONFIG_END
> +
> +
> +#if defined(CL_VERSION_1_2)
> +static bool
> +test(cl_command_queue queue, cl_mem buffer,
> + const void *pattern, size_t pattern_size,
> + size_t offset, size_t size,
> + cl_uint num_events_in_wait_list,
> + const cl_event *event_wait_list,
> + cl_event *event ,
> + cl_int expected_error, enum piglit_result* result,
> + const char* test_str) {
> + cl_int errNo;
> +
> + errNo = clEnqueueFillBuffer(queue, buffer,
> +   pattern, pattern_size, offset, size,
> +  

Re: [Piglit] Error when using creating a summary with old results

2015-07-28 Thread Tom Stellard
On Tue, Jul 28, 2015 at 11:25:59AM -0400, Ilia Mirkin wrote:
> Instead of
> 
> piglit-summary-html foo.old
> 

Hi,

I'm passing directory names to piglit that don't have a .old
suffix.  However inside the directories, I see results.json.bz2 and
results.json.old.  Is it possible there is an upgrade path that isn't
deleting the .old files when it should?

-Tom



> you can do
> 
> piglit-summary-html <(cat foo.old)
> 
> That should hide the filename from python.
> 
> Dylan: Looks like your logic is a bit *too* clever now :)
> 
> On Tue, Jul 28, 2015 at 10:47 AM, Tom Stellard  wrote:
> > Hi,
> >
> > I'm getting this error when I try to include older results in a summary:
> >
> > Warning: A python exception that should have been handled was not. This is 
> > bug and should be reported.
> > BUG: No module supports file extensions ".old"
> >
> > Is there some way to fix this?
> >
> > Thanks,
> > Tom
> > ___
> > Piglit mailing list
> > Piglit@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] Error when using creating a summary with old results

2015-07-28 Thread Tom Stellard
Hi,

I'm getting this error when I try to include older results in a summary:

Warning: A python exception that should have been handled was not. This is bug 
and should be reported.
BUG: No module supports file extensions ".old"

Is there some way to fix this?

Thanks,
Tom
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl/api: Avoid deprecated declarations warnings.

2015-07-08 Thread Tom Stellard

Reviewed-by: Tom Stellard 

-Tom
On Wed, Jul 08, 2015 at 02:54:51PM +0100, Jose Fonseca wrote:
> ---
>  tests/cl/api/create-image.c| 2 ++
>  tests/cl/api/unload-compiler.c | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/tests/cl/api/create-image.c b/tests/cl/api/create-image.c
> index a1e143b..1ee5f71 100644
> --- a/tests/cl/api/create-image.c
> +++ b/tests/cl/api/create-image.c
> @@ -24,6 +24,8 @@
>   *
>   */
>  
> +#define CL_USE_DEPRECATED_OPENCL_1_1_APIS
> +
>  #include "piglit-framework-cl-api.h"
>  
>  PIGLIT_CL_API_TEST_CONFIG_BEGIN
> diff --git a/tests/cl/api/unload-compiler.c b/tests/cl/api/unload-compiler.c
> index 7c915e8..382d0dc 100644
> --- a/tests/cl/api/unload-compiler.c
> +++ b/tests/cl/api/unload-compiler.c
> @@ -30,6 +30,8 @@
>   *   cl_int clUnloadCompiler (void)
>   */
>  
> +#define CL_USE_DEPRECATED_OPENCL_1_1_APIS
> +
>  #include "piglit-framework-cl-api.h"
>  
>  
> -- 
> 2.1.4
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: fix CL_KERNEL_GLOBAL_WORK_SIZE query

2015-07-07 Thread Tom Stellard
On Sun, Jun 14, 2015 at 05:02:26PM +0200, EdB wrote:
> this query is only valid for a custom device or a build-in kernel

Reviewed-by: Tom Stellard 
> ---
>  tests/cl/api/get-kernel-work-group-info.c | 18 --
>  1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/cl/api/get-kernel-work-group-info.c 
> b/tests/cl/api/get-kernel-work-group-info.c
> index a38cdf0..1334168 100644
> --- a/tests/cl/api/get-kernel-work-group-info.c
> +++ b/tests/cl/api/get-kernel-work-group-info.c
> @@ -83,6 +83,20 @@ piglit_cl_test(const int argc,
>  
>   /*** Normal usage ***/
>   for(i = 0; i < num_kernel_work_group_infos; i++) {
> + cl_int success_code = CL_SUCCESS;
> +
> +#if defined(CL_VERSION_1_2)
> + /* CL_KERNEL_GLOBAL_WORK_SIZE query
> +  * is valid for custom device or build-in kernel
> +  */
> + if (kernel_work_group_infos[i] == CL_KERNEL_GLOBAL_WORK_SIZE) {
> + cl_device_type* dev_type_ptr =
> +   piglit_cl_get_device_info(env->device_id, 
> CL_DEVICE_TYPE);
> + if (*dev_type_ptr != CL_DEVICE_TYPE_CUSTOM)
> + success_code = CL_INVALID_VALUE;
> + }
> +#endif
> +
>   printf("%s ", 
> piglit_cl_get_enum_name(kernel_work_group_infos[i]));
>  
>   errNo = clGetKernelWorkGroupInfo(kernel,
> @@ -91,7 +105,7 @@ piglit_cl_test(const int argc,
>0,
>NULL,
>¶m_value_size);
> - if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
> + if(!piglit_cl_check_error(errNo, success_code)) {
>   fprintf(stderr,
>   "Failed (error code: %s): Get size of %s.\n",
>   piglit_cl_get_error_name(errNo),
> @@ -107,7 +121,7 @@ piglit_cl_test(const int argc,
>param_value_size,
>param_value,
>NULL);
> - if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
> + if(!piglit_cl_check_error(errNo, success_code)) {
>   fprintf(stderr,
>   "Failed (error code: %s): Get value of %s.\n",
>   piglit_cl_get_error_name(errNo),
> -- 
> 2.4.3
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 3/3] cl: Add fmin, fmax tests

2015-04-28 Thread Tom Stellard
On Mon, Apr 27, 2015 at 04:53:37PM -0400, Jan Vesely wrote:
> On Mon, 2015-04-20 at 16:57 -0400, Jan Vesely wrote:
> > On Sat, 2015-04-11 at 21:16 -0400, Jan Vesely wrote:
> > > Pass on Intel CPU, fail (expected) on Turks
> > 
> > note that the test passes on turks since llvm r234716
> 
> ping. Anything wrong with 3/3?
> 

No.

Reviewed-by: Tom Stellard 

> jan
> 
> > 
> > jan
> > 
> > > 
> > > Signed-off-by: Jan Vesely 
> > > ---
> > >  generated_tests/gen_cl_math_builtins.py | 20 
> > >  1 file changed, 20 insertions(+)
> > > 
> > > diff --git a/generated_tests/gen_cl_math_builtins.py 
> > > b/generated_tests/gen_cl_math_builtins.py
> > > index ce7682d..9e51079 100644
> > > --- a/generated_tests/gen_cl_math_builtins.py
> > > +++ b/generated_tests/gen_cl_math_builtins.py
> > > @@ -53,6 +53,8 @@ CLC_VERSION_MIN = {
> > >  'exp' : 10,
> > >  'fabs' : 10,
> > >  'floor' : 10,
> > > +'fmax' : 10,
> > > +'fmin' : 10,
> > >  'fmod' : 10,
> > >  'ldexp' : 10,
> > >  'log10' : 10,
> > > @@ -277,6 +279,24 @@ tests = {
> > >  [0.5, -0.5, 0.0, -0.0, float("nan"), -3.99, 1.5]
> > >  ]
> > >  },
> > > +'fmax' : {
> > > +'arg_types': [F, F, F],
> > > +'function_type': 'tss',
> > > +'values': [
> > > +[1.0,  0.0, 0.0,  0.0, 1.0, 1.0,  float("nan")], 
> > > #Result
> > > +[1.0, -0.5, 0.0,  0.0, 1.0, float("nan"), float("nan")], 
> > > #Arg0
> > > +[0.0,  0.0, 0.0, -0.5, float("nan"), 1.0, float("nan")] #Arg1
> > > +]
> > > +},
> > > +'fmin' : {
> > > +'arg_types': [F, F, F],
> > > +'function_type': 'tss',
> > > +'values': [
> > > +[0.0, -0.5, 0.0, -0.5, 1.0, 1.0,  float("nan")], 
> > > #Result
> > > +[1.0, -0.5, 0.0,  0.0, 1.0, float("nan"), float("nan")], 
> > > #Arg0
> > > +[0.0,  0.0, 0.0, -0.5, float("nan"), 1.0, float("nan")] #Arg1
> > > +]
> > > +},
> > >  'fmod' : {
> > >  'arg_types': [F, F, F],
> > >  'function_type': 'ttt',
> > 
> 
> -- 
> Jan Vesely 



> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v2 2/3] cl: Add tests for common builtin functions

2015-04-20 Thread Tom Stellard
On Sun, Apr 12, 2015 at 12:37:21PM -0400, Jan Vesely wrote:
> Move sign and mix out of math
> All tests pass on Turks (min needs a libclc patch)
> All tests except step pass on Intel CPU, it fails in NaN cases.
> 
> v2: Remove min/max NaN tests, as OpenCL 1.1 changed the wording, making
> the results undefined
> 

Reviewed-by: Tom Stellard 

> Signed-off-by: Jan Vesely 
> ---
>  generated_tests/CMakeLists.txt|   4 +
>  generated_tests/gen_cl_common_builtins.py | 154 
> ++
>  generated_tests/gen_cl_math_builtins.py   |  21 
>  tests/cl.py   |   3 +
>  4 files changed, 161 insertions(+), 21 deletions(-)
>  create mode 100644 generated_tests/gen_cl_common_builtins.py
> 
> diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
> index 82679e1..5036a5d 100644
> --- a/generated_tests/CMakeLists.txt
> +++ b/generated_tests/CMakeLists.txt
> @@ -134,6 +134,9 @@ piglit_make_generated_tests(
>  piglit_make_generated_tests(
>   builtin_cl_relational_tests.list
>   gen_cl_relational_builtins.py)
> +piglit_make_generated_tests(
> + builtin_cl_common_tests.list
> + gen_cl_common_builtins.py)
>  
>  # Create a custom target for generating OpenGL tests
>  # This is not added to the default target, instead it is added
> @@ -167,6 +170,7 @@ add_custom_target(gen-cl-tests
>   DEPENDS builtin_cl_int_tests.list
>   builtin_cl_math_tests.list
>   builtin_cl_relational_tests.list
> + builtin_cl_common_tests.list
>   cl_store_tests.list
>  )
>  
> diff --git a/generated_tests/gen_cl_common_builtins.py 
> b/generated_tests/gen_cl_common_builtins.py
> new file mode 100644
> index 000..19563eb
> --- /dev/null
> +++ b/generated_tests/gen_cl_common_builtins.py
> @@ -0,0 +1,154 @@
> +# Copyright 2013 Advanced Micro Devices, Inc.
> +#
> +# Permission is hereby granted, free of charge, to any person obtaining a
> +# copy of this software and associated documentation files (the "Software"),
> +# to deal in the Software without restriction, including without limitation
> +# the rights to use, copy, modify, merge, publish, distribute, sublicense,
> +# and/or sell copies of the Software, and to permit persons to whom the
> +# Software is furnished to do so, subject to the following conditions:
> +#
> +# The above copyright notice and this permission notice (including the next
> +# paragraph) shall be included in all copies or substantial portions of the
> +# Software.
> +#
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
> FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
> THE
> +# SOFTWARE.
> +#
> +# Authors: Tom Stellard 
> +#  Aaron Watry  
> +#
> +
> +from __future__ import print_function, division, absolute_import
> +import os
> +
> +from genclbuiltins import gen, NEGNAN
> +from math import radians, degrees, pi
> +
> +CLC_VERSION_MIN = {
> +'clamp' : 10,
> +'degrees' : 10,
> +'max' : 10,
> +'min' : 10,
> +'mix' : 10,
> +'radians' : 10,
> +'step' : 10,
> +'smoothstep' : 10,
> +'sign' : 10
> +}
> +
> +DATA_TYPES = ['float']
> +
> +F = {
> +'float' : 'float'
> +}
> +
> +I = {
> +'float' : 'int'
> +}
> +
> +tests = {
> +'clamp' : {
> +'arg_types': [F, F, F, F],
> +'function_type': 'tss',
> +'values': [
> +[0.5,  0.0, 0.0,  0.0, float("nan")], #Result
> +[1.0, -0.5, 0.0,  0.0, float("nan")], #Arg0
> +[0.0,  0.0, 0.0, -0.5, float("nan")], #Arg1
> +[0.5,  0.5, 0.0,  0.5, float("nan")], #Arg2
> +]
> +},
> +'degrees' : {
> +'arg_types': [F, F],
> +'function_type': 'ttt',
> +'values': [
> +[degrees(0.5), degrees(-0.5), 180.0, 0.0, 360, 1800.0, 18000, 
> 90], #Result
> +[0.5,   -0.5, pi,0.0, 2*pi, 10*pi, 10

Re: [Piglit] [PATCH 1/3] cl: Fix generating tts tests

2015-04-20 Thread Tom Stellard
On Sat, Apr 11, 2015 at 09:16:57PM -0400, Jan Vesely wrote:
> That's just 'mix' at this moment
> 
> Signed-off-by: Jan Vesely 

Patches 1 and 2 are:

Reviewed-by: Tom Stellard 

> ---
>  generated_tests/genclbuiltins.py | 16 +++-
>  1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/generated_tests/genclbuiltins.py 
> b/generated_tests/genclbuiltins.py
> index cf95f9c..24bf249 100644
> --- a/generated_tests/genclbuiltins.py
> +++ b/generated_tests/genclbuiltins.py
> @@ -302,22 +302,20 @@ def isFloatType(t):
>  return t not in U
>  
>  # Print a test with all-vector inputs/outputs and/or mixed vector/scalar args
> -def print_test(f, fnName, argType, functionDef, tests, numTests, vecSize, 
> tss):
> +def print_test(f, fnName, argType, functionDef, tests, numTests, vecSize, 
> fntype):
>  # If the test allows mixed vector/scalar arguments, handle the case with
>  # only vector arguments through a recursive call.
> -if (tss):
> +if (fntype is 'tss' or fntype is 'tts'):
>  print_test(f, fnName, argType, functionDef, tests, numTests, vecSize,
> -   False)
> +   'ttt')
>  
>  # The tss && vecSize==1 case is handled in the non-tss case.
> -if (tss and vecSize == 1):
> +if ((not fntype is 'ttt') and vecSize == 1):
>  return
>  
>  # If we're handling mixed vector/scalar input widths, the kernels have
>  # different names than when the vector widths match
> -tssStr = 'tss_'
> -if (not tss):
> -tssStr = ''
> +tssStr = fntype + '_' if (not fntype is 'ttt') else ''
>  
>  argTypes = getArgTypes(argType, functionDef['arg_types'])
>  argCount = len(argTypes)
> @@ -342,7 +340,7 @@ def print_test(f, fnName, argType, functionDef, tests, 
> numTests, vecSize, tss):
>  # The output argument and first tss argument are vectors, any that
>  # follow are scalar. If !tss, then everything has a matching vector
>  # width
> -if (arg < 2 or not tss):
> +if (fntype is 'ttt' or (arg < 2 and fntype is 'tss') or (arg < 3 and 
> fntype is 'tts')):
>  f.write(argInOut + str(arg) + ' buffer ' + argTypes[arg] +
>  '[' + str(numTests * vecSize) + '] ' +
>  ''.join(map(lambda x: (x + ' ') * vecSize, 
> argVal.split()))
> @@ -421,7 +419,7 @@ def gen(types, minVersions, functions, testDefs, dirName):
>  sizes.insert(0, 1)  # Add 1-wide scalar to the vector widths
>  for vecSize in sizes:
>  print_test(f, fnName, dataType, functionDef, tests,
> -   numTests, vecSize, (fnType is 'tss'))
> +   numTests, vecSize, fnType)
>  
>  # Terminate the header section
>  f.write('!*/\n\n')
> -- 
> 2.1.0
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/2] cl: Add generated tests for fract

2015-04-07 Thread Tom Stellard
This uses a custom function to generate the kernel code in order to handle the
output parameters correctly.
---
 generated_tests/gen_cl_math_builtins.py | 75 +
 generated_tests/genclbuiltins.py| 18 +++-
 2 files changed, 91 insertions(+), 2 deletions(-)

diff --git a/generated_tests/gen_cl_math_builtins.py 
b/generated_tests/gen_cl_math_builtins.py
index 30d0c43..34b364d 100644
--- a/generated_tests/gen_cl_math_builtins.py
+++ b/generated_tests/gen_cl_math_builtins.py
@@ -30,6 +30,64 @@ from genclbuiltins import gen, NEGNAN
 from math import acos, acosh, asin, asinh, atan, atan2, atanh, cos, cosh, exp
 from math import fabs, fmod, log10, log1p, pi, pow, sin, sinh, sqrt, tan, tanh
 
+
+def gen_fract_kernels(functionDef, f):
+   dataType = 'float'
+   fnName = 'fract'
+   for vec_suffix in ['', '2', '4', '8', '16']:
+if vec_suffix == '':
+vec_count = 1
+else:
+vec_count = int(vec_suffix)
+vec_type = '{}{}'.format(dataType, vec_suffix)
+
+
+kernel ="""
+
+#if 1 == %(vec_count)s
+#define STORE_RESULT(ptr, value) ptr[get_global_id(0)] = (value)
+#define LOAD_ARG(arg) (arg[get_global_id(0)])
+#else
+#define STORE_RESULT(ptr, value) vstore%(vec_suffix)s((value), 
get_global_id(0), ptr)
+#define LOAD_ARG(arg) (vload%(vec_suffix)s(get_global_id(0), arg))
+#endif
+
+
+
+kernel void test_%(vec_count)s_%(fnName)s_%(dataType)s(
+global %(dataType)s *outp_fract,
+global %(dataType)s *outl_fract,
+global %(dataType)s *outg_fract,
+global %(dataType)s *outp_floor,
+global %(dataType)s *outl_floor,
+global %(dataType)s *outg_floor,
+global %(dataType)s *in0) {
+
+%(vec_type)s floor_private;
+local %(vec_type)s floor_local[1];
+
+global %(vec_type)s *outg_floor_vec = (global %(vec_type)s *)(outg_floor);
+
+// Test private address space
+STORE_RESULT(outp_fract, fract(LOAD_ARG(in0), &floor_private));
+STORE_RESULT(outp_floor, floor_private);
+
+// Test local address space
+STORE_RESULT(outl_fract, fract(LOAD_ARG(in0), floor_local));
+STORE_RESULT(outl_floor, floor_local[0]);
+
+// Test global address space
+STORE_RESULT(outg_fract, fract(LOAD_ARG(in0), (outg_floor_vec + 
get_global_id(0;
+}
+
+#undef STORE_RESULT
+#undef LOAD_ARG
+
+""" % locals()
+
+f.write(kernel)
+
+
 CLC_VERSION_MIN = {
 'acos' : 10,
 'acosh' : 10,
@@ -51,6 +109,7 @@ CLC_VERSION_MIN = {
 'fabs' : 10,
 'floor' : 10,
 'fmod' : 10,
+'fract' : 10,
 'ldexp' : 10,
 'log10' : 10,
 'log1p' : 10,
@@ -258,6 +317,22 @@ tests = {
 ],
 'tolerance' : 0
 },
+   'fract' : {
+'arg_types': [F, F, F, F, F, F, F],
+'function_type': 'custom',
+# For fract we have two outputs per address space.
+'values': [
+[float("nan"), 0.0,  0.5, 0.0, 
float.fromhex('0x1.3p-2'), float.fromhex('0x1.fep-1') ], #fract 
(private)
+[float("nan"), 0.0,  0.5, 0.0, 
float.fromhex('0x1.3p-2'), float.fromhex('0x1.fep-1') ], #fract (local)
+[float("nan"), 0.0,  0.5, 0.0, 
float.fromhex('0x1.3p-2'), float.fromhex('0x1.fep-1') ], #fract (global)
+[float("nan"), float("inf"),  1.0, 2.0, -2.0,  
-1.0], #floor (private)
+[float("nan"), float("inf"),  1.0, 2.0, -2.0,  
-1.0], #floor (local)
+[float("nan"), float("inf"),  1.0, 2.0, -2.0,  
-1.0], #floor (global)
+[float("nan"), float("inf"), 1.5, 
2.0,float.fromhex('-0x1.b4p+0'), float.fromhex('-0x1.000242p-24')] #src0
+],
+'num_out_args' : 6,
+'generate_kernels_fn' : gen_fract_kernels
+},
 'ldexp' : {
 'arg_types': [F, F, I],
 'function_type': 'tss',
diff --git a/generated_tests/genclbuiltins.py b/generated_tests/genclbuiltins.py
index cf95f9c..9a9607d 100644
--- a/generated_tests/genclbuiltins.py
+++ b/generated_tests/genclbuiltins.py
@@ -186,6 +186,11 @@ def gen_kernel_3_arg_mixed_size_tts(f, fnName, inTypes, 
outType):
 
 
 def generate_kernels(f, dataType, fnName, fnDef):
+# Functions that need special handling
+if fnDef['function_type'] is 'custom':
+fnDef['generate_kernels_fn'](fnDef, f)
+return
+
 argTypes = getArgTypes(dataType, fnDef['arg_types'])
 
 # For len(argTypes), remember that this includes the output arg
@@ -301,6 +306,15 @@ def getArgTypes(baseType, argTypes):
 def isFloatType(t):
 return t not in U
 
+def getNumOutArgs(functionDef):
+if 'num_out_args' in functionDef:
+return functionDef['num_out_args']
+else:
+return 1
+
+def isOutArg(functionDef, argIdx):
+return argIdx < getNumOutArgs(functionDef)
+
 # Print a test with all-vector inputs/outputs and/or mixed 

[Piglit] [PATCH 2/2] cl: Add failing case to exp test

2015-04-07 Thread Tom Stellard
---
 generated_tests/gen_cl_math_builtins.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/generated_tests/gen_cl_math_builtins.py 
b/generated_tests/gen_cl_math_builtins.py
index 34b364d..cced8a9 100644
--- a/generated_tests/gen_cl_math_builtins.py
+++ b/generated_tests/gen_cl_math_builtins.py
@@ -285,8 +285,8 @@ tests = {
 'arg_types' : [F, F],
 'function_type': 'ttt',
 'values' : [
-[1.0, exp(0.95), exp(pi), exp(-pi), float("inf") ], # Result
-[0.0, 0.95, pi, -pi, float("inf")]  # Arg0
+[1.0, exp(0.95), exp(pi), exp(-pi), float("inf"), 
float.fromhex('0x1.66fe8ap+4')], # Result
+[0.0, 0.95, pi, -pi, float("inf"), float.fromhex('0x1.8e2cp+1')]  
# Arg0
 ],
 'tolerance' : 3
 },
-- 
2.0.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/1] cl: Fix tolerance requirementts to match the specs

2015-04-07 Thread Tom Stellard
On Tue, Apr 07, 2015 at 06:34:18PM -0400, Jan Vesely wrote:
> Whitespace errors for atanpi
> 

Reviewed-by: Tom Stellard 

> Signed-off-by: Jan Vesely 
> ---
>  generated_tests/gen_cl_math_builtins.py | 24 
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/generated_tests/gen_cl_math_builtins.py 
> b/generated_tests/gen_cl_math_builtins.py
> index 59b7f18..331202c 100644
> --- a/generated_tests/gen_cl_math_builtins.py
> +++ b/generated_tests/gen_cl_math_builtins.py
> @@ -142,7 +142,7 @@ tests = {
>  [atan(0.0), atan(0.12345), atan(3567147.0)], # Result
>  [0.0,   0.12345,   3567147.0]# Arg0
>  ],
> -'tolerance' : 2
> +'tolerance' : 5
>   },
>  'atan2' : {
>  'arg_types' : [F, F, F],
> @@ -171,17 +171,17 @@ tests = {
>  [0.0, float("inf"), float("-inf"), float("nan"), 
> atanh(0.123456789)], #Result
>  [0.0, 1.0,  -1.0,  float("nan"),   
> 0.123456789 ]  #Arg0
>  ],
> -'tolerance' : 4
> +'tolerance' : 5
>   },
>  'atanpi' : {
> -'arg_types' : [F, F],
> -'function_type': 'ttt',
> -'values' : [
> -[0.0, -0.0, atan(1.02345)/pi, atan(-1.02345)/pi, float("nan"), 0.5,  
> -0.5  ],
> -[0.0, -0.0, 1.02345,  -1.02345,  float("nan"), 
> float("inf"), float("-inf") ]
> -],
> -'tolerance' : 5
> - },
> +'arg_types' : [F, F],
> +'function_type': 'ttt',
> +'values' : [
> +[0.0, -0.0, atan(1.02345)/pi, atan(-1.02345)/pi, float("nan"), 
> 0.5,  -0.5  ],
> +[0.0, -0.0, 1.02345,  -1.02345,  float("nan"), 
> float("inf"), float("-inf") ]
> +],
> +'tolerance' : 5
> +},
>  'cbrt' : {
>  'arg_types': [F, F],
>  'function_type': 'ttt',
> @@ -215,7 +215,7 @@ tests = {
>  [1.0, 0.0,-1.0, 0.0,1.0,cos(1.12345), cos(7), 
> cos(8), cos(pow(2,20)), cos(pow(2,24)), cos(pow(2,120)), float("nan")], # 
> Result
>  [0.0, pi / 2, pi,   3 * pi / 2, 2 * pi, 1.12345, 7, 8, 
> pow(2,20), pow(2,24), pow(2,120), float("nan")] # Arg0
>  ],
> -'tolerance' : 2
> +'tolerance' : 4
>  },
>  'cosh' : {
>  'arg_types' : [F, F],
> @@ -360,7 +360,7 @@ tests = {
>  [0.0, 1.0,   0.0, -1.0,   0.0,sin(2.234567), sin(7), 
> sin(8), sin(pow(2,20)), sin(pow(2,24)), sin(pow(2,120)), float("nan")], # 
> Result
>  [0.0, pi / 2, pi, 3 * pi / 2, 2 * pi, 2.234567, 7, 8, pow(2,20), 
> pow(2,24), pow(2,120), float("nan")] # Arg0
>  ],
> -'tolerance': 2
> +'tolerance': 4
>  },
>  'sinh' : {
>  'arg_types' : [F, F],
> -- 
> 2.1.0
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/1] cl: Enable required extension before using double type

2015-03-30 Thread Tom Stellard
On Fri, Mar 27, 2015 at 07:36:26PM -0400, Jan Vesely wrote:
> Fixes failures on OCL-1.1 implementations that provide cl_khr_fp64
> 
> Signed-off-by: Jan Vesely 
Reviewed-by: Tom Stellard 
> ---
>  generated_tests/cl/store/store-kernels-global.inc | 4 ++--
>  generated_tests/cl/store/store-kernels-local.inc  | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/generated_tests/cl/store/store-kernels-global.inc 
> b/generated_tests/cl/store/store-kernels-global.inc
> index b6220d0..ae9b74e 100644
> --- a/generated_tests/cl/store/store-kernels-global.inc
> +++ b/generated_tests/cl/store/store-kernels-global.inc
> @@ -1,9 +1,9 @@
> -typedef TYPE type_t;
> -
>  #if TYPE == double
>  #pragma OPENCL EXTENSION cl_khr_fp64 : enable
>  #endif
>  
> +typedef TYPE type_t;
> +
>  kernel void store_global(global type_t *out, global type_t *in) {
>   out[0] = in[0];
>   out[1] = in[1];
> diff --git a/generated_tests/cl/store/store-kernels-local.inc 
> b/generated_tests/cl/store/store-kernels-local.inc
> index b3265f4..6692e37 100644
> --- a/generated_tests/cl/store/store-kernels-local.inc
> +++ b/generated_tests/cl/store/store-kernels-local.inc
> @@ -1,9 +1,9 @@
> -typedef TYPE type_t;
> -
>  #if TYPE == double
>  #pragma OPENCL EXTENSION cl_khr_fp64 : enable
>  #endif
>  
> +typedef TYPE type_t;
> +
>  kernel void store_local(global type_t *out, global type_t *in) {
>   local type_t local_data[8];
>   size_t id = get_local_id(0);
> -- 
> 2.1.0
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/3] cl: add acospi test

2015-03-26 Thread Tom Stellard
On Wed, Mar 25, 2015 at 01:33:49PM -0400, Jan Vesely wrote:
> copied from acos.
> tested on clover and intel ocl
> 
> Signed-off-by: Jan Vesely 

For the series:

Reviewed-by: Tom Stellard 

> ---
>  generated_tests/gen_cl_math_builtins.py | 10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/generated_tests/gen_cl_math_builtins.py 
> b/generated_tests/gen_cl_math_builtins.py
> index 30d0c43..0890fa1 100644
> --- a/generated_tests/gen_cl_math_builtins.py
> +++ b/generated_tests/gen_cl_math_builtins.py
> @@ -33,6 +33,7 @@ from math import fabs, fmod, log10, log1p, pi, pow, sin, 
> sinh, sqrt, tan, tanh
>  CLC_VERSION_MIN = {
>  'acos' : 10,
>  'acosh' : 10,
> +'acospi' : 10,
>  'asin' : 10,
>  'asinh' : 10,
>  'atan' : 10,
> @@ -96,6 +97,15 @@ tests = {
>  ],
>  'tolerance' : 4
>   },
> +'acospi' : {
> +'arg_types' : [F, F],
> +'function_type': 'ttt',
> +'values' : [
> +[ 1,  1/2, 0.0, acos(0.12345) / pi, float("nan")], # Result
> +[-1.0, 0.0,  1.0,  0.12345,  float("nan")]  # Arg0
> +],
> +'tolerance' : 5
> + },
>  'asin' : {
>  'arg_types' : [F, F],
>  'function_type': 'ttt',
> -- 
> 2.1.0
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] Add test for accessing a varying array with a large negative offset

2015-03-24 Thread Tom Stellard
From: Marek Olšák 

This tests for a bug causing either a crash or a mis-compile in the
radeonsi compiler.

Tom Stellard:
  - Decrease the offset to guarantee we hit the bug.
---
 ...rying-array-float-negative-index-rd.shader_test | 77 ++
 1 file changed, 77 insertions(+)
 create mode 100644 
tests/shaders/fs-varying-array-float-negative-index-rd.shader_test

diff --git a/tests/shaders/fs-varying-array-float-negative-index-rd.shader_test 
b/tests/shaders/fs-varying-array-float-negative-index-rd.shader_test
new file mode 100644
index 000..3f8926f
--- /dev/null
+++ b/tests/shaders/fs-varying-array-float-negative-index-rd.shader_test
@@ -0,0 +1,77 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+varying float m1[4];
+varying float m2[4];
+
+void main()
+{
+gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+
+m1[0] = 1.0;
+m1[1] = 2.0;
+m1[2] = 3.0;
+m1[3] = 4.0;
+m2[0] = 5.0;
+m2[1] = 6.0;
+m2[2] = 7.0;
+m2[3] = 8.0;
+}
+
+[fragment shader]
+uniform int index;
+uniform float expect;
+varying float m1[4];
+varying float m2[4];
+
+void main()
+{
+gl_FragColor = ((index >= 512 ? m2[index-512] : m1[index]) == expect)
+? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+clear
+ortho
+
+uniform int index 0
+uniform float expect 1
+draw rect 5 5 10 10
+probe rgb 10 10 0.0 1.0 0.0
+
+uniform int index 1
+uniform float expect 2
+draw rect 30 5 10 10
+probe rgb 35 10 0.0 1.0 0.0
+
+uniform int index 2
+uniform float expect 3
+draw rect 55 5 10 10
+probe rgb 60 10 0.0 1.0 0.0
+
+uniform int index 3
+uniform float expect 4
+draw rect 80 5 10 10
+probe rgb 85 10 0.0 1.0 0.0
+
+uniform int index 512
+uniform float expect 5
+draw rect 105 5 10 10
+probe rgb 110 10 0.0 1.0 0.0
+
+uniform int index 513
+uniform float expect 6
+draw rect 130 5 10 10
+probe rgb 135 10 0.0 1.0 0.0
+
+uniform int index 514
+uniform float expect 7
+draw rect 155 5 10 10
+probe rgb 160 10 0.0 1.0 0.0
+
+uniform int index 515
+uniform float expect 8
+draw rect 180 5 10 10
+probe rgb 185 10 0.0 1.0 0.0
-- 
2.0.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/2] get-kernel-work-group-info: Check value of CL_KERNEL_COMPILE_WORK_GROUP_SIZE

2015-03-24 Thread Tom Stellard
Verify it returns {0,0,0} when the reqd_work_group_size attribute is
not specified.
---
 tests/cl/api/get-kernel-work-group-info.c | 25 +
 1 file changed, 25 insertions(+)

diff --git a/tests/cl/api/get-kernel-work-group-info.c 
b/tests/cl/api/get-kernel-work-group-info.c
index a38cdf0..2e12e0d 100644
--- a/tests/cl/api/get-kernel-work-group-info.c
+++ b/tests/cl/api/get-kernel-work-group-info.c
@@ -115,6 +115,31 @@ piglit_cl_test(const int argc,
piglit_merge_result(&result, PIGLIT_FAIL);
}
 
+   /* Checks for specific queries */
+   switch (kernel_work_group_infos[i]) {
+   case CL_KERNEL_COMPILE_WORK_GROUP_SIZE: {
+   size_t zero[3] = {0, 0, 0};
+   unsigned expected_size = 3 * sizeof(size_t);
+   if (param_value_size != expected_size) {
+   fprintf(stderr, "Error: "
+   "Invalid param_value_size "
+   "Expected %u, got %u\n",
+   expected_size,
+   (unsigned)param_value_size);
+   piglit_merge_result(&result, PIGLIT_FAIL);
+   }
+   if (memcmp(param_value, &zero, expected_size)) {
+   fprintf(stderr, "Error: expected {0,0,0} "
+   "when attribute "
+   "reqd_work_group_size is "
+   "unspecified.");
+   piglit_merge_result(&result, PIGLIT_FAIL);
+   }
+   break;
+   }
+   default: break;
+   }
+
//TODO: output returned values
printf("\n");
free(param_value);
-- 
2.0.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/2] cl: Add test for reqd_group_work_size attribute

2015-03-24 Thread Tom Stellard
---
 tests/cl.py|   1 +
 tests/cl/api/CMakeLists.cl.txt |   1 +
 tests/cl/api/enqueue-nd-range-kernel.c | 121 +
 3 files changed, 123 insertions(+)
 create mode 100644 tests/cl/api/enqueue-nd-range-kernel.c

diff --git a/tests/cl.py b/tests/cl.py
index 1578297..ea9179a 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -95,6 +95,7 @@ add_plain_test(api, 'clCreateKernelsInProgram',
['cl-api-create-kernels-in-program'])
 add_plain_test(api, 'clGetProgramInfo', ['cl-api-get-program-info'])
 add_plain_test(api, 'clGetProgramBuildInfo', ['cl-api-get-program-build-info'])
+add_plain_test(api, 'clEnqueueNDRangeKernel', 
['cl-api-enqueue-nd-range-kernel'])
 add_plain_test(api, 'clRetainProgram and clReleaseProgram',
['cl-api-retain_release-program'])
 add_plain_test(api, 'clUnloadCompiler', ['cl-api-unload-compiler'])
diff --git a/tests/cl/api/CMakeLists.cl.txt b/tests/cl/api/CMakeLists.cl.txt
index 7e78491..377992d 100644
--- a/tests/cl/api/CMakeLists.cl.txt
+++ b/tests/cl/api/CMakeLists.cl.txt
@@ -34,6 +34,7 @@ piglit_cl_add_api_test (compile-program compile-program.c)
 piglit_cl_add_api_test (unload-compiler unload-compiler.c)
 piglit_cl_add_api_test (get-program-info get-program-info.c)
 piglit_cl_add_api_test (get-program-build-info get-program-build-info.c)
+piglit_cl_add_api_test (enqueue-nd-range-kernel enqueue-nd-range-kernel.c)
 
 # Kernels
 piglit_cl_add_api_test (create-kernel create-kernel.c)
diff --git a/tests/cl/api/enqueue-nd-range-kernel.c 
b/tests/cl/api/enqueue-nd-range-kernel.c
new file mode 100644
index 000..766d393
--- /dev/null
+++ b/tests/cl/api/enqueue-nd-range-kernel.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright © 2012 Blaž Tomažič 
+ * Copyright © 2015 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * @file enqueue-nd-range-kernel.c
+ *
+ * Test API function:
+ *
+ *
+ * cl_int clEnqueueNDRangeKernel(cl_command_queue command_queue,
+ *   cl_kernel kernel,
+ *   cl_uint work_dim,
+ *   const size_t *global_work_offset,
+ *   const size_t *global_work_size,
+ *   const size_t *local_work_size,
+ *   cl_uint num_events_in_wait_list,
+ *   const cl_event *event_wait_list,
+ *   cl_event *event) 
+ */
+
+#include "piglit-framework-cl-api.h"
+
+
+PIGLIT_CL_API_TEST_CONFIG_BEGIN
+
+   config.name = "clCreateProgramWithSource";
+   config.version_min = 10;
+
+   config.run_per_device = true;
+   config.create_context = true;
+
+PIGLIT_CL_API_TEST_CONFIG_END
+
+
+char* reqd_wgs_kernel =
+   "__attribute__((reqd_work_group_size(2, 2, 2)))  kernel void read_wqs() 
{ }";
+
+
+enum piglit_result
+piglit_cl_test(const int argc,
+   const char** argv,
+   const struct piglit_cl_api_test_config* config,
+   const struct piglit_cl_api_test_env* env)
+{
+   enum piglit_result result = PIGLIT_PASS;
+   size_t work_size_4_4_4[3] = {4, 4, 4};
+   size_t work_size_2_2_2[3] = {2, 2, 2};
+   cl_int err;
+   size_t *reqd_wgs;
+
+   cl_command_queue queue = env->context->command_queues[0];
+   cl_program program =
+   piglit_cl_build_program_with_source(
+   env->context, 1, &reqd_wgs_kernel, "");
+
+   if (!program) {
+   fprintf(stderr, "Failed to create program");
+   return PIGLIT_FAIL;
+   }
+
+   cl_kernel kernel =
+   piglit_cl_create_kernel(program, "read_wqs");
+
+   if (!kernel) {
+   fprintf(stderr, "Failed to create kernel.");
+   return PIGLIT_FAIL;
+   }
+
+   reqd_wgs = piglit_cl_get_kernel_

[Piglit] [PATCH] Add test for accessing a varying array with a large negative offset

2015-03-19 Thread Tom Stellard
From: Marek Olšák 

This tests for a bug causing either a crash or a mis-compile in the
radeonsi compiler.

Tom Stellard:
  - Decrease the offset to guarantee we hit the bug.
---
 ...rying-array-float-negative-index-rd.shader_test | 77 ++
 1 file changed, 77 insertions(+)
 create mode 100644 
tests/shaders/fs-varying-array-float-negative-index-rd.shader_test

diff --git a/tests/shaders/fs-varying-array-float-negative-index-rd.shader_test 
b/tests/shaders/fs-varying-array-float-negative-index-rd.shader_test
new file mode 100644
index 000..3f8926f
--- /dev/null
+++ b/tests/shaders/fs-varying-array-float-negative-index-rd.shader_test
@@ -0,0 +1,77 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+varying float m1[4];
+varying float m2[4];
+
+void main()
+{
+gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+
+m1[0] = 1.0;
+m1[1] = 2.0;
+m1[2] = 3.0;
+m1[3] = 4.0;
+m2[0] = 5.0;
+m2[1] = 6.0;
+m2[2] = 7.0;
+m2[3] = 8.0;
+}
+
+[fragment shader]
+uniform int index;
+uniform float expect;
+varying float m1[4];
+varying float m2[4];
+
+void main()
+{
+gl_FragColor = ((index >= 512 ? m2[index-512] : m1[index]) == expect)
+? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+clear
+ortho
+
+uniform int index 0
+uniform float expect 1
+draw rect 5 5 10 10
+probe rgb 10 10 0.0 1.0 0.0
+
+uniform int index 1
+uniform float expect 2
+draw rect 30 5 10 10
+probe rgb 35 10 0.0 1.0 0.0
+
+uniform int index 2
+uniform float expect 3
+draw rect 55 5 10 10
+probe rgb 60 10 0.0 1.0 0.0
+
+uniform int index 3
+uniform float expect 4
+draw rect 80 5 10 10
+probe rgb 85 10 0.0 1.0 0.0
+
+uniform int index 512
+uniform float expect 5
+draw rect 105 5 10 10
+probe rgb 110 10 0.0 1.0 0.0
+
+uniform int index 513
+uniform float expect 6
+draw rect 130 5 10 10
+probe rgb 135 10 0.0 1.0 0.0
+
+uniform int index 514
+uniform float expect 7
+draw rect 155 5 10 10
+probe rgb 160 10 0.0 1.0 0.0
+
+uniform int index 515
+uniform float expect 8
+draw rect 180 5 10 10
+probe rgb 185 10 0.0 1.0 0.0
-- 
2.0.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/3] cl-program-tester: Avoid void pointer arithmetic.

2015-03-03 Thread Tom Stellard
On Tue, Mar 03, 2015 at 01:46:18PM +, Jose Fonseca wrote:
> Although CL tests are not built with MSVC, this is the single instance
> of void pointer arithmetic in them, so updating it to not use void
> pointer arithmetic will enable us to use -Werror=pointer-arith option
> universally in a follow on change.

Reviewed-by: Tom Stellard 

> ---
>  tests/cl/program/program-tester.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/cl/program/program-tester.c 
> b/tests/cl/program/program-tester.c
> index 3905679..314871a 100644
> --- a/tests/cl/program/program-tester.c
> +++ b/tests/cl/program/program-tester.c
> @@ -188,7 +188,7 @@ add_dynamic_array(void** array,
>   free(old_array);
>   }
>  
> - memcpy((*array) + ((*count)*element_size), data, element_size);
> + memcpy((char *)(*array) + ((*count)*element_size), data, element_size);
>   (*count)++;
>  #undef GROW_SIZE
>  }
> -- 
> 2.1.0
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] CL: Add support for generating double-precision tests

2015-02-12 Thread Tom Stellard
On Thu, Feb 12, 2015 at 09:31:11AM -0600, Aaron Watry wrote:
> Ping.  I just realized that I had this sitting around in my local
> repository and never got any review (yay for the holidays causing things to
> get lost).
> 

Reviewed-by: Tom Stellard 

> --Aaron
> 
> On Wed, Dec 17, 2014 at 10:52 PM, Aaron Watry  wrote:
> 
> > The tests are skipped for devices that don't support doubles, and
> > when the primary data type for a file is double, we enable the cl_khr_fp64
> > pragma
> > before writing any kernels.
> >
> > Signed-off-by: Aaron Watry 
> > ---
> >  generated_tests/genclbuiltins.py | 10 +-
> >  1 file changed, 9 insertions(+), 1 deletion(-)
> >
> > diff --git a/generated_tests/genclbuiltins.py
> > b/generated_tests/genclbuiltins.py
> > index 7e85a51..9a8e85e 100644
> > --- a/generated_tests/genclbuiltins.py
> > +++ b/generated_tests/genclbuiltins.py
> > @@ -395,8 +395,13 @@ def gen(types, minVersions, functions, testDefs,
> > dirName):
> >  '[config]\n' +
> >  'name: Test '+dataType+' '+fnName+' built-in on CL
> > 1.1\n' +
> >  'clc_version_min: '+str(clcVersionMin)+'\n' +
> > -'dimensions: 1\n\n'
> > +'dimensions: 1\n'
> >  )
> > +if (dataType == 'double'):
> > +f.write('require_device_extensions: cl_khr_fp64\n')
> > +
> > +# Blank line  to provide separation between config header and
> > tests
> > +f.write('\n')
> >
> >  # Write all tests for the built-in function
> >  tests = functionDef['values']
> > @@ -416,6 +421,9 @@ def gen(types, minVersions, functions, testDefs,
> > dirName):
> >  # Terminate the header section
> >  f.write('!*/\n\n')
> >
> > +if (dataType == 'double'):
> > +f.write('#pragma OPENCL EXTENSION cl_khr_fp64 :
> > enable\n\n')
> > +
> >  # Generate the actual kernels
> >  generate_kernels(f, dataType, fnName, functionDef)
> >
> > --
> > 2.2.0
> >
> >

> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/1] cl: Fix tolerance for division in scalar arithmetic test

2015-02-06 Thread Tom Stellard
On Mon, Jan 26, 2015 at 03:20:34PM -0500, Jan Vesely wrote:
> Signed-off-by: Jan Vesely 

Reviewed-by: Tom Stellard 

> ---
> RFC: I only tagged numerical results,
>  it did not make sense to me to do it for NaNs and Infs
>

I think this is fine.

> R600: Fail -> Pass
> 
>  tests/cl/program/execute/scalar-arithmetic-float.cl | 14 +++---
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/cl/program/execute/scalar-arithmetic-float.cl 
> b/tests/cl/program/execute/scalar-arithmetic-float.cl
> index 33a44d4..84c3970 100644
> --- a/tests/cl/program/execute/scalar-arithmetic-float.cl
> +++ b/tests/cl/program/execute/scalar-arithmetic-float.cl
> @@ -178,42 +178,42 @@ name: pos div pos
>  kernel_name: div
>  arg_in:  1 float 8.5
>  arg_in:  2 float 4.25
> -arg_out: 0 buffer float[1] 2
> +arg_out: 0 buffer float[1] 2 tolerance 2
>  
>  [test]
>  name: pos div neg
>  kernel_name: div
>  arg_in:  1 float 11.25
>  arg_in:  2 float -3
> -arg_out: 0 buffer float[1] -3.75
> +arg_out: 0 buffer float[1] -3.75 tolerance 2
>  
>  [test]
>  name: neg div pos
>  kernel_name: div
>  arg_in:  1 float -21
>  arg_in:  2 float 5.25
> -arg_out: 0 buffer float[1] -4
> +arg_out: 0 buffer float[1] -4 tolerance 2
>  
>  [test]
>  name: neg div neg
>  kernel_name: div
>  arg_in:  1 float -21.25
>  arg_in:  2 float -5
> -arg_out: 0 buffer float[1] 4.25
> +arg_out: 0 buffer float[1] 4.25 tolerance 2
>  
>  [test]
>  name: 0 div pos
>  kernel_name: div
>  arg_in:  1 float 0
>  arg_in:  2 float 3.7
> -arg_out: 0 buffer float[1] 0
> +arg_out: 0 buffer float[1] 0 tolerance 2
>  
>  [test]
>  name: 0 div neg
>  kernel_name: div
>  arg_in:  1 float 0
>  arg_in:  2 float -3.7
> -arg_out: 0 buffer float[1] -0
> +arg_out: 0 buffer float[1] -0 tolerance 2
>  
>  [test]
>  name: num div 0
> @@ -234,7 +234,7 @@ name: 0 div inf
>  kernel_name: div
>  arg_in:  1 float 0
>  arg_in:  2 float inf
> -arg_out: 0 buffer float[1] 0
> +arg_out: 0 buffer float[1] 0 tolerance 2
>  
>  [test]
>  name: inf div 0
> -- 
> 2.1.0
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] opencv: Automatically run tests concurrently when render-nodes are present

2015-02-04 Thread Tom Stellard
---
 framework/test/opencv.py | 11 ++-
 tests/cl.py  | 10 +-
 tests/quick_cl.py|  4 ++--
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/framework/test/opencv.py b/framework/test/opencv.py
index 2c3d627..804cba4 100644
--- a/framework/test/opencv.py
+++ b/framework/test/opencv.py
@@ -38,14 +38,14 @@ __all__ = [
 
 
 class OpenCVTest(GTest):
-def __init__(self, test_prog, testname):
+def __init__(self, test_prog, testname, should_run_concurrent):
 options = [test_prog, '--gtest_filter=' + testname, '--gtest_color=no']
 if PIGLIT_CONFIG.has_option('opencv', 'workdir'):
 options.append('-w {}'.format(PIGLIT_CONFIG.get('opencv', 
'workdir')))
-GTest.__init__(self, options)
+GTest.__init__(self, options, run_concurrent=should_run_concurrent)
 
 
-def add_opencv_tests(profile):
+def add_opencv_tests(profile, should_run_concurrent=False):
 if not PIGLIT_CONFIG.has_option('opencv', 'opencv_test_ocl_bindir'):
 return
 
@@ -69,7 +69,7 @@ def add_opencv_tests(profile):
 full_test_name = 'opencv/{}'.format(group_desc)
 if not individual:
 profile.tests[full_test_name] = OpenCVTest(opencv_test_ocl,
-'{}*'.format(group_name))
+'{}*'.format(group_name), should_run_concurrent)
 continue
 
 if not individual:
@@ -80,4 +80,5 @@ def add_opencv_tests(profile):
 if m:
 test_name = m.group(1)
 profile.tests[grouptools.join(full_test_name, test_name)] = \
-OpenCVTest(opencv_test_ocl, '{}{}'.format(group_name 
,test_name))
+OpenCVTest(opencv_test_ocl, '{}{}'.format(group_name 
,test_name),
+   should_run_concurrent)
diff --git a/tests/cl.py b/tests/cl.py
index 06301af..ea3a11c 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -19,15 +19,15 @@ from .py_modules.constants import TESTS_DIR, 
GENERATED_TESTS_DIR
 
 __all__ = ['profile']
 
-##
-# Helper functions
+CL_CONCURRENT = (not sys.platform.startswith('linux') or
+glob.glob('/dev/dri/render*'))
 
-can_do_concurrent = (not sys.platform.startswith('linux') or
- glob.glob('/dev/dri/render*'))
 
+##
+# Helper functions
 
 def add_plain_test(group, name, args):
-group[name] = PiglitCLTest(args, run_concurrent=can_do_concurrent)
+group[name] = PiglitCLTest(args, run_concurrent=CL_CONCURRENT)
 
 
 def add_plain_program_tester_test(group, name, path):
diff --git a/tests/quick_cl.py b/tests/quick_cl.py
index 7f82a86..cee49b9 100644
--- a/tests/quick_cl.py
+++ b/tests/quick_cl.py
@@ -24,8 +24,8 @@
 # Authors: Tom Stellard 
 #
 
-from tests.cl import profile
+from tests.cl import profile, CL_CONCURRENT
 from framework.test import add_opencv_tests, add_oclconform_tests
 
-add_opencv_tests(profile)
+add_opencv_tests(profile, CL_CONCURRENT)
 add_oclconform_tests(profile)
-- 
1.8.5.5

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] cl: Add test case from opencv's knn_find_nearest kernel

2015-02-04 Thread Tom Stellard
---
 tests/cl/program/execute/opencv-knearest.cl | 77 +
 1 file changed, 77 insertions(+)
 create mode 100644 tests/cl/program/execute/opencv-knearest.cl

diff --git a/tests/cl/program/execute/opencv-knearest.cl 
b/tests/cl/program/execute/opencv-knearest.cl
new file mode 100644
index 000..f394beb
--- /dev/null
+++ b/tests/cl/program/execute/opencv-knearest.cl
@@ -0,0 +1,77 @@
+//  This test case was extracted from the knn_find_nearest kernel in the OpenCV
+//  (opencv.org) project: 2.4 branch, modules/ocl/src/opencl/knearest.cl
+//
+//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+//  By downloading, copying, installing or using the software you agree to 
this license.
+//  If you do not agree to this license, do not download, install,
+//  copy or use the software.
+//
+//
+//   License Agreement
+//For Open Source Computer Vision Library
+//
+// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
+// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// @Authors
+//Jin Ma, j...@multicorewareinc.com
+//
+// Redistribution and use in source and binary forms, with or without 
modification,
+// are permitted provided that the following conditions are met:
+//
+//   * Redistribution's of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+//   * Redistribution's in binary form must reproduce the above copyright 
notice,
+// this list of conditions and the following disclaimer in the 
documentation
+// and/or other materials provided with the distribution.
+//
+//   * The name of the copyright holders may not be used to endorse or promote 
products
+// derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors as is 
and
+// any express or implied warranties, including, but not limited to, the 
implied
+// warranties of merchantability and fitness for a particular purpose are 
disclaimed.
+// In no event shall the Intel Corporation or contributors be liable for any 
direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+
+/*!
+[config]
+dimensions: 2
+global_size: 1 1 0
+kernel_name: test
+build_options: -DOPENCL
+
+[test]
+name: test
+arg_out: 0 buffer float[1]  1.0
+arg_in:  1 int  6
+arg_in:  2 buffer float[8] 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0
+!*/
+
+kernel void test(global float *out, int K1, global float *nr)
+{
+   int j;
+   int cur_count, best_count = 0, prev_start = 0;
+   float best_val = 50.0;
+   for(j = 1; j <= K1; j++)
+   if(j == K1 || nr[j] != nr[(j - 1)])
+   {
+   cur_count = j - prev_start;
+   if(best_count < cur_count)
+   {
+   best_count = cur_count;
+   best_val = nr[(j - 1)];
+   }
+   prev_start = j;
+   }
+   out[0] = best_val;
+}
-- 
1.8.5.5

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v2] cl: Add exp tests

2015-01-26 Thread Tom Stellard
On Sun, Jan 04, 2015 at 04:20:39PM +0800, Meng Mengmeng wrote:
> Signed-off-by: Meng Mengmeng 

Pushed, thanks!

> ---
>  generated_tests/generate-cl-math-builtins.py | 12 +++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/generated_tests/generate-cl-math-builtins.py 
> b/generated_tests/generate-cl-math-builtins.py
> index ce16a6b..226bce9 100644
> --- a/generated_tests/generate-cl-math-builtins.py
> +++ b/generated_tests/generate-cl-math-builtins.py
> @@ -26,7 +26,7 @@
>  import os
>  
>  from genclbuiltins import gen, NEGNAN
> -from math import acos, acosh, asin, asinh, atan, atan2, atanh, cos, cosh
> +from math import acos, acosh, asin, asinh, atan, atan2, atanh, cos, cosh, exp
>  from math import fabs, fmod, log1p, pi, pow, sin, sinh, sqrt, tan, tanh
>  
>  CLC_VERSION_MIN = {
> @@ -45,6 +45,7 @@ CLC_VERSION_MIN = {
>  'cospi' : 10,
>  'erf' : 10,
>  'erfc' : 10,
> +'exp' : 10,
>  'fabs' : 10,
>  'floor' : 10,
>  'fmod' : 10,
> @@ -209,6 +210,15 @@ tests = {
>  ],
>  'tolerance' : 16
>  },
> +'exp' : {
> +'arg_types' : [F, F],
> +'function_type': 'ttt',
> +'values' : [
> +[1.0, exp(0.95), exp(pi), exp(-pi), float("inf") ], # Result
> +[0.0, 0.95, pi, -pi, float("inf")]  # Arg0
> +],
> +'tolerance' : 3
> +},
>  'fabs' : {
>  'arg_types' : [F, F],
>  'function_type': 'ttt',
> -- 
> 1.9.3
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/1] cl: Fix tolerance for SP division

2015-01-26 Thread Tom Stellard
On Fri, Jan 23, 2015 at 06:51:39PM -0500, Jan Vesely wrote:
> The specs say 2.5 ulp, but we only take integer values
> 

Pushed, thanks!

> Signed-off-by: Jan Vesely 
> ---
> 
> R600: Fail -> Pass
> 
>  tests/cl/program/execute/vector-arithmetic-float4.program_test | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/cl/program/execute/vector-arithmetic-float4.program_test 
> b/tests/cl/program/execute/vector-arithmetic-float4.program_test
> index 7127bb9..a80a973 100644
> --- a/tests/cl/program/execute/vector-arithmetic-float4.program_test
> +++ b/tests/cl/program/execute/vector-arithmetic-float4.program_test
> @@ -91,21 +91,21 @@ name: pos div pos, neg div neg, pos div neg, neg div pos
>  kernel_name: div
>  arg_in:  1 float4 8.5 -21.25 11.25  -21
>  arg_in:  2 float44.25 -5-3 5.25
> -arg_out: 0 buffer float4[1] 2   4.25 -3.75   -4
> +arg_out: 0 buffer float4[1] 2   4.25 -3.75   -4 tolerance 2
>  
>  [test]
>  name: 0 div pos, 0 div neg, pos div 0, neg div 0
>  kernel_name: div
>  arg_in:  1 float4   0  0 11.25  -21
>  arg_in:  2 float44.25 -5 00
> -arg_out: 0 buffer float4[1] 0  0   inf -inf
> +arg_out: 0 buffer float4[1] 0  0   inf -inf tolerance 2
>  
>  [test]
>  name: 0 div inf, inf div 0, inf div inf, nan div 0
>  kernel_name: div
>  arg_in:  1 float4   0  inf inf nan
>  arg_in:  2 float4 inf0 inf   0
> -arg_out: 0 buffer float4[1] 0  inf nan nan
> +arg_out: 0 buffer float4[1] 0  inf nan nan tolerance 2
>  
>  ## Unary plus ##
>  
> -- 
> 2.1.0
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v2 1/1] cl: add log10 test

2015-01-26 Thread Tom Stellard
On Fri, Jan 23, 2015 at 06:59:13PM -0500, Jan Vesely wrote:
> v2: Fix tolerance
> 

Pushed, thanks!

> Signed-off-by: Jan Vesely 
> ---
>  generated_tests/generate-cl-math-builtins.py | 12 +++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/generated_tests/generate-cl-math-builtins.py 
> b/generated_tests/generate-cl-math-builtins.py
> index af3843f..1c96adb 100644
> --- a/generated_tests/generate-cl-math-builtins.py
> +++ b/generated_tests/generate-cl-math-builtins.py
> @@ -27,7 +27,7 @@ import os
>  
>  from genclbuiltins import gen, NEGNAN
>  from math import acos, acosh, asin, asinh, atan, atan2, atanh, cos, cosh, exp
> -from math import fabs, fmod, log1p, pi, pow, sin, sinh, sqrt, tan, tanh
> +from math import fabs, fmod, log10, log1p, pi, pow, sin, sinh, sqrt, tan, 
> tanh
>  
>  CLC_VERSION_MIN = {
>  'acos' : 10,
> @@ -51,6 +51,7 @@ CLC_VERSION_MIN = {
>  'floor' : 10,
>  'fmod' : 10,
>  'ldexp' : 10,
> +'log10' : 10,
>  'log1p' : 10,
>  'mix' : 10,
>  'nextafter' : 10,
> @@ -266,6 +267,15 @@ tests = {
>  ],
>  'tolerance' : 0
>  },
> +'log10' : {
> +'arg_types': [F, F],
> +'function_type': 'ttt',
> +'values': [
> +[log10(0.5), float("-inf"), log10(1.e-15), float("nan")],
> +[0.5,0.0,   1.e-15,float("nan")]
> +],
> +'tolerance' : 3
> +},
>  'log1p' : {
>  'arg_types': [F, F],
>  'function_type': 'ttt',
> -- 
> 2.1.0
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/2] update documentation to be clear about using multiple profiles

2015-01-23 Thread Tom Stellard
On Fri, Jan 23, 2015 at 12:10:09PM -0800, Dylan Baker wrote:
> Updates README and the help message to be clear about using multiple
> test profiles.
> 

Thanks.

Reviewed-by: Tom Stellard 

> Signed-off-by: Dylan Baker 
> ---
>  README| 6 +-
>  framework/programs/run.py | 6 --
>  2 files changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/README b/README
> index ef8b639..9ba0a97 100644
> --- a/README
> +++ b/README
> @@ -209,11 +209,15 @@ Build from the Command Prompt.
>  
>  Make sure that everything is set up correctly:
>  
> -  $ ./piglit run tests/sanity results/sanity.results
> +  $ ./piglit run tests/sanity results/sanity
>  
>  You may include '.py' on the profile, or you may exclude it (sanity vs 
> sanity.py),
>  both are equally valid.
>  
> +You may provide multiple profiles to be run at the same time:
> +  
> +  $ ./piglit run quick_cl gpu deqp-gles3 results/gl-cl-combined
> +
>  Use
>  
>$ ./piglit run
> diff --git a/framework/programs/run.py b/framework/programs/run.py
> index 89ccd11..9bb4713 100644
> --- a/framework/programs/run.py
> +++ b/framework/programs/run.py
> @@ -183,9 +183,11 @@ def _run_parser(input_):
>  parser.add_argument("--test-list",
>  help="A file containing a list of tests to run")
>  parser.add_argument("test_profile",
> -metavar="",
> +metavar="  nargs='+',
> -help="Path to testfile to run")
> +help="Path to one or more test profiles to run. "
> + "If more than one profile is provided then they 
> "
> + "will be merged.")
>  parser.add_argument("results_path",
>  type=path.realpath,
>  metavar="",
> -- 
> 2.2.2
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/2] Add quick_glcl test profile

2015-01-23 Thread Tom Stellard
On Fri, Jan 23, 2015 at 11:20:16AM -0800, Dylan Baker wrote:
> I'm against this, you can already pass multiple profiles to piglit to
> run at the same time:
> ./piglit run gpu quick_cl output
> 

I do not know that.  Thanks for the tip.

-Tom

> On Friday, January 23, 2015 12:54:59 Tom Stellard wrote:
> > The combines the gpu and quick_cl test profiles.
> > ---
> >  tests/quick_glcl.py | 6 ++
> >  1 file changed, 6 insertions(+)
> >  create mode 100644 tests/quick_glcl.py
> > 
> > diff --git a/tests/quick_glcl.py b/tests/quick_glcl.py
> > new file mode 100644
> > index 000..1ee2733
> > --- /dev/null
> > +++ b/tests/quick_glcl.py
> > @@ -0,0 +1,6 @@
> > +
> > +import tests.gpu
> > +import tests.quick_cl
> > +
> > +profile = tests.gpu.profile
> > +profile.tests = dict(profile.tests.items() + 
> > tests.quick_cl.profile.tests.items())
> > -- 
> > 1.8.5.5
> > 
> > ___
> > Piglit mailing list
> > Piglit@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/piglit
> > 



> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/2] opencv: Automatically run tests concurrently when render-nodes are present

2015-01-23 Thread Tom Stellard
---
 framework/test/opencv.py | 11 ++-
 tests/cl.py  |  9 -
 tests/quick_cl.py|  4 ++--
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/framework/test/opencv.py b/framework/test/opencv.py
index 2c3d627..2eca948 100644
--- a/framework/test/opencv.py
+++ b/framework/test/opencv.py
@@ -38,14 +38,14 @@ __all__ = [
 
 
 class OpenCVTest(GTest):
-def __init__(self, test_prog, testname):
+def __init__(self, test_prog, testname, should_run_concurrent):
 options = [test_prog, '--gtest_filter=' + testname, '--gtest_color=no']
 if PIGLIT_CONFIG.has_option('opencv', 'workdir'):
 options.append('-w {}'.format(PIGLIT_CONFIG.get('opencv', 
'workdir')))
-GTest.__init__(self, options)
+GTest.__init__(self, options, run_concurrent = should_run_concurrent)
 
 
-def add_opencv_tests(profile):
+def add_opencv_tests(profile, should_run_concurrent = False):
 if not PIGLIT_CONFIG.has_option('opencv', 'opencv_test_ocl_bindir'):
 return
 
@@ -69,7 +69,7 @@ def add_opencv_tests(profile):
 full_test_name = 'opencv/{}'.format(group_desc)
 if not individual:
 profile.tests[full_test_name] = OpenCVTest(opencv_test_ocl,
-'{}*'.format(group_name))
+'{}*'.format(group_name), should_run_concurrent)
 continue
 
 if not individual:
@@ -80,4 +80,5 @@ def add_opencv_tests(profile):
 if m:
 test_name = m.group(1)
 profile.tests[grouptools.join(full_test_name, test_name)] = \
-OpenCVTest(opencv_test_ocl, '{}{}'.format(group_name 
,test_name))
+OpenCVTest(opencv_test_ocl, '{}{}'.format(group_name 
,test_name),
+   should_run_concurrent)
diff --git a/tests/cl.py b/tests/cl.py
index 06301af..0915279 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -22,13 +22,12 @@ __all__ = ['profile']
 ##
 # Helper functions
 
-can_do_concurrent = (not sys.platform.startswith('linux') or
- glob.glob('/dev/dri/render*'))
-
+def cl_can_do_concurrent():
+return (not sys.platform.startswith('linux') or
+glob.glob('/dev/dri/render*'))
 
 def add_plain_test(group, name, args):
-group[name] = PiglitCLTest(args, run_concurrent=can_do_concurrent)
-
+group[name] = PiglitCLTest(args, run_concurrent=cl_can_do_concurrent())
 
 def add_plain_program_tester_test(group, name, path):
 add_plain_test(group, name, ['cl-program-tester', path])
diff --git a/tests/quick_cl.py b/tests/quick_cl.py
index 7f82a86..5d46d45 100644
--- a/tests/quick_cl.py
+++ b/tests/quick_cl.py
@@ -24,8 +24,8 @@
 # Authors: Tom Stellard 
 #
 
-from tests.cl import profile
+from tests.cl import profile, cl_can_do_concurrent
 from framework.test import add_opencv_tests, add_oclconform_tests
 
-add_opencv_tests(profile)
+add_opencv_tests(profile, cl_can_do_concurrent())
 add_oclconform_tests(profile)
-- 
1.8.5.5

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/2] Add quick_glcl test profile

2015-01-23 Thread Tom Stellard
The combines the gpu and quick_cl test profiles.
---
 tests/quick_glcl.py | 6 ++
 1 file changed, 6 insertions(+)
 create mode 100644 tests/quick_glcl.py

diff --git a/tests/quick_glcl.py b/tests/quick_glcl.py
new file mode 100644
index 000..1ee2733
--- /dev/null
+++ b/tests/quick_glcl.py
@@ -0,0 +1,6 @@
+
+import tests.gpu
+import tests.quick_cl
+
+profile = tests.gpu.profile
+profile.tests = dict(profile.tests.items() + 
tests.quick_cl.profile.tests.items())
-- 
1.8.5.5

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] test profile cleanups, mailny in cl.py

2015-01-16 Thread Tom Stellard
On Mon, Jan 12, 2015 at 12:22:25AM -0800, Dylan Baker wrote:
> This started as an attempt for me to check the I hadn't broken cl tests,
> and quickly spiraled from there. The basic problem being solved is that
> cl.py cannot currently be run outside of the piglit source directory
> (such when installed). Patches 1-4 directly address that problem, while
> pathes 5-7 cleanup a few things in cl.py, since it's reasonable to work
> on that profile.
> 

I haven't tested these, but if they break anything, I'll let you know.

The cl.py patches are:

Acked-by: Tom Stellard 

> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v2] cl: add clLinkProgram test

2014-12-19 Thread Tom Stellard
On Fri, Dec 19, 2014 at 02:39:06PM +0100, EdB wrote:
> v2:
> Use piglit_cl_get_program_build_info instead of piglit_cl_get_program_info,
> I was expected it to fail so I didn't paid attention.
> 
> Remove "-invalid- --link-- options" on CL_INVALID_OPERATION test.

Reviewed-by: Tom Stellard 

> ---
>  tests/cl/api/CMakeLists.cl.txt |   1 +
>  tests/cl/api/link-program.c| 394 
> +
>  2 files changed, 395 insertions(+)
>  create mode 100644 tests/cl/api/link-program.c
> 
> diff --git a/tests/cl/api/CMakeLists.cl.txt b/tests/cl/api/CMakeLists.cl.txt
> index 7e78491..b598528 100644
> --- a/tests/cl/api/CMakeLists.cl.txt
> +++ b/tests/cl/api/CMakeLists.cl.txt
> @@ -31,6 +31,7 @@ piglit_cl_add_api_test (create-program-with-source 
> create-program-with-source.c)
>  piglit_cl_add_api_test (retain_release-program retain_release-program.c)
>  piglit_cl_add_api_test (build-program build-program.c)
>  piglit_cl_add_api_test (compile-program compile-program.c)
> +piglit_cl_add_api_test (link-program link-program.c)
>  piglit_cl_add_api_test (unload-compiler unload-compiler.c)
>  piglit_cl_add_api_test (get-program-info get-program-info.c)
>  piglit_cl_add_api_test (get-program-build-info get-program-build-info.c)
> diff --git a/tests/cl/api/link-program.c b/tests/cl/api/link-program.c
> new file mode 100644
> index 000..e98f428
> --- /dev/null
> +++ b/tests/cl/api/link-program.c
> @@ -0,0 +1,394 @@
> +/*
> + * Copyright © 2014 EdB 
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> + * DEALINGS IN THE SOFTWARE.
> + */
> +
> +/**
> + * @file link-program.c
> + *
> + * Test API function:
> + *
> + *   cl_program
> + *   clLinkProgram(cl_context context,
> + * cl_uint num_devices, const cl_device_id device_list,
> + * const char *options,
> + * cl_uint num_input_programs, const cl_program *input_programs,
> + * void (CL_CALLBACK *pfn_notify)(cl_program program, void 
> *user_data),
> + * void *user_data,
> + * cl_int *errcode_ret)
> + */
> +
> +#include "piglit-framework-cl-api.h"
> +
> +
> +PIGLIT_CL_API_TEST_CONFIG_BEGIN
> +
> + config.name = "clLinkProgram";
> + config.version_min = 12;
> +
> + config.run_per_platform = true;
> + config.create_context = true;
> +
> +PIGLIT_CL_API_TEST_CONFIG_END
> +
> +
> +const char* strings[] = {
> + "int get_number() { return 42; }",
> + "int get_number();\n",
> + "kernel void test_kernel() { int i = get_number(); }",
> + "int get_number() { return 0; }"
> +};
> +
> +#if defined(CL_VERSION_1_2)
> +static cl_program
> +compile_program(cl_context context,
> +cl_uint num_devices, const cl_device_id *device_list,
> +cl_uint count, const char **strings,
> +const char* err_str) {
> + cl_int errNo;
> + cl_program program;
> +
> + /* Create program with source */
> + program = clCreateProgramWithSource(context,
> + count,
> + strings,
> + NULL,
> + &errNo);
> + if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
> + fprintf(stderr,
> + "Failed (error code: %s): Create program with source 
> (for the %s).\n",
> + piglit_cl_get_error_name(errNo), err_str);
> +  

Re: [Piglit] [PATCH 1/2] CL: refactor genclbuiltins.py to allow TSS functions with different arg types

2014-12-17 Thread Tom Stellard
On Fri, Dec 12, 2014 at 03:05:25PM -0600, Aaron Watry wrote:
> Before, if you had a function that had 2-3 args, it was assumed that all
> arguments were of the same base type.
> 
> Now, that assumption is removed and we used the argument type defined in the
> test profile.
> 
> This will be useful in the next commit, where ldexp(floatN,int) is introduced.
> 
> This patch updates all multi-argument kernel generators to take an array of
> input types, instead of assuming that all inputs are of the same base type as
> the first argument.

For the series: 

Reviewed-by: Tom Stellard 

> ---
>  generated_tests/genclbuiltins.py | 44 
> +++-
>  1 file changed, 25 insertions(+), 19 deletions(-)
> 
> diff --git a/generated_tests/genclbuiltins.py 
> b/generated_tests/genclbuiltins.py
> index 571930d..6a595ff 100644
> --- a/generated_tests/genclbuiltins.py
> +++ b/generated_tests/genclbuiltins.py
> @@ -139,44 +139,44 @@ def gen_kernel_1_arg(f, fnName, inType, outType):
>  gen_kernel(f, fnName, [inType], outType, [vecSize], '')
>  
>  
> -#  2 argument kernel with input types that match
> -def gen_kernel_2_arg_same_type(f, fnName, inType, outType):
> +#  2 argument kernel with input types that match their vector size
> +def gen_kernel_2_arg_same_size(f, fnName, inTypes, outType):
>  for vecSize in ALL_WIDTHS:
> -gen_kernel(f, fnName, [inType, inType], outType, [vecSize, vecSize],
> +gen_kernel(f, fnName, inTypes, outType, [vecSize, vecSize],
> '')
>  
>  
>  #  2 argument kernel with 1 vector and one scalar input argument
> -def gen_kernel_2_arg_mixed_size(f, fnName, inType, outType):
> +def gen_kernel_2_arg_mixed_size(f, fnName, inTypes, outType):
>  for vecSize in VEC_WIDTHS:
> -gen_kernel(f, fnName, [inType, inType], outType, [vecSize, 1], 
> 'tss_')
> +gen_kernel(f, fnName, inTypes, outType, [vecSize, 1], 'tss_')
>  
>  
>  #  2 argument kernel with 1 vector and one scalar input argument with 
> multiple
>  #input data types
> -def gen_kernel_2_arg_mixed_sign(f, fnName, inType1, inType2, outType):
> +def gen_kernel_2_arg_mixed_sign(f, fnName, inTypes, outType):
>  for vecSize in ALL_WIDTHS:
> -gen_kernel(f, fnName, [inType1, inType2], outType, [vecSize, 
> vecSize],
> +gen_kernel(f, fnName, inTypes, outType, [vecSize, vecSize],
> '')
>  
>  
>  #  3-argument built-in functions
>  
>  
> -def gen_kernel_3_arg_same_type(f, fnName, inType, outType):
> +def gen_kernel_3_arg_same_type(f, fnName, inTypes, outType):
>  for vecSize in ALL_WIDTHS:
> -gen_kernel(f, fnName, [inType, inType, inType], outType,
> +gen_kernel(f, fnName, inTypes, outType,
> [vecSize, vecSize, vecSize], ''
>  )
>  
> -def gen_kernel_3_arg_mixed_size_tss(f, fnName, inType, outType):
> +def gen_kernel_3_arg_mixed_size_tss(f, fnName, inTypes, outType):
>  for vecSize in VEC_WIDTHS:
> -gen_kernel(f, fnName, [inType, inType, inType], outType,
> +gen_kernel(f, fnName, inTypes, outType,
> [vecSize, 1, 1], 'tss_')
>  
> -def gen_kernel_3_arg_mixed_size_tts(f, fnName, inType, outType):
> +def gen_kernel_3_arg_mixed_size_tts(f, fnName, inTypes, outType):
>  for vecSize in VEC_WIDTHS:
> -gen_kernel(f, fnName, [inType, inType, inType], outType,
> +gen_kernel(f, fnName, inTypes, outType,
> [vecSize, vecSize, 1], 'tts_')
>  
>  
> @@ -189,21 +189,27 @@ def generate_kernels(f, dataType, fnName, fnDef):
>  return
>  
>  if (len(argTypes) == 3 and not fnName is 'upsample'):
> -gen_kernel_2_arg_same_type(f, fnName, argTypes[1], argTypes[0])
> +gen_kernel_2_arg_same_size(f, fnName,
> +[argTypes[1], argTypes[2]], argTypes[0])
>  if (fnDef['function_type'] is 'tss'):
> -gen_kernel_2_arg_mixed_size(f, fnName, argTypes[1], argTypes[0])
> +gen_kernel_2_arg_mixed_size(f, fnName,
> +[argTypes[1], argTypes[2]], argTypes[0])
>  return
>  
>  if (len(argTypes) == 4):
> -gen_kernel_3_arg_same_type(f, fnName, argTypes[1], argTypes[0])
> +gen_kernel_3_arg_same_type(f, fnName,
> +   [argTypes[1], argTypes[2], argTypes[3]], argTypes[0])
>  if (fnDef['function_type'] is 'tss'):
> -gen_kernel_3_arg_mixed_size_tss(f, fnName, argTypes[1], 
> argTypes[0])
> +ge

Re: [Piglit] [PATCH 1/5] cl: Fix signed/unsigned comparison warnings

2014-12-11 Thread Tom Stellard
On Wed, Dec 03, 2014 at 03:53:28PM -0500, Jan Vesely wrote:
> Signed-off-by: Jan Vesely 
> ---

I've pushed patches 1,2,4,and 5.  Thanks!

-Tom

>  tests/cl/program/program-tester.c | 16 
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/tests/cl/program/program-tester.c 
> b/tests/cl/program/program-tester.c
> index cfd81be..d6dbc55 100644
> --- a/tests/cl/program/program-tester.c
> +++ b/tests/cl/program/program-tester.c
> @@ -310,7 +310,7 @@ add_test(struct test t)
>  bool
>  add_test_arg(struct test* t, struct test_arg ta, bool arg_in)
>  {
> - int i;
> + unsigned i;
>   struct test_arg* this_args;
>   size_t num_this_args;
>   struct test_arg* other_args;
> @@ -392,7 +392,7 @@ add_test_arg_out(struct test* t, struct test_arg ta)
>  void
>  free_tests()
>  {
> - int i,j;
> + unsigned i,j;
>  
>   for(i = 0; i < num_tests; i++) {
>   for(j = 0; j < tests[i].num_args_in; j++) {
> @@ -431,7 +431,7 @@ void
>  free_dynamic_strs()
>  {
>   if(dynamic_strs != NULL) {
> - int i;
> + unsigned i;
>  
>   for(i = 0; i < num_dynamic_strs; i++) {
>   free(dynamic_strs[i]);
> @@ -1626,7 +1626,7 @@ struct buffer_arg {
>  void
>  free_buffer_args(struct buffer_arg** buffer_args, unsigned int* 
> num_buffer_args)
>  {
> - int i;
> + unsigned i;
>  
>   for(i = 0; i < *num_buffer_args; i++) {
>   clReleaseMemObject((*buffer_args)[i].buffer);
> @@ -1720,7 +1720,7 @@ test_kernel(const struct piglit_cl_program_test_config* 
> config,
>   enum piglit_result result = PIGLIT_PASS;
>  
>   // all
> - int j;
> + unsigned j;
>   char* kernel_name;
>   cl_kernel kernel;
>  
> @@ -1826,7 +1826,7 @@ test_kernel(const struct piglit_cl_program_test_config* 
> config,
>   // not accepted by parser
>   break;
>   case TEST_ARG_BUFFER: {
> - int k;
> + unsigned k;
>   struct buffer_arg buffer_arg;
>   buffer_arg.index = test_arg.index;
>  
> @@ -1894,7 +1894,7 @@ test_kernel(const struct piglit_cl_program_test_config* 
> config,
>   printf("Validating results...\n");
>  
>   for(j = 0; j < test.num_args_out; j++) {
> - int k;
> + unsigned k;
>   bool arg_valid = false;
>   struct test_arg test_arg = test.args_out[j];
>  
> @@ -1969,7 +1969,7 @@ piglit_cl_test(const int argc,
>  {
>   enum piglit_result result = PIGLIT_SKIP;
>  
> - int i;
> + unsigned i;
>  
>   /* Print building status */
>   if(!config->expect_build_fail) {
> -- 
> 1.9.3
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: -cl-std=CL1.0 is not valid

2014-12-11 Thread Tom Stellard
On Wed, Dec 03, 2014 at 11:04:50PM +0100, EdB wrote:
> By OpenCL 1.2 spec, -cl-std= should only be CL1.1 or CL1.2
> We were checking against the device version instead of the desired version
> 
> Report by: yan.w...@linux.intel.com

I've pushed this, thanks!

-Tom

> ---
>  tests/util/piglit-framework-cl-program.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/util/piglit-framework-cl-program.c 
> b/tests/util/piglit-framework-cl-program.c
> index 374296f..d335486 100644
> --- a/tests/util/piglit-framework-cl-program.c
> +++ b/tests/util/piglit-framework-cl-program.c
> @@ -218,7 +218,8 @@ piglit_cl_program_test_run(const int argc,
>   sprintf(build_options+strlen(old), "%s", config->build_options);
>   free(old);
>   }
> - if(version > 10) {
> +
> + if(env.clc_version > 10) {
>   //If -cl-std was already in config->build_options, use what the 
> test requested
>   if (!strstr(build_options, "-cl-std")){
>   char* template = " -cl-std=CL%d.%d";
> -- 
> 2.2.0
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: split CL10/CL11+ optimization options testing

2014-11-14 Thread Tom Stellard
On Wed, Nov 12, 2014 at 03:31:28PM +0100, EdB wrote:
> because -cl-strict-aliasing options argument to
> clBuildProgram is no longer supported in OpenCL 1.1.
> 

I've pushed this, thanks!


> ---
> or may be we should just test this in api/build-program.c
> ---
>  tests/cl/program/build/optimization-options-cl10.cl  | 13 +
>  tests/cl/program/build/optimization-options-cl11+.cl | 12 
>  tests/cl/program/build/optimization-options.cl   | 12 
>  3 files changed, 25 insertions(+), 12 deletions(-)
>  create mode 100644 tests/cl/program/build/optimization-options-cl10.cl
>  create mode 100644 tests/cl/program/build/optimization-options-cl11+.cl
>  delete mode 100644 tests/cl/program/build/optimization-options.cl
> 
> diff --git a/tests/cl/program/build/optimization-options-cl10.cl 
> b/tests/cl/program/build/optimization-options-cl10.cl
> new file mode 100644
> index 000..38a519c
> --- /dev/null
> +++ b/tests/cl/program/build/optimization-options-cl10.cl
> @@ -0,0 +1,13 @@
> +/*!
> +[config]
> +name: Optimization Options
> +clc_version_min: 10
> +clc_version_max: 10
> +build_options: -cl-opt-disable -cl-strict-aliasing -cl-mad-enable 
> -cl-finite-math-only -cl-no-signed-zeros -cl-unsafe-math-optimizations 
> -cl-fast-relaxed-math
> +!*/
> +
> +void dummy_function() {}
> +
> +kernel void dummy_kernel(global int* out) {
> +dummy_function();
> +}
> \ No newline at end of file
> diff --git a/tests/cl/program/build/optimization-options-cl11+.cl 
> b/tests/cl/program/build/optimization-options-cl11+.cl
> new file mode 100644
> index 000..080ba6d
> --- /dev/null
> +++ b/tests/cl/program/build/optimization-options-cl11+.cl
> @@ -0,0 +1,12 @@
> +/*!
> +[config]
> +name: Optimization Options CL1.1+
> +clc_version_min: 11
> +build_options: -cl-opt-disable -cl-mad-enable -cl-finite-math-only 
> -cl-no-signed-zeros -cl-unsafe-math-optimizations -cl-fast-relaxed-math
> +!*/
> +
> +void dummy_function() {}
> +
> +kernel void dummy_kernel(global int* out) {
> +dummy_function();
> +}
> \ No newline at end of file
> diff --git a/tests/cl/program/build/optimization-options.cl 
> b/tests/cl/program/build/optimization-options.cl
> deleted file mode 100644
> index 9d73fb4..000
> --- a/tests/cl/program/build/optimization-options.cl
> +++ /dev/null
> @@ -1,12 +0,0 @@
> -/*!
> -[config]
> -name: Optimization Options
> -clc_version_min: 10
> -build_options: -cl-opt-disable -cl-strict-aliasing -cl-mad-enable 
> -cl-finite-math-only -cl-no-signed-zeros -cl-unsafe-math-optimizations 
> -cl-fast-relaxed-math
> -!*/
> -
> -void dummy_function() {}
> -
> -kernel void dummy_kernel(global int* out) {
> -dummy_function();
> -}
> \ No newline at end of file
> -- 
> 1.9.3
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 0/3] add CL_MEM_HOST_* releated tests

2014-11-14 Thread Tom Stellard
On Mon, Nov 10, 2014 at 03:24:58PM +0100, EdB wrote:
> change existing tests in order to add CL_MEM_HOST_* checks
> The fisrt two patches are standalone fixes
> 
> EdB (3):
>   cl: fix doxygen filename
>   cl: fix test name
>   cl: add CL_MEM_HOST_* releated tests

I've pushed these, thanks!

> 
>  tests/cl/api/create-buffer.c |   4 +-
>  tests/cl/api/enqueue-map-buffer.c| 113 
> ++-
>  tests/cl/api/enqueue-read_write-buffer.c |  49 +-
>  3 files changed, 161 insertions(+), 5 deletions(-)
> 
> -- 
> 1.9.3
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v2] cl: add tests for clCompileProgram

2014-11-14 Thread Tom Stellard
On Fri, Nov 07, 2014 at 04:24:27PM +0100, EdB wrote:
> v2:
> Use clBuildProgram to create to program to attach kernel to

I've pushed this, thanks!

> 
> ---
>  tests/cl.py|   1 +
>  tests/cl/api/CMakeLists.cl.txt |   1 +
>  tests/cl/api/compile-program.c | 366 
> +
>  3 files changed, 368 insertions(+)
>  create mode 100644 tests/cl/api/compile-program.c
> 
> diff --git a/tests/cl.py b/tests/cl.py
> index 3154b4b..4c44b9f 100644
> --- a/tests/cl.py
> +++ b/tests/cl.py
> @@ -74,6 +74,7 @@ add_plain_test(api, 'clRetainMemObject and 
> clReleaseMemObject', ['cl-api-retain_
>  add_plain_test(api, 'clCreateProgramWithBinary', 
> ['cl-api-create-program-with-binary'])
>  add_plain_test(api, 'clCreateProgramWithSource', 
> ['cl-api-create-program-with-source'])
>  add_plain_test(api, 'clBuildProgram', ['cl-api-build-program'])
> +add_plain_test(api, 'clCompileProgram', ['cl-api-compile-program'])
>  add_plain_test(api, 'clCreateKernelsInProgram', 
> ['cl-api-create-kernels-in-program'])
>  add_plain_test(api, 'clGetProgramInfo', ['cl-api-get-program-info'])
>  add_plain_test(api, 'clGetProgramBuildInfo', 
> ['cl-api-get-program-build-info'])
> diff --git a/tests/cl/api/CMakeLists.cl.txt b/tests/cl/api/CMakeLists.cl.txt
> index a51b45e..7e78491 100644
> --- a/tests/cl/api/CMakeLists.cl.txt
> +++ b/tests/cl/api/CMakeLists.cl.txt
> @@ -30,6 +30,7 @@ piglit_cl_add_api_test (create-program-with-binary 
> create-program-with-binary.c)
>  piglit_cl_add_api_test (create-program-with-source 
> create-program-with-source.c)
>  piglit_cl_add_api_test (retain_release-program retain_release-program.c)
>  piglit_cl_add_api_test (build-program build-program.c)
> +piglit_cl_add_api_test (compile-program compile-program.c)
>  piglit_cl_add_api_test (unload-compiler unload-compiler.c)
>  piglit_cl_add_api_test (get-program-info get-program-info.c)
>  piglit_cl_add_api_test (get-program-build-info get-program-build-info.c)
> diff --git a/tests/cl/api/compile-program.c b/tests/cl/api/compile-program.c
> new file mode 100644
> index 000..d280f98
> --- /dev/null
> +++ b/tests/cl/api/compile-program.c
> @@ -0,0 +1,366 @@
> +/*
> + * Copyright © 2014 EdB 
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> + * DEALINGS IN THE SOFTWARE.
> + *
> + * created from build-program.c
> + * Copyright © 2012 Blaž Tomažič 
> + */
> +
> +/**
> + * @file compile-program.c
> + *
> + * Test API function:
> + *
> + *   cl_int clCompileProgram(cl_program d_prog, cl_uint num_devs,
> + *   const cl_device_id *d_devs, const char *p_opts,
> + *   cl_uint num_headers, const cl_program *d_header_progs,
> + *   const char **headers_names,
> + *   void (*pfn_notify)(cl_program, void *),
> + *   void *user_data)
> + */
> +
> +#include "piglit-framework-cl-api.h"
> +
> +
> +PIGLIT_CL_API_TEST_CONFIG_BEGIN
> +
> + config.name = "clCompileProgram";
> + config.version_min = 12;
> +
> + config.run_per_platform = true;
> + config.create_context = true;
> +
> +PIGLIT_CL_API_TEST_CONFIG_END
> +
> +
> +const char* strings[] = {
> + "#include \"header.h\"\n",
> + "kernel void dummy_kernel() { w_int i = 0; }",
> + "kernel void dummy_kernel() { int i = 0; }"
> +};
> +
> +const char* headers_strings[] = {
> + "typedef int w_int;",
> + "int w_int;" //to trigger invalid
> +};
> +
> +const char* headers_names[] = {
> + "header.h"
> +};
> +
> +const char* empty_strings[] = {
> + ""
> +};
> +
> +static bool
> +test(cl_program program,
> + cl_uint num_devices, const cl_device_id *device_list,
> + const char *options,
> + cl_uint num_headers, const cl_program *d_header_progs, const char 
> **headers_names,
> + void (CL_CALLBACK *pfn_notify)(cl_program program, void *user_data), 
> void *user_data,
> + cl_int expected_error,
> + 

Re: [Piglit] [PATCH v2] cl: add tests for clCompileProgram

2014-11-07 Thread Tom Stellard
On Fri, Nov 07, 2014 at 04:24:27PM +0100, EdB wrote:
> v2:
> Use clBuildProgram to create to program to attach kernel to
> 

Thanks for the patch, I'm not quite so familiar with clCompileProgram,
so I'm going to give it a few days to see if anyone else has any
comments.

-Tom

> ---
>  tests/cl.py|   1 +
>  tests/cl/api/CMakeLists.cl.txt |   1 +
>  tests/cl/api/compile-program.c | 366 
> +
>  3 files changed, 368 insertions(+)
>  create mode 100644 tests/cl/api/compile-program.c
> 
> diff --git a/tests/cl.py b/tests/cl.py
> index 3154b4b..4c44b9f 100644
> --- a/tests/cl.py
> +++ b/tests/cl.py
> @@ -74,6 +74,7 @@ add_plain_test(api, 'clRetainMemObject and 
> clReleaseMemObject', ['cl-api-retain_
>  add_plain_test(api, 'clCreateProgramWithBinary', 
> ['cl-api-create-program-with-binary'])
>  add_plain_test(api, 'clCreateProgramWithSource', 
> ['cl-api-create-program-with-source'])
>  add_plain_test(api, 'clBuildProgram', ['cl-api-build-program'])
> +add_plain_test(api, 'clCompileProgram', ['cl-api-compile-program'])
>  add_plain_test(api, 'clCreateKernelsInProgram', 
> ['cl-api-create-kernels-in-program'])
>  add_plain_test(api, 'clGetProgramInfo', ['cl-api-get-program-info'])
>  add_plain_test(api, 'clGetProgramBuildInfo', 
> ['cl-api-get-program-build-info'])
> diff --git a/tests/cl/api/CMakeLists.cl.txt b/tests/cl/api/CMakeLists.cl.txt
> index a51b45e..7e78491 100644
> --- a/tests/cl/api/CMakeLists.cl.txt
> +++ b/tests/cl/api/CMakeLists.cl.txt
> @@ -30,6 +30,7 @@ piglit_cl_add_api_test (create-program-with-binary 
> create-program-with-binary.c)
>  piglit_cl_add_api_test (create-program-with-source 
> create-program-with-source.c)
>  piglit_cl_add_api_test (retain_release-program retain_release-program.c)
>  piglit_cl_add_api_test (build-program build-program.c)
> +piglit_cl_add_api_test (compile-program compile-program.c)
>  piglit_cl_add_api_test (unload-compiler unload-compiler.c)
>  piglit_cl_add_api_test (get-program-info get-program-info.c)
>  piglit_cl_add_api_test (get-program-build-info get-program-build-info.c)
> diff --git a/tests/cl/api/compile-program.c b/tests/cl/api/compile-program.c
> new file mode 100644
> index 000..d280f98
> --- /dev/null
> +++ b/tests/cl/api/compile-program.c
> @@ -0,0 +1,366 @@
> +/*
> + * Copyright © 2014 EdB 
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> + * DEALINGS IN THE SOFTWARE.
> + *
> + * created from build-program.c
> + * Copyright © 2012 Blaž Tomažič 
> + */
> +
> +/**
> + * @file compile-program.c
> + *
> + * Test API function:
> + *
> + *   cl_int clCompileProgram(cl_program d_prog, cl_uint num_devs,
> + *   const cl_device_id *d_devs, const char *p_opts,
> + *   cl_uint num_headers, const cl_program *d_header_progs,
> + *   const char **headers_names,
> + *   void (*pfn_notify)(cl_program, void *),
> + *   void *user_data)
> + */
> +
> +#include "piglit-framework-cl-api.h"
> +
> +
> +PIGLIT_CL_API_TEST_CONFIG_BEGIN
> +
> + config.name = "clCompileProgram";
> + config.version_min = 12;
> +
> + config.run_per_platform = true;
> + config.create_context = true;
> +
> +PIGLIT_CL_API_TEST_CONFIG_END
> +
> +
> +const char* strings[] = {
> + "#include \"header.h\"\n",
> + "kernel void dummy_kernel() { w_int i = 0; }",
> + "kernel void dummy_kernel() { int i = 0; }"
> +};
> +
> +const char* headers_strings[] = {
> + "typedef int w_int;",
> + "int w_int;" //to trigger invalid
> +};
> +
> +const char* headers_names[] = {
> + "header.h"
> +};
> +
> +const char* empty_strings[] = {
> + ""
> +};
> +
> +static bool
> +test(cl_program program,
> + cl_uint num_devices, const cl_device_id *device_list,
> + const char *options,
> + cl_uint num_headers, const cl_program *d_header_progs, const char 
> **headers_names,
> + vo

Re: [Piglit] [PATCH v2] cl: fix clGetKernelWorkGroupInfo

2014-11-07 Thread Tom Stellard
On Sun, Nov 02, 2014 at 02:35:56PM +0100, EdB wrote:
> If there is only one device associed with the kernel and device arg is NULL
> you don't have to trigger CL_INVALID_DEVICE
> 

I've pushed this patch, thanks!

-Tom

> v2:
> Test for CL_SUCCESS instead of disabling it (Jan Vesely)
> ---
>  tests/cl/api/get-kernel-work-group-info.c | 28 +---
>  1 file changed, 21 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/cl/api/get-kernel-work-group-info.c 
> b/tests/cl/api/get-kernel-work-group-info.c
> index 47d09da..a38cdf0 100644
> --- a/tests/cl/api/get-kernel-work-group-info.c
> +++ b/tests/cl/api/get-kernel-work-group-info.c
> @@ -61,6 +61,7 @@ piglit_cl_test(const int argc,
>   int i;
>   cl_int errNo;
>   cl_kernel kernel;
> + cl_uint* dev_count_ptr;
>  
>   size_t param_value_size;
>   void* param_value;
> @@ -168,24 +169,37 @@ piglit_cl_test(const int argc,
>   piglit_cl_get_error_name(errNo));
>   piglit_merge_result(&result, PIGLIT_FAIL);
>   }
> - 
> +
>   /*
>* CL_INVALID_DEVICE if device is not in the list of devices associated 
> with
>* kernel or if device is NULL but there is more than one device 
> associated
> -  * with kernel.
> +  * with kernel
> +  * or
> +  * CL_SUCCESS if device is NULL but there is only one device associated 
> with kernel.
>*/
> + dev_count_ptr = piglit_cl_get_program_info(env->program, 
> CL_PROGRAM_NUM_DEVICES);
>   errNo = clGetKernelWorkGroupInfo(kernel,
>NULL,
>CL_KERNEL_WORK_GROUP_SIZE,
>0,
>NULL,
>¶m_value_size);
> - if(!piglit_cl_check_error(errNo, CL_INVALID_DEVICE)) {
> - fprintf(stderr,
> - "Failed (error code: %s): Trigger CL_INVALID_DEVICE if 
> device is NULL but there is more than one device associated with kernel.\n",
> - piglit_cl_get_error_name(errNo));
> - piglit_merge_result(&result, PIGLIT_FAIL);
> + if (*dev_count_ptr == 1) {
> + if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
> + fprintf(stderr,
> + "Failed (error code: %s): Trigger CL_SUCCESS if 
> device is NULL but there is only one device associated with kernel.\n",
> + piglit_cl_get_error_name(errNo));
> + piglit_merge_result(&result, PIGLIT_FAIL);
> + }
> + } else {
> + if(!piglit_cl_check_error(errNo, CL_INVALID_DEVICE)) {
> + fprintf(stderr,
> + "Failed (error code: %s): Trigger 
> CL_INVALID_DEVICE if device is NULL but there is more than one device 
> associated with kernel.\n",
> + piglit_cl_get_error_name(errNo));
> + piglit_merge_result(&result, PIGLIT_FAIL);
> + }
>   }
> + free(dev_count_ptr);
>  
>   clReleaseKernel(kernel);
>  
> -- 
> 1.9.3
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] cl: Add test for clCreateProgramWithBinary() v3

2014-10-21 Thread Tom Stellard
v2:
  - Fix filename in doxygen comments
  - Remove redundant binary status check.

v3:
  - Add test cases for passing binary programs to clBuildProgram() and
clCompileProgram().
---
 tests/cl.py   |   1 +
 tests/cl/api/CMakeLists.cl.txt|   1 +
 tests/cl/api/create-program-with-binary.c | 224 ++
 3 files changed, 226 insertions(+)
 create mode 100644 tests/cl/api/create-program-with-binary.c

diff --git a/tests/cl.py b/tests/cl.py
index 8325728..3154b4b 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -71,6 +71,7 @@ add_plain_test(api, 'clGetMemObjectInfo', 
['cl-api-get-mem-object-info'])
 add_plain_test(api, 'clGetImageInfo', ['cl-api-get-image-info'])
 add_plain_test(api, 'clRetainMemObject and clReleaseMemObject', 
['cl-api-retain_release-mem-object'])
 #  Program
+add_plain_test(api, 'clCreateProgramWithBinary', 
['cl-api-create-program-with-binary'])
 add_plain_test(api, 'clCreateProgramWithSource', 
['cl-api-create-program-with-source'])
 add_plain_test(api, 'clBuildProgram', ['cl-api-build-program'])
 add_plain_test(api, 'clCreateKernelsInProgram', 
['cl-api-create-kernels-in-program'])
diff --git a/tests/cl/api/CMakeLists.cl.txt b/tests/cl/api/CMakeLists.cl.txt
index 460c8ac..a51b45e 100644
--- a/tests/cl/api/CMakeLists.cl.txt
+++ b/tests/cl/api/CMakeLists.cl.txt
@@ -26,6 +26,7 @@ piglit_cl_add_api_test (get-mem-object-info 
get-mem-object-info.c)
 piglit_cl_add_api_test (get-image-info get-image-info.c)
 
 # Programs
+piglit_cl_add_api_test (create-program-with-binary 
create-program-with-binary.c)
 piglit_cl_add_api_test (create-program-with-source 
create-program-with-source.c)
 piglit_cl_add_api_test (retain_release-program retain_release-program.c)
 piglit_cl_add_api_test (build-program build-program.c)
diff --git a/tests/cl/api/create-program-with-binary.c 
b/tests/cl/api/create-program-with-binary.c
new file mode 100644
index 000..4873b76
--- /dev/null
+++ b/tests/cl/api/create-program-with-binary.c
@@ -0,0 +1,224 @@
+/*
+ * Copyright © 2012 Blaž Tomažič 
+ * Copyright 2014 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * @file create-program-with-binary.c
+ *
+ * Test API function:
+ *
+ *  cl_program clCreateProgramWithBinary (cl_context context,
+ *cl_uint num_devices,
+ *const cl_device_id *device_list,
+ *const size_t *lengths,
+ *const unsigned char **binaries,
+ *cl_int *binary_status,
+ *cl_int *errcode_ret)
+ */
+
+#include "piglit-framework-cl-api.h"
+
+
+PIGLIT_CL_API_TEST_CONFIG_BEGIN
+
+   config.name = "clCreateProgramWithBinary";
+   config.version_min = 10;
+
+   config.run_per_platform = true;
+   config.create_context = true;
+
+PIGLIT_CL_API_TEST_CONFIG_END
+
+
+const char* dummy_kernel = "kernel void dummy_kernel() { }";
+
+static cl_program create_binary_program(const piglit_cl_context ctx)
+{
+   cl_program program = NULL;
+   cl_program binary_program = NULL;
+   cl_int errNo;
+   unsigned i;
+
+   size_t kernel_length = strlen(dummy_kernel);
+   cl_context cl_ctx = ctx->cl_ctx;
+   size_t *sizes;
+   unsigned char **binaries;
+
+   program = clCreateProgramWithSource(cl_ctx,
+   1,
+   &dummy_kernel,
+   &kernel_length,
+   &errNo);
+
+   if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
+   fprintf(stderr, "clCreateProgramWithSource failed "
+   "(error code: %s)\n",
+   piglit_cl_get_er

[Piglit] [PATCH] cl: Add test for clCreateProgramWithBinary() v2

2014-10-21 Thread Tom Stellard
v2:
  - Fix filename in doxygen comments
  - Remove redundant binary status check.
---
 tests/cl.py   |   1 +
 tests/cl/api/CMakeLists.cl.txt|   1 +
 tests/cl/api/create-program-with-binary.c | 177 ++
 3 files changed, 179 insertions(+)
 create mode 100644 tests/cl/api/create-program-with-binary.c

diff --git a/tests/cl.py b/tests/cl.py
index 8325728..3154b4b 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -71,6 +71,7 @@ add_plain_test(api, 'clGetMemObjectInfo', 
['cl-api-get-mem-object-info'])
 add_plain_test(api, 'clGetImageInfo', ['cl-api-get-image-info'])
 add_plain_test(api, 'clRetainMemObject and clReleaseMemObject', 
['cl-api-retain_release-mem-object'])
 #  Program
+add_plain_test(api, 'clCreateProgramWithBinary', 
['cl-api-create-program-with-binary'])
 add_plain_test(api, 'clCreateProgramWithSource', 
['cl-api-create-program-with-source'])
 add_plain_test(api, 'clBuildProgram', ['cl-api-build-program'])
 add_plain_test(api, 'clCreateKernelsInProgram', 
['cl-api-create-kernels-in-program'])
diff --git a/tests/cl/api/CMakeLists.cl.txt b/tests/cl/api/CMakeLists.cl.txt
index 460c8ac..a51b45e 100644
--- a/tests/cl/api/CMakeLists.cl.txt
+++ b/tests/cl/api/CMakeLists.cl.txt
@@ -26,6 +26,7 @@ piglit_cl_add_api_test (get-mem-object-info 
get-mem-object-info.c)
 piglit_cl_add_api_test (get-image-info get-image-info.c)
 
 # Programs
+piglit_cl_add_api_test (create-program-with-binary 
create-program-with-binary.c)
 piglit_cl_add_api_test (create-program-with-source 
create-program-with-source.c)
 piglit_cl_add_api_test (retain_release-program retain_release-program.c)
 piglit_cl_add_api_test (build-program build-program.c)
diff --git a/tests/cl/api/create-program-with-binary.c 
b/tests/cl/api/create-program-with-binary.c
new file mode 100644
index 000..e5c26ad
--- /dev/null
+++ b/tests/cl/api/create-program-with-binary.c
@@ -0,0 +1,177 @@
+/*
+ * Copyright © 2012 Blaž Tomažič 
+ * Copyright 2014 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * @file create-program-with-binary.c
+ *
+ * Test API function:
+ *
+ *  cl_program clCreateProgramWithBinary (cl_context context,
+ *cl_uint num_devices,
+ *const cl_device_id *device_list,
+ *const size_t *lengths,
+ *const unsigned char **binaries,
+ *cl_int *binary_status,
+ *cl_int *errcode_ret)
+ */
+
+#include "piglit-framework-cl-api.h"
+
+
+PIGLIT_CL_API_TEST_CONFIG_BEGIN
+
+   config.name = "clCreateProgramWithBinary";
+   config.version_min = 10;
+
+   config.run_per_platform = true;
+   config.create_context = true;
+
+PIGLIT_CL_API_TEST_CONFIG_END
+
+
+const char* dummy_kernel = "kernel void dummy_kernel() { }";
+
+enum piglit_result
+piglit_cl_test(const int argc,
+   const char** argv,
+   const struct piglit_cl_api_test_config* config,
+   const struct piglit_cl_api_test_env* env)
+{
+   enum piglit_result result = PIGLIT_PASS;
+   int i;
+
+   cl_int errNo;
+   cl_program program;
+   cl_program binary_program;
+   piglit_cl_context ctx = env->context;
+   cl_context cl_ctx = ctx->cl_ctx;
+   cl_kernel kernel;
+
+   size_t kernel_length = strlen(dummy_kernel);
+   size_t *sizes = calloc(sizeof(size_t), ctx->num_devices);
+   unsigned char **binaries = calloc(sizeof(char*),  ctx->num_devices);
+
+
+   /*** Normal usage ***/
+
+   /* with errNo */
+   program = clCreateProgramWithSource(cl_ctx,
+   1,
+   &dummy_kernel,
+   

[Piglit] [PATCH] cl: Add test for clCreateProgramWithBinary()

2014-10-14 Thread Tom Stellard
---
 tests/cl.py   |   1 +
 tests/cl/api/CMakeLists.cl.txt|   1 +
 tests/cl/api/create-program-with-binary.c | 189 ++
 3 files changed, 191 insertions(+)
 create mode 100644 tests/cl/api/create-program-with-binary.c

diff --git a/tests/cl.py b/tests/cl.py
index 67ed542..1812e11 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -73,6 +73,7 @@ add_plain_test(api, 'clGetMemObjectInfo', 
['cl-api-get-mem-object-info'])
 add_plain_test(api, 'clGetImageInfo', ['cl-api-get-image-info'])
 add_plain_test(api, 'clRetainMemObject and clReleaseMemObject', 
['cl-api-retain_release-mem-object'])
 #  Program
+add_plain_test(api, 'clCreateProgramWithBinary', 
['cl-api-create-program-with-binary'])
 add_plain_test(api, 'clCreateProgramWithSource', 
['cl-api-create-program-with-source'])
 add_plain_test(api, 'clBuildProgram', ['cl-api-build-program'])
 add_plain_test(api, 'clCreateKernelsInProgram', 
['cl-api-create-kernels-in-program'])
diff --git a/tests/cl/api/CMakeLists.cl.txt b/tests/cl/api/CMakeLists.cl.txt
index 460c8ac..a51b45e 100644
--- a/tests/cl/api/CMakeLists.cl.txt
+++ b/tests/cl/api/CMakeLists.cl.txt
@@ -26,6 +26,7 @@ piglit_cl_add_api_test (get-mem-object-info 
get-mem-object-info.c)
 piglit_cl_add_api_test (get-image-info get-image-info.c)
 
 # Programs
+piglit_cl_add_api_test (create-program-with-binary 
create-program-with-binary.c)
 piglit_cl_add_api_test (create-program-with-source 
create-program-with-source.c)
 piglit_cl_add_api_test (retain_release-program retain_release-program.c)
 piglit_cl_add_api_test (build-program build-program.c)
diff --git a/tests/cl/api/create-program-with-binary.c 
b/tests/cl/api/create-program-with-binary.c
new file mode 100644
index 000..f2b3791
--- /dev/null
+++ b/tests/cl/api/create-program-with-binary.c
@@ -0,0 +1,189 @@
+/*
+ * Copyright © 2012 Blaž Tomažič 
+ * Copyright 2014 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * @file create-program-with-source.c
+ *
+ * Test API function:
+ *
+ *  cl_program clCreateProgramWithBinary (cl_context context,
+ *cl_uint num_devices,
+ *const cl_device_id *device_list,
+ *const size_t *lengths,
+ *const unsigned char **binaries,
+ *cl_int *binary_status,
+ *cl_int *errcode_ret)
+ */
+
+#include "piglit-framework-cl-api.h"
+
+
+PIGLIT_CL_API_TEST_CONFIG_BEGIN
+
+   config.name = "clCreateProgramWithBinary";
+   config.version_min = 10;
+
+   config.run_per_platform = true;
+   config.create_context = true;
+
+PIGLIT_CL_API_TEST_CONFIG_END
+
+
+const char* dummy_kernel = "kernel void dummy_kernel() { }";
+
+enum piglit_result
+piglit_cl_test(const int argc,
+   const char** argv,
+   const struct piglit_cl_api_test_config* config,
+   const struct piglit_cl_api_test_env* env)
+{
+   enum piglit_result result = PIGLIT_PASS;
+   int i;
+
+   cl_int errNo;
+   cl_program program;
+   cl_program binary_program;
+   piglit_cl_context ctx = env->context;
+   cl_context cl_ctx = ctx->cl_ctx;
+   cl_kernel kernel;
+
+   size_t kernel_length = strlen(dummy_kernel);
+   size_t *sizes = calloc(sizeof(size_t), ctx->num_devices);
+   unsigned char **binaries = calloc(sizeof(char*),  ctx->num_devices);
+   cl_int *binary_status = calloc(sizeof(cl_int), ctx->num_devices);
+
+
+   /*** Normal usage ***/
+
+   /* with errNo */
+   program = clCreateProgramWithSource(cl_ctx,
+   1,
+   &dummy_kernel,
+   &kernel_l

Re: [Piglit] [PATCH 1/1] cl: Add more sin/cos tests

2014-10-09 Thread Tom Stellard
On Wed, Oct 08, 2014 at 04:07:39PM -0400, Jan Vesely wrote:
> On Wed, 2014-10-08 at 09:49 -0500, Aaron Watry wrote:
> > Reviewed-by: Aaron Watry 
> 
> thanks.
> btw: do these pass on your system?
> 
> > 
> > Do you need someone to push this for you?
> 
> yes pls. my access request bug is stale for some reason
> 

Can you send me the bugzilla link for your account request.

-Tom

> jan
> 
> > 
> > --Aaron
> > 
> > On Fri, Oct 3, 2014 at 7:27 PM, Jan Vesely  wrote:
> > > Signed-off-by: Jan Vesely 
> > > ---
> > >
> > > the newly added values fail on my TURKS gpu.
> > > All tests still pass on Intel CPU.
> > >
> > >  generated_tests/generate-cl-math-builtins.py | 8 
> > >  1 file changed, 4 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/generated_tests/generate-cl-math-builtins.py 
> > > b/generated_tests/generate-cl-math-builtins.py
> > > index fcdcc94..0551a89 100644
> > > --- a/generated_tests/generate-cl-math-builtins.py
> > > +++ b/generated_tests/generate-cl-math-builtins.py
> > > @@ -113,8 +113,8 @@ tests = {
> > >  'arg_types' : [F, F],
> > >  'function_type': 'ttt',
> > >  'values' : [
> > > -[1.0, 0.0,-1.0, 0.0,1.0,cos(1.12345), 
> > > -0.9258790228548379], # Result
> > > -[0.0, pi / 2, pi,   3 * pi / 2, 2 * pi, 1.12345, pow(2,120)] 
> > > # Arg0
> > > +[1.0, 0.0,-1.0, 0.0,1.0,cos(1.12345), 
> > > cos(7), cos(8), cos(pow(2,20)), cos(pow(2,24)), cos(pow(2,120)), 
> > > float("nan")], # Result
> > > +[0.0, pi / 2, pi,   3 * pi / 2, 2 * pi, 1.12345, 7, 8, 
> > > pow(2,20), pow(2,24), pow(2,120), float("nan")] # Arg0
> > >  ],
> > >  'tolerance' : 2
> > >  },
> > > @@ -185,8 +185,8 @@ tests = {
> > >  'arg_types' : [F, F],
> > >  'function_type': 'ttt',
> > >  'values' : [
> > > -[0.0, 1.0,   0.0, -1.0,   0.0,sin(2.234567)], # 
> > > Result
> > > -[0.0, pi / 2, pi, 3 * pi / 2, 2 * pi, 2.234567] # Arg0
> > > +[0.0, 1.0,   0.0, -1.0,   0.0,sin(2.234567), sin(7), 
> > > sin(8), sin(pow(2,20)), sin(pow(2,24)), sin(pow(2,120)), float("nan")], # 
> > > Result
> > > +[0.0, pi / 2, pi, 3 * pi / 2, 2 * pi, 2.234567, 7, 8, 
> > > pow(2,20), pow(2,24), pow(2,120), float("nan")] # Arg0
> > >  ],
> > >  'tolerance': 2
> > >  },
> > > --
> > > 1.9.3
> > >
> 
> -- 
> Jan Vesely 


___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/2] cl: Add cospi tests

2014-10-03 Thread Tom Stellard
On Thu, Oct 02, 2014 at 04:12:49PM -0500, Aaron Watry wrote:
> On Wed, Oct 1, 2014 at 2:39 PM, Tom Stellard  wrote:
> > On Mon, Sep 29, 2014 at 10:01:06AM -0500, Aaron Watry wrote:
> >> v2: Remove stray ', pi' in Arg0 list
> >>
> > Reviewed-by: Tom Stellard 
> 
> Thanks, Tom.
> 
> Was this for this one patch, or have you had a change to look at the
> rest of the series as well (v2 of cospi/sinpi, v1 of the 7 others)?
> 

Yes, you can add my r-b for all 9 patches.

-Tom

> --Aaron
> 
> >> CC: Bruno Jiménez 
> >> Signed-off-by: Aaron Watry 
> >> ---
> >>  generated_tests/generate-cl-math-builtins.py | 10 ++
> >>  1 file changed, 10 insertions(+)
> >>
> >> diff --git a/generated_tests/generate-cl-math-builtins.py 
> >> b/generated_tests/generate-cl-math-builtins.py
> >> index 531106d..6677c1f 100644
> >> --- a/generated_tests/generate-cl-math-builtins.py
> >> +++ b/generated_tests/generate-cl-math-builtins.py
> >> @@ -42,6 +42,7 @@ CLC_VERSION_MIN = {
> >>  'copysign' : 10,
> >>  'cos' : 10,
> >>  'cosh' : 10,
> >> +'cospi' : 10,
> >>  'fabs' : 10,
> >>  'floor' : 10,
> >>  'fmod' : 10,
> >> @@ -172,6 +173,15 @@ tests = {
> >>  ],
> >>  'tolerance' : 4
> >>  },
> >> +'cospi' : {
> >> +'arg_types' : [F, F],
> >> +'function_type': 'ttt',
> >> +'values' : [
> >> +[1.0, cos(pi*pi/2), cos(pi*3*pi/2), cos(2*pi*pi), 
> >> cos(pi*1.12345)], # Result
> >> +[0.0, pi / 2,   3 * pi / 2, 2 * pi,   1.12345 
> >>]  # Arg0
> >> +],
> >> +'tolerance' : 4
> >> +},
> >>  'fabs' : {
> >>  'arg_types' : [F, F],
> >>  'function_type': 'ttt',
> >> --
> >> 1.9.1
> >>
> >> ___
> >> Piglit mailing list
> >> Piglit@lists.freedesktop.org
> >> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/2] cl: Add cospi tests

2014-10-01 Thread Tom Stellard
On Mon, Sep 29, 2014 at 10:01:06AM -0500, Aaron Watry wrote:
> v2: Remove stray ', pi' in Arg0 list
> 
Reviewed-by: Tom Stellard 
> CC: Bruno Jiménez 
> Signed-off-by: Aaron Watry 
> ---
>  generated_tests/generate-cl-math-builtins.py | 10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/generated_tests/generate-cl-math-builtins.py 
> b/generated_tests/generate-cl-math-builtins.py
> index 531106d..6677c1f 100644
> --- a/generated_tests/generate-cl-math-builtins.py
> +++ b/generated_tests/generate-cl-math-builtins.py
> @@ -42,6 +42,7 @@ CLC_VERSION_MIN = {
>  'copysign' : 10,
>  'cos' : 10,
>  'cosh' : 10,
> +'cospi' : 10,
>  'fabs' : 10,
>  'floor' : 10,
>  'fmod' : 10,
> @@ -172,6 +173,15 @@ tests = {
>  ],
>  'tolerance' : 4
>  },
> +'cospi' : {
> +'arg_types' : [F, F],
> +'function_type': 'ttt',
> +'values' : [
> +[1.0, cos(pi*pi/2), cos(pi*3*pi/2), cos(2*pi*pi), 
> cos(pi*1.12345)], # Result
> +[0.0, pi / 2,   3 * pi / 2, 2 * pi,   1.12345
> ]  # Arg0
> +],
> +'tolerance' : 4
> +},
>  'fabs' : {
>  'arg_types' : [F, F],
>  'function_type': 'ttt',
> -- 
> 1.9.1
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v2 1/1] cl: Run concurrent on Linux render nodes, or non-Linux

2014-10-01 Thread Tom Stellard
On Sun, Sep 28, 2014 at 04:30:34PM -0400, Jan Vesely wrote:
> v2: make the flag a module parameter
> 

Pushed, thanks!
-Tom

> Signed-off-by: Jan Vesely 
> ---
> 
> This still restricts CPU implementations to run serial on linux machines 
> without
> render nodes, but I guess those few cases can use -c.
> 
>  tests/cl.py | 13 ++---
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/cl.py b/tests/cl.py
> index f618f59..67ed542 100644
> --- a/tests/cl.py
> +++ b/tests/cl.py
> @@ -7,6 +7,9 @@ __all__ = ['profile']
>  import os
>  import os.path as path
>  
> +import platform
> +import glob
> +
>  from framework.opencv import add_opencv_tests
>  
>  from framework.profile import TestProfile
> @@ -15,14 +18,10 @@ from framework.exectest import PiglitTest
>  ##
>  # Helper functions
>  
> -def add_plain_test(group, name, args):
> -group[name] = PiglitTest(args)
> +can_do_concurrent = platform.system().lower()[0:5] != 'linux' or 
> glob.glob('/dev/dri/render*')
>  
> -# TODO: Use concurrent tests for everything once kernels with render nodes
> -# enabled by default (3.16 or newer) are more widely used.
> -def add_concurrent_test(group, name, args):
> -test = PiglitTest(args, run_concurrent=True)
> -group[name] = test
> +def add_plain_test(group, name, args):
> +group[name] = PiglitTest(args, run_concurrent=can_do_concurrent)
>  
>  def add_plain_program_tester_test(group, name, path):
>  add_plain_test(group, name, ['cl-program-tester', path])
> -- 
> 1.9.3
> 
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] CL: Add atomic_add global tests

2014-09-26 Thread Tom Stellard
On Tue, Sep 23, 2014 at 11:13:06AM -0500, Aaron Watry wrote:
> Adds two separate files, one which tests atomic_add without usage
> of the return values, and another which tests with return usage.
> 
> At least the Radeon HD (EG/SI) line has two separate sets of instructions
> depending on whether the return value is used or not.
> 
> v2: Only use return variant for atomic_add-global-return
> 
Reviewed-by: Tom Stellard 
> Signed-off-by: Aaron Watry 
> CC: Tom Stellard 
> ---
>  .../builtin/atomic/atomic_add-global-return.cl | 62 
> ++
>  .../execute/builtin/atomic/atomic_add-global.cl| 59 
>  2 files changed, 121 insertions(+)
>  create mode 100644 
> tests/cl/program/execute/builtin/atomic/atomic_add-global-return.cl
>  create mode 100644 
> tests/cl/program/execute/builtin/atomic/atomic_add-global.cl
> 
> diff --git 
> a/tests/cl/program/execute/builtin/atomic/atomic_add-global-return.cl 
> b/tests/cl/program/execute/builtin/atomic/atomic_add-global-return.cl
> new file mode 100644
> index 000..e3abe6c
> --- /dev/null
> +++ b/tests/cl/program/execute/builtin/atomic/atomic_add-global-return.cl
> @@ -0,0 +1,62 @@
> +/*!
> +[config]
> +name: atomic_add global, with usage of return variable
> +clc_version_min: 11
> +
> +[test]
> +name: simple int
> +kernel_name: simple_int
> +dimensions: 1
> +global_size: 1 0 0
> +local_size:  1 0 0
> +arg_out: 0 buffer int[2] -4 -5
> +arg_in:  0 buffer int[2] -5 0
> +
> +[test]
> +name: simple uint
> +kernel_name: simple_uint
> +dimensions: 1
> +global_size: 1 0 0
> +local_size:  1 0 0
> +arg_out: 0 buffer uint[2] 1 0
> +arg_in:  0 buffer uint[2] 0 0
> +
> +[test]
> +name: threads int
> +kernel_name: threads_int
> +dimensions: 1
> +global_size: 8 0 0
> +local_size:  8 0 0
> +arg_out: 0 buffer int[18] 28 0 1 1 3 2 5 3 7 4 9 5 11 6 13 7 15 8
> +arg_in:  0 buffer int[18] 0  0 1 0 2 0 3 0 4 0 5 0  6 0  7 0  8 0
> +
> +[test]
> +name: threads uint
> +kernel_name: threads_uint
> +dimensions: 1
> +global_size: 8 0 0
> +local_size:  8 0 0
> +arg_out: 0 buffer uint[18] 28 0 1 1 3 2 5 3 7 4 9 5 11 6 13 7 15 8
> +arg_in:  0 buffer uint[18] 0  0 1 0 2 0 3 0 4 0 5 0  6 0  7 0  8 0
> +
> +!*/
> +
> +#define SIMPLE_TEST(TYPE) \
> +kernel void simple_##TYPE(global TYPE *mem) { \
> +  mem[1] = atomic_add(mem, 1); \
> +}
> +
> +#define THREADS_TEST(TYPE) \
> +kernel void threads_##TYPE(global TYPE *mem) { \
> +  TYPE mul = mem[1]; \
> +  TYPE id = get_global_id(0); \
> +  TYPE ret = atomic_add(mem, id); \
> +  TYPE ret2 = atomic_add(&mem[(id+1)*2], id+ret*mul); \
> +  mem[(id+1)*2+1] = ret2; \
> +}
> +
> +SIMPLE_TEST(int)
> +SIMPLE_TEST(uint)
> +
> +THREADS_TEST(int)
> +THREADS_TEST(uint)
> diff --git a/tests/cl/program/execute/builtin/atomic/atomic_add-global.cl 
> b/tests/cl/program/execute/builtin/atomic/atomic_add-global.cl
> new file mode 100644
> index 000..bc1c311
> --- /dev/null
> +++ b/tests/cl/program/execute/builtin/atomic/atomic_add-global.cl
> @@ -0,0 +1,59 @@
> +/*!
> +[config]
> +name: atomic_add global, no usage of return variable
> +clc_version_min: 11
> +
> +[test]
> +name: simple int
> +kernel_name: simple_int
> +dimensions: 1
> +global_size: 1 0 0
> +local_size:  1 0 0
> +arg_out: 0 buffer int[1] -4
> +arg_in:  0 buffer int[1] -5
> +
> +[test]
> +name: simple uint
> +kernel_name: simple_uint
> +dimensions: 1
> +global_size: 1 0 0
> +local_size:  1 0 0
> +arg_out: 0 buffer uint[1] 1
> +arg_in:  0 buffer uint[1] 0
> +
> +[test]
> +name: threads int
> +kernel_name: threads_int
> +dimensions: 1
> +global_size: 8 0 0
> +local_size:  8 0 0
> +arg_out: 0 buffer int[1] 28
> +arg_in:  0 buffer int[1] 0
> +
> +[test]
> +name: threads uint
> +kernel_name: threads_uint
> +dimensions: 1
> +global_size: 8 0 0
> +local_size:  8 0 0
> +arg_out: 0 buffer uint[1] 28
> +arg_in:  0 buffer uint[1] 0
> +
> +!*/
> +
> +#define SIMPLE_TEST(TYPE) \
> +kernel void simple_##TYPE(global TYPE *mem) { \
> +  atomic_add(mem, 1); \
> +}
> +
> +#define THREADS_TEST(TYPE) \
> +kernel void threads_##TYPE(global TYPE *mem) { \
> +  TYPE id = get_global_id(0); \
> +  atomic_add(mem, id); \
> +}
> +
> +SIMPLE_TEST(int)
> +SIMPLE_TEST(uint)
> +
> +THREADS_TEST(int)
> +THREADS_TEST(uint)
> -- 
> 2.1.0
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: Add log1p tests

2014-09-26 Thread Tom Stellard
On Fri, Sep 26, 2014 at 01:05:35PM -0500, Aaron Watry wrote:
> Signed-off-by: Aaron Watry 
> ---

Reviewed-by: Tom Stellard 

>  generated_tests/generate-cl-math-builtins.py | 12 +++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/generated_tests/generate-cl-math-builtins.py 
> b/generated_tests/generate-cl-math-builtins.py
> index dfc1d1d..48b4507 100644
> --- a/generated_tests/generate-cl-math-builtins.py
> +++ b/generated_tests/generate-cl-math-builtins.py
> @@ -27,7 +27,7 @@ import os
>  
>  from genclbuiltins import gen, NEGNAN
>  from math import acos, acosh, asin, asinh, atan, atan2, atanh, cos, cosh
> -from math import fabs, fmod, pi, pow, sin, sinh, sqrt, tan, tanh
> +from math import fabs, fmod, log1p, pi, pow, sin, sinh, sqrt, tan, tanh
>  
>  CLC_VERSION_MIN = {
>  'acos' : 10,
> @@ -46,6 +46,7 @@ CLC_VERSION_MIN = {
>  'fabs' : 10,
>  'floor' : 10,
>  'fmod' : 10,
> +'log1p' : 10,
>  'mix' : 10,
>  'nextafter' : 10,
>  'round' : 10,
> @@ -210,6 +211,15 @@ tests = {
>  ],
>  'tolerance' : 0
>  },
> +'log1p' : {
> +'arg_types': [F, F],
> +'function_type': 'ttt',
> +'values': [
> +[log1p(0.5), float("-inf"), log1p(1.e-15), float("nan")],
> +[0.5,-1.0,  1.e-15,float("nan")]
> +],
> +'tolerance' : 2
> +},
>  'mix' : { #x + (y - x) * a
>  'arg_types': [F, F, F, F],
>  'function_type': 'tts',
> -- 
> 2.1.0
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/1] cl: fix adding concurent tests

2014-09-26 Thread Tom Stellard
On Fri, Sep 26, 2014 at 01:51:15PM -0400, Jan Vesely wrote:
> On Fri, 2014-09-26 at 07:22 -0700, Tom Stellard wrote:
> > On Thu, Sep 25, 2014 at 10:19:16PM -0400, Jan Vesely wrote:
> > > Didn't notice somebody dropped Tom from the cc list.
> > > 
> > > On Thu, 2014-09-04 at 10:28 -0400, Jan Vesely wrote:
> > > > On Wed, 2014-09-03 at 20:20 -0700, Dylan Baker wrote:
> > > > > I'd caught this error in a branch as well, but noticed there were no 
> > > > > users
> > > > > of this function so it didn't seem pressing to fix it.
> > > > > 
> > > > > If you wanted a little less code:
> > > > > group[name] = PiglitTest(args, run_concurrent=True)
> > > > 
> > > > yeah, it looks nicer.
> > > > 
> > > > > 
> > > > > 
> > > > > On Wed, Sep 3, 2014 at 4:35 PM, Ilia Mirkin  
> > > > > wrote:
> > > > > 
> > > > > > On Wed, Sep 3, 2014 at 7:28 PM, Tom Stellard  
> > > > > > wrote:
> > > > > > > On Wed, Sep 03, 2014 at 07:20:10PM -0400, Jan Vesely wrote:
> > > > > > >> Signed-off-by: Jan Vesely 
> > > > > > >
> > > > > > > Reviewed-by: Tom Stellard 
> > > > 
> > > > thanks, can you push it too? I don't have commit access. Or Dylan's
> > > > version if it is preferable.
> > > > 
> > > > jan
> > > > 
> > > > > > >
> > > > > > >> ---
> > > > > > >>
> > > > > > >> seemed wrong. Wonder if we can use concurrent tests.
> > > > > > >>
> > > > > > >
> > > > > > > If you have render-nodes enabled, then you can run the cl tests
> > > > > > > concurrently by adding the -c flag when running piglit.
> > > 
> > > It works nicely (I get linear speedup to number of cores with -c).
> > > 
> > > I think in this case we can remove add_concurrent_test entirely, since
> > > we are not going to have a mix of concurrent and non-concurrent tests.
> > > 
> > 
> > Hi,
> > 
> > I've pushed this patch with Dylan's suggest change.  I left the 
> > add_concurrent_test
> > function in, because we will use it eventually once more people are using
> > render nodes.
> 
> I thought in that case we would switch all tests to concurrent, and drop
> add_plain_test.
> or we can do something like:
> 
> run_concurrent = glob.glob('/dev/dri/render*')
>

Yeah, something like that might work.
 
> so we don't need to check kernel version or platform (I assume it
> returns empty list on mac/win)
> 

I wasn't thinking about other platforms, I guess we should enable concurrent
by default on those and just add the render node check on linux.

-Tom

> jan
> 
> > 
> > -Tom
> > 
> > > jan
> > > 
> > > > > > >
> > > > > > > Render-nodes were enabled by default in the 3.16 kernel, so
> > > > > > > I think it may be too early to enable concurrent tests by default.
> > > > > >
> > > > > > Conversely, you can use -1 to force single-threaded runs... seems 
> > > > > > like
> > > > > > it's not for piglit to worry about that. -c forces all tests to run
> > > > > > concurrently even if the test author said that it shouldn't run
> > > > > > concurrently with other things. Not sure how common that is in the 
> > > > > > CL
> > > > > > world though.
> > > > > >
> > > > > > >
> > > > > > > -Tom
> > > > > > >
> > > > > > >>  tests/cl.py | 2 +-
> > > > > > >>  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > > >>
> > > > > > >> diff --git a/tests/cl.py b/tests/cl.py
> > > > > > >> index fd698fc..b59368d 100644
> > > > > > >> --- a/tests/cl.py
> > > > > > >> +++ b/tests/cl.py
> > > > > > >> @@ -21,7 +21,7 @@ def add_plain_test(group, name, args):
> > > > > > >>  def add_concurrent_test(group, name, args):
> > > > > > >>  test = PiglitTest(args)
> > > > > > >>  test.run_concurrent = true;
> > > > > > >> -group[name] = PiglitTest(args)
> > > > > > >> +group[name] = test
> > > > > > >>
> > > > > > >>  def add_plain_program_tester_test(group, name, path):
> > > > > > >>  add_plain_test(group, name, ['cl-program-tester', path])
> > > > > > >> --
> > > > > > >> 1.9.3
> > > > > > >>
> > > > > > >> ___
> > > > > > >> Piglit mailing list
> > > > > > >> Piglit@lists.freedesktop.org
> > > > > > >> http://lists.freedesktop.org/mailman/listinfo/piglit
> > > > > > > ___
> > > > > > > Piglit mailing list
> > > > > > > Piglit@lists.freedesktop.org
> > > > > > > http://lists.freedesktop.org/mailman/listinfo/piglit
> > > > > > ___
> > > > > > Piglit mailing list
> > > > > > Piglit@lists.freedesktop.org
> > > > > > http://lists.freedesktop.org/mailman/listinfo/piglit
> > > > > >
> > > > > ___
> > > > > Piglit mailing list
> > > > > Piglit@lists.freedesktop.org
> > > > > http://lists.freedesktop.org/mailman/listinfo/piglit
> > > > 
> > > 
> > > 
> > > -- 
> > > Jan Vesely 
> > 
> > 
> 
> -- 
> Jan Vesely 


___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/1] cl: fix adding concurent tests

2014-09-26 Thread Tom Stellard
On Thu, Sep 25, 2014 at 10:19:16PM -0400, Jan Vesely wrote:
> Didn't notice somebody dropped Tom from the cc list.
> 
> On Thu, 2014-09-04 at 10:28 -0400, Jan Vesely wrote:
> > On Wed, 2014-09-03 at 20:20 -0700, Dylan Baker wrote:
> > > I'd caught this error in a branch as well, but noticed there were no users
> > > of this function so it didn't seem pressing to fix it.
> > > 
> > > If you wanted a little less code:
> > > group[name] = PiglitTest(args, run_concurrent=True)
> > 
> > yeah, it looks nicer.
> > 
> > > 
> > > 
> > > On Wed, Sep 3, 2014 at 4:35 PM, Ilia Mirkin  wrote:
> > > 
> > > > On Wed, Sep 3, 2014 at 7:28 PM, Tom Stellard  wrote:
> > > > > On Wed, Sep 03, 2014 at 07:20:10PM -0400, Jan Vesely wrote:
> > > > >> Signed-off-by: Jan Vesely 
> > > > >
> > > > > Reviewed-by: Tom Stellard 
> > 
> > thanks, can you push it too? I don't have commit access. Or Dylan's
> > version if it is preferable.
> > 
> > jan
> > 
> > > > >
> > > > >> ---
> > > > >>
> > > > >> seemed wrong. Wonder if we can use concurrent tests.
> > > > >>
> > > > >
> > > > > If you have render-nodes enabled, then you can run the cl tests
> > > > > concurrently by adding the -c flag when running piglit.
> 
> It works nicely (I get linear speedup to number of cores with -c).
> 
> I think in this case we can remove add_concurrent_test entirely, since
> we are not going to have a mix of concurrent and non-concurrent tests.
> 

Hi,

I've pushed this patch with Dylan's suggest change.  I left the 
add_concurrent_test
function in, because we will use it eventually once more people are using
render nodes.

-Tom

> jan
> 
> > > > >
> > > > > Render-nodes were enabled by default in the 3.16 kernel, so
> > > > > I think it may be too early to enable concurrent tests by default.
> > > >
> > > > Conversely, you can use -1 to force single-threaded runs... seems like
> > > > it's not for piglit to worry about that. -c forces all tests to run
> > > > concurrently even if the test author said that it shouldn't run
> > > > concurrently with other things. Not sure how common that is in the CL
> > > > world though.
> > > >
> > > > >
> > > > > -Tom
> > > > >
> > > > >>  tests/cl.py | 2 +-
> > > > >>  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >>
> > > > >> diff --git a/tests/cl.py b/tests/cl.py
> > > > >> index fd698fc..b59368d 100644
> > > > >> --- a/tests/cl.py
> > > > >> +++ b/tests/cl.py
> > > > >> @@ -21,7 +21,7 @@ def add_plain_test(group, name, args):
> > > > >>  def add_concurrent_test(group, name, args):
> > > > >>  test = PiglitTest(args)
> > > > >>  test.run_concurrent = true;
> > > > >> -group[name] = PiglitTest(args)
> > > > >> +group[name] = test
> > > > >>
> > > > >>  def add_plain_program_tester_test(group, name, path):
> > > > >>  add_plain_test(group, name, ['cl-program-tester', path])
> > > > >> --
> > > > >> 1.9.3
> > > > >>
> > > > >> ___
> > > > >> Piglit mailing list
> > > > >> Piglit@lists.freedesktop.org
> > > > >> http://lists.freedesktop.org/mailman/listinfo/piglit
> > > > > ___
> > > > > Piglit mailing list
> > > > > Piglit@lists.freedesktop.org
> > > > > http://lists.freedesktop.org/mailman/listinfo/piglit
> > > > ___
> > > > Piglit mailing list
> > > > Piglit@lists.freedesktop.org
> > > > http://lists.freedesktop.org/mailman/listinfo/piglit
> > > >
> > > ___
> > > Piglit mailing list
> > > Piglit@lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/piglit
> > 
> 
> 
> -- 
> Jan Vesely 


___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH V2] fix CL_KERNEL_GLOBAL_WORK_SIZE bug.

2014-09-26 Thread Tom Stellard
On Fri, Sep 26, 2014 at 07:11:03AM +0800, xionghu@intel.com wrote:
> From: Luo 
> 
> the option  CL_KERNEL_GLOBAL_WORK_SIZE for clGetKernelWorkGroupInfo
> should call built in kernel or custom device according to the spec,
> this patch calls the built in kernel to query the GLOBAL_WORK_SIZE.
> 
> v2: use built in kernel to qury the GLOBAL_WORK_SIZE if exist, dummy
> kernel for other options, handle the case when no built in kernel is
> provided.
> 
> Signed-off-by: Luo 
> ---
>  tests/cl/api/get-kernel-work-group-info.c |   66 
> +++--
>  1 file changed, 63 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/cl/api/get-kernel-work-group-info.c 
> b/tests/cl/api/get-kernel-work-group-info.c
> index 47d09da..11d29d2 100644
> --- a/tests/cl/api/get-kernel-work-group-info.c
> +++ b/tests/cl/api/get-kernel-work-group-info.c
> @@ -61,6 +61,11 @@ piglit_cl_test(const int argc,
>   int i;
>   cl_int errNo;
>   cl_kernel kernel;
> + cl_program built_in_prog = NULL;
> + cl_kernel built_in_kernel = NULL;
> + cl_kernel temp_kernel;
> + size_t built_in_kernels_size;
> +
>  
>   size_t param_value_size;
>   void* param_value;
> @@ -71,19 +76,65 @@ piglit_cl_test(const int argc,
>   PIGLIT_CL_ENUM_ARRAY(cl_kernel_work_group_info);
>  
>   kernel = clCreateKernel(env->program,
> - "dummy_kernel",
> - &errNo);
> + "dummy_kernel",
> + &errNo);

This change is unnecessary.

> +
> + errNo = clGetDeviceInfo(env->device_id, CL_DEVICE_BUILT_IN_KERNELS, 0, 
> 0, &built_in_kernels_size);
>   if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
>   fprintf(stderr,
> - "Failed (error code: %s): Create kernel.\n",
> + "Failed (error code: %s): Get Device Info.\n",
>   piglit_cl_get_error_name(errNo));
>   return PIGLIT_FAIL;
>   }
>  
> + if(built_in_kernels_size != 0)
> + {
> + char* built_in_kernel_names;
> + char* kernel_name;
> + size_t ret_sz;
> + built_in_kernel_names = (char* )malloc(built_in_kernels_size * 
> sizeof(char) );
> +
> + errNo = clGetDeviceInfo(env->device_id, 
> CL_DEVICE_BUILT_IN_KERNELS, built_in_kernels_size, 
> (void*)built_in_kernel_names, &ret_sz);
> + if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
> + fprintf(stderr,
> + "Failed (error code: %s): Get 
> Device Info.\n",
> + 
> piglit_cl_get_error_name(errNo));
> + return PIGLIT_FAIL;
> + }
> +
> + built_in_prog = 
> clCreateProgramWithBuiltInKernels(env->context->cl_ctx, 1, &env->device_id, 
> built_in_kernel_names, &errNo);
> + if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
> + fprintf(stderr,
> + "Failed (error code: %s): 
> Create BuiltIn Program.\n",
> + 
> piglit_cl_get_error_name(errNo));
> + return PIGLIT_FAIL;
> + }
> +
> + kernel_name = strtok(built_in_kernel_names, ";");
> +
> + built_in_kernel = clCreateKernel(built_in_prog, kernel_name,  
> &errNo);
> + if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
> + fprintf(stderr,
> + "Failed (error code: %s): 
> Create kernel.\n",
> + 
> piglit_cl_get_error_name(errNo));
> + return PIGLIT_FAIL;
> + }
> + free(built_in_kernel_names);

The indentation here is wrong.

> + }
> +
>   /*** Normal usage ***/
>   for(i = 0; i < num_kernel_work_group_infos; i++) {
>   printf("%s ", 
> piglit_cl_get_enum_name(kernel_work_group_infos[i]));
>  
> + //use builtin kernel to test CL_KERNEL_GLOBAL_WORK_SIZE.
> swap the dummy kernel and builtin_kernel.
> + if(kernel_work_group_infos[i] == CL_KERNEL_GLOBAL_WORK_SIZE){
> + if(built_in_kernel != NULL) {
> + temp_kernel = kernel;
> + kernel = built_in_kernel;
> + built_in_kernel = temp_kernel;
> + }
> + }
> +

Rather than swapping the kernel, I think it would be better to
factor the body of this loop out to its own function and do something like:

|
|   for (i = 0; i < num_kernel_work_group_infos; i++) {
|   cl_int expected_error = CL_SUCCESS; 
|   if (kernel_work_group_infos[i] == CL_KERNEL_GLOBAL_WORK_SIZE) {
|   if (cl_version < 1.2) {
|   con

Re: [Piglit] [PATCH v2 5/5] cl: i32-stack-array: Rename to avoid subtest conflicts

2014-09-25 Thread Tom Stellard
On Thu, Sep 25, 2014 at 06:50:46PM -0400, Jan Vesely wrote:
> On Mon, 2014-09-22 at 11:31 -0700, Tom Stellard wrote:
> > On Fri, Sep 19, 2014 at 07:30:41PM -0400, Jan Vesely wrote:
> > > Signed-off-by: Jan Vesely 
> > 
> > For the whole series:
> > 
> > Reviewed-by: Tom Stellard 
> > 
> > Do you need me to commit these?
> 
> these too,
> thanks,

I've pushed these, thanks.

-Tom

> jan
> 
> > 
> > > ---
> > >  tests/cl/program/execute/i32-stack-array.cl | 20 ++--
> > >  1 file changed, 10 insertions(+), 10 deletions(-)
> > > 
> > > diff --git a/tests/cl/program/execute/i32-stack-array.cl 
> > > b/tests/cl/program/execute/i32-stack-array.cl
> > > index 534ee13..1269663 100644
> > > --- a/tests/cl/program/execute/i32-stack-array.cl
> > > +++ b/tests/cl/program/execute/i32-stack-array.cl
> > > @@ -1,6 +1,6 @@
> > >  /*!
> > >  [config]
> > > -name: i32 stack array read
> > > +name: i32 stack array
> > >  clc_version_min: 10
> > >  
> > >  dimensions: 1
> > > @@ -15,25 +15,25 @@ global_size: 1 0 0
> > >  
> > >  [test]
> > >  kernel_name: stack_array_read
> > > -name: i32 stack array read
> > > +name: i32 stack array read up
> > >  arg_out: 0 buffer int[5] 4 5 6 7 8
> > >  arg_in:  1 buffer int[5] 0 1 2 3 4
> > >  
> > >  [test]
> > >  kernel_name: stack_array_read
> > > -name: i32 stack array read
> > > +name: i32 stack array read const
> > >  arg_out: 0 buffer int[5] 5 5 5 5 5
> > >  arg_in:  1 buffer int[5] 1 1 1 1 1
> > >  
> > >  [test]
> > >  kernel_name: stack_array_read
> > > -name: i32 stack array read
> > > +name: i32 stack array read down
> > >  arg_out: 0 buffer int[5] 8 7 5 6 4
> > >  arg_in:  1 buffer int[5] 4 3 1 2 0
> > >  
> > >  [test]
> > >  kernel_name: stack_array_read
> > > -name: i32 stack array read
> > > +name: i32 stack array read rand
> > >  arg_out: 0 buffer int[5] 7 5 8 4 6
> > >  arg_in:  1 buffer int[5] 3 1 4 0 2
> > >  
> > > @@ -72,21 +72,21 @@ arg_in:  1 buffer int[1] 1
> > >  
> > > ##===--===##
> > >  [test]
> > >  kernel_name: stack_array_write_if_else_indirect_read
> > > -name: i32 stack array direct write (IF and ELSE) indirect read
> > > +name: i32 stack array direct write (IF and ELSE) indirect read up
> > >  arg_out: 0 buffer int[5] 4 5 6 7 8
> > >  arg_in:  1 buffer int[6] 1 \
> > >   0 1 2 3 4
> > >  
> > >  [test]
> > >  kernel_name: stack_array_write_if_else_indirect_read
> > > -name: i32 stack array direct write (IF and ELSE) indirect read
> > > +name: i32 stack array direct write (IF and ELSE) indirect read const
> > >  arg_out: 0 buffer int[5] 0 0 0 0 0
> > >  arg_in:  1 buffer int[6] 0 \
> > >   0 1 2 3 4
> > >  
> > >  [test]
> > >  kernel_name: stack_array_write_if_else_indirect_read
> > > -name: i32 stack array direct write (IF and ELSE) indirect read
> > > +name: i32 stack array direct write (IF and ELSE) indirect read down
> > >  arg_out: 0 buffer int[5] 8 7 6 5 4
> > >  arg_in:  1 buffer int[6] 1 \
> > >   4 3 2 1 0
> > > @@ -106,14 +106,14 @@ arg_in:  1 buffer int[6] 1 \
> > >  
> > > ##===--===##
> > >  [test]
> > >  kernel_name: stack_array_indirect_write_if_else_indirect_read
> > > -name: i32 stack array indirect write (IF and ELSE) indirect read
> > > +name: i32 stack array indirect write (IF and ELSE) indirect read up
> > >  arg_out: 0 buffer int[5] 4 5 6 7 8
> > >  arg_in:  1 buffer int[11] 1 \
> > >0 1 2 3 4 \
> > >0 1 2 3 4
> > >  [test]
> > >  kernel_name: stack_array_indirect_write_if_else_indirect_read
> > > -name: i32 stack array indirect write (IF and ELSE) indirect read
> > > +name: i32 stack array indirect write (IF and ELSE) indirect read up-down
> > >  arg_out: 0 buffer int[5] 8 7 6 5 4
> > >  arg_in:  1 buffer int[11] 1 \
> > >0 1 2 3 4 \
> > > -- 
> > > 1.9.3
> > > 
> 
> 
> -- 
> Jan Vesely 


___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v2 1/1] cl: Merge tests with the same name.

2014-09-25 Thread Tom Stellard
On Thu, Sep 25, 2014 at 03:36:23PM -0400, Jan Vesely wrote:
> ping

Pushed, thanks!

-Tom

> 
> On Tue, 2014-09-16 at 17:49 -0400, Jan Vesely wrote:
> > ping
> > 
> > this fixes duplicate subtest names in generated tests
> > 
> > 
> > 
> > On Thu, 2014-09-04 at 17:16 -0400, Jan Vesely wrote:
> > > This fixes hidden failures where summary would report the result
> > > of the last test with given name.
> > > 
> > > v2: Tag tss variants
> > > 
> > > Signed-off-by: Jan Vesely 
> > > ---
> > >  generated_tests/genclbuiltins.py | 65 
> > > 
> > >  1 file changed, 33 insertions(+), 32 deletions(-)
> > > 
> > > diff --git a/generated_tests/genclbuiltins.py 
> > > b/generated_tests/genclbuiltins.py
> > > index cdef80b..571930d 100644
> > > --- a/generated_tests/genclbuiltins.py
> > > +++ b/generated_tests/genclbuiltins.py
> > > @@ -113,10 +113,10 @@ def gen_kernel(f, fnName, inTypes, outType, 
> > > vecSizes, typePrefix):
> > >  
> > >  suffix = ';'
> > >  if (vecSizes[0] == 1):
> > > -f.write('  *out = ')
> > > +f.write('  out[get_global_id(0)] = ')
> > >  else:
> > >  f.write('  vstore'+str(vecSizes[0])+'(')
> > > -suffix = ', 0, out)' + suffix
> > > +suffix = ', get_global_id(0), out)' + suffix
> > >  
> > >  f.write(fnName+'(')
> > >  suffix = ')' + suffix
> > > @@ -126,9 +126,9 @@ def gen_kernel(f, fnName, inTypes, outType, vecSizes, 
> > > typePrefix):
> > >  f.write(', ')
> > >  # if scalar, don't print vload/vstore
> > >  if (vecSizes[arg] == 1):
> > > -f.write('*in'+str(arg))
> > > +f.write('in'+str(arg)+'[get_global_id(0)]')
> > >  else:
> > > -f.write('vload'+str(vecSizes[arg])+'(0, in'+str(arg)+')')
> > > +f.write('vload'+str(vecSizes[arg])+'(get_global_id(0), 
> > > in'+str(arg)+')')
> > >  
> > >  f.write(suffix+'\n}\n\n')
> > >  
> > > @@ -247,16 +247,19 @@ def getValue(type, val, isVector):
> > >  
> > >  # Evaluate the value of the requested function and arguments
> > >  # TODO: Change to varargs calls after unshifting the first list 
> > > element
> > > -if (len(val) == 2):
> > > -return (val[0])(getValue(type, val[1], isVector))
> > > -elif (len(val) == 3):
> > > -return (val[0])(getValue(type, val[1], isVector), 
> > > getValue(type, val[2], isVector))
> > > -elif (len(val) == 4):
> > > -return (val[0])(getValue(type, val[1], isVector), 
> > > getValue(type, val[2], isVector),
> > > +if (callable(val[0])):
> > > +if (len(val) == 2):
> > > +return (val[0])(getValue(type, val[1], isVector))
> > > +elif (len(val) == 3):
> > > +return (val[0])(getValue(type, val[1], isVector), 
> > > getValue(type, val[2], isVector))
> > > +elif (len(val) == 4):
> > > +return (val[0])(getValue(type, val[1], isVector), 
> > > getValue(type, val[2], isVector),
> > >  getValue(type, val[3], isVector))
> > > -else:
> > > -return (val[0])(getValue(type, val[1], isVector), 
> > > getValue(type, val[2], isVector),
> > > +else:
> > > +return (val[0])(getValue(type, val[1], isVector), 
> > > getValue(type, val[2], isVector),
> > >  getValue(type, val[3], isVector), 
> > > getValue(type, val[4], isVector))
> > > +else:
> > > + return map(lambda x: getValue(type, x, isVector), val);
> > >  
> > >  # At this point, we should have been passed a number
> > >  if (isinstance(val, (int, long, float))):
> > > @@ -267,7 +270,7 @@ def getValue(type, val, isVector):
> > >  
> > > 
> > >  def getStrVal(type, val, isVector):
> > > -return str(getValue(type, val, isVector))
> > > +return " ".join(map(str, getValue(type, val, isVector)))
> > >  
> > > 
> > >  def getArgType(baseType, argType):
> > > @@ -288,11 +291,11 @@ def isFloatType(t):
> > >  return t not in U
> > >  
> > >  # Print a test with all-vector inputs/outputs and/or mixed vector/scalar 
> > > args
> > > -def print_test(f, fnName, argType, functionDef, tests, testIdx, vecSize, 
> > > tss):
> > > +def print_test(f, fnName, argType, functionDef, tests, numTests, 
> > > vecSize, tss):
> > >  # If the test allows mixed vector/scalar arguments, handle the case 
> > > with
> > >  # only vector arguments through a recursive call.
> > >  if (tss):
> > > -print_test(f, fnName, argType, functionDef, tests, testIdx, 
> > > vecSize,
> > > +print_test(f, fnName, argType, functionDef, tests, numTests, 
> > > vecSize,
> > > False)
> > >  
> > >  # The tss && vecSize==1 case is handled in the non-tss case.
> > > @@ -305,20 +308,21 @@ def print_test(f, fnName, argType, functionDef, 
> > > tests, testIdx, vecSize, tss):
> > >  if (not tss):
> > > 

Re: [Piglit] [Beignet] [PATCH] fix CL_KERNEL_GLOBAL_WORK_SIZE bug.

2014-09-25 Thread Tom Stellard
On Thu, Sep 25, 2014 at 09:18:18AM +0800, Zhigang Gong wrote:
> On Wed, Sep 24, 2014 at 08:03:10AM -0700, Tom Stellard wrote:
> > On Wed, Sep 24, 2014 at 01:13:18AM +, Luo, Xionghu wrote:
> > > Hi Tom,
> > > According to the opencl-1.2 spec in page 165, the option 
> > > CL_KERNEL_GLOBAL_WORK_SIZE for clGetKernelWorkGroupInfo should call built 
> > > in kernel or custom device.
> > > 
> > > "This provides a mechanism for the
> > > application to query the maximum global
> > > size that can be used to execute a kernel
> > > (i.e. global_work_size argument to
> > > clEnqueueNDRangeKernel) on a custom
> > > device given by device or a built-in kernel
> > > on an OpenCL device given by device.
> > > If device is not a custom device or kernel
> > > is not a built-in kernel,
> > > clGetKernelArgInfo returns the error
> > > CL_INVALID_VALUE."
> > > 
> > > And this case called dummy kernel instead of built in kernel, so the 
> > > return value is not as expected, my patch could call built in kernel to 
> > > test the correct return value of option CL_KERNEL_GLOBAL_WORK_SIZE.
> > > 
> > 
> > I'm still confused by this patch, because the CL_KERNEL_GLOBAL_WORK_SIZE 
> > enum
> > value does not appear anywhere in this patch or in the file being patched.
> Hi Tom,
> 
> Please check the following code in the get-kernel-work-group-info.c:
> 
>   const cl_kernel_work_group_info* kernel_work_group_infos =
> PIGLIT_CL_ENUM_ARRAY(cl_kernel_work_group_info);
> 
> And the cl_kernel_work_group_info is defined as below in 
> piglit-util-cl-enum.c as below:
> 
>   PIGLIT_CL_DEFINE_ENUM_2(cl_kernel_work_group_info, 3, 5, 6) = {
>   CL_KERNEL_WORK_GROUP_SIZE,
>   CL_KERNEL_COMPILE_WORK_GROUP_SIZE,
>   CL_KERNEL_LOCAL_MEM_SIZE,
>   #ifdef CL_VERSION_1_1
>   CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE,
>   CL_KERNEL_PRIVATE_MEM_SIZE, // 5
>   #endif //CL_VERSION_1_1
>   #ifdef CL_VERSION_1_2
>   CL_KERNEL_GLOBAL_WORK_SIZE,
>   #endif //CL_VERSION_1_2
>   };
>   PIGLIT_CL_DEFINE_ENUM_PTR_2(cl_kernel_work_group_info);
> 
> You can see the CL_KERNEL_GLOBAL_WORK_SIZE is the last element of that array 
> when
> CL_VERSION_1_2 is defined.
> 
>

OK, thanks for the explain.  The other question I had about the patch
is: Won't it break the test for devices without builtin kernels?


-Tom
> Thanks,
> Zhigang Gong.
> 
> > 
> > -Tom
> > 
> > > 
> > > 
> > > Luo Xionghu
> > > Best Regards
> > > 
> > > -Original Message-
> > > From: Tom Stellard [mailto:t...@stellard.net] 
> > > Sent: Friday, September 19, 2014 10:14 PM
> > > To: Luo, Xionghu
> > > Cc: piglit@lists.freedesktop.org
> > > Subject: Re: [Piglit] [PATCH] fix CL_KERNEL_GLOBAL_WORK_SIZE bug.
> > > 
> > > On Wed, Sep 17, 2014 at 06:05:12AM +0800, xionghu@intel.com wrote:
> > > > From: Luo 
> > > > 
> > > > the option  CL_KERNEL_GLOBAL_WORK_SIZE for clGetKernelWorkGroupInfo 
> > > > should call built in kernel or custom device according to the spec, 
> > > > this patch calls the built in kernel to query the GLOBAL_WOR_SIZ.
> > > > 
> > > 
> > > This commit message doesn't seem to match the contents of the patch.
> > > 
> > > > Signed-off-by: Luo 
> > > > ---
> > > >  tests/cl/api/get-kernel-work-group-info.c |   40 
> > > > ++---
> > > >  1 file changed, 37 insertions(+), 3 deletions(-)
> > > > 
> > > > diff --git a/tests/cl/api/get-kernel-work-group-info.c 
> > > > b/tests/cl/api/get-kernel-work-group-info.c
> > > > index 47d09da..2b2c7ba 100644
> > > > --- a/tests/cl/api/get-kernel-work-group-info.c
> > > > +++ b/tests/cl/api/get-kernel-work-group-info.c
> > > > @@ -60,6 +60,7 @@ piglit_cl_test(const int argc,
> > > >  
> > > > int i;
> > > > cl_int errNo;
> > > > +   cl_program built_in_prog;
> > > > cl_kernel kernel;
> > > >  
> > > > size_t param_value_size;
> > > > @@ -70,15 +71,47 @@ piglit_cl_test(const int argc,
> > > > const cl_kernel_work_group_info* kernel_work_group_infos =
> > > > PIGLIT_CL_ENUM_ARRAY(cl_kernel_work_group_info);
> > > >  
> > > > -   kernel = clCreateKernel(env->program,
>

Re: [Piglit] [PATCH] fix CL_KERNEL_GLOBAL_WORK_SIZE bug.

2014-09-24 Thread Tom Stellard
On Wed, Sep 24, 2014 at 01:13:18AM +, Luo, Xionghu wrote:
> Hi Tom,
> According to the opencl-1.2 spec in page 165, the option 
> CL_KERNEL_GLOBAL_WORK_SIZE for clGetKernelWorkGroupInfo should call built in 
> kernel or custom device.
> 
> "This provides a mechanism for the
> application to query the maximum global
> size that can be used to execute a kernel
> (i.e. global_work_size argument to
> clEnqueueNDRangeKernel) on a custom
> device given by device or a built-in kernel
> on an OpenCL device given by device.
> If device is not a custom device or kernel
> is not a built-in kernel,
> clGetKernelArgInfo returns the error
> CL_INVALID_VALUE."
> 
> And this case called dummy kernel instead of built in kernel, so the return 
> value is not as expected, my patch could call built in kernel to test the 
> correct return value of option CL_KERNEL_GLOBAL_WORK_SIZE.
> 

I'm still confused by this patch, because the CL_KERNEL_GLOBAL_WORK_SIZE enum
value does not appear anywhere in this patch or in the file being patched.

-Tom

> 
> 
> Luo Xionghu
> Best Regards
> 
> -Original Message-
> From: Tom Stellard [mailto:t...@stellard.net] 
> Sent: Friday, September 19, 2014 10:14 PM
> To: Luo, Xionghu
> Cc: piglit@lists.freedesktop.org
> Subject: Re: [Piglit] [PATCH] fix CL_KERNEL_GLOBAL_WORK_SIZE bug.
> 
> On Wed, Sep 17, 2014 at 06:05:12AM +0800, xionghu@intel.com wrote:
> > From: Luo 
> > 
> > the option  CL_KERNEL_GLOBAL_WORK_SIZE for clGetKernelWorkGroupInfo 
> > should call built in kernel or custom device according to the spec, 
> > this patch calls the built in kernel to query the GLOBAL_WOR_SIZ.
> > 
> 
> This commit message doesn't seem to match the contents of the patch.
> 
> > Signed-off-by: Luo 
> > ---
> >  tests/cl/api/get-kernel-work-group-info.c |   40 
> > ++---
> >  1 file changed, 37 insertions(+), 3 deletions(-)
> > 
> > diff --git a/tests/cl/api/get-kernel-work-group-info.c 
> > b/tests/cl/api/get-kernel-work-group-info.c
> > index 47d09da..2b2c7ba 100644
> > --- a/tests/cl/api/get-kernel-work-group-info.c
> > +++ b/tests/cl/api/get-kernel-work-group-info.c
> > @@ -60,6 +60,7 @@ piglit_cl_test(const int argc,
> >  
> > int i;
> > cl_int errNo;
> > +   cl_program built_in_prog;
> > cl_kernel kernel;
> >  
> > size_t param_value_size;
> > @@ -70,15 +71,47 @@ piglit_cl_test(const int argc,
> > const cl_kernel_work_group_info* kernel_work_group_infos =
> > PIGLIT_CL_ENUM_ARRAY(cl_kernel_work_group_info);
> >  
> > -   kernel = clCreateKernel(env->program,
> > -   "dummy_kernel",
> > -   &errNo);
> > +   char* built_in_kernel_names;
> > +   char* kernel_name;
> > +   size_t built_in_kernels_size;
> > +   size_t ret_sz;
> > +
> > +   errNo = clGetDeviceInfo(env->device_id, CL_DEVICE_BUILT_IN_KERNELS, 0, 
> > 0, &built_in_kernels_size);
> > +   if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
> > +   fprintf(stderr,
> > +   "Failed (error code: %s): Get Device Info.\n",
> > +   piglit_cl_get_error_name(errNo));
> > +   return PIGLIT_FAIL;
> > +   }
> > +
> > +   built_in_kernel_names = (char* )malloc(built_in_kernels_size * 
> > +sizeof(char) );
> > +
> > +   errNo = clGetDeviceInfo(env->device_id, CL_DEVICE_BUILT_IN_KERNELS, 
> > built_in_kernels_size, (void*)built_in_kernel_names, &ret_sz);
> > +   if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
> > +   fprintf(stderr,
> > +   "Failed (error code: %s): Get Device Info.\n",
> > +   piglit_cl_get_error_name(errNo));
> > +   return PIGLIT_FAIL;
> > +   }
> > +
> > +   built_in_prog = 
> > +clCreateProgramWithBuiltInKernels(env->context->cl_ctx, 1, 
> > +&env->device_id, built_in_kernel_names, &errNo);
> 
> Won't this call fail if there are no builtin kernels?
> 
> -Tom
> 
> > +   if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
> > +   fprintf(stderr,
> > +   "Failed (error code: %s): Create BuiltIn Program.\n",
> > +   piglit_cl_get_error_name(errNo));
> > +   return PIGLIT_FAIL;
> > +   }
> > +
> > +   kernel_name = strtok(built_in_kernel_names, ";");
> > +
> > +   kernel = clCreateKernel(built_in_prog, kernel_name,  &errNo);
> &

Re: [Piglit] [PATCH v2 5/5] cl: i32-stack-array: Rename to avoid subtest conflicts

2014-09-22 Thread Tom Stellard
On Fri, Sep 19, 2014 at 07:30:41PM -0400, Jan Vesely wrote:
> Signed-off-by: Jan Vesely 

For the whole series:

Reviewed-by: Tom Stellard 

Do you need me to commit these?

> ---
>  tests/cl/program/execute/i32-stack-array.cl | 20 ++--
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/tests/cl/program/execute/i32-stack-array.cl 
> b/tests/cl/program/execute/i32-stack-array.cl
> index 534ee13..1269663 100644
> --- a/tests/cl/program/execute/i32-stack-array.cl
> +++ b/tests/cl/program/execute/i32-stack-array.cl
> @@ -1,6 +1,6 @@
>  /*!
>  [config]
> -name: i32 stack array read
> +name: i32 stack array
>  clc_version_min: 10
>  
>  dimensions: 1
> @@ -15,25 +15,25 @@ global_size: 1 0 0
>  
>  [test]
>  kernel_name: stack_array_read
> -name: i32 stack array read
> +name: i32 stack array read up
>  arg_out: 0 buffer int[5] 4 5 6 7 8
>  arg_in:  1 buffer int[5] 0 1 2 3 4
>  
>  [test]
>  kernel_name: stack_array_read
> -name: i32 stack array read
> +name: i32 stack array read const
>  arg_out: 0 buffer int[5] 5 5 5 5 5
>  arg_in:  1 buffer int[5] 1 1 1 1 1
>  
>  [test]
>  kernel_name: stack_array_read
> -name: i32 stack array read
> +name: i32 stack array read down
>  arg_out: 0 buffer int[5] 8 7 5 6 4
>  arg_in:  1 buffer int[5] 4 3 1 2 0
>  
>  [test]
>  kernel_name: stack_array_read
> -name: i32 stack array read
> +name: i32 stack array read rand
>  arg_out: 0 buffer int[5] 7 5 8 4 6
>  arg_in:  1 buffer int[5] 3 1 4 0 2
>  
> @@ -72,21 +72,21 @@ arg_in:  1 buffer int[1] 1
>  
> ##===--===##
>  [test]
>  kernel_name: stack_array_write_if_else_indirect_read
> -name: i32 stack array direct write (IF and ELSE) indirect read
> +name: i32 stack array direct write (IF and ELSE) indirect read up
>  arg_out: 0 buffer int[5] 4 5 6 7 8
>  arg_in:  1 buffer int[6] 1 \
>   0 1 2 3 4
>  
>  [test]
>  kernel_name: stack_array_write_if_else_indirect_read
> -name: i32 stack array direct write (IF and ELSE) indirect read
> +name: i32 stack array direct write (IF and ELSE) indirect read const
>  arg_out: 0 buffer int[5] 0 0 0 0 0
>  arg_in:  1 buffer int[6] 0 \
>   0 1 2 3 4
>  
>  [test]
>  kernel_name: stack_array_write_if_else_indirect_read
> -name: i32 stack array direct write (IF and ELSE) indirect read
> +name: i32 stack array direct write (IF and ELSE) indirect read down
>  arg_out: 0 buffer int[5] 8 7 6 5 4
>  arg_in:  1 buffer int[6] 1 \
>   4 3 2 1 0
> @@ -106,14 +106,14 @@ arg_in:  1 buffer int[6] 1 \
>  
> ##===--===##
>  [test]
>  kernel_name: stack_array_indirect_write_if_else_indirect_read
> -name: i32 stack array indirect write (IF and ELSE) indirect read
> +name: i32 stack array indirect write (IF and ELSE) indirect read up
>  arg_out: 0 buffer int[5] 4 5 6 7 8
>  arg_in:  1 buffer int[11] 1 \
>0 1 2 3 4 \
>0 1 2 3 4
>  [test]
>  kernel_name: stack_array_indirect_write_if_else_indirect_read
> -name: i32 stack array indirect write (IF and ELSE) indirect read
> +name: i32 stack array indirect write (IF and ELSE) indirect read up-down
>  arg_out: 0 buffer int[5] 8 7 6 5 4
>  arg_in:  1 buffer int[11] 1 \
>0 1 2 3 4 \
> -- 
> 1.9.3
> 
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] oclconform: Join the bindir and executable name when running single tests

2014-09-22 Thread Tom Stellard
This fixes running oclconform tests that don't have subtests.
---
 framework/oclconform.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/framework/oclconform.py b/framework/oclconform.py
index 91a9e43..01e10d9 100644
--- a/framework/oclconform.py
+++ b/framework/oclconform.py
@@ -87,6 +87,6 @@ def add_oclconform_tests(profile):
run_concurrent=should_run_concurrent))
 else:
 run_test = PIGLIT_CONFIG.get(test_section_name, 'run_test')
-add_test(profile, test_name, OCLConform(command=run_test,
+add_test(profile, test_name, OCLConform(command=join(bindir, 
run_test),

run_concurrent=should_run_concurrent))
 
-- 
1.8.5.5

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] cl: Add tests for global atomc_add()

2014-09-19 Thread Tom Stellard
---
 .../builtin/atomic/atomic_add-global.program_test  | 46 ++
 .../execute/builtin/atomic/atomic_add-local.cl | 70 --
 .../builtin/atomic/atomic_add-local.program_test   | 46 ++
 .../program/execute/builtin/atomic/atomic_add.inc  | 23 +++
 4 files changed, 115 insertions(+), 70 deletions(-)
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_add-global.program_test
 delete mode 100644 tests/cl/program/execute/builtin/atomic/atomic_add-local.cl
 create mode 100644 
tests/cl/program/execute/builtin/atomic/atomic_add-local.program_test
 create mode 100644 tests/cl/program/execute/builtin/atomic/atomic_add.inc

diff --git 
a/tests/cl/program/execute/builtin/atomic/atomic_add-global.program_test 
b/tests/cl/program/execute/builtin/atomic/atomic_add-global.program_test
new file mode 100644
index 000..26c6752
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_add-global.program_test
@@ -0,0 +1,46 @@
+[config]
+name: Scalar Data Type Load (int)
+
+program_source_file: atomic_add.inc
+build_options: -D ATOMIC_ADDRSPACE=global
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -4 1
+arg_in:  1 buffer int[1] 0
+arg_in:  2 int   -4
+arg_in:  3 int   5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 4 9
+arg_in:  1 buffer uint[1] 0
+arg_in:  2 uint   4
+arg_in:  3 uint   5
+
+[test]
+name: threads
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 28
+arg_in:  1 buffer int[1] 0
+
+[test]
+name: threads
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 28
+arg_in:  1 buffer uint[1] 0
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_add-local.cl 
b/tests/cl/program/execute/builtin/atomic/atomic_add-local.cl
deleted file mode 100644
index c155fbb..000
--- a/tests/cl/program/execute/builtin/atomic/atomic_add-local.cl
+++ /dev/null
@@ -1,70 +0,0 @@
-/*!
-[config]
-name: atomic_add local
-clc_version_min: 11
-
-[test]
-name: simple int
-kernel_name: simple_int
-dimensions: 1
-global_size: 1 0 0
-local_size:  1 0 0
-arg_out: 0 buffer int[2] -4 1
-arg_in:  1 buffer int[1] NULL
-arg_in:  2 int   -4
-arg_in:  3 int   5
-
-[test]
-name: simple uint
-kernel_name: simple_uint
-dimensions: 1
-global_size: 1 0 0
-local_size:  1 0 0
-arg_out: 0 buffer uint[2] 4 9
-arg_in:  1 buffer uint[1] NULL
-arg_in:  2 uint   4
-arg_in:  3 uint   5
-
-[test]
-name: threads
-kernel_name: threads_int
-dimensions: 1
-global_size: 8 0 0
-local_size:  8 0 0
-arg_out: 0 buffer int[1] 28
-arg_in:  1 buffer int[1] NULL
-
-[test]
-name: threads
-kernel_name: threads_uint
-dimensions: 1
-global_size: 8 0 0
-local_size:  8 0 0
-arg_out: 0 buffer uint[1] 28
-arg_in:  1 buffer uint[1] NULL
-
-!*/
-
-#define SIMPLE_TEST(TYPE) \
-kernel void simple_##TYPE(global TYPE *out, local TYPE *mem, TYPE initial, 
TYPE value) { \
-   *mem = initial; \
-   TYPE a = atomic_add(mem, value); \
-   out[0] = a; \
-   out[1] = *mem; \
-}
-
-#define THREADS_TEST(TYPE) \
-kernel void threads_##TYPE(global TYPE *out, local TYPE *mem) { \
-   *mem = 0; \
-   barrier(CLK_LOCAL_MEM_FENCE); \
-   TYPE id = get_local_id(0); \
-   atomic_add(mem, id); \
-   barrier(CLK_LOCAL_MEM_FENCE); \
-   *out = *mem; \
-}
-
-SIMPLE_TEST(int)
-SIMPLE_TEST(uint)
-
-THREADS_TEST(int)
-THREADS_TEST(uint)
diff --git 
a/tests/cl/program/execute/builtin/atomic/atomic_add-local.program_test 
b/tests/cl/program/execute/builtin/atomic/atomic_add-local.program_test
new file mode 100644
index 000..75479d1
--- /dev/null
+++ b/tests/cl/program/execute/builtin/atomic/atomic_add-local.program_test
@@ -0,0 +1,46 @@
+[config]
+name: Scalar Data Type Load (int)
+
+program_source_file: atomic_add.inc
+build_options: -D ATOMIC_ADDRSPACE=local
+clc_version_min: 11
+
+[test]
+name: simple int
+kernel_name: simple_int
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer int[2] -4 1
+arg_in:  1 buffer int[1] NULL
+arg_in:  2 int   -4
+arg_in:  3 int   5
+
+[test]
+name: simple uint
+kernel_name: simple_uint
+dimensions: 1
+global_size: 1 0 0
+local_size:  1 0 0
+arg_out: 0 buffer uint[2] 4 9
+arg_in:  1 buffer uint[1] NULL
+arg_in:  2 uint   4
+arg_in:  3 uint   5
+
+[test]
+name: threads
+kernel_name: threads_int
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer int[1] 28
+arg_in:  1 buffer int[1] NULL
+
+[test]
+name: threads
+kernel_name: threads_uint
+dimensions: 1
+global_size: 8 0 0
+local_size:  8 0 0
+arg_out: 0 buffer uint[1] 28
+arg_in:  1 buffer uint[1] NULL
diff --git a/tests/cl/program/execute/builtin/atomic/atomic_add.inc 

Re: [Piglit] [PATCH] fix CL_KERNEL_GLOBAL_WORK_SIZE bug.

2014-09-19 Thread Tom Stellard
On Wed, Sep 17, 2014 at 06:05:12AM +0800, xionghu@intel.com wrote:
> From: Luo 
> 
> the option  CL_KERNEL_GLOBAL_WORK_SIZE for clGetKernelWorkGroupInfo
> should call built in kernel or custom device according to the spec,
> this patch calls the built in kernel to query the GLOBAL_WOR_SIZ.
> 

This commit message doesn't seem to match the contents of the patch.

> Signed-off-by: Luo 
> ---
>  tests/cl/api/get-kernel-work-group-info.c |   40 
> ++---
>  1 file changed, 37 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/cl/api/get-kernel-work-group-info.c 
> b/tests/cl/api/get-kernel-work-group-info.c
> index 47d09da..2b2c7ba 100644
> --- a/tests/cl/api/get-kernel-work-group-info.c
> +++ b/tests/cl/api/get-kernel-work-group-info.c
> @@ -60,6 +60,7 @@ piglit_cl_test(const int argc,
>  
>   int i;
>   cl_int errNo;
> + cl_program built_in_prog;
>   cl_kernel kernel;
>  
>   size_t param_value_size;
> @@ -70,15 +71,47 @@ piglit_cl_test(const int argc,
>   const cl_kernel_work_group_info* kernel_work_group_infos =
>   PIGLIT_CL_ENUM_ARRAY(cl_kernel_work_group_info);
>  
> - kernel = clCreateKernel(env->program,
> - "dummy_kernel",
> - &errNo);
> + char* built_in_kernel_names;
> + char* kernel_name;
> + size_t built_in_kernels_size;
> + size_t ret_sz;
> +
> + errNo = clGetDeviceInfo(env->device_id, CL_DEVICE_BUILT_IN_KERNELS, 0, 
> 0, &built_in_kernels_size);
> + if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
> + fprintf(stderr,
> + "Failed (error code: %s): Get Device Info.\n",
> + piglit_cl_get_error_name(errNo));
> + return PIGLIT_FAIL;
> + }
> +
> + built_in_kernel_names = (char* )malloc(built_in_kernels_size * 
> sizeof(char) );
> +
> + errNo = clGetDeviceInfo(env->device_id, CL_DEVICE_BUILT_IN_KERNELS, 
> built_in_kernels_size, (void*)built_in_kernel_names, &ret_sz);
> + if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
> + fprintf(stderr,
> + "Failed (error code: %s): Get Device Info.\n",
> + piglit_cl_get_error_name(errNo));
> + return PIGLIT_FAIL;
> + }
> +
> + built_in_prog = clCreateProgramWithBuiltInKernels(env->context->cl_ctx, 
> 1, &env->device_id, built_in_kernel_names, &errNo);

Won't this call fail if there are no builtin kernels?

-Tom

> + if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
> + fprintf(stderr,
> + "Failed (error code: %s): Create BuiltIn Program.\n",
> + piglit_cl_get_error_name(errNo));
> + return PIGLIT_FAIL;
> + }
> +
> + kernel_name = strtok(built_in_kernel_names, ";");
> +
> + kernel = clCreateKernel(built_in_prog, kernel_name,  &errNo);
>   if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
>   fprintf(stderr,
>   "Failed (error code: %s): Create kernel.\n",
>   piglit_cl_get_error_name(errNo));
>   return PIGLIT_FAIL;
>   }
> + free(built_in_kernel_names);
>  
>   /*** Normal usage ***/
>   for(i = 0; i < num_kernel_work_group_infos; i++) {
> @@ -188,6 +221,7 @@ piglit_cl_test(const int argc,
>   }
>  
>   clReleaseKernel(kernel);
> + clReleaseProgram(built_in_prog);
>  
>   return result;
>  }
> -- 
> 1.7.9.5
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 4/5] cl: Run vXi32-stack subtest in parallel

2014-09-19 Thread Tom Stellard
On Wed, Sep 17, 2014 at 05:40:38PM -0400, Jan Vesely wrote:
> On Wed, 2014-09-17 at 07:47 -0700, Tom Stellard wrote:
> > On Wed, Sep 03, 2014 at 08:51:39PM -0400, Jan Vesely wrote:
> > > Avoid duplicate subtest names
> > > 
> > 
> > For patches 4 and 5, I would rather just rename the tests than merge them
> > together.  This keeps the tests simple and easy to debug if they fail.
> 
> I did that for consistency with the changes to generated tests, as
> combining the same named tests seemed to be the preferred option based
> on the replies to [0].
> the problem is more pronounced in generated tests with sometimes as many
> as 12 subtests using the same name.
> 

You can leave the generated tests as is, but I would prefer that we just
change the names for the stack tests.

-Tom

> should I change the fix for generated tests as well (and use indexing),
> or are you ok with these two tests (patch 4 and 5) being inconsistent in
> this regard?
> 
> [0] http://lists.freedesktop.org/archives/piglit/2014-August/012386.html
> 
> > 
> > You should apply for commit access, so you can start committing some
> > of these on your own.
> 
> I have filed a bug for this
> 
> jan
> 
> > 
> > -Tom
> > 
> > > Signed-off-by: Jan Vesely 
> > > ---
> > >  tests/cl/program/execute/v2i32-stack.cl | 17 ++---
> > >  tests/cl/program/execute/v3i32-stack.cl | 15 ++-
> > >  tests/cl/program/execute/v4i32-stack.cl | 15 ++-
> > >  3 files changed, 18 insertions(+), 29 deletions(-)
> > > 
> > > diff --git a/tests/cl/program/execute/v2i32-stack.cl 
> > > b/tests/cl/program/execute/v2i32-stack.cl
> > > index e61e386..536e39c 100644
> > > --- a/tests/cl/program/execute/v2i32-stack.cl
> > > +++ b/tests/cl/program/execute/v2i32-stack.cl
> > > @@ -1,22 +1,17 @@
> > >  /*!
> > >  [config]
> > > +dimensions: 1
> > >  
> > >  [test]
> > >  kernel_name: direct_write_indirect_read
> > >  name: direct write - indirect read
> > > -arg_out: 0 buffer int2[1] 0 1
> > > -arg_in:  1 int 0
> > > -
> > > -[test]
> > > -kernel_name: direct_write_indirect_read
> > > -name: direct write - indirect read
> > > -arg_out: 0 buffer int2[1] 2 3
> > > -arg_in:  1 int 1
> > > -
> > > +arg_out: 0 buffer int2[2] 0 1 2 3
> > > +global_size: 2 0 0
> > >  !*/
> > >  
> > > -kernel void direct_write_indirect_read(global int2 *out, int index) {
> > > +kernel void direct_write_indirect_read(global int2 *out) {
> > >  
> > > + int index = get_global_id(0);
> > >   int2 stack[2];
> > >   stack[0].s0 = 0;
> > >   stack[0].s1 = 1;
> > > @@ -24,5 +19,5 @@ kernel void direct_write_indirect_read(global int2 
> > > *out, int index) {
> > >   stack[1].s0 = 2;
> > >   stack[1].s1 = 3;
> > >  
> > > - out[0] = stack[index];
> > > + out[index] = stack[index];
> > >  }
> > > diff --git a/tests/cl/program/execute/v3i32-stack.cl 
> > > b/tests/cl/program/execute/v3i32-stack.cl
> > > index 7c88979..8b7b13c 100644
> > > --- a/tests/cl/program/execute/v3i32-stack.cl
> > > +++ b/tests/cl/program/execute/v3i32-stack.cl
> > > @@ -1,21 +1,18 @@
> > >  /*!
> > >  [config]
> > > +dimensions: 1
> > >  
> > >  [test]
> > >  kernel_name: direct_write_indirect_read
> > >  name: direct write - indirect read
> > > -arg_out: 0 buffer int3[1] 0 1 2
> > > -arg_in:  1 int 0
> > > +arg_out: 0 buffer int3[2] 0 1 2 3 4 5
> > > +global_size: 2 0 0
> > >  
> > > -[test]
> > > -kernel_name: direct_write_indirect_read
> > > -name: direct write - indirect read
> > > -arg_out: 0 buffer int3[1] 3 4 5
> > > -arg_in:  1 int 1
> > >  !*/
> > >  
> > > -kernel void direct_write_indirect_read(global int3 *out, int index) {
> > > +kernel void direct_write_indirect_read(global int3 *out) {
> > >  
> > > + int index = get_global_id(0);
> > >   int3 stack[2];
> > >   stack[0].s0 = 0;
> > >   stack[0].s1 = 1;
> > > @@ -25,5 +22,5 @@ kernel void direct_write_indirect_read(global int3 
> > > *out, int index) {
> > >   stack[1].s1 = 4;
> > >   stack[1].s2 = 5;
> > >  
> > > - out[0] = stack[index];
> > > + out[index] = stack[index];
> > >  }
> > > diff --git a/tests/cl/program/exe

Re: [Piglit] [PATCH 4/5] cl: Run vXi32-stack subtest in parallel

2014-09-17 Thread Tom Stellard
On Wed, Sep 03, 2014 at 08:51:39PM -0400, Jan Vesely wrote:
> Avoid duplicate subtest names
> 

For patches 4 and 5, I would rather just rename the tests than merge them
together.  This keeps the tests simple and easy to debug if they fail.

You should apply for commit access, so you can start committing some
of these on your own.

-Tom

> Signed-off-by: Jan Vesely 
> ---
>  tests/cl/program/execute/v2i32-stack.cl | 17 ++---
>  tests/cl/program/execute/v3i32-stack.cl | 15 ++-
>  tests/cl/program/execute/v4i32-stack.cl | 15 ++-
>  3 files changed, 18 insertions(+), 29 deletions(-)
> 
> diff --git a/tests/cl/program/execute/v2i32-stack.cl 
> b/tests/cl/program/execute/v2i32-stack.cl
> index e61e386..536e39c 100644
> --- a/tests/cl/program/execute/v2i32-stack.cl
> +++ b/tests/cl/program/execute/v2i32-stack.cl
> @@ -1,22 +1,17 @@
>  /*!
>  [config]
> +dimensions: 1
>  
>  [test]
>  kernel_name: direct_write_indirect_read
>  name: direct write - indirect read
> -arg_out: 0 buffer int2[1] 0 1
> -arg_in:  1 int 0
> -
> -[test]
> -kernel_name: direct_write_indirect_read
> -name: direct write - indirect read
> -arg_out: 0 buffer int2[1] 2 3
> -arg_in:  1 int 1
> -
> +arg_out: 0 buffer int2[2] 0 1 2 3
> +global_size: 2 0 0
>  !*/
>  
> -kernel void direct_write_indirect_read(global int2 *out, int index) {
> +kernel void direct_write_indirect_read(global int2 *out) {
>  
> + int index = get_global_id(0);
>   int2 stack[2];
>   stack[0].s0 = 0;
>   stack[0].s1 = 1;
> @@ -24,5 +19,5 @@ kernel void direct_write_indirect_read(global int2 *out, 
> int index) {
>   stack[1].s0 = 2;
>   stack[1].s1 = 3;
>  
> - out[0] = stack[index];
> + out[index] = stack[index];
>  }
> diff --git a/tests/cl/program/execute/v3i32-stack.cl 
> b/tests/cl/program/execute/v3i32-stack.cl
> index 7c88979..8b7b13c 100644
> --- a/tests/cl/program/execute/v3i32-stack.cl
> +++ b/tests/cl/program/execute/v3i32-stack.cl
> @@ -1,21 +1,18 @@
>  /*!
>  [config]
> +dimensions: 1
>  
>  [test]
>  kernel_name: direct_write_indirect_read
>  name: direct write - indirect read
> -arg_out: 0 buffer int3[1] 0 1 2
> -arg_in:  1 int 0
> +arg_out: 0 buffer int3[2] 0 1 2 3 4 5
> +global_size: 2 0 0
>  
> -[test]
> -kernel_name: direct_write_indirect_read
> -name: direct write - indirect read
> -arg_out: 0 buffer int3[1] 3 4 5
> -arg_in:  1 int 1
>  !*/
>  
> -kernel void direct_write_indirect_read(global int3 *out, int index) {
> +kernel void direct_write_indirect_read(global int3 *out) {
>  
> + int index = get_global_id(0);
>   int3 stack[2];
>   stack[0].s0 = 0;
>   stack[0].s1 = 1;
> @@ -25,5 +22,5 @@ kernel void direct_write_indirect_read(global int3 *out, 
> int index) {
>   stack[1].s1 = 4;
>   stack[1].s2 = 5;
>  
> - out[0] = stack[index];
> + out[index] = stack[index];
>  }
> diff --git a/tests/cl/program/execute/v4i32-stack.cl 
> b/tests/cl/program/execute/v4i32-stack.cl
> index 751a370..79a1584 100644
> --- a/tests/cl/program/execute/v4i32-stack.cl
> +++ b/tests/cl/program/execute/v4i32-stack.cl
> @@ -1,21 +1,18 @@
>  /*!
>  [config]
> +dimensions: 1
>  
>  [test]
>  kernel_name: direct_write_indirect_read
>  name: direct write - indirect read
> -arg_out: 0 buffer int4[1] 0 1 2 3
> -arg_in:  1 int 0
> +arg_out: 0 buffer int4[2] 0 1 2 3 4 5 6 7
> +global_size: 2 0 0
>  
> -[test]
> -kernel_name: direct_write_indirect_read
> -name: direct write - indirect read
> -arg_out: 0 buffer int4[1] 4 5 6 7
> -arg_in:  1 int 1
>  !*/
>  
> -kernel void direct_write_indirect_read(global int4 *out, int index) {
> +kernel void direct_write_indirect_read(global int4 *out) {
>  
> + int index = get_global_id(0);
>   int4 stack[2];
>   stack[0].s0 = 0;
>   stack[0].s1 = 1;
> @@ -27,5 +24,5 @@ kernel void direct_write_indirect_read(global int4 *out, 
> int index) {
>   stack[1].s2 = 6;
>   stack[1].s3 = 7;
>  
> - out[0] = stack[index];
> + out[index] = stack[index];
>  }
> -- 
> 1.9.3
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/3] quick_cl: Add oclconform tests

2014-09-09 Thread Tom Stellard
---
 tests/quick_cl.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/quick_cl.py b/tests/quick_cl.py
index 17729b2..ea48a7a 100644
--- a/tests/quick_cl.py
+++ b/tests/quick_cl.py
@@ -25,6 +25,8 @@
 #
 
 from tests.cl import profile
+from framework.oclconform import add_oclconform_tests
 from framework.opencv import add_opencv_tests
 
 add_opencv_tests(profile)
+add_oclconform_tests(profile)
-- 
1.8.5.5

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/3] opencv: Add 'individual' option to piglit.conf

2014-09-09 Thread Tom Stellard
This replaces the individual parameter in add_opencv_tests()
---
 framework/opencv.py |  3 ++-
 piglit.conf.example | 10 ++
 tests/all_cl.py |  2 +-
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/framework/opencv.py b/framework/opencv.py
index cefc94c..a5201c9 100644
--- a/framework/opencv.py
+++ b/framework/opencv.py
@@ -38,12 +38,13 @@ class OpenCVTest(GTest):
 GTest.__init__(self, options)
 
 
-def add_opencv_tests(profile, individual = False):
+def add_opencv_tests(profile):
 if not PIGLIT_CONFIG.has_option('opencv', 'opencv_test_ocl_bindir'):
 return
 
 opencv_test_ocl = path.join(PIGLIT_CONFIG.get('opencv',
 'opencv_test_ocl_bindir'), 'opencv_test_ocl')
+individual = PIGLIT_CONFIG.has_option('opencv', 'individual')
 if not path.isfile(opencv_test_ocl):
 print('Warning: {} does not exist.\nSkipping OpenCV '
   'tests...'.format(opencv_test_ocl))
diff --git a/piglit.conf.example b/piglit.conf.example
index e7a2101..9cb7dd1 100644
--- a/piglit.conf.example
+++ b/piglit.conf.example
@@ -2,6 +2,16 @@
 ; Set the opencv_test_ocl_bindir variable to run the OpenCV OpenCL tests.
 ;opencv_test_ocl_bindir=/home/user/opencv/build/bin
 ;opencv_workdir=/home/user/opencv/samples/c/
+; Run each subtest individiually to so a result is recored for each subtest.
+; For example, default behavior:
+; opencv/OCL_ML/Kmeans -> Pass
+;
+; With 'individual' option:
+; OCL_ML/Kmeans.Mat/0 -> Pass
+; OCL_ML/Kmeans.Mat/1 -> Pass
+; OCL_ML/Kmeans.Mat/2 -> Pass
+;
+;individual
 ;
 [xts]
 ; Set bindir equal to the root of the xts directory
diff --git a/tests/all_cl.py b/tests/all_cl.py
index 45de569..ea48a7a 100644
--- a/tests/all_cl.py
+++ b/tests/all_cl.py
@@ -28,5 +28,5 @@ from tests.cl import profile
 from framework.oclconform import add_oclconform_tests
 from framework.opencv import add_opencv_tests
 
-add_opencv_tests(profile, True)
+add_opencv_tests(profile)
 add_oclconform_tests(profile)
-- 
1.8.5.5

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 3/3] Remove all_cl profile

2014-09-09 Thread Tom Stellard
The test list that was provided by the all_cl can now be replicated with the
quick_cl profile by adding the 'individual' option to the opencv
section.
---
 tests/all_cl.py | 32 
 1 file changed, 32 deletions(-)
 delete mode 100644 tests/all_cl.py

diff --git a/tests/all_cl.py b/tests/all_cl.py
deleted file mode 100644
index ea48a7a..000
--- a/tests/all_cl.py
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2014 Advanced Micro Devices, Inc.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-#
-# Authors: Tom Stellard 
-#
-
-from tests.cl import profile
-from framework.oclconform import add_oclconform_tests
-from framework.opencv import add_opencv_tests
-
-add_opencv_tests(profile)
-add_oclconform_tests(profile)
-- 
1.8.5.5

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/1] cl: fix adding concurent tests

2014-09-03 Thread Tom Stellard
On Wed, Sep 03, 2014 at 07:20:10PM -0400, Jan Vesely wrote:
> Signed-off-by: Jan Vesely 

Reviewed-by: Tom Stellard 

> ---
> 
> seemed wrong. Wonder if we can use concurrent tests.
> 

If you have render-nodes enabled, then you can run the cl tests
concurrently by adding the -c flag when running piglit.

Render-nodes were enabled by default in the 3.16 kernel, so
I think it may be too early to enable concurrent tests by default.

-Tom

>  tests/cl.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/cl.py b/tests/cl.py
> index fd698fc..b59368d 100644
> --- a/tests/cl.py
> +++ b/tests/cl.py
> @@ -21,7 +21,7 @@ def add_plain_test(group, name, args):
>  def add_concurrent_test(group, name, args):
>  test = PiglitTest(args)
>  test.run_concurrent = true;
> -group[name] = PiglitTest(args)
> +group[name] = test
>  
>  def add_plain_program_tester_test(group, name, path):
>  add_plain_test(group, name, ['cl-program-tester', path])
> -- 
> 1.9.3
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] oclconform: Add test class for ocl conformance tests v2

2014-08-19 Thread Tom Stellard
v2:
  - Code cleanups
---

Hi Dylan,

Here is an updated patch addressing your comments.  However, I was not able
to get the constructor to work using args, kwargs.

class OCLConform(Test):
def __init__(self, *args, **kwargs):
Test.__init__(self, *args, **kwargs)

subtest_command='run_test'

# When I call the constructor this way and then dump the value of command from
# The Test construction, I get:
# ('run_test',)
OCLConform(subtest_command)

# When I call the constructor this way, the value of command is ()
OCLConform(command=subtest_command)

# The expected value of command is 'run_test'

-Tom

 framework/oclconform.py | 92 +
 piglit.conf.example | 34 ++
 2 files changed, 126 insertions(+)
 create mode 100644 framework/oclconform.py

diff --git a/framework/oclconform.py b/framework/oclconform.py
new file mode 100644
index 000..cd8e2a7
--- /dev/null
+++ b/framework/oclconform.py
@@ -0,0 +1,92 @@
+# Copyright 2014 Advanced Micro Devices, Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#
+# Authors: Tom Stellard 
+#
+
+from __future__ import print_function
+
+import re
+import subprocess
+from os import listdir
+from os.path import isfile, join
+from sys import stderr
+
+from framework.core import PIGLIT_CONFIG
+from framework.exectest import Test
+
+def get_test_section_name(test):
+return 'oclconform-{}'.format(test)
+
+class OCLConform(Test):
+def __init__(self, commands, run_concurrent=False):
+Test.__init__(self, commands, run_concurrent)
+
+def interpret_result(self):
+if self.result['returncode'] != 0 or 'FAIL' in self.result['out']:
+self.result['result'] = 'fail'
+else:
+self.result['result'] = 'pass'
+
+def add_sub_test(profile, test_name, subtest_name, subtest):
+profile.tests['oclconform/{}/{}'.format(test_name, subtest_name)] = subtest
+
+def add_test(profile, test_name, test):
+profile.tests['oclconform/{}'.format(test_name)] = test
+
+def add_oclconform_tests(profile):
+section_name = 'oclconform'
+if not PIGLIT_CONFIG.has_section(section_name):
+return
+
+bindir = PIGLIT_CONFIG.get(section_name, 'bindir')
+options = PIGLIT_CONFIG.options(section_name)
+
+tests = (o for o in options if PIGLIT_CONFIG.get(section_name, o) is None)
+
+for test in tests:
+test_section_name = get_test_section_name(test)
+if not PIGLIT_CONFIG.has_section(test_section_name):
+print("Warning: no section defined for {}".format(test), 
file=sys.stderr)
+continue
+
+test_name = PIGLIT_CONFIG.get(test_section_name, 'test_name')
+should_run_concurrent = PIGLIT_CONFIG.has_option(test_section_name, 
'concurrent')
+if PIGLIT_CONFIG.has_option(test_section_name, 'list_subtests'):
+# Test with subtests
+list_tests = PIGLIT_CONFIG.get(test_section_name, 'list_subtests')
+subtest_regex = PIGLIT_CONFIG.get(test_section_name, 
'subtest_regex')
+subtest_regex.encode('string_escape')
+run_subtests = PIGLIT_CONFIG.get(test_section_name, 'run_subtest')
+list_tests =list_tests.split()
+
+subtests = subprocess.check_output(args=list_tests, 
cwd=bindir).split('\n')
+for subtest in subtests:
+m = re.match(subtest_regex, subtest)
+if not m:
+continue
+subtest = m.group(1)
+subtest_command = join(bindir, 
run_subtests.replace('', subtest))
+add_sub_test(profile, test_name, subt

[Piglit] [PATCH 3/3] all_cl: Add ocl conformance tests to test list

2014-08-18 Thread Tom Stellard
---
 tests/all_cl.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/all_cl.py b/tests/all_cl.py
index b62b6c1..45de569 100644
--- a/tests/all_cl.py
+++ b/tests/all_cl.py
@@ -25,6 +25,8 @@
 #
 
 from tests.cl import profile
+from framework.oclconform import add_oclconform_tests
 from framework.opencv import add_opencv_tests
 
 add_opencv_tests(profile, True)
+add_oclconform_tests(profile)
-- 
1.8.1.5

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/3] oclconform: Add test class for ocl conformance tests

2014-08-18 Thread Tom Stellard
---
 framework/oclconform.py | 91 +
 piglit.conf.example | 34 ++
 2 files changed, 125 insertions(+)
 create mode 100644 framework/oclconform.py

diff --git a/framework/oclconform.py b/framework/oclconform.py
new file mode 100644
index 000..a3e44ee
--- /dev/null
+++ b/framework/oclconform.py
@@ -0,0 +1,91 @@
+# Copyright 2014 Advanced Micro Devices, Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#
+# Authors: Tom Stellard 
+#
+
+import re
+import subprocess
+from os import listdir
+from os.path import isfile, join
+
+from framework.core import PIGLIT_CONFIG
+from framework.exectest import Test
+
+def get_test_section_name(test):
+return 'oclconform-{}'.format(test)
+
+class OCLConform(Test):
+def __init__(self, commands, run_concurrent=False):
+Test.__init__(self, commands, run_concurrent)
+
+def interpret_result(self):
+if self.result['returncode'] != 0 or 'FAIL' in self.result['out']:
+self.result['result'] = 'fail'
+else:
+self.result['result'] = 'pass'
+
+def add_sub_test(profile, test_name, subtest_name, subtest):
+profile.tests['oclconform/{}/{}'.format(test_name, subtest_name)] = subtest
+
+def add_test(profile, test_name, test):
+profile.tests['oclconform/{}'.format(test_name)] = test
+
+def add_oclconform_tests(profile):
+section_name = 'oclconform'
+if not PIGLIT_CONFIG.has_section(section_name):
+return
+
+bindir = PIGLIT_CONFIG.get(section_name, 'bindir')
+options = PIGLIT_CONFIG.options(section_name)
+
+tests = []
+for option in options:
+if PIGLIT_CONFIG.get(section_name, option) == None:
+tests.append(option)
+
+for test in tests:
+test_section_name = get_test_section_name(test)
+if not PIGLIT_CONFIG.has_section(test_section_name):
+print "Warning: not section defined for ", test
+continue
+
+test_name = PIGLIT_CONFIG.get(test_section_name, 'test_name')
+should_run_concurrent = PIGLIT_CONFIG.has_option(test_section_name, 
'concurrent')
+if PIGLIT_CONFIG.has_option(test_section_name, 'list_subtests'):
+# Test with subtests
+list_tests = PIGLIT_CONFIG.get(test_section_name, 'list_subtests')
+subtest_regex = PIGLIT_CONFIG.get(test_section_name, 
'subtest_regex')
+run_subtests = PIGLIT_CONFIG.get(test_section_name, 'run_subtest')
+list_tests =list_tests.split()
+
+subtests = subprocess.check_output(args=list_tests, 
cwd=bindir).split('\n')
+for subtest in subtests:
+m = re.match(r'{}'.format(subtest_regex), subtest)
+if not m:
+continue
+subtest = m.group(1)
+subtest_command = join(bindir, 
run_subtests.replace('', subtest))
+add_sub_test(profile, test_name, subtest, 
OCLConform(subtest_command, should_run_concurrent))
+else:
+run_test = PIGLIT_CONFIG.get(test_section_name, 'run_test')
+add_test(profile, test_name, OCLConform(run_test, 
should_run_concurrent))
+
diff --git a/piglit.conf.example b/piglit.conf.example
index 61a28cf..bdf27aa 100644
--- a/piglit.conf.example
+++ b/piglit.conf.example
@@ -14,3 +14,37 @@
 [oglconform]
 ; Set bindir equal to the absolute root of the oglconform directory
 ;path=/home/usr/src/oglconform
+
+[oclconform]
+; bindir is the directory that the commands to run tests and list subtests
+; will be executed in.
+bindir=/home/usr/oclconform
+; List the tests you want to run
+testA
+testB
+
+; Section 

[Piglit] [PATCH 1/3] core: Initialize ConfigParser with allow_no_value=True

2014-08-18 Thread Tom Stellard
---
 framework/core.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/framework/core.py b/framework/core.py
index d3922a9..950ed7e 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -37,7 +37,7 @@ __all__ = ['PIGLIT_CONFIG',
'parse_listfile']
 
 
-PIGLIT_CONFIG = ConfigParser.SafeConfigParser()
+PIGLIT_CONFIG = ConfigParser.SafeConfigParser(allow_no_value=True)
 
 def get_config(arg=None):
 if arg:
-- 
1.8.1.5

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v2 1/1] cl: Extend float to long conversion test

2014-07-25 Thread Tom Stellard
On Fri, Jul 25, 2014 at 09:49:08AM -0400, Jan Vesely wrote:
> On Tue, 2014-07-15 at 10:22 -0400, Tom Stellard wrote:
> > On Tue, Jul 15, 2014 at 09:03:18AM -0400, Jan Vesely wrote:
> > > a light poke
> > > 
> > > Tom, Matt,
> > > sorry I forgot to CC you, this piglit tests the conversions submitted
> > > last week.
> > > 
> > 
> > Reviewed-by: Tom Stellard 
> 
> Thank you. Can you push it as well? I don't have commit access
> 

I just pushed this, thanks!

-Tom

> jan
> 
> > 
> > > thank you,
> > > Jan
> > > 
> > > On Tue, 2014-06-24 at 15:15 -0400, Jan Vesely wrote:
> > > > Fill in subtest name
> > > > v2: Add 2^63 as a test value
> > > > 
> > > > Signed-off-by: Jan Vesely 
> > > > ---
> > > >  .../execute/builtin/convert/float-convert_long.cl  | 28 
> > > > --
> > > >  1 file changed, 26 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git 
> > > > a/tests/cl/program/execute/builtin/convert/float-convert_long.cl 
> > > > b/tests/cl/program/execute/builtin/convert/float-convert_long.cl
> > > > index 3d6930a..c8baa38 100644
> > > > --- a/tests/cl/program/execute/builtin/convert/float-convert_long.cl
> > > > +++ b/tests/cl/program/execute/builtin/convert/float-convert_long.cl
> > > > @@ -4,9 +4,10 @@ name: convert_long(float)
> > > >  dimensions: 1
> > > >  global_size: 1 1 1
> > > >  local_size: 1 1 1
> > > > -kernel_name: test
> > > >  
> > > >  [test]
> > > > +name: convert_long(float)
> > > > +kernel_name: test_long
> > > >  arg_out: 0 buffer long[8] 0 36864 -47104 41943040 -35651584 131 
> > > > 50 -60
> > > >  # These values were choosen to exercise all code paths in the generic
> > > >  # implementation of __fixsfdi in compiler-rt:
> > > > @@ -20,11 +21,34 @@ arg_in:  1 buffer float[8] 0x1.2p-5  \ # exp < 0
> > > > 50.0  \ # Positive value requiring 
> > > > more than 32-bits
> > > > -60.0   # Negative value requiring 
> > > > more than 32-bits
> > > >  
> > > > +[test]
> > > > +name: convert_ulong(float)
> > > > +kernel_name: test_ulong
> > > > +arg_out: 0 buffer ulong[8] 0 36864 47104 41943040 35651584 131 
> > > > 50 9223372036854775808
> > > > +# These values were choosen to exercise all code paths in the generic
> > > > +# implementation of __fixsfdi in compiler-rt:
> > > > +# 
> > > > https://github.com/llvm-mirror/compiler-rt/blob/master/lib/builtins/fixsfdi.c
> > > > +arg_in:  1 buffer float[8] 0x1.2p-5  \ # exp < 0
> > > > +   0x1.2p+15 \ # pos exp <= 23
> > > > +   0x1.7p+15 \ # pos exp <= 23
> > > > +   0x1.4p25  \ # pos exp > 23
> > > > +   0x1.1p25  \ # pos exp > 23
> > > > +   131.35\ # Random non-integer value
> > > > +   50.0  \ # Positive value requiring 
> > > > more than 32-bits
> > > > +   9223372036854775808.0  # Positive value 
> > > > requiring 64-bits
> > > > +
> > > >  !*/
> > > >  
> > > > -kernel void test(global long *out, global float *in) {
> > > > +kernel void test_long(global long *out, global float *in) {
> > > > unsigned i;
> > > > for (i = 0; i < 8; i++) {
> > > > out[i] = convert_long(in[i]);
> > > > }
> > > >  }
> > > > +
> > > > +kernel void test_ulong(global ulong *out, global float *in) {
> > > > +   unsigned i;
> > > > +   for (i = 0; i < 8; i++) {
> > > > +   out[i] = convert_ulong(in[i]);
> > > > +   }
> > > > +}
> > > 
> > > -- 
> > > Jan Vesely 
> > 
> > 
> > 
> > > ___
> > > Piglit mailing list
> > > Piglit@lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/piglit
> > 
> 
> -- 
> Jan Vesely 


___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] clGetDeviceInfo: Check for minimum value of CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE

2014-07-23 Thread Tom Stellard
---
 tests/cl/api/get-device-info.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/tests/cl/api/get-device-info.c b/tests/cl/api/get-device-info.c
index 81ab11c..ca13fa1 100644
--- a/tests/cl/api/get-device-info.c
+++ b/tests/cl/api/get-device-info.c
@@ -59,6 +59,7 @@ piglit_cl_test(const int argc,
 
size_t param_value_size;
void* param_value;
+   int* int_value;
 
int num_device_infos = PIGLIT_CL_ENUM_NUM(cl_device_info, env->version);
const cl_device_info *device_infos = 
PIGLIT_CL_ENUM_ARRAY(cl_device_info);
@@ -149,5 +150,17 @@ piglit_cl_test(const int argc,
}
 
 
+   /*
+* Checks for minimum required values.
+*/
+
+   int_value =  piglit_cl_get_device_info(env->device_id,
+   CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE);
+   if (*int_value < 64 * 1024) {
+   fprintf(stderr, "CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE must be "
+   "at least 64 KB\n");
+   piglit_merge_result(&result, PIGLIT_FAIL);
+   }
+
return result;
 }
-- 
1.8.1.5

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/2] cl: Add minimal tests for clCreateImage2D and clCreateImage3D

2014-07-23 Thread Tom Stellard
The only tests for devices without image support.
---
 tests/cl.py|   1 +
 tests/cl/api/CMakeLists.cl.txt |   1 +
 tests/cl/api/create-image.c| 110 +
 3 files changed, 112 insertions(+)
 create mode 100644 tests/cl/api/create-image.c

diff --git a/tests/cl.py b/tests/cl.py
index 1f88f70..187022d 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -64,6 +64,7 @@ add_plain_test(api, 'clRetainComandQueue and 
clReleaseCommandQueue', ['cl-api-re
 add_plain_test(api, 'clGetCommandQueueInfo', ['cl-api-get-command-queue-info'])
 #  Memory objects
 add_plain_test(api, 'clCreateBuffer', ['cl-api-create-buffer'])
+add_plain_test(api, 'clCreateImage', ['cl-api-create-image'])
 add_plain_test(api, 'clEnqueueCopyBuffer', ['cl-api-enqueue-copy-buffer'])
 add_plain_test(api, 'clEnqueueCopyBufferRect', 
['cl-api-enqueue-copy-buffer-rect'])
 add_plain_test(api, 'clEnqueueReadBuffer and clEnqueueWriteBuffer', 
['cl-api-enqueue-read_write-buffer'])
diff --git a/tests/cl/api/CMakeLists.cl.txt b/tests/cl/api/CMakeLists.cl.txt
index bfb0dbf..2386eb2 100644
--- a/tests/cl/api/CMakeLists.cl.txt
+++ b/tests/cl/api/CMakeLists.cl.txt
@@ -15,6 +15,7 @@ piglit_cl_add_api_test (retain_release-command-queue 
retain_release-command-queu
 
 # Memory objects
 piglit_cl_add_api_test (create-buffer create-buffer.c)
+piglit_cl_add_api_test (create-image create-image.c)
 piglit_cl_add_api_test (enqueue-copy-buffer enqueue-copy-buffer.c)
 piglit_cl_add_api_test (enqueue-map-buffer enqueue-map-buffer.c)
 piglit_cl_add_api_test (enqueue-copy-buffer-rect enqueue-copy-buffer-rect.c)
diff --git a/tests/cl/api/create-image.c b/tests/cl/api/create-image.c
new file mode 100644
index 000..46a98dd
--- /dev/null
+++ b/tests/cl/api/create-image.c
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2014 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Tom Stellard 
+ *
+ */
+
+#include "piglit-framework-cl-api.h"
+
+PIGLIT_CL_API_TEST_CONFIG_BEGIN
+
+   config.name = "clCreateImage";
+   config.version_min = 10;
+
+   config.run_per_platform = true;
+   config.create_context = true;
+
+PIGLIT_CL_API_TEST_CONFIG_END
+
+static bool context_has_image_support(const piglit_cl_context ctx)
+{
+   unsigned i;
+   for(i = 0; i < ctx->num_devices; i++) {
+   int *image_support =
+   piglit_cl_get_device_info(ctx->device_ids[i],
+   CL_DEVICE_IMAGE_SUPPORT);
+   if (*image_support) {
+   return true;
+   }
+   }
+   return false;
+}
+
+static void
+no_image_check_invalid(
+   cl_int errcode_ret,
+   enum piglit_result *result,
+   const char *name)
+{
+   if (!piglit_cl_check_error(errcode_ret, CL_INVALID_OPERATION)) {
+   fprintf(stderr, "%s: CL_INVALID_OPERATION expected when no "
+   "devices support images.\n", name);
+   piglit_merge_result(result, PIGLIT_FAIL);
+   }
+}
+
+static enum piglit_result
+no_image_tests(const struct piglit_cl_api_test_env* env)
+{
+   enum piglit_result result = PIGLIT_PASS;
+   cl_context cl_ctx = env->context->cl_ctx;
+   cl_mem_flags flags = CL_MEM_READ_ONLY;
+   cl_image_format image_format;
+   size_t image_width = 1;
+   size_t image_height = 1;
+   size_t image_depth = 2;
+   size_t image_row_pitch = 0;
+   size_t image_slice_pitch = 0;
+   void *host_ptr = NULL;
+   cl_int errcode_ret;
+
+   image_format.image_channel_order = CL_RGBA;
+   image_format.image_channel_data_type = CL_FLOAT;
+
+

[Piglit] [PATCH 2/2] cl: Add minimal test for clCreateSampler

2014-07-23 Thread Tom Stellard
The only test is for devices without image support.
---
 tests/cl.py|  1 +
 tests/cl/api/CMakeLists.cl.txt |  1 +
 tests/cl/api/create-sampler.c  | 86 ++
 3 files changed, 88 insertions(+)
 create mode 100644 tests/cl/api/create-sampler.c

diff --git a/tests/cl.py b/tests/cl.py
index 187022d..fd698fc 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -65,6 +65,7 @@ add_plain_test(api, 'clGetCommandQueueInfo', 
['cl-api-get-command-queue-info'])
 #  Memory objects
 add_plain_test(api, 'clCreateBuffer', ['cl-api-create-buffer'])
 add_plain_test(api, 'clCreateImage', ['cl-api-create-image'])
+add_plain_test(api, 'clCreateSampler', ['cl-api-create-sampler'])
 add_plain_test(api, 'clEnqueueCopyBuffer', ['cl-api-enqueue-copy-buffer'])
 add_plain_test(api, 'clEnqueueCopyBufferRect', 
['cl-api-enqueue-copy-buffer-rect'])
 add_plain_test(api, 'clEnqueueReadBuffer and clEnqueueWriteBuffer', 
['cl-api-enqueue-read_write-buffer'])
diff --git a/tests/cl/api/CMakeLists.cl.txt b/tests/cl/api/CMakeLists.cl.txt
index 2386eb2..460c8ac 100644
--- a/tests/cl/api/CMakeLists.cl.txt
+++ b/tests/cl/api/CMakeLists.cl.txt
@@ -16,6 +16,7 @@ piglit_cl_add_api_test (retain_release-command-queue 
retain_release-command-queu
 # Memory objects
 piglit_cl_add_api_test (create-buffer create-buffer.c)
 piglit_cl_add_api_test (create-image create-image.c)
+piglit_cl_add_api_test (create-sampler create-sampler.c)
 piglit_cl_add_api_test (enqueue-copy-buffer enqueue-copy-buffer.c)
 piglit_cl_add_api_test (enqueue-map-buffer enqueue-map-buffer.c)
 piglit_cl_add_api_test (enqueue-copy-buffer-rect enqueue-copy-buffer-rect.c)
diff --git a/tests/cl/api/create-sampler.c b/tests/cl/api/create-sampler.c
new file mode 100644
index 000..cce5f87
--- /dev/null
+++ b/tests/cl/api/create-sampler.c
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2014 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Tom Stellard 
+ *
+ */
+
+#include "piglit-framework-cl-api.h"
+
+PIGLIT_CL_API_TEST_CONFIG_BEGIN
+
+   config.name = "clCreateSampler";
+   config.version_min = 10;
+
+   config.run_per_platform = true;
+   config.create_context = true;
+
+PIGLIT_CL_API_TEST_CONFIG_END
+
+static bool context_has_image_support(const piglit_cl_context ctx)
+{
+   unsigned i;
+   for(i = 0; i < ctx->num_devices; i++) {
+   int *image_support =
+   piglit_cl_get_device_info(ctx->device_ids[i],
+   CL_DEVICE_IMAGE_SUPPORT);
+   if (*image_support) {
+   return true;
+   }
+   }
+   return false;
+}
+
+static enum piglit_result
+no_image_tests(const struct piglit_cl_api_test_env* env)
+{
+   enum piglit_result result = PIGLIT_PASS;
+   cl_context cl_ctx = env->context->cl_ctx;
+   cl_bool normalized_coords = false;
+   cl_addressing_mode addressing_mode = CL_ADDRESS_NONE;
+   cl_filter_mode filter_mode = CL_FILTER_NEAREST;
+   cl_int errcode_ret;
+
+   clCreateSampler(cl_ctx, normalized_coords, addressing_mode, filter_mode,
+   &errcode_ret);
+
+   if (!piglit_cl_check_error(errcode_ret, CL_INVALID_OPERATION)) {
+   fprintf(stderr, "clCreateSampler: CL_INVALID_OPERATION "
+   "expected when no devices support images.\n");
+   piglit_merge_result(&result, PIGLIT_FAIL);
+   }
+
+   return result;
+}
+
+enum piglit_result
+piglit_cl_test(const int argc,
+   const char **argv,
+   const struct piglit_cl_api_test_confi

Re: [Piglit] [PATCH v2 1/1] cl: Extend float to long conversion test

2014-07-15 Thread Tom Stellard
On Tue, Jul 15, 2014 at 09:03:18AM -0400, Jan Vesely wrote:
> a light poke
> 
> Tom, Matt,
> sorry I forgot to CC you, this piglit tests the conversions submitted
> last week.
> 

Reviewed-by: Tom Stellard 

> thank you,
> Jan
> 
> On Tue, 2014-06-24 at 15:15 -0400, Jan Vesely wrote:
> > Fill in subtest name
> > v2: Add 2^63 as a test value
> > 
> > Signed-off-by: Jan Vesely 
> > ---
> >  .../execute/builtin/convert/float-convert_long.cl  | 28 
> > --
> >  1 file changed, 26 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tests/cl/program/execute/builtin/convert/float-convert_long.cl 
> > b/tests/cl/program/execute/builtin/convert/float-convert_long.cl
> > index 3d6930a..c8baa38 100644
> > --- a/tests/cl/program/execute/builtin/convert/float-convert_long.cl
> > +++ b/tests/cl/program/execute/builtin/convert/float-convert_long.cl
> > @@ -4,9 +4,10 @@ name: convert_long(float)
> >  dimensions: 1
> >  global_size: 1 1 1
> >  local_size: 1 1 1
> > -kernel_name: test
> >  
> >  [test]
> > +name: convert_long(float)
> > +kernel_name: test_long
> >  arg_out: 0 buffer long[8] 0 36864 -47104 41943040 -35651584 131 50 
> > -60
> >  # These values were choosen to exercise all code paths in the generic
> >  # implementation of __fixsfdi in compiler-rt:
> > @@ -20,11 +21,34 @@ arg_in:  1 buffer float[8] 0x1.2p-5  \ # exp < 0
> > 50.0  \ # Positive value requiring more 
> > than 32-bits
> > -60.0   # Negative value requiring more 
> > than 32-bits
> >  
> > +[test]
> > +name: convert_ulong(float)
> > +kernel_name: test_ulong
> > +arg_out: 0 buffer ulong[8] 0 36864 47104 41943040 35651584 131 50 
> > 9223372036854775808
> > +# These values were choosen to exercise all code paths in the generic
> > +# implementation of __fixsfdi in compiler-rt:
> > +# 
> > https://github.com/llvm-mirror/compiler-rt/blob/master/lib/builtins/fixsfdi.c
> > +arg_in:  1 buffer float[8] 0x1.2p-5  \ # exp < 0
> > +   0x1.2p+15 \ # pos exp <= 23
> > +   0x1.7p+15 \ # pos exp <= 23
> > +   0x1.4p25  \ # pos exp > 23
> > +   0x1.1p25  \ # pos exp > 23
> > +   131.35\ # Random non-integer value
> > +   50.0  \ # Positive value requiring more 
> > than 32-bits
> > +   9223372036854775808.0  # Positive value 
> > requiring 64-bits
> > +
> >  !*/
> >  
> > -kernel void test(global long *out, global float *in) {
> > +kernel void test_long(global long *out, global float *in) {
> > unsigned i;
> > for (i = 0; i < 8; i++) {
> > out[i] = convert_long(in[i]);
> > }
> >  }
> > +
> > +kernel void test_ulong(global ulong *out, global float *in) {
> > +   unsigned i;
> > +   for (i = 0; i < 8; i++) {
> > +   out[i] = convert_ulong(in[i]);
> > +   }
> > +}
> 
> -- 
> Jan Vesely 



> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 0/9] Implement more CL relational builtins

2014-07-14 Thread Tom Stellard
On Fri, Jul 11, 2014 at 11:33:45PM -0500, Aaron Watry wrote:
> Fixes a bad test value in isnan, and implements more relational builtins
> 
> After this, the only relational ones that are missing auto-generated tests 
> are:
> any
> all
> bitselect (has a hand-coded test, but just 1 scalar test)
> select
> 

For the series:

Reviewed-by: Tom Stellard 

> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: Add __attribute__(work_group_size_hint(..)) test

2014-07-04 Thread Tom Stellard
On Fri, Jun 27, 2014 at 08:48:10AM -0500, Aaron Watry wrote:
> Currently, this test triggers an llvm error on r600g/radeonsi.
> 
> Signed-off-by: Aaron Watry 

Reviewed-by: Tom Stellard 

> CC: Tom Stellard 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76223
> ---
>  tests/cl/program/execute/attributes.cl | 40 
> ++
>  1 file changed, 40 insertions(+)
>  create mode 100644 tests/cl/program/execute/attributes.cl
> 
> diff --git a/tests/cl/program/execute/attributes.cl 
> b/tests/cl/program/execute/attributes.cl
> new file mode 100644
> index 000..c31762a
> --- /dev/null
> +++ b/tests/cl/program/execute/attributes.cl
> @@ -0,0 +1,40 @@
> +/*!
> +[config]
> +name: __attribute__ tests
> +clc_version_min: 10
> +
> +[test]
> +name: work_group_size_hint
> +kernel_name: testKernel
> +dimensions: 1
> +global_size: 4 0 0
> +arg_out: 0 buffer int[4] repeat 5
> +
> +!*/
> +
> +/*
> +https://bugs.freedesktop.org/show_bug.cgi?id=76223
> +
> +If you remove the __attribute__((work_group_size_hint(4,1,1)), then the test 
> works.
> +
> +With the attribute, you get:
> +LLVM ERROR: not a number, or does not fit in an unsigned int
> +
> +This only causes an error if there's more than 1 kernel in the program
> +*/
> +__kernel __attribute__((work_group_size_hint(4, 1, 1))) void testKernel(
> + global int* out
> +) {
> + const size_t gid = get_global_id(0);
> + if (gid >= get_global_size(0))
> + return;
> + out[gid] = 5;
> +}
> +
> +/*
> +XXX: With this useless kernel commented out, things work...
> +*/
> +__kernel void BogusKernel(global int* out, global int* in){
> + *out = *in;
> +}
> +
> -- 
> 1.9.1
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: Fix out-of-bounds write in get-num-groups

2014-07-04 Thread Tom Stellard
On Wed, Jun 25, 2014 at 07:16:55AM -0700, Tom Stellard wrote:
> On Wed, Jun 25, 2014 at 12:35:50PM +0200, Lars-Dominik Braun wrote:
> > ---
> > Each work-item writes three values. 4*4*4*3 is 192.
> 
> Reviewed-by: Tom Stellard 
> 
> I can commit this.

I just committed this, thanks for the patch.

-Tom

> 
> -Tom
> 
> > 
> > I’m new to piglit and do not have commit access.
> > 
> >  tests/cl/program/execute/get-num-groups.cl | 16 
> >  1 file changed, 12 insertions(+), 4 deletions(-)
> > 
> > diff --git a/tests/cl/program/execute/get-num-groups.cl 
> > b/tests/cl/program/execute/get-num-groups.cl
> > index 20e4b7a..803411b 100644
> > --- a/tests/cl/program/execute/get-num-groups.cl
> > +++ b/tests/cl/program/execute/get-num-groups.cl
> > @@ -76,7 +76,9 @@ kernel_name: fill3d
> >  dimensions: 3
> >  global_size: 4 4 4
> >  local_size: 1 1 1
> > -arg_out: 0 buffer int[144] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 
> > \
> > +arg_out: 0 buffer int[192] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 
> > \
> > +   4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 
> > \
> > +   4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 
> > \
> > 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 
> > \
> > 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 
> > \
> > 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 
> > \
> > @@ -89,7 +91,9 @@ kernel_name: fill3d
> >  dimensions: 3
> >  global_size: 4 4 4
> >  local_size: 2 2 2
> > -arg_out: 0 buffer int[144] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
> > \
> > +arg_out: 0 buffer int[192] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
> > \
> > +   2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
> > \
> > +   2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
> > \
> > 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
> > \
> > 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
> > \
> > 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
> > \
> > @@ -102,7 +106,9 @@ kernel_name: fill3d
> >  dimensions: 3
> >  global_size: 4 4 4
> >  local_size: 4 4 4
> > -arg_out: 0 buffer int[144] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
> > \
> > +arg_out: 0 buffer int[192] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
> > \
> > +   1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
> > \
> > +   1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
> > \
> > 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
> > \
> > 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
> > \
> > 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
> > \
> > @@ -115,7 +121,9 @@ kernel_name: fill3d
> >  dimensions: 3
> >  global_size: 4 4 4
> >  local_size: 4 2 1
> > -arg_out: 0 buffer int[144] 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 
> > \
> > +arg_out: 0 buffer int[192] 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 
> > \
> > +   1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 
> > \
> > +   1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 
> > \
> > 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 
> > \
> > 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 
> > \
> > 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 
> > \
> > -- 
> > 1.8.5.5
> > 
> > ___
> > Piglit mailing list
> > Piglit@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/piglit
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cmake: Require Mako >= 0.7

2014-07-04 Thread Tom Stellard
On Wed, Jun 25, 2014 at 08:47:24PM -0700, Chad Versace wrote:
> Piglit began requiring Mako 0.7 as of commit ac1f382 "dispatch:
> Generate piglit-dispatch from Khronos XML".
> 
> Piglit has required Mako for a long time, and CMake did check for Mako.
> But CMake didn't check the version. This patch fixes CMake to require
> Mako >= 0.7 and to provide the below hint on failure:
> 
>   Hint: Try installing Mako with `pip install --user --upgrade Mako`

You may need to bump the required version up to mako 0.7.3.  This version works
for me, but with mako 0.7.0 I get the following error:

Traceback (most recent call last):
  File "./piglit", line 111, in 
main()
  File "./piglit", line 106, in main
returncode = parsed.func(args)
  File "/home/tstellar/piglit/framework/programs/summary.py", line 98, in html
output.generate_html(args.summaryDir, args.exclude_details)
  File "/home/tstellar/piglit/framework/summary.py", line 445, in generate_html
module_directory=self.TEMP_DIR)
  File "/usr/lib64/python2.7/site-packages/mako/template.py", line 276, in 
__init__
module = self._compile_from_file(path, filename)
  File "/usr/lib64/python2.7/site-packages/mako/template.py", line 332, in 
_compile_from_file
self.module_writer)
  File "/usr/lib64/python2.7/site-packages/mako/template.py", line 613, in 
_compile_module_file
generate_magic_comment=True)
  File "/usr/lib64/python2.7/site-packages/mako/template.py", line 582, in 
_compile
node = lexer.parse()
  File "/usr/lib64/python2.7/site-packages/mako/lexer.py", line 220, in parse
if self.match_control_line():
  File "/usr/lib64/python2.7/site-packages/mako/lexer.py", line 414, in 
match_control_line
self.append_node(parsetree.ControlLine, keyword, isend, text)
  File "/usr/lib64/python2.7/site-packages/mako/lexer.py", line 130, in 
append_node
node = nodecls(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/mako/parsetree.py", line 77, in 
__init__
code = ast.PythonFragment(text, **self.exception_kwargs)
  File "/usr/lib64/python2.7/site-packages/mako/ast.py", line 96, in __init__
super(PythonFragment, self).__init__(code, **exception_kwargs)
  File "/usr/lib64/python2.7/site-packages/mako/ast.py", line 42, in __init__
f.visit(expr)
  File "/usr/lib64/python2.7/site-packages/mako/_ast_util.py", line 279, in 
visit
return self.generic_visit(node)
  File "/usr/lib64/python2.7/site-packages/mako/_ast_util.py", line 287, in 
generic_visit
self.visit(item)
  File "/usr/lib64/python2.7/site-packages/mako/_ast_util.py", line 278, in 
visit
return f(node)
  File "/usr/lib64/python2.7/site-packages/mako/pyparser.py", line 143, in 
visit_For
self.visit(node.iter)
  File "/usr/lib64/python2.7/site-packages/mako/_ast_util.py", line 279, in 
visit
return self.generic_visit(node)
  File "/usr/lib64/python2.7/site-packages/mako/_ast_util.py", line 287, in 
generic_visit
self.visit(item)
  File "/usr/lib64/python2.7/site-packages/mako/_ast_util.py", line 279, in 
visit
return self.generic_visit(node)
  File "/usr/lib64/python2.7/site-packages/mako/_ast_util.py", line 289, in 
generic_visit
self.visit(value)
  File "/usr/lib64/python2.7/site-packages/mako/_ast_util.py", line 278, in 
visit
return f(node)
  File "/usr/lib64/python2.7/site-packages/mako/pyparser.py", line 107, in 
visit_Lambda
self._visit_function(node, True)
  File "/usr/lib64/python2.7/site-packages/mako/pyparser.py", line 125, in 
_visit_function
if arg_id(arg) in self.local_ident_stack:
AttributeError: 'Tuple' object has no attribute 'id'


-Tom

> 
> Reported-by: Tom Stellard 
> Signed-off-by: Chad Versace 
> ---
>  CMakeLists.txt | 13 ++
>  cmake/Modules/PiglitFindMako.cmake | 93 
> ++
>  2 files changed, 96 insertions(+), 10 deletions(-)
>  create mode 100644 cmake/Modules/PiglitFindMako.cmake
> 
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index f875f5b..0b20084 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -183,8 +183,9 @@ if(NOT DEFINED python)
>   message(FATAL_ERROR "python version 2.x (where x >= 6) required")
>  endif(NOT DEFINED python)
>  
> -# Check for the presence of several python packages, which are needed to 
> build
> -# generated tests.
> +include(PiglitFindMako)
> +
> +# Require numpy
>  execute_process(
>   COMMAND ${python} -c "import numpy"
>   OUTPUT_QUIET
> @@ -193,14 +194,6 @@ execute_process(
>  if(NOT import_numpy_error_code EQUAL 0)
>   message(FATAL_ERROR "numpy py

Re: [Piglit] [PATCH] cl-api-get-platform-ids: Initialize variable.

2014-07-03 Thread Tom Stellard
On Tue, Jul 01, 2014 at 10:38:56PM -0700, Vinson Lee wrote:
> Fix clang sometimes-uninitialized warning.
> 
> get-platform-ids.c:62:5: warning: variable 'platforms' is used uninitialized 
> whenever 'if' condition is true [-Wsometimes-uninitialized]
> if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
>^
> get-platform-ids.c:93:30: note: uninitialized use occurs here
> errNo = clGetPlatformIDs(0, platforms, NULL);
> ^
> get-platform-ids.c:62:2: note: remove the 'if' if its condition is always 
> false
> if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
> ^~~
> get-platform-ids.c:56:27: note: initialize the variable 'platforms' to 
> silence this warning
> cl_platform_id* platforms;
>      ^
>   = NULL
> 
Reviewed-by: Tom Stellard 
> Signed-off-by: Vinson Lee 
> ---
>  tests/cl/api/get-platform-ids.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/cl/api/get-platform-ids.c b/tests/cl/api/get-platform-ids.c
> index 6cc734a..f94ab0c 100644
> --- a/tests/cl/api/get-platform-ids.c
> +++ b/tests/cl/api/get-platform-ids.c
> @@ -53,7 +53,7 @@ piglit_cl_test(const int argc,
>   int i;
>   cl_int errNo;
>   cl_uint num_platforms;
> - cl_platform_id* platforms;
> + cl_platform_id* platforms = NULL;
>  
>   /*** Normal usage ***/
>  
> -- 
> 1.9.2
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 4/4] cl: Add tests for sin builtin

2014-07-02 Thread Tom Stellard
---
 generated_tests/generate-cl-math-builtins.py | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index d93f09f..ea6fefa 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -27,14 +27,15 @@
 import os
 
 from genclbuiltins import gen
-from math import atan, pi, cos
+from math import atan, pi, sin, cos
 
 CLC_VERSION_MIN = {
 'atan' : 10,
 'cos' : 10,
 'mix' : 10,
 'nextafter' : 10,
-'sign' : 10
+'sign' : 10,
+'sin' : 10
 }
 
 DATA_TYPES = ['float']
@@ -89,6 +90,15 @@ tests = {
 [1.0, -1.0, 0.0, -0.0, 0.0],
 [0.5, -0.5, 0.0, -0.0, float("nan")]
 ]
+},
+'sin' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[0.0, 1.0,   0.0, -1.0,   0.0,sin(2.234567)], # Result
+[0.0, pi / 2, pi, 3 * pi / 2, 2 * pi, 2.234567] # Arg0
+],
+'tolerance': 2
 }
 }
 
-- 
1.8.1.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/4] cl: Add tests for atan builtin

2014-07-02 Thread Tom Stellard
---
 generated_tests/genclbuiltins.py |  7 +--
 generated_tests/generate-cl-math-builtins.py | 11 +++
 tests/cl/program/program-tester.c|  1 -
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/generated_tests/genclbuiltins.py b/generated_tests/genclbuiltins.py
index 9173cdb..da4af5a 100644
--- a/generated_tests/genclbuiltins.py
+++ b/generated_tests/genclbuiltins.py
@@ -311,6 +311,7 @@ def print_test(f, fnName, argType, functionDef, tests, 
testIdx, vecSize, tss):
 
 argTypes = getArgTypes(argType, functionDef['arg_types'])
 argCount = len(argTypes)
+tolerance = functionDef['tolerance'] if 'tolerance' in functionDef else 0
 
 # For each argument, write a line containing its type, index, and values
 for arg in range(0, argCount):
@@ -326,9 +327,11 @@ def print_test(f, fnName, argType, functionDef, tests, 
testIdx, vecSize, tss):
 # width
 if (arg < 2 or not tss):
 f.write(argInOut + str(arg) + ' buffer ' + argTypes[arg] +
-'[' + str(vecSize) + '] ' + ' '.join([argVal]*vecSize) +
-'\n'
+'[' + str(vecSize) + '] ' + ' '.join([argVal]*vecSize)
 )
+if arg == 0:
+f.write(' tolerance {} ulp'.format(tolerance))
+f.write('\n')
 else:
 argInOut = 'arg_in: '
 f.write(argInOut + str(arg) + ' buffer ' + argTypes[arg] + '[1] ' +
diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index 47752e8..edf93da 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -27,8 +27,10 @@
 import os
 
 from genclbuiltins import gen
+from math import atan, pi
 
 CLC_VERSION_MIN = {
+'atan' : 10,
 'mix' : 10,
 'nextafter' : 10,
 'sign' : 10
@@ -41,6 +43,15 @@ F = {
 }
 
 tests = {
+'atan' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[atan(0.0), atan(0.12345), atan(3567147.0)], # Result
+[0.0,   0.12345,   3567147.0]# Arg0
+],
+'tolerance' : 2
+ },
 'mix' : { #x + (y - x) * a
 'arg_types': [F, F, F, F],
 'function_type': 'tts',
diff --git a/tests/cl/program/program-tester.c 
b/tests/cl/program/program-tester.c
index 51a692b..0e35826 100644
--- a/tests/cl/program/program-tester.c
+++ b/tests/cl/program/program-tester.c
@@ -903,7 +903,6 @@ get_test_arg_tolerance(struct test_arg* test_arg, const 
char* tolerance_str)
regmatch_t pmatch[2];
char* value_str = NULL;
 
-fprintf(stderr, "tolerance = %s\n", tolerance_str);
 if(regex_get_matches(tolerance_str,
 REGEX_ARG_TOLERANCE_ULP,
 pmatch,
-- 
1.8.1.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/4] cl-program-tester: Allow tolerance to be specified in terms of ulp

2014-07-02 Thread Tom Stellard
---
 tests/cl/doc_program.cl   |  1 +
 tests/cl/doc_program.program_test |  1 +
 tests/cl/program/program-tester.c | 33 +++--
 tests/util/piglit-util-cl.c   | 26 +-
 tests/util/piglit-util-cl.h   |  8 
 5 files changed, 46 insertions(+), 23 deletions(-)

diff --git a/tests/cl/doc_program.cl b/tests/cl/doc_program.cl
index 84e92ee..3dee7e1 100644
--- a/tests/cl/doc_program.cl
+++ b/tests/cl/doc_program.cl
@@ -65,6 +65,7 @@ arg_in: 1 buffer float2[6] random  # Buffer argument with 
random data to ini
 arg_in: 2 float2 1 1   # Int argument
 arg_out: 1 buffer float2[6] repeat 4.1 3.1 \ # Buffer argument with repeated 
expected data (4.1 3.1 4.1 3.1 4.1 3.1)
 tolerance 0.1# Tolerate result data with +-0.1 
offset
+ # Can also be expressed in terms 
of ulp: tolerance 5 ulp
 
 # Configuration end
 !*/
diff --git a/tests/cl/doc_program.program_test 
b/tests/cl/doc_program.program_test
index 3ff67a6..b6d50d1 100644
--- a/tests/cl/doc_program.program_test
+++ b/tests/cl/doc_program.program_test
@@ -65,6 +65,7 @@ arg_in: 1 buffer float2[6] random  # Buffer argument with 
random data to ini
 arg_in: 2 float2 1 1   # Int argument
 arg_out: 1 buffer float2[6] repeat 4.1 3.1 \ # Buffer argument with repeated 
expected data (4.1 3.1 4.1 3.1 4.1 3.1)
 tolerance 0.1# Tolerate result data with +-0.1 
offset
+ # Can also be expressed in terms 
of ulp: tolerance 5 ulp
 
 
 # Program section #
diff --git a/tests/cl/program/program-tester.c 
b/tests/cl/program/program-tester.c
index a51f148..51a692b 100644
--- a/tests/cl/program/program-tester.c
+++ b/tests/cl/program/program-tester.c
@@ -127,10 +127,11 @@
 #define REGEX_DEFINE_ARG(type, value)  "([[:digit:]]+)[[:space:]]+" type \
"[[:space:]]+(" value ")"
 #define REGEX_ARG_TOLERANCE"tolerance[[:space:]]+(" REGEX_VALUE ")"
+#define REGEX_ARG_TOLERANCE_ULPREGEX_ARG_TOLERANCE "[[:space:]]+ulp"
 #define REGEX_ARG_VALUE   REGEX_DEFINE_ARG( "(" REGEX_TYPE ")", REGEX_ARRAY )
 #define REGEX_ARG_BUFFER  REGEX_DEFINE_ARG( "buffer[[:space:]]+(" REGEX_TYPE 
")\\[([[:digit:]]+)\\]", \
 REGEX_ARRAY "|" REGEX_RANDOM "|" 
REGEX_REPEAT )   \
-  "([[:space:]]+" REGEX_ARG_TOLERANCE ")?"
+  "([[:space:]]+" "("REGEX_ARG_TOLERANCE "|" 
REGEX_ARG_TOLERANCE_ULP")" ")?"
 #define REGEX_ARG "(" REGEX_ARG_VALUE "|" REGEX_ARG_BUFFER ")"
 
 /* Match whole line */
@@ -228,7 +229,7 @@ struct test_arg {
/* tolerance */
int64_t toli;
uint64_t tolu;
-   double tolf;
+   uint64_t ulp;
 };
 
 struct test_arg create_test_arg()
@@ -247,7 +248,7 @@ struct test_arg create_test_arg()
 
.toli = 0,
.tolu = 0,
-   .tolf = 0,
+   .ulp = 0,
};
 
return ta;
@@ -902,6 +903,24 @@ get_test_arg_tolerance(struct test_arg* test_arg, const 
char* tolerance_str)
regmatch_t pmatch[2];
char* value_str = NULL;
 
+fprintf(stderr, "tolerance = %s\n", tolerance_str);
+if(regex_get_matches(tolerance_str,
+REGEX_ARG_TOLERANCE_ULP,
+pmatch,
+2,
+REG_NEWLINE)) {
+   regex_get_match_str(&value_str, tolerance_str, pmatch, 1);
+   switch(test_arg->cl_type) {
+   case TYPE_FLOAT:
+   case TYPE_DOUBLE:
+   test_arg->ulp = get_uint(value_str);
+   return;
+   default:
+   fprintf(stderr, "ulp not value for integer types\n");
+   exit_report_result(PIGLIT_WARN);
+}
+   }
+
if(regex_get_matches(tolerance_str,
 REGEX_ARG_TOLERANCE,
 pmatch,
@@ -923,9 +942,11 @@ get_test_arg_tolerance(struct test_arg* test_arg, const 
char* tolerance_str)
test_arg->tolu = get_uint(value_str);
break;
case TYPE_FLOAT:
-   case TYPE_DOUBLE:
-   test_arg->tolf = get_float(value_str);
+   case TYPE_DOUBLE: {
+   float value = get_float(value_str);
+   test_arg->ulp = *((uint64_t*)(&value));
break;
+   }
}
 
free(value_str);
@@ -1662,7 +1683,7 @@ check_test_arg_value(struct test_arg test_arg,
rb = i*test_arg.cl_mem_size + c;
 \

if(!piglit_cl_probe_floating(((cl_type*)v

[Piglit] [PATCH 3/4] cl: Add tests for cos builtin

2014-07-02 Thread Tom Stellard
---
 generated_tests/generate-cl-math-builtins.py | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index edf93da..d93f09f 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -27,10 +27,11 @@
 import os
 
 from genclbuiltins import gen
-from math import atan, pi
+from math import atan, pi, cos
 
 CLC_VERSION_MIN = {
 'atan' : 10,
+'cos' : 10,
 'mix' : 10,
 'nextafter' : 10,
 'sign' : 10
@@ -52,6 +53,15 @@ tests = {
 ],
 'tolerance' : 2
  },
+'cos' : {
+'arg_types' : [F, F],
+'function_type': 'ttt',
+'values' : [
+[1.0, 0.0,-1.0, 0.0,1.0,cos(1.12345)], # Result
+[0.0, pi / 2, pi,   3 * pi / 2, 2 * pi, 1.12345] # Arg0
+],
+'tolerance' : 2
+},
 'mix' : { #x + (y - x) * a
 'arg_types': [F, F, F, F],
 'function_type': 'tts',
-- 
1.8.1.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: Fix out-of-bounds write in get-num-groups

2014-06-25 Thread Tom Stellard
On Wed, Jun 25, 2014 at 12:35:50PM +0200, Lars-Dominik Braun wrote:
> ---
> Each work-item writes three values. 4*4*4*3 is 192.

Reviewed-by: Tom Stellard 

I can commit this.

-Tom

> 
> I’m new to piglit and do not have commit access.
> 
>  tests/cl/program/execute/get-num-groups.cl | 16 
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/cl/program/execute/get-num-groups.cl 
> b/tests/cl/program/execute/get-num-groups.cl
> index 20e4b7a..803411b 100644
> --- a/tests/cl/program/execute/get-num-groups.cl
> +++ b/tests/cl/program/execute/get-num-groups.cl
> @@ -76,7 +76,9 @@ kernel_name: fill3d
>  dimensions: 3
>  global_size: 4 4 4
>  local_size: 1 1 1
> -arg_out: 0 buffer int[144] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 \
> +arg_out: 0 buffer int[192] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 \
> +   4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 \
> +   4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 \
> 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 \
> 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 \
> 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 \
> @@ -89,7 +91,9 @@ kernel_name: fill3d
>  dimensions: 3
>  global_size: 4 4 4
>  local_size: 2 2 2
> -arg_out: 0 buffer int[144] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 \
> +arg_out: 0 buffer int[192] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 \
> +   2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 \
> +   2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 \
> 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 \
> 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 \
> 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 \
> @@ -102,7 +106,9 @@ kernel_name: fill3d
>  dimensions: 3
>  global_size: 4 4 4
>  local_size: 4 4 4
> -arg_out: 0 buffer int[144] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \
> +arg_out: 0 buffer int[192] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \
> +   1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \
> +   1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \
> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \
> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \
> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \
> @@ -115,7 +121,9 @@ kernel_name: fill3d
>  dimensions: 3
>  global_size: 4 4 4
>  local_size: 4 2 1
> -arg_out: 0 buffer int[144] 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 \
> +arg_out: 0 buffer int[192] 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 \
> +   1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 \
> +   1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 \
> 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 \
> 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 \
> 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 1 2 4 \
> -- 
> 1.8.5.5
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [Patch v2] results.py: Fix JSONWriter.close_json()

2014-06-24 Thread Tom Stellard
On Tue, Jun 24, 2014 at 06:20:46PM -0700, Dylan Baker wrote:
> A previous patch created a bug which caused an AssertionError at the end
> of a piglit run. This bug is the result of calling
> JSONWriter.close_dict() too many times. This solution is to split the
> start of the test dict out of initialize_json() and do it in the calling
> function instead.
> 
> v2: - take this approach rather than close dicts as a stack
> 
Tested-by: Tom Stellard 
> Signed-off-by: Dylan Baker 
> ---
>  framework/programs/run.py | 6 ++
>  framework/results.py  | 4 
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/framework/programs/run.py b/framework/programs/run.py
> index eea0a60..bd9bd2e 100644
> --- a/framework/programs/run.py
> +++ b/framework/programs/run.py
> @@ -170,6 +170,9 @@ def run(input_):
>  json_writer.initialize_json(options, results.name,
>  core.collect_system_info())
>  
> +json_writer.write_dict_key('tests')
> +json_writer.open_dict()
> +
>  profile = framework.profile.merge_test_profiles(args.test_profile)
>  profile.results_dir = args.results_path
>  
> @@ -217,6 +220,9 @@ def resume(input_):
>  json_writer.initialize_json(results.options, results.name,
>  core.collect_system_info())
>  
> +json_writer.write_dict_key('tests')
> +json_writer.open_dict()
> +
>  for key, value in results.tests.iteritems():
>  json_writer.write_dict_item(key, value)
>  opts.exclude_tests.add(key)
> diff --git a/framework/results.py b/framework/results.py
> index 43c1736..1a6a652 100644
> --- a/framework/results.py
> +++ b/framework/results.py
> @@ -160,9 +160,6 @@ class JSONWriter(object):
>  for key, value in env.iteritems():
>  self.write_dict_item(key, value)
>  
> -self.write_dict_key('tests')
> -self.open_dict()
> -
>  def close_json(self):
>  """ End json serialization and cleanup
>  
> @@ -171,7 +168,6 @@ class JSONWriter(object):
>  
>  """
>  self.close_dict()
> -self.close_dict()
>  assert self._open_containers == []
>  
>  self.file.close()
> -- 
> 2.0.0
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] Piglit build fails: NameError: global name 'fake_whitespace' is not defined

2014-06-24 Thread Tom Stellard
On Tue, Jun 24, 2014 at 08:34:37PM -0400, Tom Stellard wrote:
> On Tue, Jun 24, 2014 at 05:29:44PM -0700, Dylan Baker wrote:
> > what does: python -c 'import mako; print mako.__version__'
> > return?
> > 
> 
> $ python -c 'import mako; print mako.__version__'
> 0.5.0
> 

chadv showed me how to update mako on IRC, so this is working for me now
with version 1.0.  He said he would add a check for this to cmake.

-Tom

> -Tom
> 
> > On Tuesday, June 24, 2014 08:27:54 PM Tom Stellard wrote:
> > > Hi,
> > > 
> > > Building piglit fails for me with HEAD at
> > > 7e699cdb47f328206afa6dd454de8d6f28d7ffe9
> > > 
> > > Here is the error:
> > > 
> > > [  0%] Generating tests/util/piglit-dispatch-gen.c,
> > > tests/util/piglit-dispatch-gen.h, tests/util/piglit-util-gl-enum-gen.c
> > > debug: registry.gl: etree is xml.etree.cElementTree
> > > debug: registry.gl: _etree_iterfind wraps ElementTree.iterfind
> > > Traceback (most recent call last):
> > >   File "/home/tstellar/piglit/tests/util/gen_dispatch.py", line 201, in
> > > 
> > > main()
> > >   File "/home/tstellar/piglit/tests/util/gen_dispatch.py", line 68, in
> > > main
> > > DispatchCode.emit(args.out_dir, gl_registry)
> > >   File "/home/tstellar/piglit/tests/util/gen_dispatch.py", line 93, in
> > > emit
> > > render_template(cls.H_TEMPLATE, out_dir, **context_vars)
> > >   File "/home/tstellar/piglit/tests/util/gen_dispatch.py", line 127, in
> > > render_template
> > > template.render_context(ctx)
> > >   File "/usr/lib/python2.7/site-packages/mako/template.py", line 325, in
> > > render_context
> > > **kwargs)
> > >   File "/usr/lib/python2.7/site-packages/mako/runtime.py", line 692, in
> > > _render_context
> > > _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
> > >   File "/usr/lib/python2.7/site-packages/mako/runtime.py", line 718, in
> > > _exec_template
> > > callable_(context, *args, **kwargs)
> > >   File "_home_tstellar_piglit_tests_util_piglit_dispatch_gen_h_mako",
> > > line 147, in render_body
> > >   File "_home_tstellar_piglit_tests_util_piglit_dispatch_gen_h_mako",
> > > line 123, in __M_anon_26
> > > NameError: global name 'fake_whitespace' is not defined
> > > 
> > > Does anyone know what is wrong?
> > > 
> > > -Tom
> > > ___
> > > Piglit mailing list
> > > Piglit@lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/piglit
> 
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] Piglit build fails: NameError: global name 'fake_whitespace' is not defined

2014-06-24 Thread Tom Stellard
On Tue, Jun 24, 2014 at 05:29:44PM -0700, Dylan Baker wrote:
> what does: python -c 'import mako; print mako.__version__'
> return?
> 

$ python -c 'import mako; print mako.__version__'
0.5.0

-Tom

> On Tuesday, June 24, 2014 08:27:54 PM Tom Stellard wrote:
> > Hi,
> > 
> > Building piglit fails for me with HEAD at
> > 7e699cdb47f328206afa6dd454de8d6f28d7ffe9
> > 
> > Here is the error:
> > 
> > [  0%] Generating tests/util/piglit-dispatch-gen.c,
> > tests/util/piglit-dispatch-gen.h, tests/util/piglit-util-gl-enum-gen.c
> > debug: registry.gl: etree is xml.etree.cElementTree
> > debug: registry.gl: _etree_iterfind wraps ElementTree.iterfind
> > Traceback (most recent call last):
> >   File "/home/tstellar/piglit/tests/util/gen_dispatch.py", line 201, in
> > 
> > main()
> >   File "/home/tstellar/piglit/tests/util/gen_dispatch.py", line 68, in
> > main
> > DispatchCode.emit(args.out_dir, gl_registry)
> >   File "/home/tstellar/piglit/tests/util/gen_dispatch.py", line 93, in
> > emit
> > render_template(cls.H_TEMPLATE, out_dir, **context_vars)
> >   File "/home/tstellar/piglit/tests/util/gen_dispatch.py", line 127, in
> > render_template
> > template.render_context(ctx)
> >   File "/usr/lib/python2.7/site-packages/mako/template.py", line 325, in
> > render_context
> > **kwargs)
> >   File "/usr/lib/python2.7/site-packages/mako/runtime.py", line 692, in
> > _render_context
> > _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
> >   File "/usr/lib/python2.7/site-packages/mako/runtime.py", line 718, in
> > _exec_template
> > callable_(context, *args, **kwargs)
> >   File "_home_tstellar_piglit_tests_util_piglit_dispatch_gen_h_mako",
> > line 147, in render_body
> >   File "_home_tstellar_piglit_tests_util_piglit_dispatch_gen_h_mako",
> > line 123, in __M_anon_26
> > NameError: global name 'fake_whitespace' is not defined
> > 
> > Does anyone know what is wrong?
> > 
> > -Tom
> > ___
> > Piglit mailing list
> > Piglit@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/piglit


___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


  1   2   3   >