diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cb4ecf259883455ccc7c8529c048e76d7536da04..8228ce27c59b9649d1a39838104ced57e07a7179 100755 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -109,15 +109,15 @@ build:mobile_armlinux: - build:server -build:mobile_model_mobilenetv1: +build:mobile_model_resnet50: tags: - lite stage: build_mobile image: $MOBILE_LITE_DOCKER_IMAGE script: - - export CCACHE_DIR=$CI_PROJECT_DIR/build_mobile_model_mobilenetv1 - - ./paddle/fluid/lite/tools/build.sh build_test_arm_model_mobilenetv1 + - export CCACHE_DIR=$CI_PROJECT_DIR/build_mobile_model_resnet50 + - ./paddle/fluid/lite/tools/build.sh build_test_arm_model_resnet50 dependencies: - build:server @@ -127,17 +127,18 @@ build:mobile_model_mobilenetv1: paths: - build.lite.android.armv8.gcc - ~/.ccache - - $CI_PROJECT_DIR/build_mobile_model_mobilenetv1 + - $CI_PROJECT_DIR/build_mobile_model_resnet50 -build:mobile_model_mobilenetv2: + +build:mobile_model_mobilenetv1: tags: - lite stage: build_mobile image: $MOBILE_LITE_DOCKER_IMAGE script: - - export CCACHE_DIR=$CI_PROJECT_DIR/build_mobile_model_mobilenetv2 - - ./paddle/fluid/lite/tools/build.sh build_test_arm_model_mobilenetv2 + - export CCACHE_DIR=$CI_PROJECT_DIR/build_mobile_model_mobilenetv1 + - ./paddle/fluid/lite/tools/build.sh build_test_arm_model_mobilenetv1 dependencies: - build:server @@ -147,17 +148,17 @@ build:mobile_model_mobilenetv2: paths: - build.lite.android.armv8.gcc - ~/.ccache - - $CI_PROJECT_DIR/build_mobile_model_mobilenetv2 + - $CI_PROJECT_DIR/build_mobile_model_mobilenetv1 -build:mobile_model_resnet50: +build:mobile_model_mobilenetv2: tags: - lite stage: build_mobile image: $MOBILE_LITE_DOCKER_IMAGE script: - - export CCACHE_DIR=$CI_PROJECT_DIR/build_mobile_model_resnet50 - - ./paddle/fluid/lite/tools/build.sh build_test_arm_model_resnet50 + - export CCACHE_DIR=$CI_PROJECT_DIR/build_mobile_model_mobilenetv2 + - ./paddle/fluid/lite/tools/build.sh build_test_arm_model_mobilenetv2 dependencies: - build:server @@ -167,7 +168,7 @@ build:mobile_model_resnet50: paths: - build.lite.android.armv8.gcc - ~/.ccache - - $CI_PROJECT_DIR/build_mobile_model_resnet50 + - $CI_PROJECT_DIR/build_mobile_model_mobilenetv2 #build:mobile_model_inceptionv4: # tags: diff --git a/paddle/fluid/inference/analysis/passes/CMakeLists.txt b/paddle/fluid/inference/analysis/passes/CMakeLists.txt index 7b1bbbb585ad67e378cfbf0a88c7c10fef41621e..8af0a1aceac802c6e0766e05710c3e40636d4463 100644 --- a/paddle/fluid/inference/analysis/passes/CMakeLists.txt +++ b/paddle/fluid/inference/analysis/passes/CMakeLists.txt @@ -5,7 +5,7 @@ cc_library(ir_params_sync_among_devices_pass SRCS ir_params_sync_among_devices_p cc_library(ir_graph_to_program_pass SRCS ir_graph_to_program_pass.cc DEPS analysis_pass graph_to_program_pass) cc_library(adjust_cudnn_workspace_size_pass SRCS adjust_cudnn_workspace_size_pass.cc DEPS analysis_pass graph_to_program_pass) -cc_library(analysis_passes SRCS use_passes.cc DEPS +cc_library(analysis_passes SRCS paddle_use_passes.cc DEPS ir_graph_build_pass ir_analysis_pass ir_params_sync_among_devices_pass diff --git a/paddle/fluid/inference/analysis/passes/use_passes.cc b/paddle/fluid/inference/analysis/passes/paddle_use_passes.cc similarity index 100% rename from paddle/fluid/inference/analysis/passes/use_passes.cc rename to paddle/fluid/inference/analysis/passes/paddle_use_passes.cc diff --git a/paddle/fluid/lite/CMakeLists.txt b/paddle/fluid/lite/CMakeLists.txt index b35a72331d7e0323297495025ac1ea8ba5bde56b..0819c81773a77aac9d7e2c71c9ca416f0786a952 100644 --- a/paddle/fluid/lite/CMakeLists.txt +++ b/paddle/fluid/lite/CMakeLists.txt @@ -208,3 +208,33 @@ if (WITH_TESTING) lite_download_and_uncompress(${LITE_MODEL_DIR} ${LITE_URL} "GoogleNet_inference.tar.gz") endif() endif() + +# for publish +set(INFER_LITE_PUBLISH_ROOT "${CMAKE_BINARY_DIR}/inference_lite_lib" CACHE STRING "inference publish path") +message(STATUS "publish inference lib to ${INFER_LITE_PUBLISH_ROOT}") + +# The final target for publish lite lib +add_custom_target(publish_inference_lite) + +#cc_library(inference_cxx_lib DEPS cxx_api_lite) +add_custom_target(publish_inference_cxx_lib ${TARGET} + COMMAND mkdir -p "${INFER_LITE_PUBLISH_ROOT}/cxx/lib" + COMMAND mkdir -p "${INFER_LITE_PUBLISH_ROOT}/cxx/include" + COMMAND cp "${CMAKE_SOURCE_DIR}/paddle/fluid/lite/api/paddle_*.h" "${INFER_LITE_PUBLISH_ROOT}/cxx/include" + COMMAND cp "${CMAKE_BINARY_DIR}/paddle/fluid/lite/api/libpaddle_api_full.a" "${INFER_LITE_PUBLISH_ROOT}/cxx/lib" + ) +add_dependencies(publish_inference_cxx_lib paddle_api_full) +add_dependencies(publish_inference_lite publish_inference_cxx_lib) + +if (LITE_WITH_LIGHT_WEIGHT_FRAMEWORK) + #cc_library(inference_mobile_lib DEPS light_api_lite) + + add_custom_target(publish_inference_mobile_lib ${TARGET} + COMMAND mkdir -p "${INFER_LITE_PUBLISH_ROOT}/mobile/lib" + COMMAND mkdir -p "${INFER_LITE_PUBLISH_ROOT}/mobile/include" + COMMAND cp "${CMAKE_SOURCE_DIR}/paddle/fluid/lite/api/paddle_*.h" "${INFER_LITE_PUBLISH_ROOT}/cxx/include" + COMMAND cp "${CMAKE_BINARY_DIR}/paddle/fluid/lite/api/libpaddle_api_light.a" "${INFER_LITE_PUBLISH_ROOT}/cxx/lib" + ) + add_dependencies(publish_inference_mobile_lib paddle_api_light) + add_dependencies(publish_inference_lite publish_inference_mobile_lib) +endif() diff --git a/paddle/fluid/lite/api/CMakeLists.txt b/paddle/fluid/lite/api/CMakeLists.txt index 68e5eaacc47a77f6ae642eef4018e7f50518ec92..ab04f33f161ebfc8ae92f53ae4d65f7f4ccf3bdb 100644 --- a/paddle/fluid/lite/api/CMakeLists.txt +++ b/paddle/fluid/lite/api/CMakeLists.txt @@ -6,7 +6,7 @@ if(LITE_WITH_CUDA) nv_test(test_cxx_api_lite_cuda SRCS cxx_api_test.cc DEPS cxx_api_lite_cuda) endif() -lite_cc_library(place_lite SRCS place.cc DEPS glog) +lite_cc_library(place_lite SRCS paddle_place.cc DEPS glog) lite_cc_library(lite_api_test_helper SRCS lite_api_test_helper.cc DEPS scope_lite optimizer_lite target_wrapper_host model_parser_lite program_lite @@ -103,8 +103,11 @@ lite_cc_test(test_apis_lite SRCS apis_test.cc lite_cc_library(cxx_api_impl_lite SRCS cxx_api_impl.cc DEPS cxx_api_lite) lite_cc_library(light_api_impl_lite SRCS light_api_impl.cc DEPS light_api_lite) -lite_cc_library(paddle_api_lite SRCS paddle_api.cc DEPS cxx_api_impl_lite light_api_impl_lite) -lite_cc_test(test_paddle_api_lite SRCS paddle_api_test.cc DEPS cxx_api_lite light_api_lite paddle_api_lite +lite_cc_library(paddle_api_full SRCS paddle_api.cc DEPS cxx_api_impl_lite light_api_impl_lite) +lite_cc_library(paddle_api_light SRCS paddle_api.cc DEPS light_api_impl_lite) + + +lite_cc_test(test_paddle_api_lite SRCS paddle_api_test.cc DEPS cxx_api_lite light_api_lite paddle_api_full ARGS --model_dir=${LITE_MODEL_DIR}/lite_naive_model SERIAL) if (WITH_TESTING) add_dependencies(test_paddle_api_lite test_apis_lite) diff --git a/paddle/fluid/lite/api/apis_test.cc b/paddle/fluid/lite/api/apis_test.cc index a5cf93f0e29ce4b0ec5cc733da3ac609668ae539..b3694be9053f24cd0d3f0567398e47c28ba1599c 100644 --- a/paddle/fluid/lite/api/apis_test.cc +++ b/paddle/fluid/lite/api/apis_test.cc @@ -20,10 +20,10 @@ #include #include "paddle/fluid/lite/api/cxx_api.h" #include "paddle/fluid/lite/api/light_api.h" +#include "paddle/fluid/lite/api/paddle_use_kernels.h" +#include "paddle/fluid/lite/api/paddle_use_ops.h" +#include "paddle/fluid/lite/api/paddle_use_passes.h" #include "paddle/fluid/lite/core/mir/pass_registry.h" -#include "paddle/fluid/lite/core/mir/use_passes.h" -#include "paddle/fluid/lite/kernels/use_kernels.h" -#include "paddle/fluid/lite/operators/use_ops.h" DEFINE_string(model_dir, "", ""); DEFINE_string(optimized_model, "", ""); diff --git a/paddle/fluid/lite/api/cxx_api_bin.cc b/paddle/fluid/lite/api/cxx_api_bin.cc index 36f6ed45a10653aec74658a3c4794954d65dd1f5..03e4680c583c317f7cb73e55cb6ee7b1a67fef81 100644 --- a/paddle/fluid/lite/api/cxx_api_bin.cc +++ b/paddle/fluid/lite/api/cxx_api_bin.cc @@ -14,7 +14,7 @@ #include "paddle/fluid/lite/api/cxx_api.h" #include // NOLINT -#include "paddle/fluid/lite/core/mir/use_passes.h" +#include "paddle/fluid/lite/api/paddle_use_passes.h" #include "paddle/fluid/lite/core/op_registry.h" namespace paddle { diff --git a/paddle/fluid/lite/api/cxx_api_test.cc b/paddle/fluid/lite/api/cxx_api_test.cc index a1a028a5453a25f025bb55a4f81d4b94445480bb..c3c4fa51f6731998683a25a96a0e1ee88f86f61a 100644 --- a/paddle/fluid/lite/api/cxx_api_test.cc +++ b/paddle/fluid/lite/api/cxx_api_test.cc @@ -17,11 +17,11 @@ #include #include #include "paddle/fluid/lite/api/lite_api_test_helper.h" +#include "paddle/fluid/lite/api/paddle_use_kernels.h" +#include "paddle/fluid/lite/api/paddle_use_ops.h" +#include "paddle/fluid/lite/api/paddle_use_passes.h" #include "paddle/fluid/lite/core/compatible_tensor.h" -#include "paddle/fluid/lite/core/mir/use_passes.h" #include "paddle/fluid/lite/core/op_registry.h" -#include "paddle/fluid/lite/kernels/use_kernels.h" -#include "paddle/fluid/lite/operators/use_ops.h" // For training. DEFINE_string(startup_program_path, "", ""); diff --git a/paddle/fluid/lite/api/inceptionv4_test.cc b/paddle/fluid/lite/api/inceptionv4_test.cc index cea4eb450f80aa3b0f8595ea8aece89d39c1f0fb..c955a6179b3f3a43393aae6ade79a756cb6eef9e 100644 --- a/paddle/fluid/lite/api/inceptionv4_test.cc +++ b/paddle/fluid/lite/api/inceptionv4_test.cc @@ -16,11 +16,11 @@ #include #include #include "paddle/fluid/lite/api/cxx_api.h" +#include "paddle/fluid/lite/api/paddle_use_kernels.h" +#include "paddle/fluid/lite/api/paddle_use_ops.h" +#include "paddle/fluid/lite/api/paddle_use_passes.h" #include "paddle/fluid/lite/api/test_helper.h" -#include "paddle/fluid/lite/core/mir/use_passes.h" #include "paddle/fluid/lite/core/op_registry.h" -#include "paddle/fluid/lite/kernels/use_kernels.h" -#include "paddle/fluid/lite/operators/use_ops.h" namespace paddle { namespace lite { diff --git a/paddle/fluid/lite/api/light_api_test.cc b/paddle/fluid/lite/api/light_api_test.cc index d7e58fbe56cee4055c422af9a8881e664cc26605..ca34175c6e3be8627a074cfc153001d3a40a460f 100644 --- a/paddle/fluid/lite/api/light_api_test.cc +++ b/paddle/fluid/lite/api/light_api_test.cc @@ -15,9 +15,9 @@ #include "paddle/fluid/lite/api/light_api.h" #include #include -#include "paddle/fluid/lite/core/mir/use_passes.h" -#include "paddle/fluid/lite/kernels/use_kernels.h" -#include "paddle/fluid/lite/operators/use_ops.h" +#include "paddle/fluid/lite/api/paddle_use_kernels.h" +#include "paddle/fluid/lite/api/paddle_use_ops.h" +#include "paddle/fluid/lite/api/paddle_use_passes.h" DEFINE_string(optimized_model, "", ""); diff --git a/paddle/fluid/lite/api/mobilenetv1_test.cc b/paddle/fluid/lite/api/mobilenetv1_test.cc index d72fc7690d1c9e3f3e8930a835352d9105893a4a..326450317c6d1bd5204c52ab8f55ebe9c731af50 100644 --- a/paddle/fluid/lite/api/mobilenetv1_test.cc +++ b/paddle/fluid/lite/api/mobilenetv1_test.cc @@ -16,11 +16,11 @@ #include #include #include "paddle/fluid/lite/api/cxx_api.h" +#include "paddle/fluid/lite/api/paddle_use_kernels.h" +#include "paddle/fluid/lite/api/paddle_use_ops.h" +#include "paddle/fluid/lite/api/paddle_use_passes.h" #include "paddle/fluid/lite/api/test_helper.h" -#include "paddle/fluid/lite/core/mir/use_passes.h" #include "paddle/fluid/lite/core/op_registry.h" -#include "paddle/fluid/lite/kernels/use_kernels.h" -#include "paddle/fluid/lite/operators/use_ops.h" namespace paddle { namespace lite { diff --git a/paddle/fluid/lite/api/mobilenetv2_test.cc b/paddle/fluid/lite/api/mobilenetv2_test.cc index e50ac212c10a462180786d2bb9887881957bb0f7..cdcef149eba3bdcfb08550cde5817520f7f52ed4 100644 --- a/paddle/fluid/lite/api/mobilenetv2_test.cc +++ b/paddle/fluid/lite/api/mobilenetv2_test.cc @@ -16,11 +16,11 @@ #include #include #include "paddle/fluid/lite/api/cxx_api.h" +#include "paddle/fluid/lite/api/paddle_use_kernels.h" +#include "paddle/fluid/lite/api/paddle_use_ops.h" +#include "paddle/fluid/lite/api/paddle_use_passes.h" #include "paddle/fluid/lite/api/test_helper.h" -#include "paddle/fluid/lite/core/mir/use_passes.h" #include "paddle/fluid/lite/core/op_registry.h" -#include "paddle/fluid/lite/kernels/use_kernels.h" -#include "paddle/fluid/lite/operators/use_ops.h" namespace paddle { namespace lite { diff --git a/paddle/fluid/lite/api/paddle_api.h b/paddle/fluid/lite/api/paddle_api.h index 9068503995075c52836254626e0ab5ce935ab0a5..28ac6bd799ac7d1f6b58cc6845b9e311707772ab 100644 --- a/paddle/fluid/lite/api/paddle_api.h +++ b/paddle/fluid/lite/api/paddle_api.h @@ -22,7 +22,7 @@ #include #include #include -#include "place.h" // NOLINT +#include "paddle_place.h" // NOLINT namespace paddle { namespace lite_api { diff --git a/paddle/fluid/lite/api/paddle_api_test.cc b/paddle/fluid/lite/api/paddle_api_test.cc index f9f3b1e7c4086c509ac052bf38345b557bf0dc00..eafdb67d6e893c9aae697b9e199535f014b381ad 100644 --- a/paddle/fluid/lite/api/paddle_api_test.cc +++ b/paddle/fluid/lite/api/paddle_api_test.cc @@ -14,10 +14,11 @@ #include "paddle/fluid/lite/api/paddle_api.h" #include +#include #include -#include "paddle/fluid/lite/core/mir/use_passes.h" -#include "paddle/fluid/lite/kernels/use_kernels.h" -#include "paddle/fluid/lite/operators/use_ops.h" +#include "paddle/fluid/lite/api/paddle_use_kernels.h" +#include "paddle/fluid/lite/api/paddle_use_ops.h" +#include "paddle/fluid/lite/api/paddle_use_passes.h" DEFINE_string(model_dir, "", ""); diff --git a/paddle/fluid/lite/api/paddle_lite_factory_helper.h b/paddle/fluid/lite/api/paddle_lite_factory_helper.h new file mode 100644 index 0000000000000000000000000000000000000000..544cd0e313034ef4a8c378298f4e86c9597d6a98 --- /dev/null +++ b/paddle/fluid/lite/api/paddle_lite_factory_helper.h @@ -0,0 +1,37 @@ +// Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* + * This file defines some MACROS that explicitly determine the op, kernel, mir + * passes used in the inference lib. + */ +#pragma once + +#define USE_LITE_OP(op_type__) \ + extern int touch_op_##op_type__(); \ + int LITE_OP_REGISTER_FAKE(op_type__) __attribute__((unused)) = \ + touch_op_##op_type__(); + +#define USE_LITE_KERNEL(op_type__, target__, precision__, layout__, alias__) \ + extern int touch_##op_type__##target__##precision__##layout__##alias__(); \ + int op_type__##target__##precision__##layout__##alias__ \ + __attribute__((unused)) = \ + touch_##op_type__##target__##precision__##layout__##alias__(); + +#define USE_MIR_PASS(name__) \ + extern bool mir_pass_registry##name__##_fake(); \ + static bool mir_pass_usage##name__ __attribute__((unused)) = \ + mir_pass_registry##name__##_fake(); + +#define LITE_OP_REGISTER_FAKE(op_type__) op_type__##__registry__ diff --git a/paddle/fluid/lite/api/place.cc b/paddle/fluid/lite/api/paddle_place.cc similarity index 98% rename from paddle/fluid/lite/api/place.cc rename to paddle/fluid/lite/api/paddle_place.cc index 6eee4cba65edb59cf2eb6c124aaeace905713e50..6f60ea636c829ee96bc1cf8c5ea15a02757c172d 100644 --- a/paddle/fluid/lite/api/place.cc +++ b/paddle/fluid/lite/api/paddle_place.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/fluid/lite/api/place.h" +#include "paddle/fluid/lite/api/paddle_place.h" #include #include "paddle/fluid/lite/utils/hash.h" diff --git a/paddle/fluid/lite/api/place.h b/paddle/fluid/lite/api/paddle_place.h similarity index 100% rename from paddle/fluid/lite/api/place.h rename to paddle/fluid/lite/api/paddle_place.h diff --git a/paddle/fluid/lite/kernels/use_kernels.h b/paddle/fluid/lite/api/paddle_use_kernels.h similarity index 98% rename from paddle/fluid/lite/kernels/use_kernels.h rename to paddle/fluid/lite/api/paddle_use_kernels.h index df39ab98e5cf991ad6b694db80d56d5b64b92a4e..797acd7aa9002f0690554a6b3d493a0a1483e989 100644 --- a/paddle/fluid/lite/kernels/use_kernels.h +++ b/paddle/fluid/lite/api/paddle_use_kernels.h @@ -17,7 +17,7 @@ */ #pragma once -#include "paddle/fluid/lite/core/op_registry.h" +#include "paddle_lite_factory_helper.h" // NOLINT USE_LITE_KERNEL(feed, kHost, kAny, kAny, def); USE_LITE_KERNEL(fetch, kHost, kAny, kAny, def); @@ -61,6 +61,7 @@ USE_LITE_KERNEL(mul, kCUDA, kFloat, kNCHW, def); USE_LITE_KERNEL(io_copy, kCUDA, kAny, kAny, host_to_device); USE_LITE_KERNEL(io_copy, kCUDA, kAny, kAny, device_to_host); #endif + #ifdef LITE_WITH_OPENCL USE_LITE_KERNEL(elementwise_add, kOpenCL, kFloat, kNCHW, def); #endif diff --git a/paddle/fluid/lite/operators/use_ops.h b/paddle/fluid/lite/api/paddle_use_ops.h similarity index 95% rename from paddle/fluid/lite/operators/use_ops.h rename to paddle/fluid/lite/api/paddle_use_ops.h index 316e08ad4784849865b3d7722dfb7d1935d51247..cfb08bd57d4a722a98a5d569d74487f945b6c7a9 100644 --- a/paddle/fluid/lite/operators/use_ops.h +++ b/paddle/fluid/lite/api/paddle_use_ops.h @@ -16,7 +16,7 @@ // ATTENTION This can only include in a .cc file. -#include "paddle/fluid/lite/core/op_registry.h" +#include "paddle_lite_factory_helper.h" // NOLINT USE_LITE_OP(mul); USE_LITE_OP(fc); diff --git a/paddle/fluid/lite/core/mir/use_passes.h b/paddle/fluid/lite/api/paddle_use_passes.h similarity index 95% rename from paddle/fluid/lite/core/mir/use_passes.h rename to paddle/fluid/lite/api/paddle_use_passes.h index f0e6b5d243f7b374991dbfbfb807dfb342502aa8..c6fcf1f159ee727d9ef99b622a14cf2935c4e1f4 100644 --- a/paddle/fluid/lite/core/mir/use_passes.h +++ b/paddle/fluid/lite/api/paddle_use_passes.h @@ -13,7 +13,7 @@ // limitations under the License. #pragma once -#include "paddle/fluid/lite/core/mir/pass_registry.h" +#include "paddle_lite_factory_helper.h" // NOLINT USE_MIR_PASS(demo); USE_MIR_PASS(static_kernel_pick_pass); diff --git a/paddle/fluid/lite/api/resnet50_test.cc b/paddle/fluid/lite/api/resnet50_test.cc index a1e57bf32c583d74800cd36194ccd9b5171a8366..55247ae22a2ebc5a45e79f0fbf330f40be4ad4d7 100644 --- a/paddle/fluid/lite/api/resnet50_test.cc +++ b/paddle/fluid/lite/api/resnet50_test.cc @@ -16,11 +16,11 @@ #include #include #include "paddle/fluid/lite/api/cxx_api.h" +#include "paddle/fluid/lite/api/paddle_use_kernels.h" +#include "paddle/fluid/lite/api/paddle_use_ops.h" +#include "paddle/fluid/lite/api/paddle_use_passes.h" #include "paddle/fluid/lite/api/test_helper.h" -#include "paddle/fluid/lite/core/mir/use_passes.h" #include "paddle/fluid/lite/core/op_registry.h" -#include "paddle/fluid/lite/kernels/use_kernels.h" -#include "paddle/fluid/lite/operators/use_ops.h" namespace paddle { namespace lite { diff --git a/paddle/fluid/lite/api/test_googlenet_lite.cc b/paddle/fluid/lite/api/test_googlenet_lite.cc index 4ff5b2b952caceb6727cbed0af38ffa6a9474501..b878736c1e1554d3ec21d4c88c780e47b7516c9d 100644 --- a/paddle/fluid/lite/api/test_googlenet_lite.cc +++ b/paddle/fluid/lite/api/test_googlenet_lite.cc @@ -31,11 +31,11 @@ #include #include "paddle/fluid/lite/api/cxx_api.h" #include "paddle/fluid/lite/api/lite_api_test_helper.h" +#include "paddle/fluid/lite/api/paddle_use_kernels.h" +#include "paddle/fluid/lite/api/paddle_use_ops.h" +#include "paddle/fluid/lite/api/paddle_use_passes.h" #include "paddle/fluid/lite/core/compatible_tensor.h" -#include "paddle/fluid/lite/core/mir/use_passes.h" #include "paddle/fluid/lite/core/op_registry.h" -#include "paddle/fluid/lite/kernels/use_kernels.h" -#include "paddle/fluid/lite/operators/use_ops.h" // for googlenet DEFINE_string(model_dir, "", ""); diff --git a/paddle/fluid/lite/core/mir/fusion/conv_elementwise_add_activation_fuse_pass_test.cc b/paddle/fluid/lite/core/mir/fusion/conv_elementwise_add_activation_fuse_pass_test.cc index e7751d801eaa1239a70e3fb0d128165029a31669..ca50ba7692dba7d38fea79d5ffe0ffd1d58c5cf3 100644 --- a/paddle/fluid/lite/core/mir/fusion/conv_elementwise_add_activation_fuse_pass_test.cc +++ b/paddle/fluid/lite/core/mir/fusion/conv_elementwise_add_activation_fuse_pass_test.cc @@ -18,9 +18,9 @@ #include #include "paddle/fluid/framework/program_desc.h" #include "paddle/fluid/lite/api/cxx_api.h" +#include "paddle/fluid/lite/api/paddle_use_passes.h" #include "paddle/fluid/lite/core/compatible_tensor.h" #include "paddle/fluid/lite/core/mir/graph_visualize_pass.h" -#include "paddle/fluid/lite/core/mir/use_passes.h" #include "paddle/fluid/lite/core/op_registry.h" #include "paddle/fluid/lite/core/program.h" diff --git a/paddle/fluid/lite/core/mir/fusion/elementwise_add_activation_fuse_pass_test.cc b/paddle/fluid/lite/core/mir/fusion/elementwise_add_activation_fuse_pass_test.cc index 4b7742e059d8206d880859968c7f11a17ca213b7..1147400251984b4b6e6ba0895191184f6f07b43e 100644 --- a/paddle/fluid/lite/core/mir/fusion/elementwise_add_activation_fuse_pass_test.cc +++ b/paddle/fluid/lite/core/mir/fusion/elementwise_add_activation_fuse_pass_test.cc @@ -18,9 +18,9 @@ #include #include "paddle/fluid/framework/program_desc.h" #include "paddle/fluid/lite/api/cxx_api.h" +#include "paddle/fluid/lite/api/paddle_use_passes.h" #include "paddle/fluid/lite/core/compatible_tensor.h" #include "paddle/fluid/lite/core/mir/graph_visualize_pass.h" -#include "paddle/fluid/lite/core/mir/use_passes.h" #include "paddle/fluid/lite/core/op_registry.h" #include "paddle/fluid/lite/core/program.h" diff --git a/paddle/fluid/lite/core/mir/fusion/fc_fuse_pass_test.cc b/paddle/fluid/lite/core/mir/fusion/fc_fuse_pass_test.cc index 9d2c9fbc7dc9d0e7c591b189308795d3f783e112..ca880fa30e49cd0c2577092f7193ef681e48585f 100644 --- a/paddle/fluid/lite/core/mir/fusion/fc_fuse_pass_test.cc +++ b/paddle/fluid/lite/core/mir/fusion/fc_fuse_pass_test.cc @@ -17,7 +17,7 @@ #include #include #include "paddle/fluid/lite/api/cxx_api.h" -#include "paddle/fluid/lite/core/mir/use_passes.h" +#include "paddle/fluid/lite/api/paddle_use_passes.h" #include "paddle/fluid/lite/core/op_registry.h" DEFINE_string(model_dir, "", ""); diff --git a/paddle/fluid/lite/core/mir/pass_registry.h b/paddle/fluid/lite/core/mir/pass_registry.h index 0586845f3ceb6dfcb2db5bbe5db03422e493226a..deaf576664cadaee3b99714602797fdfe8bce432 100644 --- a/paddle/fluid/lite/core/mir/pass_registry.h +++ b/paddle/fluid/lite/core/mir/pass_registry.h @@ -15,6 +15,7 @@ #pragma once #include +#include "paddle/fluid/lite/api/paddle_lite_factory_helper.h" #include "paddle/fluid/lite/core/mir/pass_manager.h" namespace paddle { @@ -41,8 +42,3 @@ class PassRegistry { bool mir_pass_registry##name__##_fake() { \ return mir_pass_registry##name__.Touch(); \ } - -#define USE_MIR_PASS(name__) \ - extern bool mir_pass_registry##name__##_fake(); \ - static bool mir_pass_usage##name__ __attribute__((unused)) = \ - mir_pass_registry##name__##_fake(); diff --git a/paddle/fluid/lite/core/mir/ssa_graph_test.cc b/paddle/fluid/lite/core/mir/ssa_graph_test.cc index f1a014e018368f55ad903053c68be93f16d2a8e9..34d8c859af30591eeffe49e8db2bb73cb19ba8bd 100644 --- a/paddle/fluid/lite/core/mir/ssa_graph_test.cc +++ b/paddle/fluid/lite/core/mir/ssa_graph_test.cc @@ -16,8 +16,8 @@ #include #include #include "paddle/fluid/framework/program_desc.h" +#include "paddle/fluid/lite/api/paddle_use_passes.h" #include "paddle/fluid/lite/core/mir/graph_visualize_pass.h" -#include "paddle/fluid/lite/core/mir/use_passes.h" #include "paddle/fluid/lite/core/op_registry.h" #include "paddle/fluid/lite/core/program_fake_utils.h" diff --git a/paddle/fluid/lite/core/mir/variable_place_inference_pass_test.cc b/paddle/fluid/lite/core/mir/variable_place_inference_pass_test.cc index 60fb873670029160c5895372f07b38834b0c9cb5..808835a6f6e530845e61701e383f9fb3b65defb2 100644 --- a/paddle/fluid/lite/core/mir/variable_place_inference_pass_test.cc +++ b/paddle/fluid/lite/core/mir/variable_place_inference_pass_test.cc @@ -13,7 +13,7 @@ // limitations under the License. #include -#include "paddle/fluid/lite/core/mir/use_passes.h" +#include "paddle/fluid/lite/api/paddle_use_passes.h" #include "paddle/fluid/lite/core/optimizer.h" #include "paddle/fluid/lite/core/program_fake_utils.h" #include "paddle/fluid/lite/kernels/cuda/use_kernels.h" diff --git a/paddle/fluid/lite/core/op_registry.h b/paddle/fluid/lite/core/op_registry.h index 8f670faa049179804ebbcb39f0b28e0c0ba7b3d1..529367d076eae5549b1aa13fb6964408f33888e0 100644 --- a/paddle/fluid/lite/core/op_registry.h +++ b/paddle/fluid/lite/core/op_registry.h @@ -20,6 +20,7 @@ #include #include #include +#include "paddle/fluid/lite/api/paddle_lite_factory_helper.h" #include "paddle/fluid/lite/core/kernel.h" #include "paddle/fluid/lite/core/op_lite.h" #include "paddle/fluid/lite/core/target_wrapper.h" @@ -32,7 +33,6 @@ namespace lite { using KernelFunc = std::function; using KernelFuncCreator = std::function()>; - class LiteOpRegistry final : public Factory> { public: static LiteOpRegistry &Global() { @@ -177,7 +177,6 @@ class KernelRegistor : public lite::Registor { // Operator registry #define LITE_OP_REGISTER_INSTANCE(op_type__) op_type__##__registry__instance__ -#define LITE_OP_REGISTER_FAKE(op_type__) op_type__##__registry__ #define REGISTER_LITE_OP(op_type__, OpClass) \ static paddle::lite::OpLiteRegistor LITE_OP_REGISTER_INSTANCE( \ op_type__)(#op_type__); \ @@ -185,11 +184,6 @@ class KernelRegistor : public lite::Registor { return LITE_OP_REGISTER_INSTANCE(op_type__).Touch(); \ } -#define USE_LITE_OP(op_type__) \ - extern int touch_op_##op_type__(); \ - int LITE_OP_REGISTER_FAKE(op_type__) __attribute__((unused)) = \ - touch_op_##op_type__(); - // Kernel registry #define LITE_KERNEL_REGISTER(op_type__, target__, precision__) \ op_type__##__##target__##__##precision__##__registor__ @@ -219,12 +213,6 @@ class KernelRegistor : public lite::Registor { TARGET(target__), PRECISION(precision__), DATALAYOUT(layout__)>( \ #op_type__ "/" #alias__) -#define USE_LITE_KERNEL(op_type__, target__, precision__, layout__, alias__) \ - extern int touch_##op_type__##target__##precision__##layout__##alias__(); \ - int op_type__##target__##precision__##layout__##alias__ \ - __attribute__((unused)) = \ - touch_##op_type__##target__##precision__##layout__##alias__(); - #define LITE_KERNEL_INSTANCE(op_type__, target__, precision__, layout__, \ alias__) \ op_type__##target__##precision__##layout__##alias__ diff --git a/paddle/fluid/lite/core/optimizer_test.cc b/paddle/fluid/lite/core/optimizer_test.cc index 4d66f769811737d568f7942779744af751cca2af..016dfdf15e03761843e041ab4dad9d58bece21d6 100644 --- a/paddle/fluid/lite/core/optimizer_test.cc +++ b/paddle/fluid/lite/core/optimizer_test.cc @@ -16,10 +16,10 @@ #include #include #include +#include "paddle/fluid/lite/api/paddle_use_passes.h" #include "paddle/fluid/lite/core/mir/generate_program_pass.h" #include "paddle/fluid/lite/core/mir/pass_manager.h" #include "paddle/fluid/lite/core/mir/static_kernel_pick_pass.h" -#include "paddle/fluid/lite/core/mir/use_passes.h" #include "paddle/fluid/lite/core/program_fake_utils.h" namespace paddle { diff --git a/paddle/fluid/lite/core/target_wrapper.h b/paddle/fluid/lite/core/target_wrapper.h index 0e9d260e55ba063d7a49e9e18644c36161321c23..09cacacae184e23335d8b12d158da8a3c3cf2eb3 100644 --- a/paddle/fluid/lite/core/target_wrapper.h +++ b/paddle/fluid/lite/core/target_wrapper.h @@ -16,7 +16,7 @@ #include #include #include -#include "paddle/fluid/lite/api/place.h" +#include "paddle/fluid/lite/api/paddle_place.h" #include "paddle/fluid/lite/utils/cp_logging.h" #ifdef LITE_WITH_CUDA diff --git a/paddle/fluid/lite/tools/build.sh b/paddle/fluid/lite/tools/build.sh index 49dff53bfa50b8a9c121bc8705b097c6dd011afe..7ca891686cef36c439655e7a01116126a8c567b9 100755 --- a/paddle/fluid/lite/tools/build.sh +++ b/paddle/fluid/lite/tools/build.sh @@ -85,6 +85,9 @@ function build_single { function build { make lite_compile_deps -j$NUM_CORES_FOR_COMPILE + + # test publish inference lib + make publish_inference_lite } # It will eagerly test all lite related unittests. @@ -104,6 +107,7 @@ function build_test_server { export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/paddle/build/third_party/install/mklml/lib" cmake_x86_for_CI build + test_lite $TESTS_FILE } @@ -223,6 +227,9 @@ function build_arm { cmake_arm ${os} ${abi} ${lang} build $TESTS_FILE + + # test publish inference lib + make publish_inference_lite } # $1: ARM_TARGET_OS in "android" , "armlinux" diff --git a/paddle/fluid/lite/tools/debug/model_debug_tool.cc b/paddle/fluid/lite/tools/debug/model_debug_tool.cc index 7e29e0bd41341c0e9bcb97ecf8fae251b9a3af7f..00552f18fd3887d93582c8af8aa562794898607e 100644 --- a/paddle/fluid/lite/tools/debug/model_debug_tool.cc +++ b/paddle/fluid/lite/tools/debug/model_debug_tool.cc @@ -16,10 +16,10 @@ #include #include #include "paddle/fluid/lite/api/cxx_api.h" -#include "paddle/fluid/lite/core/mir/use_passes.h" +#include "paddle/fluid/lite/api/paddle_use_kernels.h" +#include "paddle/fluid/lite/api/paddle_use_ops.h" +#include "paddle/fluid/lite/api/paddle_use_passes.h" #include "paddle/fluid/lite/core/op_registry.h" -#include "paddle/fluid/lite/kernels/use_kernels.h" -#include "paddle/fluid/lite/operators/use_ops.h" #include "paddle/fluid/lite/tools/debug/debug_utils.h" namespace paddle {