ComputeLibrary icon indicating copy to clipboard operation
ComputeLibrary copied to clipboard

huge memory consumption during configure

Open pranathibl opened this issue 6 years ago • 8 comments

Hi,

I am seeing a huge memory consumption (~ 1.3GB) while configuring NEDeconvolutionlayer. inputSize 30 x 40 x 256 and weights 8 x 8 x 256 x 256.

Why is this happening?

Thanks, Pranathi.

pranathibl avatar Feb 04 '20 09:02 pranathibl

Hi @pranathibl

Could you please share all the values you use to configure the function? Data types and PadStrideInfo ?

morgolock avatar Feb 05 '20 17:02 morgolock

Hi @morgolock

I have attached the setup i have used here

pranathibl avatar Feb 06 '20 04:02 pranathibl

Hi @pranathibl.

Thanks for the setup and I could reproduce the issue with the setup. From investigation, I found this is expected behavior on NEON mainly due to the Im2col. We'll start our internal discussion to plan the improvement.

As an alternative for now, if you can use OpenCL version of DeconvolutionLayer, it is expected to have smaller memory consumption.

I hope it helps.

sanpar02 avatar Feb 06 '20 14:02 sanpar02

Hi @pranathibl , We recently merged a patch which should solve your problem. This is the line you might be more interested on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3135/6/src/runtime/NEON/functions/NEConvolutionLayer.cpp#170

Basically we pick NEDirectConvolution in case of big input tensors and bigger weights shapes to avoid the need of huge allocations. In fact, this layer doesn't require more memory

Let us know, Manuel

ManubARM avatar May 19 '20 10:05 ManubARM

Hi @ManubARM ,

I have tried out with the patch provided. and still seeing the memory consumption to be high (1.3GB).

Thanks, Pranathi.

pranathibl avatar Jul 07 '20 16:07 pranathibl

Could you please try to print what are your values of: input->total_size() and weights->dimension(idx_h) ? And also which ConvolutionMethod is get_convolution_method() returning?

Best, Manuel

ManubARM avatar Jul 07 '20 16:07 ManubARM

Hi @ManubARM ,

It is picking GEMM as Convolution method. And input->total_size() = 21.7MB weights->dimension(idx_h) = 8

-Pranathi

pranathibl avatar Sep 01 '20 16:09 pranathibl

Hi @pranathibl

The following patch on the top of master solves the problem: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6806

I ran the test and it's now using DirectConv as Deconvolution method.

Hope this helps.

morgolock avatar Dec 09 '21 10:12 morgolock