[Beignet] [ocl2.0] runtime: change cl-std to 2.0
Ruiling Song
ruiling.song at intel.com
Wed Sep 23 20:21:06 PDT 2015
note we should set -cl-std when generating pch, or clang will treat it
as opencl 1.0.
Signed-off-by: Ruiling Song <ruiling.song at intel.com>
---
backend/src/backend/program.cpp | 6 ++++--
backend/src/libocl/CMakeLists.txt | 4 ++--
backend/src/libocl/tmpl/ocl_defines.tmpl.h | 3 ++-
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp
index 9caf1ac..1d54a88 100644
--- a/backend/src/backend/program.cpp
+++ b/backend/src/backend/program.cpp
@@ -705,6 +705,8 @@ namespace gbe {
clOpt.push_back("-D__OPENCL_C_VERSION__=110");
else if (str == "-cl-std=CL1.2")
clOpt.push_back("-D__OPENCL_C_VERSION__=120");
+ else if (str == "-cl-std=CL2.0")
+ clOpt.push_back("-D__OPENCL_C_VERSION__=200");
else {
if (err && stringSize > 0 && errSize)
*errSize = snprintf(err, stringSize, "Invalid build option: %s\n", str.c_str());
@@ -731,8 +733,8 @@ namespace gbe {
}
if (useDefaultCLCVersion) {
- clOpt.push_back("-D__OPENCL_C_VERSION__=120");
- clOpt.push_back("-cl-std=CL1.2");
+ clOpt.push_back("-D__OPENCL_C_VERSION__=200");
+ clOpt.push_back("-cl-std=CL2.0");
}
//for clCompilerProgram usage.
if(temp_header_path){
diff --git a/backend/src/libocl/CMakeLists.txt b/backend/src/libocl/CMakeLists.txt
index 0cd1eef..d41879c 100644
--- a/backend/src/libocl/CMakeLists.txt
+++ b/backend/src/libocl/CMakeLists.txt
@@ -200,14 +200,14 @@ ADD_CUSTOM_COMMAND(OUTPUT ${OCL_OBJECT_DIR}/beignet.bc
ADD_CUSTOM_COMMAND(OUTPUT ${OCL_OBJECT_DIR}/beignet.local.pch
COMMAND mkdir -p ${OCL_OBJECT_DIR}
- COMMAND ${CLANG_EXECUTABLE} -cc1 ${CLANG_OCL_FLAGS} -triple spir -I ${OCL_OBJECT_DIR}/include/ -emit-pch -x cl ${OCL_OBJECT_DIR}/include/ocl.h -o ${OCL_OBJECT_DIR}/beignet.local.pch
+ COMMAND ${CLANG_EXECUTABLE} -cc1 ${CLANG_OCL_FLAGS} -triple spir -I ${OCL_OBJECT_DIR}/include/ -emit-pch -x cl -cl-std=CL2.0 ${OCL_OBJECT_DIR}/include/ocl.h -o ${OCL_OBJECT_DIR}/beignet.local.pch
DEPENDS ${OCL_HEADER_FILES}
COMMENT "Generate the pch file: ${OCL_OBJECT_DIR}/beignet.local.pch"
)
ADD_CUSTOM_COMMAND(OUTPUT ${OCL_OBJECT_DIR}/beignet.pch
COMMAND mkdir -p ${OCL_OBJECT_DIR}
- COMMAND ${CLANG_EXECUTABLE} -cc1 ${CLANG_OCL_FLAGS} -triple spir -I ${OCL_OBJECT_DIR}/include/ --relocatable-pch -emit-pch -isysroot ${LIBOCL_BINARY_DIR} -x cl ${OCL_OBJECT_DIR}/include/ocl.h -o ${OCL_OBJECT_DIR}/beignet.pch
+ COMMAND ${CLANG_EXECUTABLE} -cc1 ${CLANG_OCL_FLAGS} -triple spir -I ${OCL_OBJECT_DIR}/include/ --relocatable-pch -emit-pch -isysroot ${LIBOCL_BINARY_DIR} -x cl -cl-std=CL2.0 ${OCL_OBJECT_DIR}/include/ocl.h -o ${OCL_OBJECT_DIR}/beignet.pch
DEPENDS ${OCL_HEADER_FILES}
COMMENT "Generate the pch file: ${OCL_OBJECT_DIR}/beignet.pch"
)
diff --git a/backend/src/libocl/tmpl/ocl_defines.tmpl.h b/backend/src/libocl/tmpl/ocl_defines.tmpl.h
index 9c53093..8d41449 100644
--- a/backend/src/libocl/tmpl/ocl_defines.tmpl.h
+++ b/backend/src/libocl/tmpl/ocl_defines.tmpl.h
@@ -18,10 +18,11 @@
#ifndef __OCL_COMMON_DEF_H__
#define __OCL_COMMON_DEF_H__
-#define __OPENCL_VERSION__ 120
+#define __OPENCL_VERSION__ 200
#define __CL_VERSION_1_0__ 100
#define __CL_VERSION_1_1__ 110
#define __CL_VERSION_1_2__ 120
+#define __CL_VERSION_2_0__ 200
#define __ENDIAN_LITTLE__ 1
#define __IMAGE_SUPPORT__ 1
#define __kernel_exec(X, TYPE) __kernel __attribute__((work_group_size_hint(X,1,1))) \
--
2.3.1
More information about the Beignet
mailing list