[Piglit] [PATCH v5] cl: add clEnqueue-read_write BufferRect releated tests

2015-08-03 Thread Meng Mengmeng
It's a simple function test for clEnqueueReadBufferRect and
clEnqueueWriteBufferRect.
---
 tests/cl.py   |   2 +
 tests/cl/api/CMakeLists.cl.txt|   1 +
 tests/cl/api/enqueue-read_write-buffer-rect.c | 338 ++
 3 files changed, 341 insertions(+)
 create mode 100644 tests/cl/api/enqueue-read_write-buffer-rect.c

diff --git a/tests/cl.py b/tests/cl.py
index 4668ddc..572ccdc 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -58,6 +58,8 @@ 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-read_write-buffer-rect'],
+  'clEnqueueReadBufferRect and clEnqueueWriteBufferRect')
 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..f0a388f 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-read_write-buffer-rect 
enqueue-read_write-buffer-rect.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-read_write-buffer-rect.c 
b/tests/cl/api/enqueue-read_write-buffer-rect.c
new file mode 100644
index 000..6f7d2ca
--- /dev/null
+++ b/tests/cl/api/enqueue-read_write-buffer-rect.c
@@ -0,0 +1,338 @@
+/*
+ * Copyright © 2015 Intel Corporation
+ *
+ * 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: Meng Mengmeng mengmeng.meng at intel.com
+ *
+ */
+
+#include piglit-framework-cl-api.h
+#include piglit-util-cl.h
+
+
+PIGLIT_CL_API_TEST_CONFIG_BEGIN
+
+   config.name = clEnqueueReadBufferRect and clEnqueueWriteBufferRect;
+   config.version_min = 11;
+
+   config.run_per_platform = true;
+   config.create_context = true;
+
+PIGLIT_CL_API_TEST_CONFIG_END
+
+static bool
+test_read_rect(cl_command_queue command_queue,
+   cl_mem buffer,
+   cl_bool blocking_read,
+   const size_t * buffer_origin,
+   const size_t * host_origin,
+   const size_t * region,
+   size_t buffer_row_pitch,
+   size_t buffer_slice_pitch,
+   size_t host_row_pitch,
+   size_t host_slice_pitch,
+   void *ptr,
+   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 = clEnqueueReadBufferRect(command_queue,
+   buffer,
+   blocking_read,
+   buffer_origin,
+   host_origin,
+   region,
+   buffer_row_pitch,
+   buffer_slice_pitch,
+   host_row_pitch,
+   host_slice_pitch,
+   ptr,
+   num_events_in_wait_list

Re: [Piglit] [PATCH v4] cl: add clEnqueue-read_write BufferRect releated tests

2015-08-03 Thread Meng, Mengmeng
Oh, it's my negligence. I need to resend out a final edition.
I'm very grateful for your careful and repeated reviewing.


Thanks,
Meng

-Original Message-
From: EdB [mailto:edb+pig...@sigluy.net] 
Sent: Thursday, July 30, 2015 7:42 PM
To: piglit@lists.freedesktop.org
Cc: Meng, Mengmeng
Subject: Re: [Piglit] [PATCH v4] cl: add clEnqueue-read_write BufferRect 
releated tests

On Thursday 30 July 2015 19:04:47 Meng Mengmeng wrote:
 It's a simple function test for clEnqueueReadBufferRect and 
 clEnqueueWriteBufferRect.
 ---
  tests/cl.py   |   2 +
  tests/cl/api/CMakeLists.cl.txt|   1 +
  tests/cl/api/enqueue-read_write-buffer-rect.c | 338
 ++ 3 files changed, 341 insertions(+)
  create mode 100644 tests/cl/api/enqueue-read_write-buffer-rect.c
 
 diff --git a/tests/cl.py b/tests/cl.py index c55d3dd..7fce00a 100644
 --- a/tests/cl.py
 +++ b/tests/cl.py
 @@ -58,6 +58,8 @@ 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-read_write-buffer-rect'],
 +  'clEnqueueReadBufferRect and clEnqueueWriteBufferRect')
  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 7e78491..e1a25fa 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-read_write-buffer-rect
 enqueue-read_write-buffer-rect.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-read_write-buffer-rect.c
 b/tests/cl/api/enqueue-read_write-buffer-rect.c new file mode 100644 
 index 000..46dbaac
 --- /dev/null
 +++ b/tests/cl/api/enqueue-read_write-buffer-rect.c
 @@ -0,0 +1,338 @@
 +/*
 + * Copyright (c) 2015 Intel Corporation
 + *
 + * 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: Meng Mengmeng mengmeng.meng at intel.com
 + *
 + */
 +
 +#include piglit-framework-cl-api.h
 +#include piglit-util-cl.h
 +
 +
 +PIGLIT_CL_API_TEST_CONFIG_BEGIN
 +
 + config.name = clEnqueueReadBufferRect and clEnqueueWriteBufferRect;
 + config.version_min = 11;
 +
 + config.run_per_platform = true;
 + config.create_context = true;
 +
 +PIGLIT_CL_API_TEST_CONFIG_END
 +
 +static bool
 +test_read_rect(cl_command_queue command_queue,
 +   cl_mem buffer,
 +   cl_bool blocking_read,
 +   const size_t * buffer_origin,
 +   const size_t * host_origin,
 +   const size_t * region,
 +   size_t buffer_row_pitch,
 +   size_t buffer_slice_pitch,
 +   size_t host_row_pitch,
 +   size_t host_slice_pitch,
 +   void *ptr,
 +   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 = clEnqueueReadBufferRect(command_queue,
 + buffer

[Piglit] [PATCH v4] cl: add clEnqueue-read_write BufferRect releated tests

2015-07-29 Thread Meng Mengmeng
It's a simple function test for clEnqueueReadBufferRect and
clEnqueueWriteBufferRect.
---
 tests/cl.py   |   2 +
 tests/cl/api/CMakeLists.cl.txt|   1 +
 tests/cl/api/enqueue-read_write-buffer-rect.c | 338 ++
 3 files changed, 341 insertions(+)
 create mode 100644 tests/cl/api/enqueue-read_write-buffer-rect.c

diff --git a/tests/cl.py b/tests/cl.py
index c55d3dd..7fce00a 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -58,6 +58,8 @@ 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-read_write-buffer-rect'],
+  'clEnqueueReadBufferRect and clEnqueueWriteBufferRect')
 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 7e78491..e1a25fa 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-read_write-buffer-rect 
enqueue-read_write-buffer-rect.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-read_write-buffer-rect.c 
b/tests/cl/api/enqueue-read_write-buffer-rect.c
new file mode 100644
index 000..46dbaac
--- /dev/null
+++ b/tests/cl/api/enqueue-read_write-buffer-rect.c
@@ -0,0 +1,338 @@
+/*
+ * Copyright © 2015 Intel Corporation
+ *
+ * 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: Meng Mengmeng mengmeng.meng at intel.com
+ *
+ */
+
+#include piglit-framework-cl-api.h
+#include piglit-util-cl.h
+
+
+PIGLIT_CL_API_TEST_CONFIG_BEGIN
+
+   config.name = clEnqueueReadBufferRect and clEnqueueWriteBufferRect;
+   config.version_min = 11;
+
+   config.run_per_platform = true;
+   config.create_context = true;
+
+PIGLIT_CL_API_TEST_CONFIG_END
+
+static bool
+test_read_rect(cl_command_queue command_queue,
+   cl_mem buffer,
+   cl_bool blocking_read,
+   const size_t * buffer_origin,
+   const size_t * host_origin,
+   const size_t * region,
+   size_t buffer_row_pitch,
+   size_t buffer_slice_pitch,
+   size_t host_row_pitch,
+   size_t host_slice_pitch,
+   void *ptr,
+   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 = clEnqueueReadBufferRect(command_queue,
+   buffer,
+   blocking_read,
+   buffer_origin,
+   host_origin,
+   region,
+   buffer_row_pitch,
+   buffer_slice_pitch,
+   host_row_pitch,
+   host_slice_pitch,
+   ptr,
+   num_events_in_wait_list

Re: [Piglit] [PATCH v3] cl: add clEnqueue-read_write BufferRect releated tests

2015-07-29 Thread Meng, Mengmeng
Very thanks for your reviewing:)
The v4 will fix the code format issues.

-Original Message-
From: EdB [mailto:edb+pig...@sigluy.net] 
Sent: Tuesday, July 28, 2015 10:19 PM
To: piglit@lists.freedesktop.org
Cc: Meng, Mengmeng
Subject: Re: [Piglit] [PATCH v3] cl: add clEnqueue-read_write BufferRect 
releated tests

Hello

Thanks for the patch, some comments bellow.

On Friday 10 July 2015 20:17:52 Meng Mengmeng wrote:
 It's a simple function test for clEnqueueReadBufferRect and 
 clEnqueueWriteBufferRect. ---
  tests/cl.py   |   2 +
  tests/cl/api/CMakeLists.cl.txt|   1 +
  tests/cl/api/enqueue-read_write-buffer-rect.c | 330
 ++ 3 files changed, 333 insertions(+)
  create mode 100644 tests/cl/api/enqueue-read_write-buffer-rect.c
 
 diff --git a/tests/cl.py b/tests/cl.py index c55d3dd..7fce00a 100644
 --- a/tests/cl.py
 +++ b/tests/cl.py
 @@ -58,6 +58,8 @@ 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-read_write-buffer-rect'],
 +  'clEnqueueReadBufferRect and clEnqueueWriteBufferRect')
  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 7e78491..e1a25fa 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-read_write-buffer-rect
 enqueue-read_write-buffer-rect.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-read_write-buffer-rect.c
 b/tests/cl/api/enqueue-read_write-buffer-rect.c new file mode 100644 
 index 000..c91e930
 --- /dev/null
 +++ b/tests/cl/api/enqueue-read_write-buffer-rect.c
 @@ -0,0 +1,330 @@
 +/*
 + * Copyright (c) 2015 Intel Corporation
 + *
 + * 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: Meng Mengmeng mengmeng.meng at intel.com
 + *
 + */
 +
 +#include piglit-framework-cl-api.h
 +#include piglit-util-cl.h
 +
 +
 +PIGLIT_CL_API_TEST_CONFIG_BEGIN
 +
 + config.name = clEnqueueReadBufferRect and clEnqueueWriteBufferRect;
 + config.version_min = 11;
 +
 + config.run_per_platform = true;
 + config.create_context = true;
 +
 +PIGLIT_CL_API_TEST_CONFIG_END
 +
 +static bool
 +test_read_rect(cl_command_queue command_queue,
 + cl_mem buffer,
 + cl_bool blocking_read,
 + const size_t * buffer_origin,
 + const size_t * host_origin,
 + const size_t * region,
 + size_t buffer_row_pitch,
 + size_t buffer_slice_pitch,
 + size_t host_row_pitch,
 + size_t host_slice_pitch,
 + void *ptr,
 + 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 = clEnqueueReadBufferRect(command_queue,
 + buffer,
 + blocking_read,
 + buffer_origin,
 + host_origin,
 + region,
 + buffer_row_pitch,
 + buffer_slice_pitch,
 + host_row_pitch

[Piglit] [PATCH v3] cl: add clEnqueue-read_write BufferRect releated tests

2015-07-09 Thread Meng Mengmeng
It's a simple function test for clEnqueueReadBufferRect and 
clEnqueueWriteBufferRect.
---
 tests/cl.py   |   2 +
 tests/cl/api/CMakeLists.cl.txt|   1 +
 tests/cl/api/enqueue-read_write-buffer-rect.c | 330 ++
 3 files changed, 333 insertions(+)
 create mode 100644 tests/cl/api/enqueue-read_write-buffer-rect.c

diff --git a/tests/cl.py b/tests/cl.py
index c55d3dd..7fce00a 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -58,6 +58,8 @@ 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-read_write-buffer-rect'],
+  'clEnqueueReadBufferRect and clEnqueueWriteBufferRect')
 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 7e78491..e1a25fa 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-read_write-buffer-rect 
enqueue-read_write-buffer-rect.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-read_write-buffer-rect.c 
b/tests/cl/api/enqueue-read_write-buffer-rect.c
new file mode 100644
index 000..c91e930
--- /dev/null
+++ b/tests/cl/api/enqueue-read_write-buffer-rect.c
@@ -0,0 +1,330 @@
+/*
+ * Copyright ?? 2015 Intel Corporation
+ *
+ * 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: Meng Mengmeng mengmeng.meng at intel.com
+ *
+ */
+
+#include piglit-framework-cl-api.h
+#include piglit-util-cl.h
+
+
+PIGLIT_CL_API_TEST_CONFIG_BEGIN
+
+   config.name = clEnqueueReadBufferRect and clEnqueueWriteBufferRect;
+   config.version_min = 11;
+
+   config.run_per_platform = true;
+   config.create_context = true;
+
+PIGLIT_CL_API_TEST_CONFIG_END
+
+static bool
+test_read_rect(cl_command_queue command_queue,
+   cl_mem buffer,
+   cl_bool blocking_read,
+   const size_t * buffer_origin,
+   const size_t * host_origin,
+   const size_t * region,
+   size_t buffer_row_pitch,
+   size_t buffer_slice_pitch,
+   size_t host_row_pitch,
+   size_t host_slice_pitch,
+   void *ptr,
+   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 = clEnqueueReadBufferRect(command_queue,
+   buffer,
+   blocking_read,
+   buffer_origin,
+   host_origin,
+   region,
+   buffer_row_pitch,
+   buffer_slice_pitch,
+   host_row_pitch,
+   host_slice_pitch,
+   ptr,
+   num_events_in_wait_list,
+   event_wait_list,
+   event);
+
+   if(!piglit_cl_check_error(errNo, expected_error)) {
+   fprintf(stderr, clEnqueueReadBufferRect: Failed (error code: 
%s): %s.\n,
+   piglit_cl_get_error_name(errNo), test_str);
+   piglit_merge_result(result, PIGLIT_FAIL);
+   return false;
+   }
+
+   return true;
+}
+
+static bool

[Piglit] [PATCH] cl 2.0: Add to_global tests

2015-07-02 Thread Meng Mengmeng
cl 2.0 spec adds address space qualifier function: to_global, 
to_local,to_private, get_fence.
It's to_global function test.
---
 tests/cl.py|  3 +
 .../address_space_qualifier_to_global-2.0.cl   | 65 ++
 2 files changed, 68 insertions(+)
 create mode 100644 
tests/cl/program/execute/builtin/address_space_qualifier/address_space_qualifier_to_global-2.0.cl

diff --git a/tests/cl.py b/tests/cl.py
index c55d3dd..ebab384 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -116,6 +116,9 @@ add_program_test_dir(grouptools.join('program', 'execute'),
 add_program_test_dir(grouptools.join('program', 'execute'),
  os.path.join(TESTS_DIR, 'cl', 'program', 'execute',
   'builtin', 'convert'))
+add_program_test_dir(grouptools.join('program', 'execute'),
+ os.path.join(TESTS_DIR, 'cl', 'program', 'execute',
+  'builtin', 'address_space_qualifier'))
 
 # Run generated built-in tests
 add_program_test_dir(grouptools.join('program', 'execute', 'builtin'),
diff --git 
a/tests/cl/program/execute/builtin/address_space_qualifier/address_space_qualifier_to_global-2.0.cl
 
b/tests/cl/program/execute/builtin/address_space_qualifier/address_space_qualifier_to_global-2.0.cl
new file mode 100644
index 000..814b1aa
--- /dev/null
+++ 
b/tests/cl/program/execute/builtin/address_space_qualifier/address_space_qualifier_to_global-2.0.cl
@@ -0,0 +1,65 @@
+/*!
+[config]
+name: Test to_global built-in on CL 2.0
+clc_version_min: 20
+dimensions: 1
+
+[test]
+name: to_global test scalar
+kernel_name: test_1_to_global
+global_size: 1 0 0
+arg_out: 0 buffer int[1] 0
+arg_in: 1 buffer int[1] 0
+
+[test]
+name: to_global test struct
+kernel_name: test_2_to_global
+global_size: 1 0 0
+arg_out: 0 buffer int[1] 0
+arg_in: 1 buffer int[1] 0
+!*/
+__kernel void test_1_to_global(__global int* out, __global int* in0){
+   __local float lfloat;
+   lfloat = 0.0;
+   char pchar = '0';
+   
+   int failures = 0;
+   if (to_global(in0[get_global_id(0)]) == NULL)
+   failures++;
+   if (to_global(lfloat) != NULL)
+   failures++;
+   if (to_global(pchar) != NULL)
+   failures++;
+
+   out[get_global_id(0)] = failures;
+}
+
+__kernel void test_2_to_global(__global int* out, __global int* in0){
+__local int lint;
+lint = 0;
+int pint = 0;
+
+   typedef struct {
+  int * a;
+} T;
+
+__global T * g_struct;
+g_struct.a = in0[get_global_id(0)];
+ 
+__local T * l_struct;
+l_struct.a = lint;
+
+__private T * p_struct;
+p_struct.a = pint;
+
+int failures = 0;
+if (to_global(g_struct.a) == NULL)
+failures++;
+if (to_global(l_struct.a) != NULL)
+failures++;
+if (to_global(p_struct.a) != NULL)
+failures++;
+
+out[get_global_id(0)] = failures;
+}
+
-- 
1.9.1

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


Re: [Piglit] [PATCH] cl: add enqueue-read_write-buffer-rect releated tests

2015-05-28 Thread Meng, Mengmeng
Thanks for your comments, I will send out a new v2 later.

Thanks,
Meng

-Original Message-
From: EdB [mailto:edb+pig...@sigluy.net] 
Sent: Thursday, May 28, 2015 4:52 PM
To: piglit@lists.freedesktop.org
Cc: Meng, Mengmeng
Subject: Re: [Piglit] [PATCH] cl: add enqueue-read_write-buffer-rect releated 
tests

On Thursday 28 May 2015 19:15:25 Meng Mengmeng wrote:
 ---
  tests/cl.py   |  2 +
  tests/cl/api/CMakeLists.cl.txt|  1 +
  tests/cl/api/enqueue-read_write-buffer-rect.c | 95
 +++ 3 files changed, 98 insertions(+)
  create mode 100644 tests/cl/api/enqueue-read_write-buffer-rect.c
 
 diff --git a/tests/cl.py b/tests/cl.py index c55d3dd..7fce00a 100644
 --- a/tests/cl.py
 +++ b/tests/cl.py
 @@ -58,6 +58,8 @@ 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-read_write-buffer-rect'],
 +  'clEnqueueReadBufferRect and clEnqueueWriteBufferRect')
  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 7e78491..e1a25fa 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-read_write-buffer-rect
 enqueue-read_write-buffer-rect.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-read_write-buffer-rect.c
 b/tests/cl/api/enqueue-read_write-buffer-rect.c new file mode 100644 
 index 000..891068f
 --- /dev/null
 +++ b/tests/cl/api/enqueue-read_write-buffer-rect.c
 @@ -0,0 +1,95 @@
 +/*
 + * Copyright (c) 2015 Intel Corporation
 + *
 + * 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: Meng Mengmeng mengmeng.m...@intel.com
 + *
 + */
 +
 +#include piglit-framework-cl-api.h
 +#include piglit-util-cl.h
 +
 +
 +PIGLIT_CL_API_TEST_CONFIG_BEGIN
 +
 + config.name = clEnqueueReadBufferRect and clEnqueueWriteBufferRect;
 + config.version_min = 12;

clEnqueue*BufferRect are also in CL1.1

 +
 + config.run_per_platform = true;
 + config.create_context = true;
 +
 +PIGLIT_CL_API_TEST_CONFIG_END
 +
 +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) {
 +
 + cl_int i, j, err;
 + cl_int k = 0;
 + float full_matrix[81], result_matrix[9];
 + const size_t buffer_origin[3] = {3*sizeof(float), 3, 0};
 + const size_t host_origin[3] = {3*sizeof(float), 3, 0};
 + const size_t host_new_origin[3] = {0*sizeof(float), 0, 0};
 + const size_t region[3] = {3*sizeof(float), 3, 1};
 + cl_mem matrix_buffer;
 +
 + for(i=0; i81; i++) {
 + full_matrix[i] = i*1.0f;
 + }
 + for(i=0; i9; i++) {
 + result_matrix[i] = 0.0f;
 + }
 +
 + float  reference_matrix[9]={30.0f, 31.0f, 32.0f, 39.0f, 40.0f, 
 +41.0f,
 48.0f, 49.0f, 50.0f}; +
 + cl_command_queue queue = env-context-command_queues[0];
 + matrix_buffer  = piglit_cl_create_buffer(env-context, 
 +CL_MEM_READ_WRITE ,
 sizeof

[Piglit] [PATCH v2] cl: add clEnqueue-read_write BufferRect releated tests

2015-05-28 Thread Meng Mengmeng
---
 tests/cl.py   |   2 +
 tests/cl/api/CMakeLists.cl.txt|   1 +
 tests/cl/api/enqueue-read_write-buffer-rect.c | 103 ++
 3 files changed, 106 insertions(+)
 create mode 100644 tests/cl/api/enqueue-read_write-buffer-rect.c

diff --git a/tests/cl.py b/tests/cl.py
index c55d3dd..7fce00a 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -58,6 +58,8 @@ 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-read_write-buffer-rect'],
+  'clEnqueueReadBufferRect and clEnqueueWriteBufferRect')
 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 7e78491..e1a25fa 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-read_write-buffer-rect 
enqueue-read_write-buffer-rect.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-read_write-buffer-rect.c 
b/tests/cl/api/enqueue-read_write-buffer-rect.c
new file mode 100644
index 000..3d7f06a
--- /dev/null
+++ b/tests/cl/api/enqueue-read_write-buffer-rect.c
@@ -0,0 +1,103 @@
+/*
+ * Copyright © 2015 Intel Corporation
+ *
+ * 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: Meng Mengmeng mengmeng.meng at intel.com
+ *
+ */
+
+#include piglit-framework-cl-api.h
+#include piglit-util-cl.h
+
+
+PIGLIT_CL_API_TEST_CONFIG_BEGIN
+
+   config.name = clEnqueueReadBufferRect and clEnqueueWriteBufferRect;
+   config.version_min = 11;
+
+   config.run_per_platform = true;
+   config.create_context = true;
+
+PIGLIT_CL_API_TEST_CONFIG_END
+
+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)
+{
+
+   cl_int i, j, err;
+   cl_int k = 0;
+   float full_matrix[81], result_matrix[9];
+   const size_t buffer_origin[3] = {3*sizeof(float), 3, 0};
+   const size_t host_origin[3] = {3*sizeof(float), 3, 0};
+   const size_t host_new_origin[3] = {0*sizeof(float), 0, 0};
+   const size_t region[3] = {3*sizeof(float), 3, 1};
+   cl_mem matrix_buffer;
+
+   for(i=0; i81; i++) {
+   full_matrix[i] = i*1.0f;
+   }
+   for(i=0; i9; i++) {
+   result_matrix[i] = 0.0f;
+   }
+
+   float  reference_matrix[9]={30.0f, 31.0f, 32.0f, 39.0f, 40.0f, 41.0f, 
48.0f, 49.0f, 50.0f};
+
+   cl_command_queue queue = env-context-command_queues[0];
+   matrix_buffer  = piglit_cl_create_buffer(env-context, 
CL_MEM_READ_WRITE , sizeof(full_matrix));
+   err = clEnqueueWriteBufferRect(queue, matrix_buffer, CL_TRUE,
+   buffer_origin, host_origin, region, 9*sizeof(float), 0,
+   9*sizeof(float), 0, full_matrix, 0, NULL, NULL);
+   if (!piglit_cl_check_error(err, CL_SUCCESS)) {
+   fprintf(stderr,
+   Failed (error code: %s): Write a host memory host into 
buffer by rectangular region.\n,
+   piglit_cl_get_error_name(err

[Piglit] [PATCH] cl: add enqueue-read_write-buffer-rect releated tests

2015-05-27 Thread Meng Mengmeng
---
 tests/cl.py   |  2 +
 tests/cl/api/CMakeLists.cl.txt|  1 +
 tests/cl/api/enqueue-read_write-buffer-rect.c | 95 +++
 3 files changed, 98 insertions(+)
 create mode 100644 tests/cl/api/enqueue-read_write-buffer-rect.c

diff --git a/tests/cl.py b/tests/cl.py
index c55d3dd..7fce00a 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -58,6 +58,8 @@ 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-read_write-buffer-rect'],
+  'clEnqueueReadBufferRect and clEnqueueWriteBufferRect')
 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 7e78491..e1a25fa 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-read_write-buffer-rect 
enqueue-read_write-buffer-rect.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-read_write-buffer-rect.c 
b/tests/cl/api/enqueue-read_write-buffer-rect.c
new file mode 100644
index 000..891068f
--- /dev/null
+++ b/tests/cl/api/enqueue-read_write-buffer-rect.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright © 2015 Intel Corporation
+ *
+ * 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: Meng Mengmeng mengmeng.m...@intel.com
+ *
+ */
+
+#include piglit-framework-cl-api.h
+#include piglit-util-cl.h
+
+
+PIGLIT_CL_API_TEST_CONFIG_BEGIN
+
+   config.name = clEnqueueReadBufferRect and clEnqueueWriteBufferRect;
+   config.version_min = 12;
+
+   config.run_per_platform = true;
+   config.create_context = true;
+
+PIGLIT_CL_API_TEST_CONFIG_END
+
+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)
+{
+
+   cl_int i, j, err;
+   cl_int k = 0;
+   float full_matrix[81], result_matrix[9];
+   const size_t buffer_origin[3] = {3*sizeof(float), 3, 0};
+   const size_t host_origin[3] = {3*sizeof(float), 3, 0};
+   const size_t host_new_origin[3] = {0*sizeof(float), 0, 0};
+   const size_t region[3] = {3*sizeof(float), 3, 1};
+   cl_mem matrix_buffer;
+
+   for(i=0; i81; i++) {
+   full_matrix[i] = i*1.0f;
+   }
+   for(i=0; i9; i++) {
+   result_matrix[i] = 0.0f;
+   }
+
+   float  reference_matrix[9]={30.0f, 31.0f, 32.0f, 39.0f, 40.0f, 41.0f, 
48.0f, 49.0f, 50.0f};
+
+   cl_command_queue queue = env-context-command_queues[0];
+   matrix_buffer  = piglit_cl_create_buffer(env-context, 
CL_MEM_READ_WRITE , sizeof(full_matrix));
+   err = clEnqueueWriteBufferRect(queue, matrix_buffer, CL_TRUE,
+   buffer_origin, host_origin, region, 9*sizeof(float), 0,
+   9*sizeof(float), 0, full_matrix, 0, NULL, NULL);
+   if (!piglit_cl_check_error(err, CL_SUCCESS)) {
+   return PIGLIT_FAIL;
+   }
+
+
+   err = clEnqueueReadBufferRect(queue, matrix_buffer, CL_TRUE,
+   buffer_origin, host_new_origin, region, 9*sizeof(float), 0,
+   3*sizeof

[Piglit] [PATCH] cl: Add exp tests

2015-01-03 Thread Meng Mengmeng
Signed-off-by: Meng Mengmeng mengmeng.m...@intel.com
---
 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..de7b94b 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' : 10
+},
 '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