提交 519fe0b9 编写于 作者: L liuruilong

fix creat program error

上级 c52c2164
...@@ -18,6 +18,7 @@ limitations under the License. */ ...@@ -18,6 +18,7 @@ limitations under the License. */
#include <string> #include <string>
#include "CL/cl.h" #include "CL/cl.h"
#include "common/log.h"
#include "common/enforce.h" #include "common/enforce.h"
#include "framework/cl/cl_deleter.h" #include "framework/cl/cl_deleter.h"
#include "framework/cl/cl_tool.h" #include "framework/cl/cl_tool.h"
...@@ -66,8 +67,14 @@ class CLEngine { ...@@ -66,8 +67,14 @@ class CLEngine {
const char *source = data; const char *source = data;
size_t sourceSize[] = {strlen(source)}; size_t sourceSize[] = {strlen(source)};
cl_program p = cl_program p =
clCreateProgramWithSource(context, 1, &source, sourceSize, NULL); clCreateProgramWithSource(context, 1, &source, sourceSize, &status_);
DLOG << " cl kernel file name: " << file_name;
DLOG << " source size: " << sourceSize[0];
CL_CHECK_ERRORS(status_);
std::unique_ptr<_cl_program, CLProgramDeleter> program_ptr(p); std::unique_ptr<_cl_program, CLProgramDeleter> program_ptr(p);
return std::move(program_ptr); return std::move(program_ptr);
} }
...@@ -91,6 +98,8 @@ class CLEngine { ...@@ -91,6 +98,8 @@ class CLEngine {
cl_device_id *devices_; cl_device_id *devices_;
cl_int status_;
std::unique_ptr<_cl_context, CLContextDeleter> context_; std::unique_ptr<_cl_context, CLContextDeleter> context_;
std::unique_ptr<_cl_command_queue, CLCommQueueDeleter> command_queue_; std::unique_ptr<_cl_command_queue, CLCommQueueDeleter> command_queue_;
......
...@@ -55,10 +55,12 @@ class CLScope { ...@@ -55,10 +55,12 @@ class CLScope {
auto program = CLEngine::Instance()->CreateProgramWith( auto program = CLEngine::Instance()->CreateProgramWith(
context_.get(), "./cl_kernel/" + file_name); context_.get(), "./cl_kernel/" + file_name);
programs_[file_name] = std::move(program);
status_ = clBuildProgram(program.get(), 0, 0, 0, 0, 0); status_ = clBuildProgram(program.get(), 0, 0, "-cl-fast-relaxed-math", 0, 0);
CL_CHECK_ERRORS(status_); CL_CHECK_ERRORS(status_);
programs_[file_name] = std::move(program);
return program.get(); return program.get();
} }
......
...@@ -55,7 +55,7 @@ void ConvAddKernel<GPU_CL, float>::Compute( ...@@ -55,7 +55,7 @@ void ConvAddKernel<GPU_CL, float>::Compute(
auto input = param.Input()->GetCLImage(); auto input = param.Input()->GetCLImage();
auto filter = param.Filter()->GetCLImage(); auto filter = param.Filter()->GetCLImage();
auto biase = param.Bias()->GetCLImage(); auto biase = param.Bias()->GetCLImage();
auto output = param.Output(); auto output = param.Output()->GetCLImage();
int stride = param.Strides()[0]; int stride = param.Strides()[0];
int offset = param.Offset(); int offset = param.Offset();
int input_c = param.Input()->CBlock(); int input_c = param.Input()->CBlock();
......
...@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ...@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
#include "common/log.h"
#include "operators/kernel/feed_kernel.h" #include "operators/kernel/feed_kernel.h"
namespace paddle_mobile { namespace paddle_mobile {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册