From 48b3e86956fd8b25f11be60e04df0b63df857d4c Mon Sep 17 00:00:00 2001 From: HongyuJia Date: Tue, 31 Jan 2023 11:27:46 +0800 Subject: [PATCH] [Decouple phi] Decouple custom_op in fluid and phi (#49866) * decouple phi custom_op * decouple phi custom_op, remove codes * delete custom symbol of inference --- paddle/fluid/inference/paddle_inference.map | 3 --- .../inference/paddle_inference_custom_device.map | 3 --- paddle/phi/api/ext/op_meta_info.h | 10 ---------- paddle/phi/api/lib/op_meta_info.cc | 12 ------------ 4 files changed, 28 deletions(-) diff --git a/paddle/fluid/inference/paddle_inference.map b/paddle/fluid/inference/paddle_inference.map index acbdcf5d78..3d2dc85cb8 100644 --- a/paddle/fluid/inference/paddle_inference.map +++ b/paddle/fluid/inference/paddle_inference.map @@ -39,9 +39,6 @@ *paddle::GPUContextResource*; *paddle::CPUContextResource*; - *paddle::LoadCustomOperatorLib*; - *paddle::RegisterAllCustomOperator*; - /* ut needs the following symbol, we need to modify all the ut to hidden such symbols */ /* Another question: the ut size will grow from 50M to 80M, why? */ diff --git a/paddle/fluid/inference/paddle_inference_custom_device.map b/paddle/fluid/inference/paddle_inference_custom_device.map index 83de7d9a77..7434678d86 100644 --- a/paddle/fluid/inference/paddle_inference_custom_device.map +++ b/paddle/fluid/inference/paddle_inference_custom_device.map @@ -39,9 +39,6 @@ *paddle::GPUContextResource*; *paddle::CPUContextResource*; - *paddle::LoadCustomOperatorLib*; - *paddle::RegisterAllCustomOperator*; - /* ut needs the following symbol, we need to modify all the ut to hidden such symbols */ /* Another question: the ut size will grow from 50M to 80M, why? */ diff --git a/paddle/phi/api/ext/op_meta_info.h b/paddle/phi/api/ext/op_meta_info.h index 7d2be9c90d..978599c3bc 100644 --- a/paddle/phi/api/ext/op_meta_info.h +++ b/paddle/phi/api/ext/op_meta_info.h @@ -619,16 +619,6 @@ class PADDLE_API OpMetaInfoBuilder { size_t index_; }; -/////////////////////// Op register API ///////////////////////// - -// For inference: compile directly with framework -// Call after PD_BUILD_OP(...) -void RegisterAllCustomOperator(); - -// Using this api to load compiled custom operator's dynamic library and -// register Custom Operator into it -void LoadCustomOperatorLib(const std::string& dso_name); - /////////////////////// Op register Macro ///////////////////////// #define PD_BUILD_OP(op_name) \ diff --git a/paddle/phi/api/lib/op_meta_info.cc b/paddle/phi/api/lib/op_meta_info.cc index 8d64246bdb..a6b7921c30 100644 --- a/paddle/phi/api/lib/op_meta_info.cc +++ b/paddle/phi/api/lib/op_meta_info.cc @@ -19,7 +19,6 @@ limitations under the License. */ #include #include "glog/logging.h" -#include "paddle/fluid/framework/custom_operator.h" #include "paddle/phi/core/dense_tensor.h" #include "paddle/phi/core/enforce.h" @@ -244,17 +243,6 @@ OpMetaInfoBuilder& OpMetaInfoBuilder::SetInferDtypeFn(InferDtypeFunc func) { info_ptr_->SetInferDtypeFn(std::forward(func)); return *this; } - -/////////////////////// Op register API ///////////////////////// - -void RegisterAllCustomOperator() { - auto& op_meta_info_map = OpMetaInfoMap::Instance(); - framework::RegisterOperatorWithMetaInfoMap(op_meta_info_map); -} - -void LoadCustomOperatorLib(const std::string& dso_name) { - paddle::framework::LoadOpMetaInfoAndRegisterOp(dso_name); -} } // namespace paddle #ifdef __cplusplus -- GitLab