From 53db8325b4dcbe3584cf1b0438054fb70f5e24cd Mon Sep 17 00:00:00 2001 From: hong19860320 <9973393+hong19860320@users.noreply.github.com> Date: Wed, 9 Sep 2020 13:06:05 +0800 Subject: [PATCH] [Core] Adjust the file path of subgraph_bridge_registry and subgraph_engine_base (#4270) --- lite/core/CMakeLists.txt | 9 ++++++ .../subgraph_bridge_registry.cc} | 20 ++++++------ .../subgraph_bridge_registry.h} | 10 +++--- .../subgraph_engine_base.cc} | 32 +++++++++---------- .../engine.h => core/subgraph_engine_base.h} | 19 +++++------ lite/kernels/apu/CMakeLists.txt | 2 +- lite/kernels/apu/bridges/act_op.cc | 3 +- lite/kernels/apu/bridges/conv_op.cc | 2 +- lite/kernels/apu/bridges/elementwise_ops.cc | 3 +- lite/kernels/apu/bridges/fc_op.cc | 2 +- lite/kernels/apu/bridges/pool_op.cc | 2 +- lite/kernels/apu/bridges/softmax_op.cc | 2 +- lite/kernels/apu/subgraph_compute.cc | 2 +- lite/kernels/apu/subgraph_compute.h | 18 +++++------ lite/kernels/bm/CMakeLists.txt | 2 +- lite/kernels/bm/bridges/CMakeLists.txt | 3 +- lite/kernels/bm/bridges/act_op.cc | 2 +- lite/kernels/bm/bridges/assign_value_op.cc | 2 +- lite/kernels/bm/bridges/batch_norm_op.cc | 2 +- lite/kernels/bm/bridges/box_coder_op.cc | 2 +- lite/kernels/bm/bridges/cast_op.cc | 2 +- lite/kernels/bm/bridges/concat_op.cc | 3 +- lite/kernels/bm/bridges/conv_op.cc | 2 +- lite/kernels/bm/bridges/conv_transpose_op.cc | 2 +- .../bm/bridges/density_prior_box_op.cc | 2 +- lite/kernels/bm/bridges/dropout_op.cc | 3 +- lite/kernels/bm/bridges/elementwise_ops.cc | 3 +- lite/kernels/bm/bridges/fill_constant_op.cc | 2 +- lite/kernels/bm/bridges/interpolate_op.cc | 2 +- lite/kernels/bm/bridges/matmul_op.cc | 2 +- lite/kernels/bm/bridges/mul_op.cc | 3 +- lite/kernels/bm/bridges/multiclass_nms_op.cc | 2 +- lite/kernels/bm/bridges/norm_op.cc | 2 +- lite/kernels/bm/bridges/pool_op.cc | 3 +- lite/kernels/bm/bridges/prior_box_op.cc | 2 +- lite/kernels/bm/bridges/reduce_full_op.cc | 2 +- lite/kernels/bm/bridges/reshape_op.cc | 2 +- lite/kernels/bm/bridges/scale_op.cc | 2 +- lite/kernels/bm/bridges/shape_op.cc | 2 +- lite/kernels/bm/bridges/slice_op.cc | 2 +- lite/kernels/bm/bridges/softmax_op.cc | 3 +- lite/kernels/bm/bridges/split_op.cc | 2 +- lite/kernels/bm/bridges/squeeze_op.cc | 2 +- lite/kernels/bm/bridges/swish_op.cc | 3 +- lite/kernels/bm/bridges/transpose_op.cc | 2 +- lite/kernels/bm/bridges/yolo_box_op.cc | 2 +- lite/kernels/bm/subgraph_compute.cc | 2 +- lite/kernels/bm/subgraph_compute.h | 18 +++++------ lite/kernels/huawei_ascend_npu/CMakeLists.txt | 2 +- .../huawei_ascend_npu/bridges/CMakeLists.txt | 3 +- .../huawei_ascend_npu/bridges/act_op.cc | 2 +- .../bridges/batch_norm_op.cc | 2 +- .../huawei_ascend_npu/bridges/cast_op.cc | 2 +- .../huawei_ascend_npu/bridges/concat_op.cc | 2 +- .../huawei_ascend_npu/bridges/conv_op.cc | 2 +- .../huawei_ascend_npu/bridges/dropout_op.cc | 2 +- .../bridges/elementwise_ops.cc | 2 +- .../huawei_ascend_npu/bridges/fc_op.cc | 2 +- .../huawei_ascend_npu/bridges/flatten_op.cc | 2 +- .../huawei_ascend_npu/bridges/gather_op.cc | 2 +- .../bridges/interpolate_op.cc | 2 +- .../bridges/layer_norm_op.cc | 2 +- .../huawei_ascend_npu/bridges/matmul_op.cc | 2 +- .../huawei_ascend_npu/bridges/pool_op.cc | 2 +- .../huawei_ascend_npu/bridges/reshape_op.cc | 2 +- .../huawei_ascend_npu/bridges/scale_op.cc | 2 +- .../huawei_ascend_npu/bridges/slice_op.cc | 2 +- .../huawei_ascend_npu/bridges/softmax_op.cc | 2 +- .../huawei_ascend_npu/bridges/transpose_op.cc | 2 +- .../huawei_ascend_npu/subgraph_compute.cc | 2 +- .../huawei_ascend_npu/subgraph_compute.h | 18 +++++------ lite/kernels/mlu/CMakeLists.txt | 2 +- lite/kernels/mlu/bridges/CMakeLists.txt | 2 +- lite/kernels/mlu/bridges/act_op.cc | 2 +- lite/kernels/mlu/bridges/act_op_test.cc | 2 +- lite/kernels/mlu/bridges/argmax_op.cc | 2 +- lite/kernels/mlu/bridges/argmax_op_test.cc | 2 +- lite/kernels/mlu/bridges/batch_norm_op.cc | 2 +- .../kernels/mlu/bridges/batch_norm_op_test.cc | 2 +- lite/kernels/mlu/bridges/cast_op.cc | 2 +- lite/kernels/mlu/bridges/cast_op_test.cc | 2 +- lite/kernels/mlu/bridges/concat_op.cc | 2 +- lite/kernels/mlu/bridges/concat_op_test.cc | 2 +- lite/kernels/mlu/bridges/conv_op.cc | 2 +- lite/kernels/mlu/bridges/conv_op_test.cc | 2 +- lite/kernels/mlu/bridges/dropout_op.cc | 2 +- lite/kernels/mlu/bridges/dropout_op_test.cc | 2 +- lite/kernels/mlu/bridges/elementwise_ops.cc | 2 +- .../mlu/bridges/elementwise_ops_test.cc | 2 +- lite/kernels/mlu/bridges/fc_op.cc | 2 +- lite/kernels/mlu/bridges/fc_op_test.cc | 2 +- lite/kernels/mlu/bridges/flatten_op.cc | 2 +- lite/kernels/mlu/bridges/flatten_op_test.cc | 2 +- lite/kernels/mlu/bridges/gather_op.cc | 2 +- lite/kernels/mlu/bridges/gather_op_test.cc | 2 +- lite/kernels/mlu/bridges/interpolate_op.cc | 2 +- .../mlu/bridges/interpolate_op_test.cc | 2 +- lite/kernels/mlu/bridges/layout_op.cc | 2 +- lite/kernels/mlu/bridges/layout_op_test.cc | 2 +- lite/kernels/mlu/bridges/lrn_op.cc | 2 +- lite/kernels/mlu/bridges/lrn_op_test.cc | 2 +- lite/kernels/mlu/bridges/norm_op.cc | 2 +- lite/kernels/mlu/bridges/norm_op_test.cc | 2 +- lite/kernels/mlu/bridges/pool_op.cc | 2 +- lite/kernels/mlu/bridges/pool_op_test.cc | 2 +- lite/kernels/mlu/bridges/reshape_op.cc | 2 +- lite/kernels/mlu/bridges/reshape_op_test.cc | 2 +- lite/kernels/mlu/bridges/scale_op.cc | 2 +- lite/kernels/mlu/bridges/scale_op_test.cc | 2 +- lite/kernels/mlu/bridges/slice_op.cc | 2 +- lite/kernels/mlu/bridges/slice_op_test.cc | 2 +- lite/kernels/mlu/bridges/softmax_op.cc | 2 +- lite/kernels/mlu/bridges/softmax_op_test.cc | 2 +- lite/kernels/mlu/bridges/split_op.cc | 2 +- lite/kernels/mlu/bridges/split_op_test.cc | 2 +- lite/kernels/mlu/bridges/squeeze_op.cc | 2 +- lite/kernels/mlu/bridges/squeeze_op_test.cc | 2 +- lite/kernels/mlu/bridges/test_helper.cc | 2 +- lite/kernels/mlu/bridges/transpose_op.cc | 2 +- lite/kernels/mlu/bridges/transpose_op_test.cc | 2 +- lite/kernels/mlu/subgraph_compute.h | 20 ++++++------ lite/kernels/npu/CMakeLists.txt | 2 +- lite/kernels/npu/bridges/CMakeLists.txt | 11 ------- lite/kernels/npu/bridges/act_op.cc | 2 +- lite/kernels/npu/bridges/argmax_op.cc | 2 +- lite/kernels/npu/bridges/batch_norm_op.cc | 2 +- lite/kernels/npu/bridges/compare_op.cc | 2 +- lite/kernels/npu/bridges/concat_op.cc | 2 +- lite/kernels/npu/bridges/conv_op.cc | 2 +- lite/kernels/npu/bridges/conv_transpose_op.cc | 2 +- lite/kernels/npu/bridges/dropout_op.cc | 2 +- lite/kernels/npu/bridges/elementwise_ops.cc | 2 +- lite/kernels/npu/bridges/expand_op.cc | 2 +- lite/kernels/npu/bridges/fc_op.cc | 2 +- .../fill_constant_batch_size_like_op.cc | 2 +- lite/kernels/npu/bridges/fill_constant_op.cc | 2 +- lite/kernels/npu/bridges/gather_op.cc | 2 +- lite/kernels/npu/bridges/increment_op.cc | 2 +- lite/kernels/npu/bridges/instance_norm_op.cc | 2 +- lite/kernels/npu/bridges/interpolate_op.cc | 2 +- lite/kernels/npu/bridges/layer_norm_op.cc | 2 +- lite/kernels/npu/bridges/lookup_table_op.cc | 2 +- lite/kernels/npu/bridges/matmul_op.cc | 2 +- lite/kernels/npu/bridges/mul_op.cc | 2 +- lite/kernels/npu/bridges/pad2d_op.cc | 2 +- lite/kernels/npu/bridges/pool_op.cc | 2 +- lite/kernels/npu/bridges/reduce_mean_op.cc | 2 +- lite/kernels/npu/bridges/reshape_op.cc | 2 +- lite/kernels/npu/bridges/scale_op.cc | 2 +- lite/kernels/npu/bridges/shape_op.cc | 2 +- .../kernels/npu/bridges/shuffle_channel_op.cc | 2 +- lite/kernels/npu/bridges/softmax_op.cc | 2 +- lite/kernels/npu/bridges/split_op.cc | 2 +- lite/kernels/npu/bridges/topk_op.cc | 2 +- lite/kernels/npu/bridges/transpose_op.cc | 2 +- lite/kernels/npu/bridges/unsqueeze_op.cc | 2 +- lite/kernels/npu/subgraph_compute.cc | 2 +- lite/kernels/npu/subgraph_compute.h | 18 +++++------ lite/kernels/rknpu/CMakeLists.txt | 3 +- lite/kernels/rknpu/bridges/CMakeLists.txt | 2 +- lite/kernels/rknpu/bridges/act_op.cc | 4 +-- lite/kernels/rknpu/bridges/batch_norm_op.cc | 2 +- lite/kernels/rknpu/bridges/concat_op.cc | 2 +- lite/kernels/rknpu/bridges/conv_op.cc | 2 +- lite/kernels/rknpu/bridges/elementwise_ops.cc | 2 +- lite/kernels/rknpu/bridges/fc_op.cc | 2 +- lite/kernels/rknpu/bridges/pool_op.cc | 2 +- lite/kernels/rknpu/bridges/softmax_op.cc | 2 +- lite/kernels/rknpu/subgraph_compute.cc | 2 +- lite/kernels/rknpu/subgraph_compute.h | 18 +++++------ lite/kernels/xpu/CMakeLists.txt | 2 +- lite/kernels/xpu/bridges/act_op.cc | 2 +- lite/kernels/xpu/bridges/batch_norm_op.cc | 2 +- lite/kernels/xpu/bridges/cast_op.cc | 2 +- lite/kernels/xpu/bridges/conv_op.cc | 2 +- lite/kernels/xpu/bridges/dropout_op.cc | 2 +- lite/kernels/xpu/bridges/elementwise_ops.cc | 2 +- lite/kernels/xpu/bridges/gather_op.cc | 2 +- lite/kernels/xpu/bridges/layer_norm_op.cc | 2 +- lite/kernels/xpu/bridges/lookup_table_op.cc | 2 +- lite/kernels/xpu/bridges/matmul_op.cc | 2 +- lite/kernels/xpu/bridges/mul_op.cc | 2 +- lite/kernels/xpu/bridges/pool_op.cc | 2 +- lite/kernels/xpu/bridges/reshape_op.cc | 2 +- lite/kernels/xpu/bridges/scale_op.cc | 2 +- lite/kernels/xpu/bridges/slice_op.cc | 2 +- lite/kernels/xpu/bridges/softmax_op.cc | 2 +- lite/kernels/xpu/bridges/stack_op.cc | 2 +- lite/kernels/xpu/bridges/transpose_op.cc | 2 +- lite/kernels/xpu/bridges/yolo_box_op.cc | 2 +- lite/kernels/xpu/subgraph_compute.cc | 2 +- lite/kernels/xpu/subgraph_compute.h | 18 +++++------ 192 files changed, 304 insertions(+), 297 deletions(-) rename lite/{kernels/npu/bridges/registry.cc => core/subgraph_bridge_registry.cc} (68%) rename lite/{kernels/npu/bridges/registry.h => core/subgraph_bridge_registry.h} (92%) rename lite/{kernels/npu/bridges/engine.cc => core/subgraph_engine_base.cc} (78%) rename lite/{kernels/npu/bridges/engine.h => core/subgraph_engine_base.h} (81%) diff --git a/lite/core/CMakeLists.txt b/lite/core/CMakeLists.txt index d51a93971f..f6f8b231fe 100644 --- a/lite/core/CMakeLists.txt +++ b/lite/core/CMakeLists.txt @@ -142,6 +142,15 @@ if (NOT LITE_ON_TINY_PUBLISH) add_subdirectory(arena) endif() +if(LITE_WITH_NPU OR LITE_WITH_XTCL OR LITE_WITH_BM OR LITE_WITH_RKNPU OR LITE_WITH_MLU OR LITE_WITH_APU OR LITE_WITH_HUAWEI_ASCEND_NPU) + lite_cc_library(subgraph_bridge_registry + SRCS subgraph_bridge_registry.cc + DEPS op) + lite_cc_library(subgraph_engine_base + SRCS subgraph_engine_base.cc + DEPS tensor op scope program) +endif() + # for mobile, unnecessary to compile the following testings. if (LITE_WITH_LIGHT_WEIGHT_FRAMEWORK) return() diff --git a/lite/kernels/npu/bridges/registry.cc b/lite/core/subgraph_bridge_registry.cc similarity index 68% rename from lite/kernels/npu/bridges/registry.cc rename to lite/core/subgraph_bridge_registry.cc index 068e05d53c..c6d1c9a217 100644 --- a/lite/kernels/npu/bridges/registry.cc +++ b/lite/core/subgraph_bridge_registry.cc @@ -12,21 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include namespace paddle { namespace lite { namespace subgraph { -Registry& Registry::Instance() { - static Registry x; +SubgraphBridgeRegistry& SubgraphBridgeRegistry::Instance() { + static SubgraphBridgeRegistry x; return x; } -void Registry::Insert(const std::string& op_type, - const TargetType& target, - const cvt_func_type& cvt_func_name) { +void SubgraphBridgeRegistry::Insert(const std::string& op_type, + const TargetType& target, + const cvt_func_type& cvt_func_name) { int key = static_cast(target); auto it = map_.find(key); if (it == map_.end()) { @@ -35,14 +35,14 @@ void Registry::Insert(const std::string& op_type, map_.at(key).insert(std::make_pair(op_type, cvt_func_name)); } -const cvt_func_type& Registry::Select(const std::string& op_type, - const TargetType& target) const { +const cvt_func_type& SubgraphBridgeRegistry::Select( + const std::string& op_type, const TargetType& target) const { int key = static_cast(target); return map_.at(key).at(op_type); } -bool Registry::Exists(const std::string& op_type, - const TargetType& target) const { +bool SubgraphBridgeRegistry::Exists(const std::string& op_type, + const TargetType& target) const { int key = static_cast(target); bool found = map_.find(key) != map_.end(); if (found) { diff --git a/lite/kernels/npu/bridges/registry.h b/lite/core/subgraph_bridge_registry.h similarity index 92% rename from lite/kernels/npu/bridges/registry.h rename to lite/core/subgraph_bridge_registry.h index ea375db026..2859a17cda 100644 --- a/lite/kernels/npu/bridges/registry.h +++ b/lite/core/subgraph_bridge_registry.h @@ -36,9 +36,9 @@ inline bool CHECK_REBUILD_WHEN_SHAPE_CHANGED(int status) { using cvt_func_type = std::function; using cvt_map_type = std::map>; -class Registry { +class SubgraphBridgeRegistry { public: - static Registry& Instance(); + static SubgraphBridgeRegistry& Instance(); void Insert(const std::string& op_type, const TargetType& target, @@ -46,11 +46,11 @@ class Registry { const cvt_func_type& Select(const std::string& op_type, const TargetType& target) const; bool Exists(const std::string& op_type, const TargetType& target) const; - Registry() = default; + SubgraphBridgeRegistry() = default; private: cvt_map_type map_; - DISALLOW_COPY_AND_ASSIGN(Registry); + DISALLOW_COPY_AND_ASSIGN(SubgraphBridgeRegistry); }; } // namespace subgraph @@ -69,7 +69,7 @@ class Registry { "REGISTER_SUBGRAPH_BRIDGE must be called in global namespace only " \ "once!"); \ int __reg_subgraph_bridge_##op_type__##_##target__##_Insert() { \ - paddle::lite::subgraph::Registry::Instance().Insert( \ + paddle::lite::subgraph::SubgraphBridgeRegistry::Instance().Insert( \ #op_type__, TARGET(target__), cvt_func_name); \ return 0; \ } diff --git a/lite/kernels/npu/bridges/engine.cc b/lite/core/subgraph_engine_base.cc similarity index 78% rename from lite/kernels/npu/bridges/engine.cc rename to lite/core/subgraph_engine_base.cc index b9f81a74ad..e77bb9e9fd 100644 --- a/lite/kernels/npu/bridges/engine.cc +++ b/lite/core/subgraph_engine_base.cc @@ -12,23 +12,23 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/engine.h" +#include "lite/core/subgraph_engine_base.h" #include #include #include #include -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { namespace subgraph { -Engine::Engine(KernelContext *ctx, - int block_idx, - const std::shared_ptr &program_desc, - Scope *exec_scope, - const std::vector &input_names, - const std::vector &output_names) +SubgraphEngineBase::SubgraphEngineBase( + KernelContext *ctx, + int block_idx, + const std::shared_ptr &program_desc, + Scope *exec_scope, + const std::vector &input_names, + const std::vector &output_names) : ctx_(ctx), block_idx_(block_idx), program_desc_(program_desc), @@ -43,7 +43,7 @@ Engine::Engine(KernelContext *ctx, std::stable_sort(output_names_.begin(), output_names_.end()); } -bool Engine::Run() { +bool SubgraphEngineBase::Run() { if (is_first_epoch_) { PrepareWorkspaceForDeviceProgram(); is_first_epoch_ = false; @@ -54,7 +54,7 @@ bool Engine::Run() { return LaunchDeviceProgram(); } -bool Engine::PrepareWorkspaceForOriginProgram() { +bool SubgraphEngineBase::PrepareWorkspaceForOriginProgram() { origin_idims_.resize(input_names_.size()); origin_itensors_.resize(input_names_.size()); for (int i = 0; i < input_names_.size(); i++) { @@ -69,7 +69,7 @@ bool Engine::PrepareWorkspaceForOriginProgram() { return true; } -bool Engine::BuildOriginProgram() { +bool SubgraphEngineBase::BuildOriginProgram() { // TODO(hong19860320) The block_desc need to be divided into subgraphs during // the exection time. But only see them as a subgraph now. if (!origin_program_) { @@ -79,7 +79,7 @@ bool Engine::BuildOriginProgram() { return true; } -bool Engine::LaunchOriginProgram() { +bool SubgraphEngineBase::LaunchOriginProgram() { if (!origin_program_) { BuildOriginProgram(); } @@ -91,15 +91,15 @@ bool Engine::LaunchOriginProgram() { return false; } -bool Engine::PrepareWorkspaceForDeviceProgram() { +bool SubgraphEngineBase::PrepareWorkspaceForDeviceProgram() { return PrepareWorkspaceForOriginProgram(); } -bool Engine::BuildDeviceProgram() { return BuildOriginProgram(); } +bool SubgraphEngineBase::BuildDeviceProgram() { return BuildOriginProgram(); } -bool Engine::LaunchDeviceProgram() { return LaunchOriginProgram(); } +bool SubgraphEngineBase::LaunchDeviceProgram() { return LaunchOriginProgram(); } -bool Engine::InputShapeChanged() { +bool SubgraphEngineBase::InputShapeChanged() { bool changed = false; for (size_t i = 0; i < origin_itensors_.size(); i++) { auto origin_idim = origin_itensors_[i]->dims().Vectorize(); diff --git a/lite/kernels/npu/bridges/engine.h b/lite/core/subgraph_engine_base.h similarity index 81% rename from lite/kernels/npu/bridges/engine.h rename to lite/core/subgraph_engine_base.h index daa02fb0d7..e00b7f07ba 100644 --- a/lite/kernels/npu/bridges/engine.h +++ b/lite/core/subgraph_engine_base.h @@ -26,20 +26,21 @@ namespace paddle { namespace lite { namespace subgraph { -class Engine { +class SubgraphEngineBase { public: - Engine(KernelContext *ctx, - int block_idx, - const std::shared_ptr &program_desc, - Scope *exec_scope, - const std::vector &input_names, - const std::vector &output_names); - virtual ~Engine() = default; + SubgraphEngineBase( + KernelContext *ctx, + int block_idx, + const std::shared_ptr &program_desc, + Scope *exec_scope, + const std::vector &input_names, + const std::vector &output_names); + virtual ~SubgraphEngineBase() = default; virtual bool Run(); private: - Engine(const Engine &) = delete; + SubgraphEngineBase(const SubgraphEngineBase &) = delete; protected: virtual bool PrepareWorkspaceForOriginProgram(); diff --git a/lite/kernels/apu/CMakeLists.txt b/lite/kernels/apu/CMakeLists.txt index f51a8291f5..64bc4083e6 100644 --- a/lite/kernels/apu/CMakeLists.txt +++ b/lite/kernels/apu/CMakeLists.txt @@ -1,3 +1,3 @@ add_subdirectory(bridges) -add_kernel(subgraph_compute_apu APU basic SRCS subgraph_compute.cc DEPS ${lite_kernel_deps} device_apu neuron_adapter subgraph_bridge_engine ${apu_subgraph_bridges}) +add_kernel(subgraph_compute_apu APU basic SRCS subgraph_compute.cc DEPS ${lite_kernel_deps} device_apu neuron_adapter subgraph_engine_base ${apu_subgraph_bridges}) diff --git a/lite/kernels/apu/bridges/act_op.cc b/lite/kernels/apu/bridges/act_op.cc index c2451d640e..792ea9f971 100644 --- a/lite/kernels/apu/bridges/act_op.cc +++ b/lite/kernels/apu/bridges/act_op.cc @@ -12,8 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" +#include "lite/kernels/apu/bridges/graph.h" #include "lite/kernels/apu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/apu/bridges/conv_op.cc b/lite/kernels/apu/bridges/conv_op.cc index bf5e313180..bdac473b1b 100644 --- a/lite/kernels/apu/bridges/conv_op.cc +++ b/lite/kernels/apu/bridges/conv_op.cc @@ -15,9 +15,9 @@ #include "lite/operators/conv_op.h" #include #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/apu/bridges/graph.h" #include "lite/kernels/apu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/apu/bridges/elementwise_ops.cc b/lite/kernels/apu/bridges/elementwise_ops.cc index 9c637e0fe7..964e81eb6a 100644 --- a/lite/kernels/apu/bridges/elementwise_ops.cc +++ b/lite/kernels/apu/bridges/elementwise_ops.cc @@ -12,8 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/apu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/kernels/apu/bridges/utility.h" namespace paddle { namespace lite { diff --git a/lite/kernels/apu/bridges/fc_op.cc b/lite/kernels/apu/bridges/fc_op.cc index 106ce2c16f..5bee944244 100644 --- a/lite/kernels/apu/bridges/fc_op.cc +++ b/lite/kernels/apu/bridges/fc_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/apu/bridges/graph.h" #include "lite/kernels/apu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/apu/bridges/pool_op.cc b/lite/kernels/apu/bridges/pool_op.cc index b82f23beaf..594c7fabda 100644 --- a/lite/kernels/apu/bridges/pool_op.cc +++ b/lite/kernels/apu/bridges/pool_op.cc @@ -13,9 +13,9 @@ // limitations under the License. #include "lite/operators/pool_op.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/apu/bridges/graph.h" #include "lite/kernels/apu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/apu/bridges/softmax_op.cc b/lite/kernels/apu/bridges/softmax_op.cc index dec6d12307..4b2a465cd6 100644 --- a/lite/kernels/apu/bridges/softmax_op.cc +++ b/lite/kernels/apu/bridges/softmax_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/apu/bridges/graph.h" #include "lite/kernels/apu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/apu/subgraph_compute.cc b/lite/kernels/apu/subgraph_compute.cc index a107a70e4e..698536743d 100644 --- a/lite/kernels/apu/subgraph_compute.cc +++ b/lite/kernels/apu/subgraph_compute.cc @@ -50,7 +50,7 @@ bool SubgraphEngine::BuildDeviceProgram() { // Convert all of ops and their input vars and weights and added into the APU // NIR graph - const auto& bridges = subgraph::Registry::Instance(); + const auto& bridges = subgraph::SubgraphBridgeRegistry::Instance(); const auto& insts = origin_program_->instructions(kRootBlockIdx); for (auto& inst : insts) { auto op = const_cast(inst.op()); diff --git a/lite/kernels/apu/subgraph_compute.h b/lite/kernels/apu/subgraph_compute.h index de15abdf7f..f85f315220 100644 --- a/lite/kernels/apu/subgraph_compute.h +++ b/lite/kernels/apu/subgraph_compute.h @@ -19,15 +19,15 @@ #include #include "NeuronAdapter.h" #include "lite/core/kernel.h" -#include "lite/kernels/npu/bridges/engine.h" -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" +#include "lite/core/subgraph_engine_base.h" namespace paddle { namespace lite { namespace kernels { namespace apu { -class SubgraphEngine : public subgraph::Engine { +class SubgraphEngine : public subgraph::SubgraphEngineBase { public: SubgraphEngine(KernelContext *ctx, int block_idx, @@ -35,12 +35,12 @@ class SubgraphEngine : public subgraph::Engine { Scope *exec_scope, const std::vector &input_names, const std::vector &output_names) - : subgraph::Engine(ctx, - block_idx, - program_desc, - exec_scope, - input_names, - output_names) {} + : subgraph::SubgraphEngineBase(ctx, + block_idx, + program_desc, + exec_scope, + input_names, + output_names) {} ~SubgraphEngine(); diff --git a/lite/kernels/bm/CMakeLists.txt b/lite/kernels/bm/CMakeLists.txt index 691fe55978..648fe93c0d 100644 --- a/lite/kernels/bm/CMakeLists.txt +++ b/lite/kernels/bm/CMakeLists.txt @@ -3,4 +3,4 @@ if(NOT LITE_WITH_BM) endif() add_subdirectory(bridges) -add_kernel(subgraph_compute_bm BM basic SRCS subgraph_compute.cc DEPS ${lite_kernel_deps} ${bm_subgraph_bridges}) +add_kernel(subgraph_compute_bm BM basic SRCS subgraph_compute.cc DEPS ${lite_kernel_deps} subgraph_engine_base ${bm_subgraph_bridges}) diff --git a/lite/kernels/bm/bridges/CMakeLists.txt b/lite/kernels/bm/bridges/CMakeLists.txt index ca3a4052f1..33f05ee300 100644 --- a/lite/kernels/bm/bridges/CMakeLists.txt +++ b/lite/kernels/bm/bridges/CMakeLists.txt @@ -5,7 +5,7 @@ endif() lite_cc_library(subgraph_bridge_utility_bm SRCS utility.cc DEPS) lite_cc_library(subgraph_bridge_graph_bm SRCS graph.cc DEPS subgraph_bridge_utility_bm) -set(bm_subgraph_bridge_deps subgraph_bridge_registry subgraph_bridge_engine subgraph_bridge_utility_bm subgraph_bridge_graph_bm) +set(bm_subgraph_bridge_deps subgraph_bridge_registry subgraph_bridge_utility_bm subgraph_bridge_graph_bm) lite_cc_library(subgraph_bridge_act_op_bm SRCS act_op.cc DEPS ${bm_subgraph_bridge_deps}) lite_cc_library(subgraph_bridge_conv_op_bm SRCS conv_op.cc DEPS ${bm_subgraph_bridge_deps}) @@ -40,7 +40,6 @@ lite_cc_library(subgraph_bridge_swish_op_bm SRCS swish_op.cc DEPS ${bm_subgraph_ set(bm_subgraph_bridges subgraph_bridge_registry - subgraph_bridge_engine subgraph_bridge_graph_bm subgraph_bridge_act_op_bm subgraph_bridge_conv_op_bm diff --git a/lite/kernels/bm/bridges/act_op.cc b/lite/kernels/bm/bridges/act_op.cc index c85e2c5e1e..41f127a5c2 100644 --- a/lite/kernels/bm/bridges/act_op.cc +++ b/lite/kernels/bm/bridges/act_op.cc @@ -15,8 +15,8 @@ #include #include #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/assign_value_op.cc b/lite/kernels/bm/bridges/assign_value_op.cc index f7b05da82a..7e2e69002f 100644 --- a/lite/kernels/bm/bridges/assign_value_op.cc +++ b/lite/kernels/bm/bridges/assign_value_op.cc @@ -15,9 +15,9 @@ #include #include #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/batch_norm_op.cc b/lite/kernels/bm/bridges/batch_norm_op.cc index f5ecc0825a..55a95a4bd8 100644 --- a/lite/kernels/bm/bridges/batch_norm_op.cc +++ b/lite/kernels/bm/bridges/batch_norm_op.cc @@ -14,9 +14,9 @@ #include #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/box_coder_op.cc b/lite/kernels/bm/bridges/box_coder_op.cc index 67f5104c8b..9ef1824a64 100644 --- a/lite/kernels/bm/bridges/box_coder_op.cc +++ b/lite/kernels/bm/bridges/box_coder_op.cc @@ -16,9 +16,9 @@ #include #include #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/cast_op.cc b/lite/kernels/bm/bridges/cast_op.cc index 33be20685b..42c0751b92 100644 --- a/lite/kernels/bm/bridges/cast_op.cc +++ b/lite/kernels/bm/bridges/cast_op.cc @@ -14,9 +14,9 @@ #include #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/concat_op.cc b/lite/kernels/bm/bridges/concat_op.cc index 1fa8032885..0a15adaeb8 100644 --- a/lite/kernels/bm/bridges/concat_op.cc +++ b/lite/kernels/bm/bridges/concat_op.cc @@ -11,10 +11,11 @@ // 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. + #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/conv_op.cc b/lite/kernels/bm/bridges/conv_op.cc index 5deddb444e..31873f5d82 100644 --- a/lite/kernels/bm/bridges/conv_op.cc +++ b/lite/kernels/bm/bridges/conv_op.cc @@ -13,9 +13,9 @@ // limitations under the License. #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/conv_transpose_op.cc b/lite/kernels/bm/bridges/conv_transpose_op.cc index ba6a4dcd91..07612a8afe 100644 --- a/lite/kernels/bm/bridges/conv_transpose_op.cc +++ b/lite/kernels/bm/bridges/conv_transpose_op.cc @@ -13,9 +13,9 @@ // limitations under the License. #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/density_prior_box_op.cc b/lite/kernels/bm/bridges/density_prior_box_op.cc index c8f6e99680..3855116c1f 100644 --- a/lite/kernels/bm/bridges/density_prior_box_op.cc +++ b/lite/kernels/bm/bridges/density_prior_box_op.cc @@ -14,9 +14,9 @@ #include #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/dropout_op.cc b/lite/kernels/bm/bridges/dropout_op.cc index 70fe27cbf4..0d31a19610 100644 --- a/lite/kernels/bm/bridges/dropout_op.cc +++ b/lite/kernels/bm/bridges/dropout_op.cc @@ -11,11 +11,12 @@ // 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. + #include #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/elementwise_ops.cc b/lite/kernels/bm/bridges/elementwise_ops.cc index 4104ad0451..715874d418 100644 --- a/lite/kernels/bm/bridges/elementwise_ops.cc +++ b/lite/kernels/bm/bridges/elementwise_ops.cc @@ -11,13 +11,14 @@ // 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. + #include #include #include #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/fill_constant_op.cc b/lite/kernels/bm/bridges/fill_constant_op.cc index 835ccf0eb4..d26093a2bc 100644 --- a/lite/kernels/bm/bridges/fill_constant_op.cc +++ b/lite/kernels/bm/bridges/fill_constant_op.cc @@ -15,9 +15,9 @@ #include #include #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/interpolate_op.cc b/lite/kernels/bm/bridges/interpolate_op.cc index a77ec4e8f7..20a0bdbb8a 100644 --- a/lite/kernels/bm/bridges/interpolate_op.cc +++ b/lite/kernels/bm/bridges/interpolate_op.cc @@ -13,8 +13,8 @@ // limitations under the License. #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/matmul_op.cc b/lite/kernels/bm/bridges/matmul_op.cc index ca8a31d8a0..3f307a3ab8 100644 --- a/lite/kernels/bm/bridges/matmul_op.cc +++ b/lite/kernels/bm/bridges/matmul_op.cc @@ -14,9 +14,9 @@ #include #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/mul_op.cc b/lite/kernels/bm/bridges/mul_op.cc index 35e1aac766..3b6a89f98f 100644 --- a/lite/kernels/bm/bridges/mul_op.cc +++ b/lite/kernels/bm/bridges/mul_op.cc @@ -11,10 +11,11 @@ // 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. + #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/multiclass_nms_op.cc b/lite/kernels/bm/bridges/multiclass_nms_op.cc index 51ff0e69fc..fb7d656dd2 100644 --- a/lite/kernels/bm/bridges/multiclass_nms_op.cc +++ b/lite/kernels/bm/bridges/multiclass_nms_op.cc @@ -14,9 +14,9 @@ #include #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/norm_op.cc b/lite/kernels/bm/bridges/norm_op.cc index 69b2ac130d..449f629aff 100644 --- a/lite/kernels/bm/bridges/norm_op.cc +++ b/lite/kernels/bm/bridges/norm_op.cc @@ -13,9 +13,9 @@ // limitations under the License. #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/pool_op.cc b/lite/kernels/bm/bridges/pool_op.cc index 01760b7b77..0e4af1f5a5 100644 --- a/lite/kernels/bm/bridges/pool_op.cc +++ b/lite/kernels/bm/bridges/pool_op.cc @@ -11,13 +11,14 @@ // 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. + #include #include #include #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/prior_box_op.cc b/lite/kernels/bm/bridges/prior_box_op.cc index a017be8407..b283431b64 100644 --- a/lite/kernels/bm/bridges/prior_box_op.cc +++ b/lite/kernels/bm/bridges/prior_box_op.cc @@ -13,9 +13,9 @@ // limitations under the License. #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/reduce_full_op.cc b/lite/kernels/bm/bridges/reduce_full_op.cc index 3264b6d551..79685aec0c 100644 --- a/lite/kernels/bm/bridges/reduce_full_op.cc +++ b/lite/kernels/bm/bridges/reduce_full_op.cc @@ -14,9 +14,9 @@ #include #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/reshape_op.cc b/lite/kernels/bm/bridges/reshape_op.cc index 64f4ffe9f3..4c70739b13 100644 --- a/lite/kernels/bm/bridges/reshape_op.cc +++ b/lite/kernels/bm/bridges/reshape_op.cc @@ -13,8 +13,8 @@ // limitations under the License. #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/scale_op.cc b/lite/kernels/bm/bridges/scale_op.cc index bbbf896116..a5b0cfc48d 100644 --- a/lite/kernels/bm/bridges/scale_op.cc +++ b/lite/kernels/bm/bridges/scale_op.cc @@ -14,9 +14,9 @@ #include #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/shape_op.cc b/lite/kernels/bm/bridges/shape_op.cc index cb5da0013f..f9ed3fece4 100644 --- a/lite/kernels/bm/bridges/shape_op.cc +++ b/lite/kernels/bm/bridges/shape_op.cc @@ -15,9 +15,9 @@ #include #include #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/slice_op.cc b/lite/kernels/bm/bridges/slice_op.cc index ce27c6abf6..69c22e23f9 100644 --- a/lite/kernels/bm/bridges/slice_op.cc +++ b/lite/kernels/bm/bridges/slice_op.cc @@ -14,9 +14,9 @@ #include #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/softmax_op.cc b/lite/kernels/bm/bridges/softmax_op.cc index 5de58872ac..2f425351ce 100644 --- a/lite/kernels/bm/bridges/softmax_op.cc +++ b/lite/kernels/bm/bridges/softmax_op.cc @@ -11,10 +11,11 @@ // 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. + #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/split_op.cc b/lite/kernels/bm/bridges/split_op.cc index a95a83aa91..d9a1392c57 100755 --- a/lite/kernels/bm/bridges/split_op.cc +++ b/lite/kernels/bm/bridges/split_op.cc @@ -14,9 +14,9 @@ #include #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/squeeze_op.cc b/lite/kernels/bm/bridges/squeeze_op.cc index 550874e837..042c742742 100644 --- a/lite/kernels/bm/bridges/squeeze_op.cc +++ b/lite/kernels/bm/bridges/squeeze_op.cc @@ -14,9 +14,9 @@ #include #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/swish_op.cc b/lite/kernels/bm/bridges/swish_op.cc index 5f576a42f0..d0c6d84d70 100644 --- a/lite/kernels/bm/bridges/swish_op.cc +++ b/lite/kernels/bm/bridges/swish_op.cc @@ -11,11 +11,12 @@ // 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. + #include #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/transpose_op.cc b/lite/kernels/bm/bridges/transpose_op.cc index bdd1eb651a..bb5715564f 100644 --- a/lite/kernels/bm/bridges/transpose_op.cc +++ b/lite/kernels/bm/bridges/transpose_op.cc @@ -14,9 +14,9 @@ #include #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/bridges/yolo_box_op.cc b/lite/kernels/bm/bridges/yolo_box_op.cc index 3d23f87a31..a5ea07f5fd 100644 --- a/lite/kernels/bm/bridges/yolo_box_op.cc +++ b/lite/kernels/bm/bridges/yolo_box_op.cc @@ -17,9 +17,9 @@ #include #include #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/bm/bridges/graph.h" #include "lite/kernels/bm/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/bm/subgraph_compute.cc b/lite/kernels/bm/subgraph_compute.cc index 0bbf3db2e9..efbb848313 100644 --- a/lite/kernels/bm/subgraph_compute.cc +++ b/lite/kernels/bm/subgraph_compute.cc @@ -31,7 +31,7 @@ namespace bm { bool SubgraphEngine::BuildDeviceProgram() { int status = 0; subgraph::bm::Graph graph; - const auto& bridges = subgraph::Registry::Instance(); + const auto& bridges = subgraph::SubgraphBridgeRegistry::Instance(); graph.CreateCompilerHandle(); auto& ctx = this->ctx_->template As(); for (size_t i = 0; i < input_names_.size(); i++) { diff --git a/lite/kernels/bm/subgraph_compute.h b/lite/kernels/bm/subgraph_compute.h index d1dcb3a6d3..50eca1c37f 100644 --- a/lite/kernels/bm/subgraph_compute.h +++ b/lite/kernels/bm/subgraph_compute.h @@ -23,16 +23,16 @@ #include "lite/core/kernel.h" #include "lite/core/op_registry.h" #include "lite/core/program.h" +#include "lite/core/subgraph_bridge_registry.h" +#include "lite/core/subgraph_engine_base.h" #include "lite/core/types.h" -#include "lite/kernels/npu/bridges/engine.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { namespace kernels { namespace bm { -class SubgraphEngine : public subgraph::Engine { +class SubgraphEngine : public subgraph::SubgraphEngineBase { public: SubgraphEngine(KernelContext *ctx, int block_idx, @@ -40,12 +40,12 @@ class SubgraphEngine : public subgraph::Engine { Scope *exec_scope, const std::vector &input_names, const std::vector &output_names) - : subgraph::Engine(ctx, - block_idx, - program_desc, - exec_scope, - input_names, - output_names) {} + : subgraph::SubgraphEngineBase(ctx, + block_idx, + program_desc, + exec_scope, + input_names, + output_names) {} protected: bool BuildDeviceProgram() override; diff --git a/lite/kernels/huawei_ascend_npu/CMakeLists.txt b/lite/kernels/huawei_ascend_npu/CMakeLists.txt index be0a8d0508..ad47e4e73f 100644 --- a/lite/kernels/huawei_ascend_npu/CMakeLists.txt +++ b/lite/kernels/huawei_ascend_npu/CMakeLists.txt @@ -1,3 +1,3 @@ add_subdirectory(bridges) -add_kernel(subgraph_compute_huawei_ascend_npu HUAWEI_ASCEND_NPU basic SRCS subgraph_compute.cc DEPS ${lite_kernel_deps} device_huawei_ascend_npu subgraph_bridge_engine ${huawei_ascend_npu_subgraph_bridges}) +add_kernel(subgraph_compute_huawei_ascend_npu HUAWEI_ASCEND_NPU basic SRCS subgraph_compute.cc DEPS ${lite_kernel_deps} device_huawei_ascend_npu subgraph_engine_base ${huawei_ascend_npu_subgraph_bridges}) diff --git a/lite/kernels/huawei_ascend_npu/bridges/CMakeLists.txt b/lite/kernels/huawei_ascend_npu/bridges/CMakeLists.txt index 3d085f9c80..62d508305b 100644 --- a/lite/kernels/huawei_ascend_npu/bridges/CMakeLists.txt +++ b/lite/kernels/huawei_ascend_npu/bridges/CMakeLists.txt @@ -5,7 +5,7 @@ endif() lite_cc_library(subgraph_bridge_utility_huawei_ascend_npu SRCS utility.cc DEPS) lite_cc_library(subgraph_bridge_graph_huawei_ascend_npu SRCS graph.cc DEPS subgraph_bridge_utility_huawei_ascend_npu) -set(huawei_ascend_npu_subgraph_bridge_deps subgraph_bridge_registry subgraph_bridge_engine subgraph_bridge_utility_huawei_ascend_npu subgraph_bridge_graph_huawei_ascend_npu) +set(huawei_ascend_npu_subgraph_bridge_deps subgraph_bridge_registry subgraph_bridge_utility_huawei_ascend_npu subgraph_bridge_graph_huawei_ascend_npu) lite_cc_library(subgraph_bridge_act_op_huawei_ascend_npu SRCS act_op.cc DEPS ${huawei_ascend_npu_subgraph_bridge_deps}) lite_cc_library(subgraph_bridge_conv_op_huawei_ascend_npu SRCS conv_op.cc DEPS ${huawei_ascend_npu_subgraph_bridge_deps}) @@ -29,7 +29,6 @@ lite_cc_library(subgraph_bridge_gather_op_huawei_ascend_npu SRCS gather_op.cc DE set(huawei_ascend_npu_subgraph_bridges subgraph_bridge_registry - subgraph_bridge_engine subgraph_bridge_graph_huawei_ascend_npu subgraph_bridge_act_op_huawei_ascend_npu subgraph_bridge_conv_op_huawei_ascend_npu diff --git a/lite/kernels/huawei_ascend_npu/bridges/act_op.cc b/lite/kernels/huawei_ascend_npu/bridges/act_op.cc index 1ebed7ff75..2c832989dc 100644 --- a/lite/kernels/huawei_ascend_npu/bridges/act_op.cc +++ b/lite/kernels/huawei_ascend_npu/bridges/act_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/huawei_ascend_npu/bridges/graph.h" #include "lite/kernels/huawei_ascend_npu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/huawei_ascend_npu/bridges/batch_norm_op.cc b/lite/kernels/huawei_ascend_npu/bridges/batch_norm_op.cc index 06ae7b9afd..83756bdd3b 100644 --- a/lite/kernels/huawei_ascend_npu/bridges/batch_norm_op.cc +++ b/lite/kernels/huawei_ascend_npu/bridges/batch_norm_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/huawei_ascend_npu/bridges/graph.h" #include "lite/kernels/huawei_ascend_npu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/huawei_ascend_npu/bridges/cast_op.cc b/lite/kernels/huawei_ascend_npu/bridges/cast_op.cc index f948cfa2c7..9e57e08a0a 100644 --- a/lite/kernels/huawei_ascend_npu/bridges/cast_op.cc +++ b/lite/kernels/huawei_ascend_npu/bridges/cast_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/huawei_ascend_npu/bridges/graph.h" #include "lite/kernels/huawei_ascend_npu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/huawei_ascend_npu/bridges/concat_op.cc b/lite/kernels/huawei_ascend_npu/bridges/concat_op.cc index 12c89c8346..e32180e534 100644 --- a/lite/kernels/huawei_ascend_npu/bridges/concat_op.cc +++ b/lite/kernels/huawei_ascend_npu/bridges/concat_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/huawei_ascend_npu/bridges/graph.h" #include "lite/kernels/huawei_ascend_npu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/huawei_ascend_npu/bridges/conv_op.cc b/lite/kernels/huawei_ascend_npu/bridges/conv_op.cc index 1b3eb143b1..4244452e9b 100644 --- a/lite/kernels/huawei_ascend_npu/bridges/conv_op.cc +++ b/lite/kernels/huawei_ascend_npu/bridges/conv_op.cc @@ -13,9 +13,9 @@ // limitations under the License. #include "lite/operators/conv_op.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/huawei_ascend_npu/bridges/graph.h" #include "lite/kernels/huawei_ascend_npu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/huawei_ascend_npu/bridges/dropout_op.cc b/lite/kernels/huawei_ascend_npu/bridges/dropout_op.cc index 1921deafa9..71df73a229 100644 --- a/lite/kernels/huawei_ascend_npu/bridges/dropout_op.cc +++ b/lite/kernels/huawei_ascend_npu/bridges/dropout_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/huawei_ascend_npu/bridges/graph.h" #include "lite/kernels/huawei_ascend_npu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/huawei_ascend_npu/bridges/elementwise_ops.cc b/lite/kernels/huawei_ascend_npu/bridges/elementwise_ops.cc index 91e64ea034..f52ba6bf56 100644 --- a/lite/kernels/huawei_ascend_npu/bridges/elementwise_ops.cc +++ b/lite/kernels/huawei_ascend_npu/bridges/elementwise_ops.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/huawei_ascend_npu/bridges/graph.h" #include "lite/kernels/huawei_ascend_npu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/huawei_ascend_npu/bridges/fc_op.cc b/lite/kernels/huawei_ascend_npu/bridges/fc_op.cc index 96ca560051..377e12f890 100644 --- a/lite/kernels/huawei_ascend_npu/bridges/fc_op.cc +++ b/lite/kernels/huawei_ascend_npu/bridges/fc_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/huawei_ascend_npu/bridges/graph.h" #include "lite/kernels/huawei_ascend_npu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/huawei_ascend_npu/bridges/flatten_op.cc b/lite/kernels/huawei_ascend_npu/bridges/flatten_op.cc index 7e43915df5..9f52edd85a 100644 --- a/lite/kernels/huawei_ascend_npu/bridges/flatten_op.cc +++ b/lite/kernels/huawei_ascend_npu/bridges/flatten_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/huawei_ascend_npu/bridges/graph.h" #include "lite/kernels/huawei_ascend_npu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/huawei_ascend_npu/bridges/gather_op.cc b/lite/kernels/huawei_ascend_npu/bridges/gather_op.cc index bf1ae05aa4..219b29bb37 100644 --- a/lite/kernels/huawei_ascend_npu/bridges/gather_op.cc +++ b/lite/kernels/huawei_ascend_npu/bridges/gather_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/huawei_ascend_npu/bridges/graph.h" #include "lite/kernels/huawei_ascend_npu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/huawei_ascend_npu/bridges/interpolate_op.cc b/lite/kernels/huawei_ascend_npu/bridges/interpolate_op.cc index b1ca767d16..d592322a11 100644 --- a/lite/kernels/huawei_ascend_npu/bridges/interpolate_op.cc +++ b/lite/kernels/huawei_ascend_npu/bridges/interpolate_op.cc @@ -13,9 +13,9 @@ // limitations under the License. // #include "lite/operators/interpolate_op.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/huawei_ascend_npu/bridges/graph.h" #include "lite/kernels/huawei_ascend_npu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/huawei_ascend_npu/bridges/layer_norm_op.cc b/lite/kernels/huawei_ascend_npu/bridges/layer_norm_op.cc index 72649eb685..2e57578452 100644 --- a/lite/kernels/huawei_ascend_npu/bridges/layer_norm_op.cc +++ b/lite/kernels/huawei_ascend_npu/bridges/layer_norm_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/huawei_ascend_npu/bridges/graph.h" #include "lite/kernels/huawei_ascend_npu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/huawei_ascend_npu/bridges/matmul_op.cc b/lite/kernels/huawei_ascend_npu/bridges/matmul_op.cc index 561769de29..1621d10deb 100644 --- a/lite/kernels/huawei_ascend_npu/bridges/matmul_op.cc +++ b/lite/kernels/huawei_ascend_npu/bridges/matmul_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/huawei_ascend_npu/bridges/graph.h" #include "lite/kernels/huawei_ascend_npu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/huawei_ascend_npu/bridges/pool_op.cc b/lite/kernels/huawei_ascend_npu/bridges/pool_op.cc index 8c314de36d..1670f6b06d 100644 --- a/lite/kernels/huawei_ascend_npu/bridges/pool_op.cc +++ b/lite/kernels/huawei_ascend_npu/bridges/pool_op.cc @@ -13,9 +13,9 @@ // limitations under the License. #include "lite/operators/pool_op.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/huawei_ascend_npu/bridges/graph.h" #include "lite/kernels/huawei_ascend_npu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/huawei_ascend_npu/bridges/reshape_op.cc b/lite/kernels/huawei_ascend_npu/bridges/reshape_op.cc index 7fc48d4bdf..505dea55d8 100644 --- a/lite/kernels/huawei_ascend_npu/bridges/reshape_op.cc +++ b/lite/kernels/huawei_ascend_npu/bridges/reshape_op.cc @@ -13,9 +13,9 @@ // limitations under the License. #include "lite/operators/reshape_op.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/huawei_ascend_npu/bridges/graph.h" #include "lite/kernels/huawei_ascend_npu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/huawei_ascend_npu/bridges/scale_op.cc b/lite/kernels/huawei_ascend_npu/bridges/scale_op.cc index fb55822cff..3baee3af41 100644 --- a/lite/kernels/huawei_ascend_npu/bridges/scale_op.cc +++ b/lite/kernels/huawei_ascend_npu/bridges/scale_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/huawei_ascend_npu/bridges/graph.h" #include "lite/kernels/huawei_ascend_npu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/huawei_ascend_npu/bridges/slice_op.cc b/lite/kernels/huawei_ascend_npu/bridges/slice_op.cc index 6f9e7f8b18..e6a0dcbe32 100644 --- a/lite/kernels/huawei_ascend_npu/bridges/slice_op.cc +++ b/lite/kernels/huawei_ascend_npu/bridges/slice_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/huawei_ascend_npu/bridges/graph.h" #include "lite/kernels/huawei_ascend_npu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/huawei_ascend_npu/bridges/softmax_op.cc b/lite/kernels/huawei_ascend_npu/bridges/softmax_op.cc index a203268695..1b186d2dd3 100644 --- a/lite/kernels/huawei_ascend_npu/bridges/softmax_op.cc +++ b/lite/kernels/huawei_ascend_npu/bridges/softmax_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/huawei_ascend_npu/bridges/graph.h" #include "lite/kernels/huawei_ascend_npu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/huawei_ascend_npu/bridges/transpose_op.cc b/lite/kernels/huawei_ascend_npu/bridges/transpose_op.cc index e90106e2da..aa422f29e3 100644 --- a/lite/kernels/huawei_ascend_npu/bridges/transpose_op.cc +++ b/lite/kernels/huawei_ascend_npu/bridges/transpose_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/huawei_ascend_npu/bridges/graph.h" #include "lite/kernels/huawei_ascend_npu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/huawei_ascend_npu/subgraph_compute.cc b/lite/kernels/huawei_ascend_npu/subgraph_compute.cc index 2f4a226ee4..b37ceea6e9 100644 --- a/lite/kernels/huawei_ascend_npu/subgraph_compute.cc +++ b/lite/kernels/huawei_ascend_npu/subgraph_compute.cc @@ -119,7 +119,7 @@ bool DeviceProgram::BuildGraphAndCacheToFile( // then added them into the IR graph int status = 0; subgraph::huawei_ascend_npu::Graph graph; - const auto& bridges = subgraph::Registry::Instance(); + const auto& bridges = subgraph::SubgraphBridgeRegistry::Instance(); CHECK(origin_program) << "[HUAWEI_ASCEND_NPU] The origin program is not initialized!"; CHECK_GT(origin_program->instructions(kRootBlockIdx).size(), 0) diff --git a/lite/kernels/huawei_ascend_npu/subgraph_compute.h b/lite/kernels/huawei_ascend_npu/subgraph_compute.h index fb7d2efe0c..233eb3cd81 100644 --- a/lite/kernels/huawei_ascend_npu/subgraph_compute.h +++ b/lite/kernels/huawei_ascend_npu/subgraph_compute.h @@ -21,8 +21,8 @@ #include "graph/tensor.h" #include "lite/backends/huawei_ascend_npu/device.h" #include "lite/core/kernel.h" -#include "lite/kernels/npu/bridges/engine.h" -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" +#include "lite/core/subgraph_engine_base.h" namespace paddle { namespace lite { @@ -76,7 +76,7 @@ class DeviceProgram { std::vector device_odims_{}; }; -class SubgraphEngine : public subgraph::Engine { +class SubgraphEngine : public subgraph::SubgraphEngineBase { public: SubgraphEngine(KernelContext* ctx, int block_idx, @@ -84,12 +84,12 @@ class SubgraphEngine : public subgraph::Engine { Scope* exec_scope, const std::vector& input_names, const std::vector& output_names) - : subgraph::Engine(ctx, - block_idx, - program_desc, - exec_scope, - input_names, - output_names) {} + : subgraph::SubgraphEngineBase(ctx, + block_idx, + program_desc, + exec_scope, + input_names, + output_names) {} protected: bool PrepareWorkspaceForDeviceProgram() override; diff --git a/lite/kernels/mlu/CMakeLists.txt b/lite/kernels/mlu/CMakeLists.txt index 634a0afc55..cf830efbf9 100644 --- a/lite/kernels/mlu/CMakeLists.txt +++ b/lite/kernels/mlu/CMakeLists.txt @@ -3,7 +3,7 @@ if(NOT LITE_WITH_MLU) endif() add_subdirectory(bridges) -add_kernel(subgraph_compute_mlu MLU basic SRCS subgraph_compute.cc DEPS ${lite_kernel_deps} ${mlu_subgraph_bridges}) +add_kernel(subgraph_compute_mlu MLU basic SRCS subgraph_compute.cc DEPS ${lite_kernel_deps} subgraph_engine_base ${mlu_subgraph_bridges}) add_kernel(io_copy_compute_mlu MLU basic SRCS io_copy_compute.cc DEPS ${lite_kernel_deps} ${target_wrapper_mlu}) add_kernel(calib_compute_mlu MLU basic SRCS calib_compute.cc DEPS ${lite_kernel_deps}) # depend on transpose function in backend/x86/math/math_function diff --git a/lite/kernels/mlu/bridges/CMakeLists.txt b/lite/kernels/mlu/bridges/CMakeLists.txt index 91323925e1..d22fedf2a8 100644 --- a/lite/kernels/mlu/bridges/CMakeLists.txt +++ b/lite/kernels/mlu/bridges/CMakeLists.txt @@ -6,7 +6,7 @@ lite_cc_library(subgraph_bridge_utility_mlu SRCS utility.cc DEPS ${mlu_builder_l lite_cc_library(subgraph_bridge_tensor_mlu SRCS tensor.cc DEPS ${mlu_builder_libs} subgraph_bridge_utility_mlu) lite_cc_library(subgraph_bridge_graph_mlu SRCS graph.cc DEPS subgraph_bridge_utility_mlu subgraph_bridge_tensor_mlu) -set(mlu_subgraph_bridge_deps subgraph_bridge_registry subgraph_bridge_engine subgraph_bridge_utility_mlu subgraph_bridge_graph_mlu) +set(mlu_subgraph_bridge_deps subgraph_bridge_registry subgraph_bridge_utility_mlu subgraph_bridge_graph_mlu) lite_cc_library(subgraph_bridge_act_op_mlu SRCS act_op.cc DEPS ${mlu_subgraph_bridge_deps}) lite_cc_library(subgraph_bridge_batch_norm_op_mlu SRCS batch_norm_op.cc DEPS ${mlu_subgraph_bridge_deps}) diff --git a/lite/kernels/mlu/bridges/act_op.cc b/lite/kernels/mlu/bridges/act_op.cc index d24c7fac21..7288242663 100644 --- a/lite/kernels/mlu/bridges/act_op.cc +++ b/lite/kernels/mlu/bridges/act_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/act_op_test.cc b/lite/kernels/mlu/bridges/act_op_test.cc index 11c0c3f732..b59e6de146 100644 --- a/lite/kernels/mlu/bridges/act_op_test.cc +++ b/lite/kernels/mlu/bridges/act_op_test.cc @@ -18,8 +18,8 @@ #include "lite/core/op_lite.h" #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/test_helper.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/operators/activation_ops.h" namespace paddle { diff --git a/lite/kernels/mlu/bridges/argmax_op.cc b/lite/kernels/mlu/bridges/argmax_op.cc index b004639f07..302b1bdc56 100644 --- a/lite/kernels/mlu/bridges/argmax_op.cc +++ b/lite/kernels/mlu/bridges/argmax_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/argmax_op_test.cc b/lite/kernels/mlu/bridges/argmax_op_test.cc index 9eeb172812..5659533cc7 100644 --- a/lite/kernels/mlu/bridges/argmax_op_test.cc +++ b/lite/kernels/mlu/bridges/argmax_op_test.cc @@ -20,9 +20,9 @@ #include #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/test_helper.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { namespace subgraph { diff --git a/lite/kernels/mlu/bridges/batch_norm_op.cc b/lite/kernels/mlu/bridges/batch_norm_op.cc index ceac1ac696..baf95ceecd 100644 --- a/lite/kernels/mlu/bridges/batch_norm_op.cc +++ b/lite/kernels/mlu/bridges/batch_norm_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/batch_norm_op_test.cc b/lite/kernels/mlu/bridges/batch_norm_op_test.cc index 65b24a0a72..bd503b5420 100644 --- a/lite/kernels/mlu/bridges/batch_norm_op_test.cc +++ b/lite/kernels/mlu/bridges/batch_norm_op_test.cc @@ -15,8 +15,8 @@ #include "lite/operators/batch_norm_op.h" #include #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/test_helper.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/cast_op.cc b/lite/kernels/mlu/bridges/cast_op.cc index 25d988ce5a..a8125fa5a3 100644 --- a/lite/kernels/mlu/bridges/cast_op.cc +++ b/lite/kernels/mlu/bridges/cast_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/cast_op_test.cc b/lite/kernels/mlu/bridges/cast_op_test.cc index 2389ad5560..55f96c3f95 100644 --- a/lite/kernels/mlu/bridges/cast_op_test.cc +++ b/lite/kernels/mlu/bridges/cast_op_test.cc @@ -16,9 +16,9 @@ #include #include "lite/core/op_lite.h" #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/test_helper.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/concat_op.cc b/lite/kernels/mlu/bridges/concat_op.cc index 1d56663993..1eb0bd8b63 100644 --- a/lite/kernels/mlu/bridges/concat_op.cc +++ b/lite/kernels/mlu/bridges/concat_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/concat_op_test.cc b/lite/kernels/mlu/bridges/concat_op_test.cc index 1dbcaf7160..88440d53a2 100644 --- a/lite/kernels/mlu/bridges/concat_op_test.cc +++ b/lite/kernels/mlu/bridges/concat_op_test.cc @@ -17,8 +17,8 @@ #include #include "lite/core/op_lite.h" #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/test_helper.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/conv_op.cc b/lite/kernels/mlu/bridges/conv_op.cc index 6d10605e2c..13727d94d4 100644 --- a/lite/kernels/mlu/bridges/conv_op.cc +++ b/lite/kernels/mlu/bridges/conv_op.cc @@ -16,9 +16,9 @@ #include +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/conv_op_test.cc b/lite/kernels/mlu/bridges/conv_op_test.cc index e23f7c68ab..5402196275 100644 --- a/lite/kernels/mlu/bridges/conv_op_test.cc +++ b/lite/kernels/mlu/bridges/conv_op_test.cc @@ -20,8 +20,8 @@ #include "lite/core/op_lite.h" #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/test_helper.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/dropout_op.cc b/lite/kernels/mlu/bridges/dropout_op.cc index 9aa296236e..fe6ab25fb9 100644 --- a/lite/kernels/mlu/bridges/dropout_op.cc +++ b/lite/kernels/mlu/bridges/dropout_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/dropout_op_test.cc b/lite/kernels/mlu/bridges/dropout_op_test.cc index 44f03e3051..642d2fc1e2 100644 --- a/lite/kernels/mlu/bridges/dropout_op_test.cc +++ b/lite/kernels/mlu/bridges/dropout_op_test.cc @@ -16,8 +16,8 @@ #include #include #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/test_helper.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/elementwise_ops.cc b/lite/kernels/mlu/bridges/elementwise_ops.cc index 5f7192a062..e9e812352b 100644 --- a/lite/kernels/mlu/bridges/elementwise_ops.cc +++ b/lite/kernels/mlu/bridges/elementwise_ops.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/elementwise_ops_test.cc b/lite/kernels/mlu/bridges/elementwise_ops_test.cc index 7844e5b1b5..ddb053e568 100644 --- a/lite/kernels/mlu/bridges/elementwise_ops_test.cc +++ b/lite/kernels/mlu/bridges/elementwise_ops_test.cc @@ -16,8 +16,8 @@ #include #include #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/test_helper.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/fc_op.cc b/lite/kernels/mlu/bridges/fc_op.cc index e820fc7abc..dc735beda7 100644 --- a/lite/kernels/mlu/bridges/fc_op.cc +++ b/lite/kernels/mlu/bridges/fc_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/fc_op_test.cc b/lite/kernels/mlu/bridges/fc_op_test.cc index b7c576581b..2757583ecb 100644 --- a/lite/kernels/mlu/bridges/fc_op_test.cc +++ b/lite/kernels/mlu/bridges/fc_op_test.cc @@ -16,8 +16,8 @@ #include #include "lite/core/op_lite.h" #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/test_helper.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/flatten_op.cc b/lite/kernels/mlu/bridges/flatten_op.cc index faf7e6fd28..d0bac2c46f 100644 --- a/lite/kernels/mlu/bridges/flatten_op.cc +++ b/lite/kernels/mlu/bridges/flatten_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/flatten_op_test.cc b/lite/kernels/mlu/bridges/flatten_op_test.cc index 190b837ffe..6b228f63eb 100644 --- a/lite/kernels/mlu/bridges/flatten_op_test.cc +++ b/lite/kernels/mlu/bridges/flatten_op_test.cc @@ -19,8 +19,8 @@ #include #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/test_helper.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/gather_op.cc b/lite/kernels/mlu/bridges/gather_op.cc index b68f1af764..9ba616463b 100644 --- a/lite/kernels/mlu/bridges/gather_op.cc +++ b/lite/kernels/mlu/bridges/gather_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/gather_op_test.cc b/lite/kernels/mlu/bridges/gather_op_test.cc index 413de7c9d7..dc85042ecd 100644 --- a/lite/kernels/mlu/bridges/gather_op_test.cc +++ b/lite/kernels/mlu/bridges/gather_op_test.cc @@ -16,9 +16,9 @@ #include #include "lite/core/op_lite.h" #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/test_helper.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/interpolate_op.cc b/lite/kernels/mlu/bridges/interpolate_op.cc index 32840736b8..71d6f94b38 100644 --- a/lite/kernels/mlu/bridges/interpolate_op.cc +++ b/lite/kernels/mlu/bridges/interpolate_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/interpolate_op_test.cc b/lite/kernels/mlu/bridges/interpolate_op_test.cc index 13f5bfb31b..649e4280ff 100644 --- a/lite/kernels/mlu/bridges/interpolate_op_test.cc +++ b/lite/kernels/mlu/bridges/interpolate_op_test.cc @@ -18,9 +18,9 @@ #include "lite/core/device_info.h" #include "lite/core/op_lite.h" #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/test_helper.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/layout_op.cc b/lite/kernels/mlu/bridges/layout_op.cc index d14695c435..72d9b0f4b9 100644 --- a/lite/kernels/mlu/bridges/layout_op.cc +++ b/lite/kernels/mlu/bridges/layout_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/layout_op_test.cc b/lite/kernels/mlu/bridges/layout_op_test.cc index 69b905b075..5c25fd07c7 100644 --- a/lite/kernels/mlu/bridges/layout_op_test.cc +++ b/lite/kernels/mlu/bridges/layout_op_test.cc @@ -16,9 +16,9 @@ #include #include "lite/core/op_lite.h" #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/test_helper.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/lrn_op.cc b/lite/kernels/mlu/bridges/lrn_op.cc index ff428ab10c..3894e884bc 100644 --- a/lite/kernels/mlu/bridges/lrn_op.cc +++ b/lite/kernels/mlu/bridges/lrn_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/lrn_op_test.cc b/lite/kernels/mlu/bridges/lrn_op_test.cc index 266446d6d3..e60b9a8264 100644 --- a/lite/kernels/mlu/bridges/lrn_op_test.cc +++ b/lite/kernels/mlu/bridges/lrn_op_test.cc @@ -21,8 +21,8 @@ #include "lite/core/op_lite.h" #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/test_helper.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/norm_op.cc b/lite/kernels/mlu/bridges/norm_op.cc index 492c3932a8..bea76f2aab 100644 --- a/lite/kernels/mlu/bridges/norm_op.cc +++ b/lite/kernels/mlu/bridges/norm_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/norm_op_test.cc b/lite/kernels/mlu/bridges/norm_op_test.cc index 35b5eabbb9..0118af5766 100644 --- a/lite/kernels/mlu/bridges/norm_op_test.cc +++ b/lite/kernels/mlu/bridges/norm_op_test.cc @@ -20,9 +20,9 @@ #include #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/test_helper.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { namespace subgraph { diff --git a/lite/kernels/mlu/bridges/pool_op.cc b/lite/kernels/mlu/bridges/pool_op.cc index c734de1eec..0c2cbfa3f8 100644 --- a/lite/kernels/mlu/bridges/pool_op.cc +++ b/lite/kernels/mlu/bridges/pool_op.cc @@ -13,9 +13,9 @@ // limitations under the License. #include "lite/operators/pool_op.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/pool_op_test.cc b/lite/kernels/mlu/bridges/pool_op_test.cc index 2ae888744f..0fd3835eb2 100644 --- a/lite/kernels/mlu/bridges/pool_op_test.cc +++ b/lite/kernels/mlu/bridges/pool_op_test.cc @@ -16,8 +16,8 @@ #include #include #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/test_helper.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/reshape_op.cc b/lite/kernels/mlu/bridges/reshape_op.cc index 0b47322b34..29f0c19d07 100644 --- a/lite/kernels/mlu/bridges/reshape_op.cc +++ b/lite/kernels/mlu/bridges/reshape_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/reshape_op_test.cc b/lite/kernels/mlu/bridges/reshape_op_test.cc index 0cd2c6cc26..62ef810c4d 100644 --- a/lite/kernels/mlu/bridges/reshape_op_test.cc +++ b/lite/kernels/mlu/bridges/reshape_op_test.cc @@ -19,8 +19,8 @@ #include #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/test_helper.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/scale_op.cc b/lite/kernels/mlu/bridges/scale_op.cc index 5b6b3dff79..dd64da940b 100644 --- a/lite/kernels/mlu/bridges/scale_op.cc +++ b/lite/kernels/mlu/bridges/scale_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/scale_op_test.cc b/lite/kernels/mlu/bridges/scale_op_test.cc index e0ed975a84..3a8bfcb847 100644 --- a/lite/kernels/mlu/bridges/scale_op_test.cc +++ b/lite/kernels/mlu/bridges/scale_op_test.cc @@ -16,8 +16,8 @@ #include #include #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/test_helper.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/slice_op.cc b/lite/kernels/mlu/bridges/slice_op.cc index 067d110bf4..4235a26b36 100644 --- a/lite/kernels/mlu/bridges/slice_op.cc +++ b/lite/kernels/mlu/bridges/slice_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/slice_op_test.cc b/lite/kernels/mlu/bridges/slice_op_test.cc index a5e2a9f5a4..d1a5069b84 100644 --- a/lite/kernels/mlu/bridges/slice_op_test.cc +++ b/lite/kernels/mlu/bridges/slice_op_test.cc @@ -18,8 +18,8 @@ #include #include "lite/core/op_lite.h" #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/test_helper.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/softmax_op.cc b/lite/kernels/mlu/bridges/softmax_op.cc index b1b621c1ef..b4c2a58b2e 100644 --- a/lite/kernels/mlu/bridges/softmax_op.cc +++ b/lite/kernels/mlu/bridges/softmax_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/softmax_op_test.cc b/lite/kernels/mlu/bridges/softmax_op_test.cc index d5d7251205..b2b9b723fc 100644 --- a/lite/kernels/mlu/bridges/softmax_op_test.cc +++ b/lite/kernels/mlu/bridges/softmax_op_test.cc @@ -15,8 +15,8 @@ #include "lite/operators/softmax_op.h" #include #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/test_helper.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/split_op.cc b/lite/kernels/mlu/bridges/split_op.cc index 4188ba3ec0..b2b93336d1 100644 --- a/lite/kernels/mlu/bridges/split_op.cc +++ b/lite/kernels/mlu/bridges/split_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/split_op_test.cc b/lite/kernels/mlu/bridges/split_op_test.cc index a44a455040..51b0f3a67e 100644 --- a/lite/kernels/mlu/bridges/split_op_test.cc +++ b/lite/kernels/mlu/bridges/split_op_test.cc @@ -16,9 +16,9 @@ #include #include "lite/core/op_lite.h" #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/test_helper.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/squeeze_op.cc b/lite/kernels/mlu/bridges/squeeze_op.cc index 0f8af5b014..05f797520e 100644 --- a/lite/kernels/mlu/bridges/squeeze_op.cc +++ b/lite/kernels/mlu/bridges/squeeze_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/squeeze_op_test.cc b/lite/kernels/mlu/bridges/squeeze_op_test.cc index ad16dac2e9..3971031018 100644 --- a/lite/kernels/mlu/bridges/squeeze_op_test.cc +++ b/lite/kernels/mlu/bridges/squeeze_op_test.cc @@ -18,8 +18,8 @@ #include #include #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/test_helper.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/test_helper.cc b/lite/kernels/mlu/bridges/test_helper.cc index 6d4f6cf9b7..afaf632480 100644 --- a/lite/kernels/mlu/bridges/test_helper.cc +++ b/lite/kernels/mlu/bridges/test_helper.cc @@ -16,9 +16,9 @@ #include #include "lite/core/device_info.h" #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/utility.h" #include "lite/kernels/mlu/subgraph_compute.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/utils/macros.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/transpose_op.cc b/lite/kernels/mlu/bridges/transpose_op.cc index b6caeb3613..fb633dc9db 100644 --- a/lite/kernels/mlu/bridges/transpose_op.cc +++ b/lite/kernels/mlu/bridges/transpose_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/utility.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/bridges/transpose_op_test.cc b/lite/kernels/mlu/bridges/transpose_op_test.cc index 6e8f789058..02faf42a8c 100644 --- a/lite/kernels/mlu/bridges/transpose_op_test.cc +++ b/lite/kernels/mlu/bridges/transpose_op_test.cc @@ -15,8 +15,8 @@ #include "lite/operators/transpose_op.h" #include #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/mlu/bridges/test_helper.h" -#include "lite/kernels/npu/bridges/registry.h" namespace paddle { namespace lite { diff --git a/lite/kernels/mlu/subgraph_compute.h b/lite/kernels/mlu/subgraph_compute.h index 75570a6249..1631df7071 100644 --- a/lite/kernels/mlu/subgraph_compute.h +++ b/lite/kernels/mlu/subgraph_compute.h @@ -24,13 +24,13 @@ #include "lite/core/kernel.h" #include "lite/core/op_lite.h" #include "lite/core/op_registry.h" +#include "lite/core/subgraph_bridge_registry.h" +#include "lite/core/subgraph_engine_base.h" #include "lite/core/tensor.h" #include "lite/core/type_system.h" #include "lite/core/types.h" #include "lite/kernels/mlu/bridges/graph.h" #include "lite/kernels/mlu/bridges/tensor.h" -#include "lite/kernels/npu/bridges/engine.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/utils/env.h" namespace paddle { @@ -39,7 +39,7 @@ namespace kernels { namespace mlu { template -class SubgraphEngine : public subgraph::Engine { +class SubgraphEngine : public subgraph::SubgraphEngineBase { public: SubgraphEngine(KernelContext* ctx, int block_idx, @@ -48,12 +48,12 @@ class SubgraphEngine : public subgraph::Engine { const std::vector& input_names, const std::vector& output_names, paddle::lite_api::PrecisionType type) - : subgraph::Engine(ctx, - block_idx, - program_desc, - exec_scope, - input_names, - output_names), + : subgraph::SubgraphEngineBase(ctx, + block_idx, + program_desc, + exec_scope, + input_names, + output_names), fp_type_(type) { VLOG(4) << "[MLU] PADDLE_LITE_MLU_SAVE_OFFLINE_MODEL is " << GetBoolFromEnv("PADDLE_LITE_MLU_SAVE_OFFLINE_MODEL"); @@ -166,7 +166,7 @@ class SubgraphEngine : public subgraph::Engine { } LOG(INFO) << "START TO CONVERT "; // Convert all of ops and its weights and added into the MLU IR graph - const auto& bridges = subgraph::Registry::Instance(); + const auto& bridges = subgraph::SubgraphBridgeRegistry::Instance(); const auto& insts = origin_program_->instructions(kRootBlockIdx); for (auto& inst : insts) { auto op = inst.op(); diff --git a/lite/kernels/npu/CMakeLists.txt b/lite/kernels/npu/CMakeLists.txt index e7624907ca..29bceff442 100644 --- a/lite/kernels/npu/CMakeLists.txt +++ b/lite/kernels/npu/CMakeLists.txt @@ -1,3 +1,3 @@ add_subdirectory(bridges) -add_kernel(subgraph_compute_npu NPU basic SRCS subgraph_compute.cc DEPS ${lite_kernel_deps} device_npu subgraph_bridge_engine ${npu_subgraph_bridges}) +add_kernel(subgraph_compute_npu NPU basic SRCS subgraph_compute.cc DEPS ${lite_kernel_deps} device_npu subgraph_engine_base ${npu_subgraph_bridges}) diff --git a/lite/kernels/npu/bridges/CMakeLists.txt b/lite/kernels/npu/bridges/CMakeLists.txt index be30d1c039..c18d3768e9 100644 --- a/lite/kernels/npu/bridges/CMakeLists.txt +++ b/lite/kernels/npu/bridges/CMakeLists.txt @@ -1,14 +1,3 @@ -if(NOT LITE_WITH_NPU AND NOT LITE_WITH_XTCL AND NOT LITE_WITH_BM AND NOT LITE_WITH_RKNPU AND NOT LITE_WITH_MLU AND NOT LITE_WITH_APU AND NOT LITE_WITH_HUAWEI_ASCEND_NPU) - return() -endif() - -lite_cc_library(subgraph_bridge_registry - SRCS registry.cc - DEPS op) -lite_cc_library(subgraph_bridge_engine - SRCS engine.cc - DEPS tensor op scope program) - if(NOT LITE_WITH_NPU) return() endif() diff --git a/lite/kernels/npu/bridges/act_op.cc b/lite/kernels/npu/bridges/act_op.cc index afe689729d..300adeab86 100644 --- a/lite/kernels/npu/bridges/act_op.cc +++ b/lite/kernels/npu/bridges/act_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/argmax_op.cc b/lite/kernels/npu/bridges/argmax_op.cc index 4b1e45c3d2..7607543132 100644 --- a/lite/kernels/npu/bridges/argmax_op.cc +++ b/lite/kernels/npu/bridges/argmax_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/batch_norm_op.cc b/lite/kernels/npu/bridges/batch_norm_op.cc index 1911b9fd88..9a467fea49 100644 --- a/lite/kernels/npu/bridges/batch_norm_op.cc +++ b/lite/kernels/npu/bridges/batch_norm_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/compare_op.cc b/lite/kernels/npu/bridges/compare_op.cc index 180e560de1..c1c9d16c45 100644 --- a/lite/kernels/npu/bridges/compare_op.cc +++ b/lite/kernels/npu/bridges/compare_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/concat_op.cc b/lite/kernels/npu/bridges/concat_op.cc index 2214881f05..67067b25f0 100644 --- a/lite/kernels/npu/bridges/concat_op.cc +++ b/lite/kernels/npu/bridges/concat_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/conv_op.cc b/lite/kernels/npu/bridges/conv_op.cc index f21e5618b0..5cc79137b9 100644 --- a/lite/kernels/npu/bridges/conv_op.cc +++ b/lite/kernels/npu/bridges/conv_op.cc @@ -13,8 +13,8 @@ // limitations under the License. #include "lite/operators/conv_op.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/conv_transpose_op.cc b/lite/kernels/npu/bridges/conv_transpose_op.cc index da91ae125b..7e149ed243 100644 --- a/lite/kernels/npu/bridges/conv_transpose_op.cc +++ b/lite/kernels/npu/bridges/conv_transpose_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" #include "lite/operators/conv_op.h" diff --git a/lite/kernels/npu/bridges/dropout_op.cc b/lite/kernels/npu/bridges/dropout_op.cc index 9bf7d3bbca..b99789c3fa 100644 --- a/lite/kernels/npu/bridges/dropout_op.cc +++ b/lite/kernels/npu/bridges/dropout_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/elementwise_ops.cc b/lite/kernels/npu/bridges/elementwise_ops.cc index 276783aeeb..f71a17afc2 100644 --- a/lite/kernels/npu/bridges/elementwise_ops.cc +++ b/lite/kernels/npu/bridges/elementwise_ops.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/expand_op.cc b/lite/kernels/npu/bridges/expand_op.cc index 62501ab76c..76ca8d1c29 100644 --- a/lite/kernels/npu/bridges/expand_op.cc +++ b/lite/kernels/npu/bridges/expand_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/fc_op.cc b/lite/kernels/npu/bridges/fc_op.cc index 39708dfce7..1d59f27b74 100644 --- a/lite/kernels/npu/bridges/fc_op.cc +++ b/lite/kernels/npu/bridges/fc_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/fill_constant_batch_size_like_op.cc b/lite/kernels/npu/bridges/fill_constant_batch_size_like_op.cc index 2543c404dc..8604efc883 100644 --- a/lite/kernels/npu/bridges/fill_constant_batch_size_like_op.cc +++ b/lite/kernels/npu/bridges/fill_constant_batch_size_like_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/fill_constant_op.cc b/lite/kernels/npu/bridges/fill_constant_op.cc index d1208fb1b9..7b083e8423 100644 --- a/lite/kernels/npu/bridges/fill_constant_op.cc +++ b/lite/kernels/npu/bridges/fill_constant_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/gather_op.cc b/lite/kernels/npu/bridges/gather_op.cc index 08b165f02b..bdc45bba71 100644 --- a/lite/kernels/npu/bridges/gather_op.cc +++ b/lite/kernels/npu/bridges/gather_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/increment_op.cc b/lite/kernels/npu/bridges/increment_op.cc index 3f54860265..2d03ed7086 100644 --- a/lite/kernels/npu/bridges/increment_op.cc +++ b/lite/kernels/npu/bridges/increment_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/instance_norm_op.cc b/lite/kernels/npu/bridges/instance_norm_op.cc index 55b6fba7fa..01f154bd43 100644 --- a/lite/kernels/npu/bridges/instance_norm_op.cc +++ b/lite/kernels/npu/bridges/instance_norm_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/interpolate_op.cc b/lite/kernels/npu/bridges/interpolate_op.cc index 1b931afd7a..e040497146 100644 --- a/lite/kernels/npu/bridges/interpolate_op.cc +++ b/lite/kernels/npu/bridges/interpolate_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/layer_norm_op.cc b/lite/kernels/npu/bridges/layer_norm_op.cc index 235e97dc72..dc08430e7a 100644 --- a/lite/kernels/npu/bridges/layer_norm_op.cc +++ b/lite/kernels/npu/bridges/layer_norm_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/lookup_table_op.cc b/lite/kernels/npu/bridges/lookup_table_op.cc index 7356cde339..3cac003f14 100644 --- a/lite/kernels/npu/bridges/lookup_table_op.cc +++ b/lite/kernels/npu/bridges/lookup_table_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/matmul_op.cc b/lite/kernels/npu/bridges/matmul_op.cc index 79ba82d94f..79ae649026 100644 --- a/lite/kernels/npu/bridges/matmul_op.cc +++ b/lite/kernels/npu/bridges/matmul_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/mul_op.cc b/lite/kernels/npu/bridges/mul_op.cc index 140700fdd0..97f60dda84 100644 --- a/lite/kernels/npu/bridges/mul_op.cc +++ b/lite/kernels/npu/bridges/mul_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/pad2d_op.cc b/lite/kernels/npu/bridges/pad2d_op.cc index efcf33af81..70fa87e778 100644 --- a/lite/kernels/npu/bridges/pad2d_op.cc +++ b/lite/kernels/npu/bridges/pad2d_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/pool_op.cc b/lite/kernels/npu/bridges/pool_op.cc index 51f67a1c6f..fc2647f67e 100644 --- a/lite/kernels/npu/bridges/pool_op.cc +++ b/lite/kernels/npu/bridges/pool_op.cc @@ -13,8 +13,8 @@ // limitations under the License. #include "lite/operators/pool_op.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/reduce_mean_op.cc b/lite/kernels/npu/bridges/reduce_mean_op.cc index c1cffe09ec..5987342672 100644 --- a/lite/kernels/npu/bridges/reduce_mean_op.cc +++ b/lite/kernels/npu/bridges/reduce_mean_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/reshape_op.cc b/lite/kernels/npu/bridges/reshape_op.cc index 6b4c62a999..50e2e6a05d 100644 --- a/lite/kernels/npu/bridges/reshape_op.cc +++ b/lite/kernels/npu/bridges/reshape_op.cc @@ -13,8 +13,8 @@ // limitations under the License. #include "lite/operators/reshape_op.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/scale_op.cc b/lite/kernels/npu/bridges/scale_op.cc index e5f8a7b3a4..6340b6f9ec 100644 --- a/lite/kernels/npu/bridges/scale_op.cc +++ b/lite/kernels/npu/bridges/scale_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/shape_op.cc b/lite/kernels/npu/bridges/shape_op.cc index 9bac023272..03f7624545 100644 --- a/lite/kernels/npu/bridges/shape_op.cc +++ b/lite/kernels/npu/bridges/shape_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/shuffle_channel_op.cc b/lite/kernels/npu/bridges/shuffle_channel_op.cc index 0ee721186b..58a48e6357 100644 --- a/lite/kernels/npu/bridges/shuffle_channel_op.cc +++ b/lite/kernels/npu/bridges/shuffle_channel_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/softmax_op.cc b/lite/kernels/npu/bridges/softmax_op.cc index a6604fbd78..d30966714d 100644 --- a/lite/kernels/npu/bridges/softmax_op.cc +++ b/lite/kernels/npu/bridges/softmax_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/split_op.cc b/lite/kernels/npu/bridges/split_op.cc index ef2bdb68fa..2bd0cc7e4c 100644 --- a/lite/kernels/npu/bridges/split_op.cc +++ b/lite/kernels/npu/bridges/split_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/topk_op.cc b/lite/kernels/npu/bridges/topk_op.cc index 1cc662e054..572b245354 100644 --- a/lite/kernels/npu/bridges/topk_op.cc +++ b/lite/kernels/npu/bridges/topk_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/transpose_op.cc b/lite/kernels/npu/bridges/transpose_op.cc index 51ca9613fc..6d2e6ce729 100644 --- a/lite/kernels/npu/bridges/transpose_op.cc +++ b/lite/kernels/npu/bridges/transpose_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/bridges/unsqueeze_op.cc b/lite/kernels/npu/bridges/unsqueeze_op.cc index b927ca50b0..6f5ba94ba1 100644 --- a/lite/kernels/npu/bridges/unsqueeze_op.cc +++ b/lite/kernels/npu/bridges/unsqueeze_op.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/npu/bridges/graph.h" -#include "lite/kernels/npu/bridges/registry.h" #include "lite/kernels/npu/bridges/utility.h" namespace paddle { diff --git a/lite/kernels/npu/subgraph_compute.cc b/lite/kernels/npu/subgraph_compute.cc index e9c5957ff6..4485f00a6f 100644 --- a/lite/kernels/npu/subgraph_compute.cc +++ b/lite/kernels/npu/subgraph_compute.cc @@ -129,7 +129,7 @@ bool DeviceProgram::BuildGraphAndCacheToFile( // then added them into the HiAI IR graph int status = 0; subgraph::npu::Graph graph; - const auto& bridges = subgraph::Registry::Instance(); + const auto& bridges = subgraph::SubgraphBridgeRegistry::Instance(); CHECK(origin_program) << "[NPU] The origin program is not initialized!"; CHECK_GT(origin_program->instructions(kRootBlockIdx).size(), 0) << "[NPU] No instructions found in the origin program!"; diff --git a/lite/kernels/npu/subgraph_compute.h b/lite/kernels/npu/subgraph_compute.h index 2203acaee8..39cdba4fc9 100644 --- a/lite/kernels/npu/subgraph_compute.h +++ b/lite/kernels/npu/subgraph_compute.h @@ -20,8 +20,8 @@ #include #include "HiAiModelManagerService.h" #include "lite/core/kernel.h" -#include "lite/kernels/npu/bridges/engine.h" -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" +#include "lite/core/subgraph_engine_base.h" namespace paddle { namespace lite { @@ -67,7 +67,7 @@ class DeviceProgram { std::vector device_odims_{}; }; -class SubgraphEngine : public subgraph::Engine { +class SubgraphEngine : public subgraph::SubgraphEngineBase { public: SubgraphEngine(KernelContext* ctx, int block_idx, @@ -75,12 +75,12 @@ class SubgraphEngine : public subgraph::Engine { Scope* exec_scope, const std::vector& input_names, const std::vector& output_names) - : subgraph::Engine(ctx, - block_idx, - program_desc, - exec_scope, - input_names, - output_names) {} + : subgraph::SubgraphEngineBase(ctx, + block_idx, + program_desc, + exec_scope, + input_names, + output_names) {} protected: bool PrepareWorkspaceForDeviceProgram() override; diff --git a/lite/kernels/rknpu/CMakeLists.txt b/lite/kernels/rknpu/CMakeLists.txt index ebb432748f..c8e25054f1 100644 --- a/lite/kernels/rknpu/CMakeLists.txt +++ b/lite/kernels/rknpu/CMakeLists.txt @@ -1,2 +1,3 @@ add_subdirectory(bridges) -add_kernel(subgraph_compute_rknpu RKNPU basic SRCS subgraph_compute.cc DEPS ${lite_kernel_deps} device_rknpu ${rknpu_subgraph_bridges}) + +add_kernel(subgraph_compute_rknpu RKNPU basic SRCS subgraph_compute.cc DEPS ${lite_kernel_deps} device_rknpu subgraph_engine_base ${rknpu_subgraph_bridges}) diff --git a/lite/kernels/rknpu/bridges/CMakeLists.txt b/lite/kernels/rknpu/bridges/CMakeLists.txt index 4c4801553d..8025ee87f6 100644 --- a/lite/kernels/rknpu/bridges/CMakeLists.txt +++ b/lite/kernels/rknpu/bridges/CMakeLists.txt @@ -5,7 +5,7 @@ endif() lite_cc_library(subgraph_bridge_utility_rknpu SRCS utility.cc DEPS ${rknpu_builder_libs} tensor) lite_cc_library(subgraph_bridge_graph_rknpu SRCS graph.cc DEPS subgraph_bridge_utility_rknpu) -set(rknpu_subgraph_bridge_deps subgraph_bridge_registry subgraph_bridge_engine subgraph_bridge_utility_rknpu subgraph_bridge_graph_rknpu) +set(rknpu_subgraph_bridge_deps subgraph_bridge_registry subgraph_bridge_utility_rknpu subgraph_bridge_graph_rknpu) lite_cc_library(subgraph_bridge_conv_op_rknpu SRCS conv_op.cc DEPS ${rknpu_subgraph_bridge_deps}) lite_cc_library(subgraph_bridge_act_op_rknpu SRCS act_op.cc DEPS ${rknpu_subgraph_bridge_deps}) diff --git a/lite/kernels/rknpu/bridges/act_op.cc b/lite/kernels/rknpu/bridges/act_op.cc index decc9b46d6..4c24d7b3ad 100644 --- a/lite/kernels/rknpu/bridges/act_op.cc +++ b/lite/kernels/rknpu/bridges/act_op.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/rknpu/bridges/graph.h" -// #include "lite/kernels/npu/bridges/utility.h" +#include "lite/kernels/rknpu/bridges/utility.h" namespace paddle { namespace lite { diff --git a/lite/kernels/rknpu/bridges/batch_norm_op.cc b/lite/kernels/rknpu/bridges/batch_norm_op.cc index 6895b836e4..0dafb50971 100644 --- a/lite/kernels/rknpu/bridges/batch_norm_op.cc +++ b/lite/kernels/rknpu/bridges/batch_norm_op.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/rknpu/bridges/graph.h" #include "lite/kernels/rknpu/bridges/utility.h" diff --git a/lite/kernels/rknpu/bridges/concat_op.cc b/lite/kernels/rknpu/bridges/concat_op.cc index 40c388a0bc..807ba71ecc 100644 --- a/lite/kernels/rknpu/bridges/concat_op.cc +++ b/lite/kernels/rknpu/bridges/concat_op.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/rknpu/bridges/graph.h" #include "lite/kernels/rknpu/bridges/utility.h" diff --git a/lite/kernels/rknpu/bridges/conv_op.cc b/lite/kernels/rknpu/bridges/conv_op.cc index f9b65ad864..134d9e0cde 100644 --- a/lite/kernels/rknpu/bridges/conv_op.cc +++ b/lite/kernels/rknpu/bridges/conv_op.cc @@ -14,7 +14,7 @@ #include "lite/operators/conv_op.h" #include -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/rknpu/bridges/graph.h" #include "lite/kernels/rknpu/bridges/utility.h" diff --git a/lite/kernels/rknpu/bridges/elementwise_ops.cc b/lite/kernels/rknpu/bridges/elementwise_ops.cc index e4b6b0a688..18975fbfd6 100644 --- a/lite/kernels/rknpu/bridges/elementwise_ops.cc +++ b/lite/kernels/rknpu/bridges/elementwise_ops.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/rknpu/bridges/graph.h" #include "lite/kernels/rknpu/bridges/utility.h" diff --git a/lite/kernels/rknpu/bridges/fc_op.cc b/lite/kernels/rknpu/bridges/fc_op.cc index 8814b3e27e..5ad06c3c8b 100644 --- a/lite/kernels/rknpu/bridges/fc_op.cc +++ b/lite/kernels/rknpu/bridges/fc_op.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/rknpu/bridges/graph.h" #include "lite/kernels/rknpu/bridges/utility.h" diff --git a/lite/kernels/rknpu/bridges/pool_op.cc b/lite/kernels/rknpu/bridges/pool_op.cc index b7f5cb9858..36832fc578 100644 --- a/lite/kernels/rknpu/bridges/pool_op.cc +++ b/lite/kernels/rknpu/bridges/pool_op.cc @@ -13,7 +13,7 @@ // limitations under the License. #include "lite/operators/pool_op.h" -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/rknpu/bridges/graph.h" #include "lite/kernels/rknpu/bridges/utility.h" diff --git a/lite/kernels/rknpu/bridges/softmax_op.cc b/lite/kernels/rknpu/bridges/softmax_op.cc index f6012531a5..9e0573ed1f 100644 --- a/lite/kernels/rknpu/bridges/softmax_op.cc +++ b/lite/kernels/rknpu/bridges/softmax_op.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/rknpu/bridges/graph.h" #include "lite/kernels/rknpu/bridges/utility.h" diff --git a/lite/kernels/rknpu/subgraph_compute.cc b/lite/kernels/rknpu/subgraph_compute.cc index da01539b29..b1088b7654 100644 --- a/lite/kernels/rknpu/subgraph_compute.cc +++ b/lite/kernels/rknpu/subgraph_compute.cc @@ -34,7 +34,7 @@ bool SubgraphEngine::BuildDeviceProgram() { // Convert all of ops and their input vars and weights and added into the NPU // RKNPU IR graph subgraph::rknpu::Graph graph; - const auto& bridges = subgraph::Registry::Instance(); + const auto& bridges = subgraph::SubgraphBridgeRegistry::Instance(); if (!origin_program_) { BuildOriginProgram(); } diff --git a/lite/kernels/rknpu/subgraph_compute.h b/lite/kernels/rknpu/subgraph_compute.h index 78162b3d16..314b11f34b 100644 --- a/lite/kernels/rknpu/subgraph_compute.h +++ b/lite/kernels/rknpu/subgraph_compute.h @@ -20,9 +20,9 @@ #include "lite/core/kernel.h" #include "lite/core/op_registry.h" #include "lite/core/program.h" +#include "lite/core/subgraph_bridge_registry.h" +#include "lite/core/subgraph_engine_base.h" #include "lite/core/types.h" -#include "lite/kernels/npu/bridges/engine.h" -#include "lite/kernels/npu/bridges/registry.h" #include "rknpu/rknpu_pub.h" namespace paddle { @@ -30,7 +30,7 @@ namespace lite { namespace kernels { namespace rknpu { -class SubgraphEngine : public subgraph::Engine { +class SubgraphEngine : public subgraph::SubgraphEngineBase { public: SubgraphEngine(KernelContext *ctx, int block_idx, @@ -38,12 +38,12 @@ class SubgraphEngine : public subgraph::Engine { Scope *exec_scope, const std::vector &input_names, const std::vector &output_names) - : subgraph::Engine(ctx, - block_idx, - program_desc, - exec_scope, - input_names, - output_names) {} + : subgraph::SubgraphEngineBase(ctx, + block_idx, + program_desc, + exec_scope, + input_names, + output_names) {} protected: bool BuildDeviceProgram() override; diff --git a/lite/kernels/xpu/CMakeLists.txt b/lite/kernels/xpu/CMakeLists.txt index 29f14c8f3e..798d707dd7 100644 --- a/lite/kernels/xpu/CMakeLists.txt +++ b/lite/kernels/xpu/CMakeLists.txt @@ -4,7 +4,7 @@ endif() if(LITE_WITH_XTCL) add_subdirectory(bridges) - add_kernel(subgraph_compute_xpu XPU basic SRCS subgraph_compute.cc DEPS ${lite_kernel_deps} device_xpu subgraph_bridge_engine ${xpu_subgraph_bridges}) + add_kernel(subgraph_compute_xpu XPU basic SRCS subgraph_compute.cc DEPS ${lite_kernel_deps} device_xpu subgraph_engine_base ${xpu_subgraph_bridges}) else() # basic add_kernel(conv_compute_xpu XPU basic SRCS conv_compute.cc DEPS ${lite_kernel_deps}) diff --git a/lite/kernels/xpu/bridges/act_op.cc b/lite/kernels/xpu/bridges/act_op.cc index 502d189b89..ed3475779a 100644 --- a/lite/kernels/xpu/bridges/act_op.cc +++ b/lite/kernels/xpu/bridges/act_op.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/xpu/bridges/graph.h" #include "lite/kernels/xpu/bridges/utility.h" diff --git a/lite/kernels/xpu/bridges/batch_norm_op.cc b/lite/kernels/xpu/bridges/batch_norm_op.cc index 6f909ed91c..71d0536603 100644 --- a/lite/kernels/xpu/bridges/batch_norm_op.cc +++ b/lite/kernels/xpu/bridges/batch_norm_op.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/xpu/bridges/graph.h" #include "lite/kernels/xpu/bridges/utility.h" diff --git a/lite/kernels/xpu/bridges/cast_op.cc b/lite/kernels/xpu/bridges/cast_op.cc index a87beb93db..87f84a23d2 100644 --- a/lite/kernels/xpu/bridges/cast_op.cc +++ b/lite/kernels/xpu/bridges/cast_op.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/xpu/bridges/graph.h" #include "lite/kernels/xpu/bridges/utility.h" diff --git a/lite/kernels/xpu/bridges/conv_op.cc b/lite/kernels/xpu/bridges/conv_op.cc index bff96ce288..a4c0bc05cb 100644 --- a/lite/kernels/xpu/bridges/conv_op.cc +++ b/lite/kernels/xpu/bridges/conv_op.cc @@ -13,7 +13,7 @@ // limitations under the License. #include "lite/operators/conv_op.h" -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/xpu/bridges/graph.h" #include "lite/kernels/xpu/bridges/utility.h" diff --git a/lite/kernels/xpu/bridges/dropout_op.cc b/lite/kernels/xpu/bridges/dropout_op.cc index 562dad1a13..ec4a25e80e 100644 --- a/lite/kernels/xpu/bridges/dropout_op.cc +++ b/lite/kernels/xpu/bridges/dropout_op.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/xpu/bridges/graph.h" #include "lite/kernels/xpu/bridges/utility.h" diff --git a/lite/kernels/xpu/bridges/elementwise_ops.cc b/lite/kernels/xpu/bridges/elementwise_ops.cc index 31266a09cc..f0342bd16f 100644 --- a/lite/kernels/xpu/bridges/elementwise_ops.cc +++ b/lite/kernels/xpu/bridges/elementwise_ops.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/xpu/bridges/graph.h" #include "lite/kernels/xpu/bridges/utility.h" diff --git a/lite/kernels/xpu/bridges/gather_op.cc b/lite/kernels/xpu/bridges/gather_op.cc index 4a5ebdaf2c..af8e4e55b6 100644 --- a/lite/kernels/xpu/bridges/gather_op.cc +++ b/lite/kernels/xpu/bridges/gather_op.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/xpu/bridges/graph.h" #include "lite/kernels/xpu/bridges/utility.h" diff --git a/lite/kernels/xpu/bridges/layer_norm_op.cc b/lite/kernels/xpu/bridges/layer_norm_op.cc index 140fa3f5b8..f9d093d0ab 100644 --- a/lite/kernels/xpu/bridges/layer_norm_op.cc +++ b/lite/kernels/xpu/bridges/layer_norm_op.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/xpu/bridges/graph.h" #include "lite/kernels/xpu/bridges/utility.h" diff --git a/lite/kernels/xpu/bridges/lookup_table_op.cc b/lite/kernels/xpu/bridges/lookup_table_op.cc index fa480062ce..7a38d1c4c2 100644 --- a/lite/kernels/xpu/bridges/lookup_table_op.cc +++ b/lite/kernels/xpu/bridges/lookup_table_op.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/xpu/bridges/graph.h" #include "lite/kernels/xpu/bridges/utility.h" diff --git a/lite/kernels/xpu/bridges/matmul_op.cc b/lite/kernels/xpu/bridges/matmul_op.cc index cb418f5266..a329906221 100644 --- a/lite/kernels/xpu/bridges/matmul_op.cc +++ b/lite/kernels/xpu/bridges/matmul_op.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/xpu/bridges/graph.h" #include "lite/kernels/xpu/bridges/utility.h" diff --git a/lite/kernels/xpu/bridges/mul_op.cc b/lite/kernels/xpu/bridges/mul_op.cc index 7ff19fc3c8..3434be70ed 100644 --- a/lite/kernels/xpu/bridges/mul_op.cc +++ b/lite/kernels/xpu/bridges/mul_op.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/xpu/bridges/graph.h" #include "lite/kernels/xpu/bridges/utility.h" diff --git a/lite/kernels/xpu/bridges/pool_op.cc b/lite/kernels/xpu/bridges/pool_op.cc index 4909cef30f..862e1841e8 100644 --- a/lite/kernels/xpu/bridges/pool_op.cc +++ b/lite/kernels/xpu/bridges/pool_op.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/xpu/bridges/graph.h" #include "lite/kernels/xpu/bridges/utility.h" diff --git a/lite/kernels/xpu/bridges/reshape_op.cc b/lite/kernels/xpu/bridges/reshape_op.cc index 1da32bb9de..5c2db355c5 100644 --- a/lite/kernels/xpu/bridges/reshape_op.cc +++ b/lite/kernels/xpu/bridges/reshape_op.cc @@ -13,7 +13,7 @@ // limitations under the License. #include "lite/operators/reshape_op.h" -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/xpu/bridges/graph.h" #include "lite/kernels/xpu/bridges/utility.h" diff --git a/lite/kernels/xpu/bridges/scale_op.cc b/lite/kernels/xpu/bridges/scale_op.cc index b6379bfbaa..07d5519b33 100644 --- a/lite/kernels/xpu/bridges/scale_op.cc +++ b/lite/kernels/xpu/bridges/scale_op.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/xpu/bridges/graph.h" #include "lite/kernels/xpu/bridges/utility.h" diff --git a/lite/kernels/xpu/bridges/slice_op.cc b/lite/kernels/xpu/bridges/slice_op.cc index 8af5e87405..c90f240b1a 100644 --- a/lite/kernels/xpu/bridges/slice_op.cc +++ b/lite/kernels/xpu/bridges/slice_op.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/xpu/bridges/graph.h" #include "lite/kernels/xpu/bridges/utility.h" diff --git a/lite/kernels/xpu/bridges/softmax_op.cc b/lite/kernels/xpu/bridges/softmax_op.cc index 86c8469387..0fd47d1ea5 100644 --- a/lite/kernels/xpu/bridges/softmax_op.cc +++ b/lite/kernels/xpu/bridges/softmax_op.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/xpu/bridges/graph.h" #include "lite/kernels/xpu/bridges/utility.h" diff --git a/lite/kernels/xpu/bridges/stack_op.cc b/lite/kernels/xpu/bridges/stack_op.cc index 5c02848908..e1973c5d34 100644 --- a/lite/kernels/xpu/bridges/stack_op.cc +++ b/lite/kernels/xpu/bridges/stack_op.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/xpu/bridges/graph.h" #include "lite/kernels/xpu/bridges/utility.h" diff --git a/lite/kernels/xpu/bridges/transpose_op.cc b/lite/kernels/xpu/bridges/transpose_op.cc index a563d24086..f27a355d3b 100644 --- a/lite/kernels/xpu/bridges/transpose_op.cc +++ b/lite/kernels/xpu/bridges/transpose_op.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/xpu/bridges/graph.h" #include "lite/kernels/xpu/bridges/utility.h" diff --git a/lite/kernels/xpu/bridges/yolo_box_op.cc b/lite/kernels/xpu/bridges/yolo_box_op.cc index f1b7c01470..7eb1bb5e9f 100644 --- a/lite/kernels/xpu/bridges/yolo_box_op.cc +++ b/lite/kernels/xpu/bridges/yolo_box_op.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" #include "lite/kernels/xpu/bridges/graph.h" #include "lite/kernels/xpu/bridges/utility.h" diff --git a/lite/kernels/xpu/subgraph_compute.cc b/lite/kernels/xpu/subgraph_compute.cc index 2e550bfc2d..df70ffe0d8 100644 --- a/lite/kernels/xpu/subgraph_compute.cc +++ b/lite/kernels/xpu/subgraph_compute.cc @@ -36,7 +36,7 @@ bool SubgraphEngine::BuildDeviceProgram() { // Convert all of ops and their input vars and weights and added into the XPU // IR graph subgraph::xpu::Graph graph; - const auto& bridges = subgraph::Registry::Instance(); + const auto& bridges = subgraph::SubgraphBridgeRegistry::Instance(); const auto& insts = origin_program_->instructions(kRootBlockIdx); for (auto& inst : insts) { auto op = const_cast(inst.op()); diff --git a/lite/kernels/xpu/subgraph_compute.h b/lite/kernels/xpu/subgraph_compute.h index dcfe584a40..cf5012fdb8 100644 --- a/lite/kernels/xpu/subgraph_compute.h +++ b/lite/kernels/xpu/subgraph_compute.h @@ -19,15 +19,15 @@ #include #include "lite/backends/xpu/xpu_header_sitter.h" #include "lite/core/kernel.h" -#include "lite/kernels/npu/bridges/engine.h" -#include "lite/kernels/npu/bridges/registry.h" +#include "lite/core/subgraph_bridge_registry.h" +#include "lite/core/subgraph_engine_base.h" namespace paddle { namespace lite { namespace kernels { namespace xpu { -class SubgraphEngine : public subgraph::Engine { +class SubgraphEngine : public subgraph::SubgraphEngineBase { public: SubgraphEngine(KernelContext *ctx, int block_idx, @@ -35,12 +35,12 @@ class SubgraphEngine : public subgraph::Engine { Scope *exec_scope, const std::vector &input_names, const std::vector &output_names) - : subgraph::Engine(ctx, - block_idx, - program_desc, - exec_scope, - input_names, - output_names) {} + : subgraph::SubgraphEngineBase(ctx, + block_idx, + program_desc, + exec_scope, + input_names, + output_names) {} protected: bool BuildDeviceProgram() override; -- GitLab