Skip to content

Commit

Permalink
[arm] fix iOS compiling error (#5040)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiaoAngel committed Dec 24, 2020
1 parent 70b7d9b commit def0352
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
10 changes: 8 additions & 2 deletions lite/backends/arm/math/gemm_prepacked_int8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5710,8 +5710,9 @@ void gemm_prepack_int8(const int8_t* A_packed,
alpha[3] = local_alpha;
}
}
#if defined(__aarch64__) && defined(WITH_ARM_DOTPROD)
#ifdef __aarch64__
if (ctx->has_dot()) {
#ifdef WITH_ARM_DOTPROD
gemm_prepack_sdot_int8<int32_t>(A_packed,
B,
bias,
Expand All @@ -5725,6 +5726,7 @@ void gemm_prepack_int8(const int8_t* A_packed,
scale,
alpha,
ctx);
#endif
} else {
gemm_prepack_oth_int8<int32_t>(A_packed,
B,
Expand All @@ -5741,7 +5743,10 @@ void gemm_prepack_int8(const int8_t* A_packed,
ctx);
}
#else
if (ctx->has_dot()) {
if (0 && ctx->has_dot()) {
#ifdef WITH_ARM_DOTPROD
// ios build error : no template named 'gemm_prepack_vsdot_int8'
// android is ok
gemm_prepack_vsdot_int8<int32_t>(A_packed,
B,
bias,
Expand All @@ -5755,6 +5760,7 @@ void gemm_prepack_int8(const int8_t* A_packed,
scale,
alpha,
ctx);
#endif
} else {
gemm_prepack_oth_int8<int32_t>(A_packed,
B,
Expand Down
13 changes: 11 additions & 2 deletions lite/core/mir/fusion/quant_dequant_op_fuser.cc
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,23 @@ void DequantOpFuser::InsertNewNode(SSAGraph* graph,
std::vector<float> weight_scale;
int weight_scale_size = 0;
if (quantized_op_type_ == "conv2d" ||
quantized_op_type_ == "depthwise_conv2d" ||
quantized_op_type_ == "conv2d_transpose") {
quantized_op_type_ == "depthwise_conv2d") {
op_desc.SetInput("Input", {quantized_op_input->arg()->name});
op_desc.SetOutput("Output", {dequant_op_out->arg()->name});
// Conv weight shape: Cout * Cin/group * kh * hw, the weight_scale_size
// should
// be Cout.
weight_scale_size = quantized_weight_t->dims()[0];
} else if (quantized_op_type_ == "conv2d_transpose") {
op_desc.SetInput("Input", {quantized_op_input->arg()->name});
op_desc.SetOutput("Output", {dequant_op_out->arg()->name});

auto* conv_op_desc = matched.at("quantized_op")->stmt()->op_info();
auto groups = conv_op_desc->GetAttr<int>("groups");
// Conv weight shape: Cin * Cout/group * kh * hw, the weight_scale_size
// should
// be Cout.
weight_scale_size = quantized_weight_t->dims()[1] * groups;
} else if (quantized_op_type_ == "mul" || quantized_op_type_ == "matmul") {
op_desc.SetInput("X", {quantized_op_input->arg()->name});
op_desc.SetOutput("Out", {dequant_op_out->arg()->name});
Expand Down
1 change: 1 addition & 0 deletions lite/kernels/arm/conv_transpose_compute.cc
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ void Conv2DTransposeCompute<PRECISION(kInt8), PRECISION(kInt8)>::Run() {
&act_param);
}
}

} // namespace arm
} // namespace kernels
} // namespace lite
Expand Down
8 changes: 4 additions & 4 deletions lite/tests/cv/image_profiler_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,8 @@ void test_flip(const std::vector<int>& cluster_id,
} else if (srcFormat == ImageFormat::GRAY) {
size = srch * srcw;
}
uint8_t* src = new uint8_t[size];
fill_tensor_host_rand(src, size);
uint8_t* src = new uint8_t[2 * size];
fill_tensor_host_rand(src, 2 * size);

int out_size = srch * srcw;
if (dstFormat == ImageFormat::NV12 || dstFormat == ImageFormat::NV21) {
Expand All @@ -378,8 +378,8 @@ void test_flip(const std::vector<int>& cluster_id,
} else if (dstFormat == ImageFormat::GRAY) {
out_size = srch * srcw;
}
uint8_t* basic_dst = new uint8_t[out_size];
uint8_t* lite_dst = new uint8_t[out_size];
uint8_t* basic_dst = new uint8_t[2 * out_size];
uint8_t* lite_dst = new uint8_t[2 * out_size];
LOG(INFO) << "basic flip compute";
Timer t_basic, t_lite;
for (int i = 0; i < test_iter; i++) {
Expand Down

0 comments on commit def0352

Please sign in to comment.