From ea8aed3788accaa68c85d935668eee1037a3939c Mon Sep 17 00:00:00 2001 From: liuqi Date: Fri, 24 Nov 2017 13:54:37 +0800 Subject: [PATCH] Fix some typo at buffer_to_image and opecl allocator. --- mace/BUILD | 4 ++-- mace/core/opencl_allocator.cc | 2 +- mace/core/opencl_allocator.h | 3 +-- mace/kernels/BUILD | 2 +- mace/kernels/opencl/buffer_to_image.cc | 5 ++--- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/mace/BUILD b/mace/BUILD index 17a4be41..1b95aae0 100644 --- a/mace/BUILD +++ b/mace/BUILD @@ -10,7 +10,7 @@ config_setting( name = "android_armv7", values = { "crosstool_top": "//external:android/crosstool", - "android_cpu": "armeabi-v7a", + "cpu": "armeabi-v7a", }, visibility = ["//visibility:public"], ) @@ -19,7 +19,7 @@ config_setting( name = "android_arm64", values = { "crosstool_top": "//external:android/crosstool", - "android_cpu": "arm64-v8a", + "cpu": "arm64-v8a", }, visibility = ["//visibility:public"], ) diff --git a/mace/core/opencl_allocator.cc b/mace/core/opencl_allocator.cc index 5acd290e..3b393542 100644 --- a/mace/core/opencl_allocator.cc +++ b/mace/core/opencl_allocator.cc @@ -70,7 +70,7 @@ void OpenCLAllocator::Delete(void *buffer) { void OpenCLAllocator::DeleteImage(void *buffer) { if (buffer != nullptr) { - cl::Image3D *cl_image = static_cast(buffer); + cl::Image2D *cl_image = static_cast(buffer); delete cl_image; } } diff --git a/mace/core/opencl_allocator.h b/mace/core/opencl_allocator.h index a3758e85..6aa8fbf9 100644 --- a/mace/core/opencl_allocator.h +++ b/mace/core/opencl_allocator.h @@ -18,8 +18,7 @@ class OpenCLAllocator : public Allocator { void *New(size_t nbytes) override; /* - * Only support shape.size() > 1 and collapse first n-2 dimensions to depth. - * Use Image3D with RGBA (128-bit) format to represent the image. + * Use Image2D with RGBA (128-bit) format to represent the image. * * @ shape : [depth, ..., height, width ]. */ diff --git a/mace/kernels/BUILD b/mace/kernels/BUILD index bd79ac2b..4352f2a6 100644 --- a/mace/kernels/BUILD +++ b/mace/kernels/BUILD @@ -13,7 +13,7 @@ load("//mace:mace.bzl", "if_android_arm64") cc_library( name = "kernels", srcs = glob(["*.cc"]) + if_android(glob(["opencl/*.cc"])) + if_android_arm64(glob(["neon/*.cc"])), - hdrs = glob(["*.h"]) + if_android(glob(["opencl/*.cc"])) + if_android_arm64(glob(["neon/*.cc"])), + hdrs = glob(["*.h"]) + if_android(glob(["opencl/*.h"])) + if_android_arm64(glob(["neon/*.h"])), copts = [ "-std=c++11", "-fopenmp", diff --git a/mace/kernels/opencl/buffer_to_image.cc b/mace/kernels/opencl/buffer_to_image.cc index db44b451..be76710a 100644 --- a/mace/kernels/opencl/buffer_to_image.cc +++ b/mace/kernels/opencl/buffer_to_image.cc @@ -39,13 +39,12 @@ void BufferToImageFunctor::operator()(Tensor *buffer, kernel_name = i2b_ ? "arg_image_to_buffer" : "arg_buffer_to_image"; break; } - VLOG(0) << kernel_name; auto b2f_kernel = runtime->BuildKernel("buffer_to_image", kernel_name, built_options); uint32_t idx = 0; - b2f_kernel.setArg(idx++, *(static_cast(buffer->buffer()))); + b2f_kernel.setArg(idx++, *(static_cast(buffer->buffer()))); if (type == ARGUMENT) { b2f_kernel.setArg(idx++, static_cast(buffer->dim(0))); } else { @@ -53,7 +52,7 @@ void BufferToImageFunctor::operator()(Tensor *buffer, b2f_kernel.setArg(idx++, static_cast(buffer->dim(2))); b2f_kernel.setArg(idx++, static_cast(buffer->dim(3))); } - b2f_kernel.setArg(idx++, *(static_cast(image->buffer()))); + b2f_kernel.setArg(idx++, *(static_cast(image->buffer()))); const size_t gws[3] = {image_shape[0], image_shape[1], -- GitLab