[Beignet] [PATCH V2] Utest: Fix scan exclusive limits in float types

grigore.lupescu at intel.com grigore.lupescu at intel.com
Wed Apr 13 08:11:51 UTC 2016


From: Grigore Lupescu <grigore.lupescu at intel.com>

Signed-off-by: Grigore Lupescu <grigore.lupescu at intel.com>
---
 utests/compiler_workgroup_scan_exclusive.cpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/utests/compiler_workgroup_scan_exclusive.cpp b/utests/compiler_workgroup_scan_exclusive.cpp
index 9613140..7fecb70 100644
--- a/utests/compiler_workgroup_scan_exclusive.cpp
+++ b/utests/compiler_workgroup_scan_exclusive.cpp
@@ -41,14 +41,22 @@ static void compute_expected(WG_FUNCTION wg_func,
   }
   else if(wg_func == WG_SCAN_EXCLUSIVE_MAX)
   {
-    expected[0] = numeric_limits<T>::min();
+    if(numeric_limits<T>::is_integer)
+      expected[0] = numeric_limits<T>::min();
+    else
+      expected[0] = - numeric_limits<T>::infinity();
+
     expected[1] = input[0];
     for(uint32_t i = 2; i < WG_LOCAL_SIZE; i++)
       expected[i] = max(input[i - 1], expected[i - 1]);
   }
   else if(wg_func == WG_SCAN_EXCLUSIVE_MIN)
   {
-    expected[0] = numeric_limits<T>::max();
+    if(numeric_limits<T>::is_integer)
+      expected[0] = numeric_limits<T>::max();
+    else
+      expected[0] = numeric_limits<T>::infinity();
+
     expected[1] = input[0];
     for(uint32_t i = 2; i < WG_LOCAL_SIZE; i++)
       expected[i] = min(input[i - 1], expected[i - 1]);
-- 
2.5.0



More information about the Beignet mailing list