[Beignet] [ocl2.0] runtime: change cl-std to 2.0
Yang, Rong R
rong.r.yang at intel.com
Mon Nov 9 23:13:12 PST 2015
LGTM, pushed.
> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of
> Ruiling Song
> Sent: Thursday, September 24, 2015 11:21
> To: beignet at lists.freedesktop.org
> Cc: Song, Ruiling
> Subject: [Beignet] [ocl2.0] runtime: change cl-std to 2.0
>
> 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
>
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list