summaryrefslogtreecommitdiff
path: root/utests/utest_generator.py
diff options
context:
space:
mode:
authorYi Sun <yi.sun@intel.com>2014-06-23 08:56:33 +0800
committerZhigang Gong <zhigang.gong@intel.com>2014-06-23 16:53:48 +0800
commitf47fc3c961c34005027b6b9cfd99ba19f67b61c6 (patch)
tree2b78de7b5029a9fd780fcf2d615b264864124cec /utests/utest_generator.py
parent53634e3d88f455140b8e814faf065c5805895aaf (diff)
downloadbeignet-f47fc3c961c34005027b6b9cfd99ba19f67b61c6.tar.gz
utest_generator.py: add OCL_STRICT_CONFORMANCE enviroment condition.
For auto-generated math cases, when OCL_STRICT_CONFORMANCE is not set, the expected diff increases to 1000x. Signed-off-by: Yi Sun <yi.sun@intel.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'utests/utest_generator.py')
-rw-r--r--utests/utest_generator.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/utests/utest_generator.py b/utests/utest_generator.py
index 94900d9a..8d2f2a89 100644
--- a/utests/utest_generator.py
+++ b/utests/utest_generator.py
@@ -20,7 +20,14 @@ def udebug(ulpSize,returnType):
#ulpNum=re.findall(r"([0-9]+)",ulpSize)[0]
text='''
static const char* INFORNAN;
- static %s ULPSIZE;
+ static %s ULPSIZE, ULPSIZE_FACTOR;
+
+ const char* env_strict = getenv("OCL_STRICT_CONFORMANCE");
+
+ if ( strcmp(env_strict, "0") == 0)
+ ULPSIZE_FACTOR = 1000;
+ else
+ ULPSIZE_FACTOR = 1;
if (isinf(cpu_data[index])){
INFORNAN="INF";
@@ -29,7 +36,8 @@ def udebug(ulpSize,returnType):
INFORNAN="NAN";
}
else{
- ULPSIZE=cl_%s(cpu_data[index]) * %s;
+ ULPSIZE=ULPSIZE_FACTOR * cl_%s((cpu_data[index] == 0) ? 1 : cpu_data[index])
+ * ((ULPSIZE_FACTOR == 1) ? %s : ( (%s == 0) ? 1 : %s));
}
#if udebug
@@ -67,6 +75,7 @@ def udebug(ulpSize,returnType):
}
}\n'''%(returnType,\
ulpUnit(ulpSize),ulpNum(ulpSize),\
+ ulpNum(ulpSize), ulpNum(ulpSize),\
paraTypeList['string'],paraTypeList['string'],\
paraTypeList['string'],paraTypeList['string'],\
paraTypeList['string'],paraTypeList['string'],\
@@ -128,6 +137,7 @@ which can print more values and information to assist debuging the issue.
#include <stdio.h>
#include <math.h>
#include <algorithm>
+#include <string.h>
#define udebug 0
#define FLT_MAX 0x1.fffffep127f