[Beignet] [PATCH] utests:add subnormal check by fpclassify.

Yi Sun yi.sun at intel.com
Tue Feb 18 22:12:03 PST 2014


Signed-off-by: Yi Sun <yi.sun at intel.com>
Signed-off-by: Shui yangwei <yangweix.shui at intel.com>
---
 utests/utest_generator.py |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/utests/utest_generator.py b/utests/utest_generator.py
index 626ac96..4b29ba2 100644
--- a/utests/utest_generator.py
+++ b/utests/utest_generator.py
@@ -298,7 +298,10 @@ static void %s_%s(void)
 
     #funcdiff = "    diff = fabs((gpu_data[index]-cpu_data[index])"
     #funcdiff += (self.retType(index) == "int") and ');' or '/(cpu_data[index]>1?cpu_data[index]:1));'
+    valuejudge = "    if (std::fpclassify(gpu_data[index]) == FP_SUBNORMAL){ gpu_data[index] = 0; }\n"
+    valuejudge += "    if (std::fpclassify(cpu_data[index]) == FP_SUBNORMAL){ cpu_data[index] = 0; }\n"
     funcdiff = "    diff = fabs((gpu_data[index]-cpu_data[index]));"
+    funcline += [ valuejudge ]
     funcline += [ funcdiff ]
     funcline += [ funcsprintfa + funcsprintfb ]
 
-- 
1.7.10.1



More information about the Beignet mailing list