[Beignet] [PATCH 2/2] add a unit test for clenqueuemap rowpitch parameter.

Zhigang Gong zhigang.gong at linux.intel.com
Mon Sep 2 19:45:14 PDT 2013


Chuan,

 

Thanks for the patch, but it's not in a correct format. You need to commit
your change locally,

and then use git format-patch to generate patchset and then use git
send-email to send the

patchset to this list.

 

From: beignet-bounces+zhigang.gong=linux.intel.com at lists.freedesktop.org
[mailto:beignet-bounces+zhigang.gong=linux.intel.com at lists.freedesktop.org]
On Behalf Of He, Chuan
Sent: Monday, September 2, 2013 6:04 PM
To: beignet at lists.freedesktop.org
Cc: Zhigang Gong
Subject: [Beignet] [PATCH 2/2] add a unit test for clenqueuemap rowpitch
parameter.

 

Hi, everyone. I add a unit test and I have committed it, but I'm wondering
whether I'm using git the same way as you do.

 

---

...nment.cl => test_rowpitch_clenqueuemapimage.cl} |    2 +-

utests/CMakeLists.txt                              |    2 +-

....cpp => runtime_rowpitch_clenqueuemapimage.cpp} |   35
+++++++++-----------

3 files changed, 18 insertions(+), 21 deletions(-)

rename kernels/{test_map_alignment.cl => test_rowpitch_clenqueuemapimage.cl}
(76%)

rename utests/{runtime_map_alignment.cpp =>
runtime_rowpitch_clenqueuemapimage.cpp} (50%)

 

diff --git a/kernels/test_map_alignment.cl
b/kernels/test_rowpitch_clenqueuemapimage.cl

similarity index 76%

rename from kernels/test_map_alignment.cl

rename to kernels/test_rowpitch_clenqueuemapimage.cl

index 874f75c..d27c090 100644

--- a/kernels/test_map_alignment.cl

+++ b/kernels/test_rowpitch_clenqueuemapimage.cl

@@ -1,5 +1,5 @@

__kernel void 

-test_map_alignment(__write_only image2d_t out) {

+test_rowpitch_clenqueuemapimage(__write_only image2d_t out) {

     int2 loc = (int2)(get_global_id(0), get_global_id(1));

     int4 pixel;

     pixel.s0 = 1;

diff --git a/utests/CMakeLists.txt b/utests/CMakeLists.txt

index 46284a0..aebd950 100644

--- a/utests/CMakeLists.txt

+++ b/utests/CMakeLists.txt

@@ -123,6 +123,7 @@ set (utests_sources

   runtime_createcontext.cpp

   runtime_null_kernel_arg.cpp

         runtime_event.cpp

+  runtime_rowpitch_clenqueuemapimage.cpp

   compiler_double.cpp

   compiler_double_2.cpp

   compiler_double_3.cpp

@@ -135,7 +136,6 @@ set (utests_sources

   compiler_long_asr.cpp

   compiler_long_mult.cpp

   compiler_long_cmp.cpp

-  runtime_map_alignment.cpp

   utest_assert.cpp

   utest.cpp

   utest_file_map.cpp

diff --git a/utests/runtime_map_alignment.cpp
b/utests/runtime_rowpitch_clenqueuemapimage.cpp

similarity index 50%

rename from utests/runtime_map_alignment.cpp

rename to utests/runtime_rowpitch_clenqueuemapimage.cpp

index d0868ae..bd71e95 100644

--- a/utests/runtime_map_alignment.cpp

+++ b/utests/runtime_rowpitch_clenqueuemapimage.cpp

@@ -1,20 +1,18 @@

#include "utest_helper.hpp"

 

-static void runtime_map_alignment(void) 

+static void runtime_rowpitch_clenqueuemapimage(void) 

{

-    const int W = 16, H = 16;

+    const size_t W = 16, H = 16;

     cl_image_format format;

 

     buf_data[0] = (uint32_t *) malloc(sizeof(uint32_t) * W * H);

     for(uint32_t j = 0; j < H; ++j)

         for(uint32_t i = 0; i < W; i++)

             ((uint32_t*)buf_data[0])[j*W+i] = 0;

-    //OCL_CREATE_KERNEL_FROM_FILE("compiler_enqueue", kernel_name);

-    OCL_CREATE_KERNEL("test_map_alignment");

+    OCL_CREATE_KERNEL("test_rowpitch_clenqueuemapimage");

 

     format.image_channel_order = CL_RGBA;

     format.image_channel_data_type = CL_UNSIGNED_INT8;

-    //OCL_CREATE_IMAGE2D(buf[0], CL_MEM_COPY_HOST_PTR, &format, W, H, W *
sizeof(uint32_t), NULL);

     OCL_CREATE_IMAGE2D(buf[0], 0, &format, W, H, 0, NULL);

     OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]);

     globals[0] = W;

@@ -23,24 +21,23 @@ static void runtime_map_alignment(void)

     locals[1] = 16;

     OCL_NDRANGE(2);

 

-    /*const size_t origin[] = {0,0,0}, region[] = {W,H,1};

+    const size_t origin[] = {0,0,0}, region[] = {W,H,1};

     size_t image_row_pitch = W * 32;

     size_t image_slice_pitch = H * image_row_pitch;

-    cl_int * ret;

-    uint *xx = (uint *) clEnqueueMapImage(x_cmd_q,

-                   x_mem_out_1, // cl_mem            buffer,

+    cl_int ret;

+    buf_data[0] = (uint32_t *) clEnqueueMapImage(queue,

+                   buf[0],      // cl_mem            buffer,

                    CL_TRUE,     // cl_bool           blocking_map,

-                   CL_MAP_READ,           // cl_map_flags      map_flags,

-                   origin,           // size_t            origin[3],

-                   region,    // size_t            region[3],

-                   &image_row_pitch,           // size_t * image_row_pitch,

+                   CL_MAP_READ, // cl_map_flags      map_flags,

+                   origin,      // size_t            origin[3],

+                   region,      // size_t            region[3],

+                   &image_row_pitch,         // size_t * image_row_pitch,

                    &image_slice_pitch,       //size_t * image_slice_pitch,

                    0,           // cl_uint num_event_in_wait_list 

-                   nullptr,     // const cl_event *  event_wait_list,

-                   nullptr,     // cl_event *        event,

-                   & err        // cl_int *          errcode_ret

-                 );*/

-    OCL_MAP_BUFFER(0);

+                   NULL,        // const cl_event *  event_wait_list,

+                   NULL,        // cl_event *        event,

+                   & ret        // cl_int *          errcode_ret

+                 );

     for(uint32_t j = 0; j < H; ++j)

         for(uint32_t i = 0; i < W; i++)

             //printf("j=%d i=%d data=0x%x\n", j, i,
((uint32_t*)buf_data[0])[j*W+i]);

@@ -48,4 +45,4 @@ static void runtime_map_alignment(void)

     OCL_UNMAP_BUFFER(0);

}

 

-MAKE_UTEST_FROM_FUNCTION(runtime_map_alignment);

+MAKE_UTEST_FROM_FUNCTION(runtime_rowpitch_clenqueuemapimage);

-- 

1.7.9.5

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/beignet/attachments/20130903/6c141a1a/attachment-0001.html>


More information about the Beignet mailing list