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 <[email protected]> --- backend/src/CMakeLists.txt | 2 +- backend/src/backend/program.cpp | 10 ++++++++-- 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; } -- 1.8.3.2 _______________________________________________ Beignet mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/beignet
