From 1cabc4180f8dc4dbdd08133ad460d8d1625b4263 Mon Sep 17 00:00:00 2001 From: huzhiqiang <912790387@qq.com> Date: Mon, 4 Nov 2019 14:26:53 +0800 Subject: [PATCH] Move new op kernel into extra (#2348) * move some basic ops into extra type to reduce library size test=develop (#2347) --- lite/kernels/arm/CMakeLists.txt | 36 ++++++++++++++++---------------- lite/kernels/host/CMakeLists.txt | 2 +- lite/operators/CMakeLists.txt | 34 +++++++++++++++--------------- lite/tools/build.sh | 3 ++- 4 files changed, 38 insertions(+), 37 deletions(-) diff --git a/lite/kernels/arm/CMakeLists.txt b/lite/kernels/arm/CMakeLists.txt index 2f3eb8f01c..ba7a20f8c8 100644 --- a/lite/kernels/arm/CMakeLists.txt +++ b/lite/kernels/arm/CMakeLists.txt @@ -1,9 +1,9 @@ # for conv op -add_kernel(conv_depthwise ARM basic SRCS conv_depthwise.cc DEPS ${lite_kernel_deps} math_arm) -add_kernel(conv_direct ARM basic SRCS conv_direct.cc DEPS ${lite_kernel_deps} math_arm) -add_kernel(conv_gemmlike ARM basic SRCS conv_gemmlike.cc DEPS ${lite_kernel_deps} math_arm) -add_kernel(conv_winograd ARM basic SRCS conv_winograd.cc DEPS ${lite_kernel_deps} math_arm) -add_kernel(conv_compute_arm ARM basic SRCS conv_compute.cc DEPS ${lite_kernel_deps} +add_kernel(conv_depthwise ARM extra SRCS conv_depthwise.cc DEPS ${lite_kernel_deps} math_arm) +add_kernel(conv_direct ARM extra SRCS conv_direct.cc DEPS ${lite_kernel_deps} math_arm) +add_kernel(conv_gemmlike ARM extra SRCS conv_gemmlike.cc DEPS ${lite_kernel_deps} math_arm) +add_kernel(conv_winograd ARM extra SRCS conv_winograd.cc DEPS ${lite_kernel_deps} math_arm) +add_kernel(conv_compute_arm ARM extra SRCS conv_compute.cc DEPS ${lite_kernel_deps} conv_depthwise conv_direct conv_gemmlike conv_winograd) add_kernel(fc_compute_arm ARM basic SRCS fc_compute.cc DEPS ${lite_kernel_deps} math_arm) @@ -40,24 +40,24 @@ add_kernel(shape_compute_arm ARM basic SRCS shape_compute.cc DEPS ${lite_kernel_ add_kernel(slice_compute_arm ARM basic SRCS slice_compute.cc DEPS ${lite_kernel_deps} math_arm) add_kernel(cast_compute_arm ARM basic SRCS cast_compute.cc DEPS ${lite_kernel_deps} math_arm) add_kernel(squeeze_compute_arm ARM basic SRCS squeeze_compute.cc DEPS ${lite_kernel_deps} math_arm) -add_kernel(unsqueeze_compute_arm ARM basic SRCS unsqueeze_compute.cc DEPS ${lite_kernel_deps} math_arm) +add_kernel(unsqueeze_compute_arm ARM extra SRCS unsqueeze_compute.cc DEPS ${lite_kernel_deps} math_arm) add_kernel(expand_compute_arm ARM basic SRCS expand_compute.cc DEPS ${lite_kernel_deps} math_arm) add_kernel(reduce_max_compute_arm ARM basic SRCS reduce_max_compute.cc DEPS ${lite_kernel_deps} math_arm) add_kernel(sequence_expand_compute_arm ARM basic SRCS sequence_expand_compute.cc DEPS ${lite_kernel_deps} math_arm) add_kernel(im2sequence_compute_arm ARM basic SRCS im2sequence_compute.cc DEPS ${lite_kernel_deps} math_arm) add_kernel(sequence_pool_compute_arm ARM basic SRCS sequence_pool_compute.cc DEPS ${lite_kernel_deps} math_arm) -add_kernel(layer_norm_compute_arm ARM basic SRCS layer_norm_compute.cc DEPS ${lite_kernel_deps} math_arm) -add_kernel(gather_compute_arm ARM basic SRCS gather_compute.cc DEPS ${lite_kernel_deps} math_arm) -add_kernel(reduce_mean_compute_arm ARM basic SRCS reduce_mean_compute.cc DEPS ${lite_kernel_deps} math_arm) -add_kernel(stack_compute_arm ARM basic SRCS stack_compute.cc DEPS ${lite_kernel_deps} math_arm) -add_kernel(assign_compute_arm ARM basic SRCS assign_compute.cc DEPS ${lite_kernel_deps} math_arm) -add_kernel(affine_channel_compute_arm ARM basic SRCS affine_channel_compute.cc DEPS ${lite_kernel_deps} math_arm) -add_kernel(anchor_generator_compute_arm ARM basic SRCS anchor_generator_compute.cc DEPS ${lite_kernel_deps} math_arm) -add_kernel(generate_proposals_compute_arm ARM basic SRCS generate_proposals_compute.cc DEPS ${lite_kernel_deps} math_arm) -add_kernel(roi_align_compute_arm ARM basic SRCS roi_align_compute.cc DEPS ${lite_kernel_deps} math_arm) -add_kernel(box_clip_compute_arm ARM basic SRCS box_clip_compute.cc DEPS ${lite_kernel_deps} math_arm) -add_kernel(range_compute_arm ARM basic SRCS range_compute.cc DEPS ${lite_kernel_deps} math_arm) -add_kernel(assign_value_compute_arm ARM basic SRCS assign_value_compute.cc DEPS ${lite_kernel_deps} math_arm) +add_kernel(layer_norm_compute_arm ARM extra SRCS layer_norm_compute.cc DEPS ${lite_kernel_deps} math_arm) +add_kernel(gather_compute_arm ARM extra SRCS gather_compute.cc DEPS ${lite_kernel_deps} math_arm) +add_kernel(reduce_mean_compute_arm ARM extra SRCS reduce_mean_compute.cc DEPS ${lite_kernel_deps} math_arm) +add_kernel(stack_compute_arm ARM extra SRCS stack_compute.cc DEPS ${lite_kernel_deps} math_arm) +add_kernel(assign_compute_arm ARM extra SRCS assign_compute.cc DEPS ${lite_kernel_deps} math_arm) +add_kernel(affine_channel_compute_arm ARM extra SRCS affine_channel_compute.cc DEPS ${lite_kernel_deps} math_arm) +add_kernel(anchor_generator_compute_arm ARM extra SRCS anchor_generator_compute.cc DEPS ${lite_kernel_deps} math_arm) +add_kernel(generate_proposals_compute_arm ARM extra SRCS generate_proposals_compute.cc DEPS ${lite_kernel_deps} math_arm) +add_kernel(roi_align_compute_arm ARM extra SRCS roi_align_compute.cc DEPS ${lite_kernel_deps} math_arm) +add_kernel(box_clip_compute_arm ARM extra SRCS box_clip_compute.cc DEPS ${lite_kernel_deps} math_arm) +add_kernel(range_compute_arm ARM extra SRCS range_compute.cc DEPS ${lite_kernel_deps} math_arm) +add_kernel(assign_value_compute_arm ARM extra SRCS assign_value_compute.cc DEPS ${lite_kernel_deps} math_arm) # for OCR specific add_kernel(gru_unit_compute_arm ARM extra SRCS gru_unit_compute.cc DEPS ${lite_kernel_deps} math_arm) diff --git a/lite/kernels/host/CMakeLists.txt b/lite/kernels/host/CMakeLists.txt index 428cc213ce..65900fa76a 100644 --- a/lite/kernels/host/CMakeLists.txt +++ b/lite/kernels/host/CMakeLists.txt @@ -3,7 +3,7 @@ message(STATUS "compile with lite host kernels") add_kernel(feed_compute_host Host basic SRCS feed_compute.cc DEPS ${lite_kernel_deps}) add_kernel(fetch_compute_host Host basic SRCS fetch_compute.cc DEPS ${lite_kernel_deps}) add_kernel(reshape_compute_host Host basic SRCS reshape_compute.cc DEPS ${lite_kernel_deps} reshape_op) -add_kernel(multiclass_nms_compute_host Host basic SRCS multiclass_nms_compute.cc DEPS ${lite_kernel_deps}) +add_kernel(multiclass_nms_compute_host Host extra SRCS multiclass_nms_compute.cc DEPS ${lite_kernel_deps}) #lite_cc_test(test_reshape_compute_host SRCS reshape_compute_test.cc DEPS reshape_compute_host any) #lite_cc_test(test_multiclass_nms_compute_host SRCS multiclass_nms_compute_test.cc DEPS multiclass_nms_compute_host any) diff --git a/lite/operators/CMakeLists.txt b/lite/operators/CMakeLists.txt index 2d23d8bb06..9d5d1952ae 100644 --- a/lite/operators/CMakeLists.txt +++ b/lite/operators/CMakeLists.txt @@ -5,7 +5,7 @@ lite_cc_library(op_params SRCS op_params.cc DEPS tensor any) add_operator(conv_op basic SRCS conv_op.cc DEPS ${op_DEPS}) add_operator(pool_op basic SRCS pool_op.cc DEPS ${op_DEPS}) add_operator(fc_op basic SRCS fc_op.cc DEPS ${op_DEPS}) -add_operator(assign_op basic SRCS assign_op.cc DEPS ${op_DEPS}) +add_operator(assign_op extra SRCS assign_op.cc DEPS ${op_DEPS}) add_operator(relu_op basic SRCS relu_op.cc DEPS ${op_DEPS}) add_operator(mul_op basic SRCS mul_op.cc DEPS ${op_DEPS}) add_operator(matmul_op basic SRCS matmul_op.cc DEPS ${op_DEPS}) @@ -59,23 +59,23 @@ add_operator(norm_op basic SRCS norm_op.cc DEPS ${op_DEPS}) add_operator(shape_op_lite basic SRCS shape_op.cc DEPS ${op_DEPS}) add_operator(sequence_expand_op_lite basic SRCS sequence_expand_op.cc DEPS ${op_DEPS}) add_operator(squeeze_op_lite basic SRCS squeeze_op.cc DEPS ${op_DEPS}) -add_operator(unsqueeze_op_lite basic SRCS unsqueeze_op.cc DEPS ${op_DEPS}) +add_operator(unsqueeze_op_lite extra SRCS unsqueeze_op.cc DEPS ${op_DEPS}) add_operator(im2sequence_op basic SRCS im2sequence_op.cc DEPS ${op_DEPS}) -add_operator(gather_op basic SRCS gather_op.cc DEPS ${op_DEPS}) -add_operator(reduce_mean_op basic SRCS reduce_mean_op.cc DEPS ${op_DEPS}) -add_operator(stack_op basic SRCS stack_op.cc DEPS ${op_DEPS}) -add_operator(cast_op_lite basic SRCS cast_op.cc DEPS ${op_DEPS}) -add_operator(affine_channel_op basic SRCS affine_channel_op.cc DEPS ${op_DEPS}) -add_operator(anchor_generator_op basic SRCS anchor_generator_op.cc DEPS ${op_DEPS}) -add_operator(generate_proposals_op basic SRCS generate_proposals_op.cc DEPS ${op_DEPS}) -add_operator(roi_align_op basic SRCS roi_align_op.cc DEPS ${op_DEPS}) -add_operator(box_clip_op basic SRCS box_clip_op.cc DEPS ${op_DEPS}) -add_operator(flatten_op basic SRCS flatten_op.cc DEPS ${op_DEPS}) -add_operator(fake_quantize_range_abs_max_op basic SRCS fake_quantize_range_abs_max.cc DEPS ${op_DEPS}) -add_operator(sequence_expand_as_op_lite basic SRCS sequence_expand_as_op.cc DEPS ${op_DEPS}) -add_operator(range_op basic SRCS range_op.cc DEPS ${op_DEPS}) -add_operator(assign_value_op basic SRCS assign_value_op.cc DEPS ${op_DEPS}) -add_operator(fake_quantize_dequantize_moving_avg_abs_max_op basic SRCS fake_quantize_dequantize_moving_avg_max_abs.cc DEPS ${op_DEPS}) +add_operator(gather_op extra SRCS gather_op.cc DEPS ${op_DEPS}) +add_operator(reduce_mean_op extra SRCS reduce_mean_op.cc DEPS ${op_DEPS}) +add_operator(stack_op extra SRCS stack_op.cc DEPS ${op_DEPS}) +add_operator(cast_op_lite extra SRCS cast_op.cc DEPS ${op_DEPS}) +add_operator(affine_channel_op extra SRCS affine_channel_op.cc DEPS ${op_DEPS}) +add_operator(anchor_generator_op extra SRCS anchor_generator_op.cc DEPS ${op_DEPS}) +add_operator(generate_proposals_op extra SRCS generate_proposals_op.cc DEPS ${op_DEPS}) +add_operator(roi_align_op extra SRCS roi_align_op.cc DEPS ${op_DEPS}) +add_operator(box_clip_op extra SRCS box_clip_op.cc DEPS ${op_DEPS}) +add_operator(flatten_op extra SRCS flatten_op.cc DEPS ${op_DEPS}) +add_operator(fake_quantize_range_abs_max_op extra SRCS fake_quantize_range_abs_max.cc DEPS ${op_DEPS}) +add_operator(sequence_expand_as_op_lite extra SRCS sequence_expand_as_op.cc DEPS ${op_DEPS}) +add_operator(range_op extra SRCS range_op.cc DEPS ${op_DEPS}) +add_operator(assign_value_op extra SRCS assign_value_op.cc DEPS ${op_DEPS}) +add_operator(fake_quantize_dequantize_moving_avg_abs_max_op extra SRCS fake_quantize_dequantize_moving_avg_max_abs.cc DEPS ${op_DEPS}) # for OCR specific add_operator(while_op extra SRCS while_op.cc DEPS ${op_DEPS}) diff --git a/lite/tools/build.sh b/lite/tools/build.sh index 2379d85fa5..d1f47c149e 100755 --- a/lite/tools/build.sh +++ b/lite/tools/build.sh @@ -231,7 +231,8 @@ function make_cuda { -DLITE_WITH_LIGHT_WEIGHT_FRAMEWORK=OFF \ -DWITH_TESTING=OFF \ -DLITE_WITH_ARM=OFF \ - -DLITE_WITH_PYTHON=ON + -DLITE_WITH_PYTHON=ON \ + -DLITE_BUILD_EXTRA=ON make publish_inference_python_lib -j8 cd - -- GitLab