[Beignet] [PATCH] utest: memset the output buffer to fix random fail.

Ruiling Song ruiling.song at intel.com
Tue Sep 3 00:39:56 PDT 2013


the inactive lanes will not modify corresponding output.
So, output buffer needs initialization to 0.

Signed-off-by: Ruiling Song <ruiling.song at intel.com>
---
 utests/compiler_group_size.cpp |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/utests/compiler_group_size.cpp b/utests/compiler_group_size.cpp
index 724d6e8..0c8881c 100644
--- a/utests/compiler_group_size.cpp
+++ b/utests/compiler_group_size.cpp
@@ -107,6 +107,10 @@ void compiler_group_size4(void)
     ((struct xyz*)buf_data[0])[0].o = 0;
     OCL_UNMAP_BUFFER(0);
 
+    OCL_MAP_BUFFER(1);
+    memset(((uint32_t*)buf_data[1]), 0x0, sizeof(uint32_t)*n);
+    OCL_UNMAP_BUFFER(1);
+
     OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]);
     OCL_SET_ARG(1, sizeof(cl_mem), &buf[1]);
     OCL_SET_ARG(2, sizeof(cl_int), &group_size[i]);
@@ -127,7 +131,6 @@ void compiler_group_size4(void)
       }
 
     }
-    memset(((uint32_t*)buf_data[1]), 0x0, sizeof(int)*n);
     OCL_UNMAP_BUFFER(1);
   }
 }
-- 
1.7.9.5



More information about the Beignet mailing list