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

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

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