From 7a669a87ef04ecb4c9b51ea4a10d9a16aebf3227 Mon Sep 17 00:00:00 2001 From: Giorgio Arena Date: Wed, 13 Nov 2019 17:07:13 +0000 Subject: COMPMID-2921 Performance regression on NEON Int8 Change-Id: I60ede3e8aeec678a9fb0d8d0f05a8048ab1ced7c Signed-off-by: Giorgio Arena Reviewed-on: https://review.mlplatform.org/c/2285 Tested-by: Arm Jenkins Reviewed-by: Michele Di Giorgio --- arm_compute/runtime/NEON/functions/NEGEMMConvolutionLayer.h | 3 ++- src/runtime/NEON/functions/NEGEMMConvolutionLayer.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/arm_compute/runtime/NEON/functions/NEGEMMConvolutionLayer.h b/arm_compute/runtime/NEON/functions/NEGEMMConvolutionLayer.h index 2d4aaa495f..6452fc9249 100644 --- a/arm_compute/runtime/NEON/functions/NEGEMMConvolutionLayer.h +++ b/arm_compute/runtime/NEON/functions/NEGEMMConvolutionLayer.h @@ -231,13 +231,14 @@ private: /** Static function to check if GEMM3D is supported in @ref NEGEMM or in @ref NEGEMMLowpMatrixMultiplyCore * * @param[in] input_info Input tensor info. Data types supported: QASYMM8/F16/F32. + * @param[in] weights_info Weights tensor info. Data types supported: QASYMM8/F16/F32. * @param[in] act_info Activation layer information in case of a fused activation. Only RELU, BOUNDED_RELU and LU_BOUNDED_RELU supported. * @param[in] gemm_3d_depth Depth of GEMM 3D * @param[in] skip_im2col Flag which specifies if im2col has to be skipped. i.e. 1x1 convolution with NHWC data layout * * @return a status */ - static Status validate_gemm3d(const ITensorInfo *input_info, const ActivationLayerInfo &act_info, int gemm_3d_depth, bool skip_im2col); + static Status validate_gemm3d(const ITensorInfo *input_info, const ITensorInfo *weights_info, const ActivationLayerInfo &act_info, int gemm_3d_depth, bool skip_im2col); private: MemoryGroup _memory_group; diff --git a/src/runtime/NEON/functions/NEGEMMConvolutionLayer.cpp b/src/runtime/NEON/functions/NEGEMMConvolutionLayer.cpp index caff117e09..a730749b8b 100644 --- a/src/runtime/NEON/functions/NEGEMMConvolutionLayer.cpp +++ b/src/runtime/NEON/functions/NEGEMMConvolutionLayer.cpp @@ -218,7 +218,7 @@ Status NEGEMMConvolutionLayer::validate_mm(const ITensorInfo *input, const ITens } } -Status NEGEMMConvolutionLayer::validate_gemm3d(const ITensorInfo *input_info, const ActivationLayerInfo &act_info, int gemm_3d_depth, bool skip_im2col) +Status NEGEMMConvolutionLayer::validate_gemm3d(const ITensorInfo *input_info, const ITensorInfo *weights_info, const ActivationLayerInfo &act_info, int gemm_3d_depth, bool skip_im2col) { const DataType data_type = input_info->data_type(); const unsigned int mult_y = skip_im2col ? 1U : gemm_3d_depth; @@ -226,7 +226,7 @@ Status NEGEMMConvolutionLayer::validate_gemm3d(const ITensorInfo *input_info, co // Set dummy tensor shapes for the validation const TensorInfo dummy_input_info(TensorShape(4U, 4U * mult_y, 1U * mult_z), 1, data_type, input_info->quantization_info()); - const TensorInfo dummy_weights_info(TensorShape(4U, 4U), 1, data_type); + const TensorInfo dummy_weights_info(TensorShape(4U, 4U), 1, data_type, weights_info->quantization_info()); const TensorInfo dummy_output_info(TensorShape(4U, 4U, gemm_3d_depth), 1, data_type, input_info->quantization_info()); return validate_mm(&dummy_input_info, &dummy_weights_info, nullptr, &dummy_output_info, act_info, gemm_3d_depth, skip_im2col); @@ -278,7 +278,7 @@ void NEGEMMConvolutionLayer::configure(const ITensor *input, const ITensor *weig // Check if GEMM3D is supported if(data_layout == DataLayout::NHWC) { - _skip_col2im = bool(validate_gemm3d(input->info(), act_info, conv_h, true)); + _skip_col2im = bool(validate_gemm3d(input->info(), weights->info(), act_info, conv_h, true)); // If not supported, we need to perform im2col and col2im (or reshape layer) if(!_skip_col2im) { @@ -429,7 +429,7 @@ Status NEGEMMConvolutionLayer::validate(const ITensorInfo *input, const ITensorI bool skip_col2im = false; if(data_layout == DataLayout::NHWC) { - skip_col2im = bool(validate_gemm3d(input, act_info, conv_h, true)); + skip_col2im = bool(validate_gemm3d(input, weights, act_info, conv_h, true)); // If not supported, we need to perform im2col and col2im (or reshape layer) if(!skip_col2im) { @@ -440,7 +440,7 @@ Status NEGEMMConvolutionLayer::validate(const ITensorInfo *input, const ITensorI if(skip_col2im) { // If not supported, we need to perform im2col and col2im (or reshape layer) - if(!bool(validate_gemm3d(input, act_info, conv_h, skip_im2col))) + if(!bool(validate_gemm3d(input, weights, act_info, conv_h, skip_im2col))) { skip_im2col = false; skip_col2im = false; -- cgit v1.2.1