simd_any is a built-in function based on the simd width for the
hardware instructions generated by the compiler, therefore, the
utest has to check the result according to the simd width. But,
currently there is no way to query it from driver, so use genenv
to get the info in this patch.

Signed-off-by: Guo Yejun <[email protected]>
---
 utests/compiler_simd_any.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/utests/compiler_simd_any.cpp b/utests/compiler_simd_any.cpp
index dcc5ef1..d41cb54 100644
--- a/utests/compiler_simd_any.cpp
+++ b/utests/compiler_simd_any.cpp
@@ -26,10 +26,16 @@ void compiler_simd_any(void)
 
   // Compare
   OCL_MAP_BUFFER(1);
+
+  int32_t width = locals[0];
+  const char* simd_width = getenv("OCL_SIMD_WIDTH");
+  if (simd_width != NULL)
+    width = atoi(simd_width);
+
   for (int32_t i = 0; i < (int32_t) n; ++i){
     //printf("%d %d\n", i, ((int *)buf_data[1])[i]);
     if (i % 2 == 1) {
-      if (i < (int32_t)locals[0])
+      if (i < (int32_t)width)
         OCL_ASSERT(((int *)buf_data[1])[i] == 1);
       else
         OCL_ASSERT(((int *)buf_data[1])[i] == 2);
-- 
1.8.3.2

_______________________________________________
Beignet mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet

Reply via email to