Skip to content

Commit

Permalink
fix build without neon
Browse files Browse the repository at this point in the history
  • Loading branch information
nihui committed Aug 30, 2018
1 parent c4e3a9c commit 19ad4cf
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/layer/arm/convolution_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ namespace ncnn {
#include "convolution_5x5.h"
#include "convolution_7x7.h"

#if __ARM_NEON
#include "convolution_1x1_int8.h"
#include "convolution_3x3_int8.h"
#endif // __ARM_NEON

DEFINE_LAYER_CREATOR(Convolution_arm)

Expand Down Expand Up @@ -64,13 +66,15 @@ int Convolution_arm::load_model(const ModelBin& mb)

if (use_int8_inference)
{
#if __ARM_NEON
#if !__aarch64__
if (kernel_w == 3 && kernel_h == 3 && dilation_w == 1 && dilation_h == 1 && stride_w == 1 && stride_h == 1)
{
int num_input = weight_data_size / 9 / num_output;
conv3x3s1_transform_kernel_int8_neon(weight_data, weight_3x3s1_int8_data, num_input, num_output);
}
#endif // !__aarch64__
#endif // __ARM_NEON
return 0;
}

Expand Down Expand Up @@ -274,6 +278,7 @@ int Convolution_arm::forward(const Mat& bottom_blob, Mat& top_blob, const Option

typedef void (*conv_int8_func)(const Mat&, Mat&, const Mat&, const Option&);

#if __ARM_NEON
// kernel_size x stride
conv_int8_func conv_int8_func_table[5][5] =
{
Expand Down Expand Up @@ -313,17 +318,22 @@ int Convolution_arm::forward(const Mat& bottom_blob, Mat& top_blob, const Option
0
} // kernel_size = 5
};
#endif // __ARM_NEON

conv_func conv = 0;
conv_int8_func conv_int8 = 0;

if (use_int8_inference)
{
#if __ARM_NEON
conv_int8 = conv_int8_func_table[kernel_size-1][stride-1];
if (!conv_int8)
{
return Convolution::forward(bottom_blob, top_blob, opt);
}
#else
return Convolution::forward(bottom_blob, top_blob, opt);
#endif // __ARM_NEON
}
else
{
Expand Down Expand Up @@ -400,13 +410,15 @@ int Convolution_arm::forward(const Mat& bottom_blob, Mat& top_blob, const Option

if (use_int8_inference)
{
#if __ARM_NEON
#if !__aarch64__
if (kernel_w == 3 && kernel_h == 3 && dilation_w == 1 && dilation_h == 1 && stride_w == 1 && stride_h == 1)
{
conv3x3s1_packed_int8_neon(bottom_blob_bordered, top_blob, weight_3x3s1_int8_data, opt);
}
else
#endif // !__aarch64__
#endif // __ARM_NEON
{
conv_int8(bottom_blob_bordered, top_blob, weight_data, opt);
}
Expand Down

0 comments on commit 19ad4cf

Please sign in to comment.