未验证 提交 508ca98b 编写于 作者: J Jiaying Zhao 提交者: GitHub

fix clang compile error. test=develop (#2180)

上级 a6b1e4fa
...@@ -66,9 +66,9 @@ class CLHelper { ...@@ -66,9 +66,9 @@ class CLHelper {
auto h = image_dim[2]; auto h = image_dim[2];
auto w = image_dim[3]; auto w = image_dim[3];
auto image_width = image.ImageWidth(); auto image_width = image.ImageWidth();
auto work_size_0 = image_width / w; size_t work_size_0 = image_width / w;
auto work_size_1 = w; size_t work_size_1 = w;
auto work_size_2 = n * h; size_t work_size_2 = n * h;
return {work_size_0, work_size_1, work_size_2}; return {work_size_0, work_size_1, work_size_2};
} else if (image_dim.size() == 2) { } else if (image_dim.size() == 2) {
auto h = image_dim[0]; auto h = image_dim[0];
...@@ -77,9 +77,9 @@ class CLHelper { ...@@ -77,9 +77,9 @@ class CLHelper {
} else if (image_dim.size() == 1) { } else if (image_dim.size() == 1) {
return {1, image.ImageWidth(), 1}; return {1, image.ImageWidth(), 1};
} else if (image_dim.size() == 3) { } else if (image_dim.size() == 3) {
int c = image_dim[0]; size_t c = image_dim[0];
int h = image_dim[1]; size_t h = image_dim[1];
int w = image_dim[2]; size_t w = image_dim[2];
return {(c + 3) / 4, w, h}; return {(c + 3) / 4, w, h};
} }
PADDLE_MOBILE_THROW_EXCEPTION(" not support this dim, need imp "); PADDLE_MOBILE_THROW_EXCEPTION(" not support this dim, need imp ");
......
...@@ -119,8 +119,8 @@ void TensorToCLImage(Tensor *tensor, CLImage *cl_image, cl_context context, ...@@ -119,8 +119,8 @@ void TensorToCLImage(Tensor *tensor, CLImage *cl_image, cl_context context,
#ifdef PADDLE_MOBILE_DEBUG #ifdef PADDLE_MOBILE_DEBUG
Print &operator<<(Print &printer, const CLImage &cl_image) { Print &operator<<(Print &printer, const CLImage &cl_image) {
int width = cl_image.ImageDims()[0]; size_t width = cl_image.ImageDims()[0];
int height = cl_image.ImageDims()[1]; size_t height = cl_image.ImageDims()[1];
half_t *image_data = new half_t[height * width * 4]; half_t *image_data = new half_t[height * width * 4];
cl_int err; cl_int err;
......
...@@ -177,7 +177,7 @@ class CLImage { ...@@ -177,7 +177,7 @@ class CLImage {
* init cl mem with a exist cl mem * init cl mem with a exist cl mem
*/ */
void InitWithExistMem(cl_context context, cl_command_queue command_queue, void InitWithExistMem(cl_context context, cl_command_queue command_queue,
DDim need_dims, CLImage &src) { DDim need_dims, const CLImage &src) {
CLImageConverterNormal *normal_converter = new CLImageConverterNormal(); CLImageConverterNormal *normal_converter = new CLImageConverterNormal();
real_image_dims_ = src.real_image_dims_; real_image_dims_ = src.real_image_dims_;
...@@ -271,7 +271,8 @@ class CLImage { ...@@ -271,7 +271,8 @@ class CLImage {
CLImageConverterBase *Converter() const { return image_converter_; } CLImageConverterBase *Converter() const { return image_converter_; }
private: private:
void InitCLImage(cl_context context, int width, int height, void *data) { void InitCLImage(cl_context context, size_t width, size_t height,
void *data) {
cl_image_format cf = {.image_channel_order = CL_RGBA, cl_image_format cf = {.image_channel_order = CL_RGBA,
.image_channel_data_type = CL_HALF_FLOAT}; .image_channel_data_type = CL_HALF_FLOAT};
cl_image_desc cid = { cl_image_desc cid = {
......
...@@ -77,8 +77,8 @@ void ElementwiseAddKernel<GPU_CL, float>::Compute( ...@@ -77,8 +77,8 @@ void ElementwiseAddKernel<GPU_CL, float>::Compute(
status = clSetKernelArg(kernel, 2, sizeof(cl_mem), status = clSetKernelArg(kernel, 2, sizeof(cl_mem),
reinterpret_cast<void *>(&output_image)); reinterpret_cast<void *>(&output_image));
CL_CHECK_ERRORS(status); CL_CHECK_ERRORS(status);
int width = input->ImageWidth(); auto width = input->ImageWidth();
int height = input->ImageHeight(); auto height = input->ImageHeight();
size_t global_work_size[2] = {width, height}; size_t global_work_size[2] = {width, height};
status = status =
clEnqueueNDRangeKernel(this->cl_helper_.CLCommandQueue(), kernel, 2, clEnqueueNDRangeKernel(this->cl_helper_.CLCommandQueue(), kernel, 2,
...@@ -103,8 +103,8 @@ void ElementwiseAddKernel<GPU_CL, float>::Compute( ...@@ -103,8 +103,8 @@ void ElementwiseAddKernel<GPU_CL, float>::Compute(
status = clSetKernelArg(kernel, 3, sizeof(cl_int), status = clSetKernelArg(kernel, 3, sizeof(cl_int),
reinterpret_cast<void *>(&tensor_w)); reinterpret_cast<void *>(&tensor_w));
CL_CHECK_ERRORS(status); CL_CHECK_ERRORS(status);
int width = input->ImageWidth(); auto width = input->ImageWidth();
int height = input->ImageHeight(); auto height = input->ImageHeight();
DLOG << "dede:" << width << "," << height; DLOG << "dede:" << width << "," << height;
size_t global_work_size[2] = {width, height}; size_t global_work_size[2] = {width, height};
cl_event out_event = param.Out()->GetClEvent(); cl_event out_event = param.Out()->GetClEvent();
......
...@@ -121,9 +121,9 @@ void PriorBoxKernel<GPU_CL, float>::Compute( ...@@ -121,9 +121,9 @@ void PriorBoxKernel<GPU_CL, float>::Compute(
auto kernel = this->cl_helper_.KernelAt(0); auto kernel = this->cl_helper_.KernelAt(0);
auto default_work_size = auto default_work_size =
this->cl_helper_.DefaultWorkSize(*param.OutputBoxes()); this->cl_helper_.DefaultWorkSize(*param.OutputBoxes());
int c_block = default_work_size[0]; auto c_block = default_work_size[0];
int w = default_work_size[1]; auto w = default_work_size[1];
int nh = default_work_size[2]; auto nh = default_work_size[2];
std::vector<int64_t> box_shape({num_priors}); std::vector<int64_t> box_shape({num_priors});
framework::DDim ddim = framework::make_ddim(box_shape); framework::DDim ddim = framework::make_ddim(box_shape);
......
...@@ -185,8 +185,8 @@ void test(int argc, char *argv[]) { ...@@ -185,8 +185,8 @@ void test(int argc, char *argv[]) {
if (len == 0) { if (len == 0) {
continue; continue;
} }
int width = cl_image->ImageDims()[0]; size_t width = cl_image->ImageDims()[0];
int height = cl_image->ImageDims()[1]; size_t height = cl_image->ImageDims()[1];
paddle_mobile::framework::half_t *image_data = paddle_mobile::framework::half_t *image_data =
new paddle_mobile::framework::half_t[height * width * 4]; new paddle_mobile::framework::half_t[height * width * 4];
cl_int err; cl_int err;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册