[Beignet] [PATCH] Add uncompatible PCH Options to avoid compiling failure.
junyan.he at inbox.com
junyan.he at inbox.com
Fri Sep 5 01:54:27 PDT 2014
From: Junyan He <junyan.he at linux.intel.com>
Signed-off-by: Junyan He <junyan.he at linux.intel.com>
---
backend/src/backend/program.cpp | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp
index 092398c..30e7a0b 100644
--- a/backend/src/backend/program.cpp
+++ b/backend/src/backend/program.cpp
@@ -629,6 +629,7 @@ namespace gbe {
std::istringstream idirs(dirs);
std::string pchFileName;
bool findPCH = false;
+ bool invalidPCH = false;
size_t start = 0, end = 0;
std::string hdirs = OCL_HEADER_FILE_DIR;
@@ -653,6 +654,10 @@ namespace gbe {
std::string optionStr(str);
const std::string unsupportedOptions("-cl-denorms-are-zero, -cl-strict-aliasing, -cl-opt-disable,"
"-cl-no-signed-zeros, -cl-fp32-correctly-rounded-divide-sqrt");
+
+ const std::string uncompatiblePCHOptions = ("-cl-single-precision-constant, -cl-fast-relaxed-math");
+ const std::string fastMathOption = ("-cl-fast-relaxed-math");
+
while (end != std::string::npos) {
end = optionStr.find(' ', start);
std::string str = optionStr.substr(start, end - start);
@@ -663,6 +668,14 @@ namespace gbe {
if(unsupportedOptions.find(str) != std::string::npos)
continue;
+ if (uncompatiblePCHOptions.find(str) != std::string::npos)
+ invalidPCH = true;
+
+ if (fastMathOption.find(str) != std::string::npos) {
+ clOpt.push_back("-D");
+ clOpt.push_back("__FAST_RELAXED_MATH__=1");
+ }
+
clOpt.push_back(str);
}
free(str);
@@ -688,7 +701,7 @@ namespace gbe {
FILE *clFile = fdopen(clFd, "w");
FATAL_IF(clFile == NULL, "Failed to open temporary file");
- if (!findPCH) {
+ if (!findPCH || invalidPCH) {
clOpt.push_back("-include");
clOpt.push_back("ocl.h");
} else {
--
1.7.9.5
More information about the Beignet
mailing list