提交 a564cbcb 编写于 作者: L liuruilong

add log info

上级 ebf7e03e
......@@ -88,6 +88,8 @@ class CLEngine {
return true;
}
cl_device_id DeviceID(int index = 0) { return devices_[index]; }
private:
CLEngine() { initialized_ = false; }
......
......@@ -58,11 +58,24 @@ class CLScope {
auto program = CLEngine::Instance()->CreateProgramWith(
context_.get(), "./cl_kernel/" + file_name);
DLOG << " --- begin build program -> " << file_name << " --- ";
status_ =
clBuildProgram(program.get(), 0, 0, "-cl-fast-relaxed-math", 0, 0);
CL_CHECK_ERRORS(status_);
if (status_ == CL_BUILD_PROGRAM_FAILURE) {
size_t log_size;
clGetProgramBuildInfo(program.get(), CLEngine::Instance()->DeviceID(),
CL_PROGRAM_BUILD_LOG, 0, NULL, &log_size);
char *log = (char *)malloc(log_size);
clGetProgramBuildInfo(program.get(), CLEngine::Instance()->DeviceID(),
CL_PROGRAM_BUILD_LOG, log_size, log, NULL);
DLOG << " program build error: " << log;
}
DLOG << " --- end build program -> " << file_name << " --- ";
programs_[file_name] = std::move(program);
return programs_[file_name].get();
......
......@@ -114,6 +114,8 @@ CreatePaddlePredictor<PaddleMobileConfig, PaddleEngineKind::kPaddleMobile>(
x.reset(new PaddleMobilePredictor<FPGA, Precision::FP32>(config));
} else if (config.device == PaddleMobileConfig::kGPU_MALI) {
x.reset(new PaddleMobilePredictor<GPU_MALI, Precision::FP32>(config));
} else if (config.device == PaddleMobileConfig::kGPU_CL) {
x.reset(new PaddleMobilePredictor<GPU_CL, Precision::FP32>(config));
} else {
LOG(kLOG_ERROR) << "unsupport device type!";
return nullptr;
......
......@@ -111,7 +111,7 @@ class PaddlePredictor {
struct PaddleMobileConfig : public PaddlePredictor::Config {
enum Precision { FP32 = 0 };
enum Device { kCPU = 0, kFPGA = 1, kGPU_MALI = 2 };
enum Device { kCPU = 0, kFPGA = 1, kGPU_MALI = 2, kGPU_CL = 3 };
enum Precision precision;
enum Device device;
......
......@@ -43,7 +43,7 @@ __kernel void reshape(__read_only image2d_t input,
int i0 = oindex;
int ix = (i1 / 4) * d3 + i3;
int iy = i0 * d2 + i2;
r[i] = read_imageh(input, sampler, int2(ix, iy))[i1%4];
r[i] = read_imageh(input, sampler, (int2)(ix, iy))[i1%4];
}
write_imageh(output, int2(x, y), r);
write_imageh(output, (int2)(x, y), r);
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册