summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhigang Gong <zhigang.gong@intel.com>2014-09-11 08:52:44 +0800
committerZhigang Gong <zhigang.gong@intel.com>2014-09-11 13:38:38 +0800
commit59c4c3191e61a6d93ecc7556b51c8e44f901b232 (patch)
treeba2c1a4490191d6fd98ab5d87ce7b2f6c755af66
parent18d6a0611fd8d29ec9651655646d88bd88d2ef5e (diff)
GBE: fix bugs when handling -cl-std option.
Actually, CLANG does take this option and we should not filter it out. We also change the default option to create PCH file to -cl-std=CL1.2. And if the user pass in a CL1.1 we will have to disable PCH. Another change is that if we are CL1.2, then we should enable the cl_khr_fp64 by default. As from CL1.2, this extension should be enabled by default. Signed-off-by: Zhigang Gong <zhigang.gong@intel.com> Reviewed-by: "Yang, Rong R" <rong.r.yang@intel.com>
-rw-r--r--backend/src/CMakeLists.txt2
-rw-r--r--backend/src/backend/program.cpp10
2 files changed, 9 insertions, 3 deletions
diff --git a/backend/src/CMakeLists.txt b/backend/src/CMakeLists.txt
index 23ccc27..a3818ab 100644
--- a/backend/src/CMakeLists.txt
+++ b/backend/src/CMakeLists.txt
@@ -50,7 +50,7 @@ else (LLVM_VERSION_NODOT VERSION_GREATER 32)
set (clang_cmd -cc1 -x cl -triple ptx32)
endif (LLVM_VERSION_NODOT VERSION_GREATER 31)
endif (LLVM_VERSION_NODOT VERSION_GREATER 32)
-set (clang_cmd ${clang_cmd} -fno-builtin -DGEN7_SAMPLER_CLAMP_BORDER_WORKAROUND)
+set (clang_cmd ${clang_cmd} -cl-std=CL1.2 -fno-builtin -DGEN7_SAMPLER_CLAMP_BORDER_WORKAROUND)
add_custom_command(
OUTPUT ${pch_object}
diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp
index 40adc1d..22c6b0d 100644
--- a/backend/src/backend/program.cpp
+++ b/backend/src/backend/program.cpp
@@ -576,13 +576,14 @@ namespace gbe {
*errSize = snprintf(err, stringSize, "Invalid build option: %s\n", str.c_str());
return false;
}
- continue;
}
useless.push_back(str);
args.push_back(str.c_str());
}
- if (useDefaultCLCVersion)
+ if (useDefaultCLCVersion) {
args.push_back("-D__OPENCL_C_VERSION__=120");
+ args.push_back("-cl-std=CL1.2");
+ }
args.push_back("-mllvm");
args.push_back("-inline-threshold=200000");
#ifdef GEN7_SAMPLER_CLAMP_BORDER_WORKAROUND
@@ -775,6 +776,7 @@ namespace gbe {
"-cl-single-precision-constant",
// "-cl-denorms-are-zero",
"-cl-fast-relaxed-math",
+ "-cl-std=CL1.1"
};
const char * incompatible_defs[] = {
"GET_FLOAT_WORD",
@@ -804,6 +806,10 @@ namespace gbe {
if (p)
optLevel = 0;
+ #define ENABLE_CL_KHR_FP64_STR "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n"
+ if (!strstr(const_cast<char *>(options), "-cl-std=CL1.1"))
+ fwrite(ENABLE_CL_KHR_FP64_STR, strlen(ENABLE_CL_KHR_FP64_STR), 1, clFile);
+
clOpt += options;
}