Re: [Mesa-dev] [PATCH] cl: Add support for OpenCV unit tests v2

2014-01-20 Thread Tom Stellard
On Fri, Jan 17, 2014 at 03:04:46PM -0800, Dylan Baker wrote:
 I think you meant to ping the piglit list not mesa dev :)
 
 In general this looks a lot better, I've got a few little things for you
 
 On Friday, January 17, 2014 02:30:13 PM Tom Stellard wrote:
  From: Tom Stellard thomas.stell...@amd.com
  
  This enables piglit to run and interpret the results from OpenCV's
  gtest based opencv_test_ocl program.
  
  This patch adds two new CMake configuration variables:
  
  OPENCL_OpenCVTestOCL_BINDIR: You can use this variable to enable
  the OpenCV tests by setting it to the full path of the
  bin directory in your opencv build tree (e.g. /home/user/opencv/build/bin).
  
  OPENCL_OpenCVTestOCL_WORKDIR: (Optional)If you don't want to use
  OpenCV's default work directory, you can use this variable to specify
  a different one.
  
  v2:
- Python code cleanups
  
  XXX: opencv
  ---
   CMakeLists.txt|  9 ++-
   tests/all_cl.py   |  4 ++
   tests/cl/program/execute/opencv-merge-hist.cl | 98
  --- tests/ocl_config.py.in|
  31 +
   tests/opencv.py   | 76 +
   5 files changed, 119 insertions(+), 99 deletions(-)
   delete mode 100644 tests/cl/program/execute/opencv-merge-hist.cl
   create mode 100644 tests/ocl_config.py.in
   create mode 100644 tests/opencv.py
  
  diff --git a/CMakeLists.txt b/CMakeLists.txt
  index 1befffb..37eac65 100644
  --- a/CMakeLists.txt
  +++ b/CMakeLists.txt
  @@ -92,7 +92,10 @@ if(PIGLIT_BUILD_GLES3_TESTS AND NOT PIGLIT_USE_WAFFLE)
   endif(PIGLIT_BUILD_GLES3_TESTS AND NOT PIGLIT_USE_WAFFLE)
  
   if(PIGLIT_BUILD_CL_TESTS)
  -   find_package(OpenCL REQUIRED)
  +find_package(OpenCL REQUIRED)
  +set(OPENCL_OpenCVTestOCL_BINDIR  CACHE STRING Directory with the
  opencv_ocl_test program ) +set(OPENCL_OpenCVTestOCL_WORKDIR 
  CACHE STRING
  +Directory with the opencv test resources (This is not needed
  if your OpenCV build directory was $(opencv_src_dir)/build ) )
  endif(PIGLIT_BUILD_CL_TESTS)
  
   IF(${CMAKE_SYSTEM_NAME} MATCHES Linux)
  @@ -356,6 +359,10 @@ configure_file(
  ${piglit_SOURCE_DIR}/tests/util/config.h.in
  ${piglit_BINARY_DIR}/tests/util/config.h
   )
  +configure_file(
  +   ${piglit_SOURCE_DIR}/tests/ocl_config.py.in
  +   ${piglit_BINARY_DIR}/tests/ocl_config.py
  +)
  
   include(cmake/piglit_util.cmake)
   include(cmake/piglit_glapi.cmake)
  diff --git a/tests/all_cl.py b/tests/all_cl.py
  index a7d7106..b9c112a 100644
  --- a/tests/all_cl.py
  +++ b/tests/all_cl.py
  @@ -7,6 +7,8 @@ __all__ = ['profile']
   import os
   import os.path as path
  
  +from tests.opencv import add_opencv_tests
  +
   from framework.core import Group, TestProfile
   from framework.exectest import PlainExecTest
  
  @@ -122,3 +124,5 @@ add_program_test_dir(program_execute_builtin,
  'generated_tests/cl/builtin/relati program_execute_store = Group()
   program[Execute][Store] = program_execute_store
   add_program_test_dir(program_execute_store, 'generated_tests/cl/store')
  +
  +add_opencv_tests(profile)
  diff --git a/tests/cl/program/execute/opencv-merge-hist.cl
  b/tests/cl/program/execute/opencv-merge-hist.cl deleted file mode 100644
  index 8dccf24..000
  --- a/tests/cl/program/execute/opencv-merge-hist.cl
  +++ /dev/null
  @@ -1,98 +0,0 @@
  -/*!
  -[config]
  -name: OpenCV merge-hist
  -kernel_name: merge_hist
  -dimensions: 1
  -global_size: 65536 1 1
  -local_size: 256 1 1
  -
  -# This test checks that the loop:
  -# for(int stride = HISTOGRAM256_WORK_GROUP_SIZE /2; stride  0; stride =
  1) -# in this kernel is unrolled correctly or not unrolled at all.  The
  Clang -# OpenCL frontend was unrolling this in way that created illegal
  uses of the -# barrier() builtin which resulted in GPU hangs on r600g.
  -[test]
  -arg_in:  0 buffer int[65536] repeat 0
  -arg_out: 1 buffer int[256]   repeat 0
  -arg_in:  2 int 256
  -
  -!*/
  -
  -// The kernel in this test is taken from the opencv library (opencv.org)
  -// File: modules/ocl/src/opencl/imgproc_histogram.cl
  -//
  -//   License Agreement
  -//For Open Source Computer Vision Library
  -//
  -// Copyright (C) 2010-2012, Institute Of Software Chinese Academy Of
  Science, all rights reserved. -// Copyright (C) 2010-2012, Advanced Micro
  Devices, Inc., all rights reserved. -// Copyright (C) 2010-2012,
  Multicoreware, Inc., all rights reserved. -// Third party copyrights are
  property of their respective owners. -//
  -// @Authors
  -//Niko Li, newlife20080...@gmail.com
  -//Jia Haipeng, jiahaipen...@gmail.com
  -//Xu Pang, pangxu...@163.com
  -//Wenju He, we...@multicorewareinc.com
  -// Redistribution and use in source and binary forms, with or without
  modification, -// are permitted provided that the following conditions are
  met:
  -//
  -//   * 

Re: [Mesa-dev] [PATCH] cl: Add support for OpenCV unit tests v2

2014-01-19 Thread Dylan Baker
I think you meant to ping the piglit list not mesa dev :)

In general this looks a lot better, I've got a few little things for you

On Friday, January 17, 2014 02:30:13 PM Tom Stellard wrote:
 From: Tom Stellard thomas.stell...@amd.com
 
 This enables piglit to run and interpret the results from OpenCV's
 gtest based opencv_test_ocl program.
 
 This patch adds two new CMake configuration variables:
 
 OPENCL_OpenCVTestOCL_BINDIR: You can use this variable to enable
 the OpenCV tests by setting it to the full path of the
 bin directory in your opencv build tree (e.g. /home/user/opencv/build/bin).
 
 OPENCL_OpenCVTestOCL_WORKDIR: (Optional)If you don't want to use
 OpenCV's default work directory, you can use this variable to specify
 a different one.
 
 v2:
   - Python code cleanups
 
 XXX: opencv
 ---
  CMakeLists.txt|  9 ++-
  tests/all_cl.py   |  4 ++
  tests/cl/program/execute/opencv-merge-hist.cl | 98
 --- tests/ocl_config.py.in|
 31 +
  tests/opencv.py   | 76 +
  5 files changed, 119 insertions(+), 99 deletions(-)
  delete mode 100644 tests/cl/program/execute/opencv-merge-hist.cl
  create mode 100644 tests/ocl_config.py.in
  create mode 100644 tests/opencv.py
 
 diff --git a/CMakeLists.txt b/CMakeLists.txt
 index 1befffb..37eac65 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
 @@ -92,7 +92,10 @@ if(PIGLIT_BUILD_GLES3_TESTS AND NOT PIGLIT_USE_WAFFLE)
  endif(PIGLIT_BUILD_GLES3_TESTS AND NOT PIGLIT_USE_WAFFLE)
 
  if(PIGLIT_BUILD_CL_TESTS)
 - find_package(OpenCL REQUIRED)
 +find_package(OpenCL REQUIRED)
 +set(OPENCL_OpenCVTestOCL_BINDIR  CACHE STRING Directory with the
 opencv_ocl_test program ) +set(OPENCL_OpenCVTestOCL_WORKDIR 
 CACHE STRING
 +Directory with the opencv test resources (This is not needed
 if your OpenCV build directory was $(opencv_src_dir)/build ) )
 endif(PIGLIT_BUILD_CL_TESTS)
 
  IF(${CMAKE_SYSTEM_NAME} MATCHES Linux)
 @@ -356,6 +359,10 @@ configure_file(
   ${piglit_SOURCE_DIR}/tests/util/config.h.in
   ${piglit_BINARY_DIR}/tests/util/config.h
  )
 +configure_file(
 + ${piglit_SOURCE_DIR}/tests/ocl_config.py.in
 + ${piglit_BINARY_DIR}/tests/ocl_config.py
 +)
 
  include(cmake/piglit_util.cmake)
  include(cmake/piglit_glapi.cmake)
 diff --git a/tests/all_cl.py b/tests/all_cl.py
 index a7d7106..b9c112a 100644
 --- a/tests/all_cl.py
 +++ b/tests/all_cl.py
 @@ -7,6 +7,8 @@ __all__ = ['profile']
  import os
  import os.path as path
 
 +from tests.opencv import add_opencv_tests
 +
  from framework.core import Group, TestProfile
  from framework.exectest import PlainExecTest
 
 @@ -122,3 +124,5 @@ add_program_test_dir(program_execute_builtin,
 'generated_tests/cl/builtin/relati program_execute_store = Group()
  program[Execute][Store] = program_execute_store
  add_program_test_dir(program_execute_store, 'generated_tests/cl/store')
 +
 +add_opencv_tests(profile)
 diff --git a/tests/cl/program/execute/opencv-merge-hist.cl
 b/tests/cl/program/execute/opencv-merge-hist.cl deleted file mode 100644
 index 8dccf24..000
 --- a/tests/cl/program/execute/opencv-merge-hist.cl
 +++ /dev/null
 @@ -1,98 +0,0 @@
 -/*!
 -[config]
 -name: OpenCV merge-hist
 -kernel_name: merge_hist
 -dimensions: 1
 -global_size: 65536 1 1
 -local_size: 256 1 1
 -
 -# This test checks that the loop:
 -# for(int stride = HISTOGRAM256_WORK_GROUP_SIZE /2; stride  0; stride =
 1) -# in this kernel is unrolled correctly or not unrolled at all.  The
 Clang -# OpenCL frontend was unrolling this in way that created illegal
 uses of the -# barrier() builtin which resulted in GPU hangs on r600g.
 -[test]
 -arg_in:  0 buffer int[65536] repeat 0
 -arg_out: 1 buffer int[256]   repeat 0
 -arg_in:  2 int 256
 -
 -!*/
 -
 -// The kernel in this test is taken from the opencv library (opencv.org)
 -// File: modules/ocl/src/opencl/imgproc_histogram.cl
 -//
 -//   License Agreement
 -//For Open Source Computer Vision Library
 -//
 -// Copyright (C) 2010-2012, Institute Of Software Chinese Academy Of
 Science, all rights reserved. -// Copyright (C) 2010-2012, Advanced Micro
 Devices, Inc., all rights reserved. -// Copyright (C) 2010-2012,
 Multicoreware, Inc., all rights reserved. -// Third party copyrights are
 property of their respective owners. -//
 -// @Authors
 -//Niko Li, newlife20080...@gmail.com
 -//Jia Haipeng, jiahaipen...@gmail.com
 -//Xu Pang, pangxu...@163.com
 -//Wenju He, we...@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 

[Mesa-dev] [PATCH] cl: Add support for OpenCV unit tests v2

2014-01-17 Thread Tom Stellard
From: Tom Stellard thomas.stell...@amd.com

This enables piglit to run and interpret the results from OpenCV's
gtest based opencv_test_ocl program.

This patch adds two new CMake configuration variables:

OPENCL_OpenCVTestOCL_BINDIR: You can use this variable to enable
the OpenCV tests by setting it to the full path of the
bin directory in your opencv build tree (e.g. /home/user/opencv/build/bin).

OPENCL_OpenCVTestOCL_WORKDIR: (Optional)If you don't want to use
OpenCV's default work directory, you can use this variable to specify
a different one.

v2:
  - Python code cleanups

XXX: opencv
---
 CMakeLists.txt|  9 ++-
 tests/all_cl.py   |  4 ++
 tests/cl/program/execute/opencv-merge-hist.cl | 98 ---
 tests/ocl_config.py.in| 31 +
 tests/opencv.py   | 76 +
 5 files changed, 119 insertions(+), 99 deletions(-)
 delete mode 100644 tests/cl/program/execute/opencv-merge-hist.cl
 create mode 100644 tests/ocl_config.py.in
 create mode 100644 tests/opencv.py

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1befffb..37eac65 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -92,7 +92,10 @@ if(PIGLIT_BUILD_GLES3_TESTS AND NOT PIGLIT_USE_WAFFLE)
 endif(PIGLIT_BUILD_GLES3_TESTS AND NOT PIGLIT_USE_WAFFLE)
 
 if(PIGLIT_BUILD_CL_TESTS)
-   find_package(OpenCL REQUIRED)
+find_package(OpenCL REQUIRED)
+set(OPENCL_OpenCVTestOCL_BINDIR  CACHE STRING Directory with the 
opencv_ocl_test program )
+set(OPENCL_OpenCVTestOCL_WORKDIR  CACHE STRING
+Directory with the opencv test resources (This is not needed if 
your OpenCV build directory was $(opencv_src_dir)/build ) )
 endif(PIGLIT_BUILD_CL_TESTS)
 
 IF(${CMAKE_SYSTEM_NAME} MATCHES Linux)
@@ -356,6 +359,10 @@ configure_file(
${piglit_SOURCE_DIR}/tests/util/config.h.in
${piglit_BINARY_DIR}/tests/util/config.h
 )
+configure_file(
+   ${piglit_SOURCE_DIR}/tests/ocl_config.py.in
+   ${piglit_BINARY_DIR}/tests/ocl_config.py
+)
 
 include(cmake/piglit_util.cmake)
 include(cmake/piglit_glapi.cmake)
diff --git a/tests/all_cl.py b/tests/all_cl.py
index a7d7106..b9c112a 100644
--- a/tests/all_cl.py
+++ b/tests/all_cl.py
@@ -7,6 +7,8 @@ __all__ = ['profile']
 import os
 import os.path as path
 
+from tests.opencv import add_opencv_tests
+
 from framework.core import Group, TestProfile
 from framework.exectest import PlainExecTest
 
@@ -122,3 +124,5 @@ add_program_test_dir(program_execute_builtin, 
'generated_tests/cl/builtin/relati
 program_execute_store = Group()
 program[Execute][Store] = program_execute_store
 add_program_test_dir(program_execute_store, 'generated_tests/cl/store')
+
+add_opencv_tests(profile)
diff --git a/tests/cl/program/execute/opencv-merge-hist.cl 
b/tests/cl/program/execute/opencv-merge-hist.cl
deleted file mode 100644
index 8dccf24..000
--- a/tests/cl/program/execute/opencv-merge-hist.cl
+++ /dev/null
@@ -1,98 +0,0 @@
-/*!
-[config]
-name: OpenCV merge-hist
-kernel_name: merge_hist
-dimensions: 1
-global_size: 65536 1 1
-local_size: 256 1 1
-
-# This test checks that the loop:
-# for(int stride = HISTOGRAM256_WORK_GROUP_SIZE /2; stride  0; stride = 1)
-# in this kernel is unrolled correctly or not unrolled at all.  The Clang
-# OpenCL frontend was unrolling this in way that created illegal uses of the
-# barrier() builtin which resulted in GPU hangs on r600g.
-[test]
-arg_in:  0 buffer int[65536] repeat 0
-arg_out: 1 buffer int[256]   repeat 0
-arg_in:  2 int 256
-
-!*/
-
-// The kernel in this test is taken from the opencv library (opencv.org)
-// File: modules/ocl/src/opencl/imgproc_histogram.cl
-//
-//   License Agreement
-//For Open Source Computer Vision Library
-//
-// Copyright (C) 2010-2012, Institute Of Software Chinese Academy Of Science, 
all rights reserved.
-// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
-// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
-// Third party copyrights are property of their respective owners.
-//
-// @Authors
-//Niko Li, newlife20080...@gmail.com
-//Jia Haipeng, jiahaipen...@gmail.com
-//Xu Pang, pangxu...@163.com
-//Wenju He, we...@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 GpuMaterials provided with the distribution.
-//
-//   * The name of the copyright holders may not be used to endorse or promote 
products
-// derived