提交 f353e8c3 编写于 作者: Y yejianwu

remove build with kernel binary

上级 f802340d
...@@ -201,25 +201,21 @@ void OpenCLRuntime::BuildProgram(const std::string &program_file_name, ...@@ -201,25 +201,21 @@ void OpenCLRuntime::BuildProgram(const std::string &program_file_name,
sources.push_back({kernel_source.c_str(), kernel_source.length()}); sources.push_back({kernel_source.c_str(), kernel_source.length()});
*program = cl::Program(this->context(), sources); *program = cl::Program(this->context(), sources);
} else {
LOG(ERROR) << "Failed to open kernel file " << binary_filename << " and " std::string build_options_str = build_options +
<< source_filename; " -Werror -cl-mad-enable -cl-fast-relaxed-math -I" + kernel_path_;
} // TODO(heliangliang) -cl-unsafe-math-optimizations -cl-fast-relaxed-math
std::string build_options_str = build_options + cl_int ret = program->build({device()}, build_options_str.c_str());
" -Werror -cl-mad-enable -cl-fast-relaxed-math -I" + kernel_path_; if (ret != CL_SUCCESS) {
// TODO(heliangliang) -cl-unsafe-math-optimizations -cl-fast-relaxed-math if (program->getBuildInfo<CL_PROGRAM_BUILD_STATUS>(device()) ==
cl_int ret = program->build({device()}, build_options_str.c_str()); CL_BUILD_ERROR) {
if (ret != CL_SUCCESS) { std::string build_log =
if (program->getBuildInfo<CL_PROGRAM_BUILD_STATUS>(device()) == program->getBuildInfo<CL_PROGRAM_BUILD_LOG>(device());
CL_BUILD_ERROR) { LOG(INFO) << "Program build log: " << build_log;
std::string build_log = }
program->getBuildInfo<CL_PROGRAM_BUILD_LOG>(device()); LOG(FATAL) << "Build program failed: " << ret;
LOG(INFO) << "Program build log: " << build_log;
} }
LOG(FATAL) << "Build program failed: " << ret;
}
if (!std::ifstream(binary_filename).is_open()) {
size_t deviceListSize = 1; size_t deviceListSize = 1;
size_t *programBinarySizes = new size_t[deviceListSize]; size_t *programBinarySizes = new size_t[deviceListSize];
clGetProgramInfo((*program)(), clGetProgramInfo((*program)(),
...@@ -240,6 +236,9 @@ void OpenCLRuntime::BuildProgram(const std::string &program_file_name, ...@@ -240,6 +236,9 @@ void OpenCLRuntime::BuildProgram(const std::string &program_file_name,
programBinarySizes[0]); programBinarySizes[0]);
WriteFile(binary_filename, content, true); WriteFile(binary_filename, content, true);
} else {
LOG(ERROR) << "Failed to open kernel file " << binary_filename << " and "
<< source_filename;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册