diff --git a/paddle/fluid/framework/attribute.cc b/paddle/fluid/framework/attribute.cc index 9ca3fe31a33c78621b9e25acaf095e8240af7db6..7460686c1a383531191377cf56ceefa6fbb26a5f 100644 --- a/paddle/fluid/framework/attribute.cc +++ b/paddle/fluid/framework/attribute.cc @@ -14,8 +14,6 @@ limitations under the License. */ #include "paddle/fluid/framework/attribute.h" -#include - namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/block_desc.h b/paddle/fluid/framework/block_desc.h index 5c6e421516269a9b9865605400efa772f944a96f..8c8fcadb05be080699fb6f7a6ab2ac3bc6328c09 100644 --- a/paddle/fluid/framework/block_desc.h +++ b/paddle/fluid/framework/block_desc.h @@ -30,6 +30,8 @@ namespace paddle { namespace framework { class ProgramDesc; +class OpDesc; +class VarDesc; // Each Protobuf Message, we provide a XXXBind class. In that class, we optimize // read/write speed. Only when we want the protobuf message, the local changes diff --git a/paddle/fluid/framework/c/c_api.cc b/paddle/fluid/framework/c/c_api.cc index 0dd2768ccb9ffa1dc7b85dca500095f8c10479c3..48181dac662272679556c444b3055fc950b8c74d 100644 --- a/paddle/fluid/framework/c/c_api.cc +++ b/paddle/fluid/framework/c/c_api.cc @@ -12,17 +12,7 @@ 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 "paddle/fluid/framework/block_desc.h" #include "paddle/fluid/framework/c/c_api.h" -#include "paddle/fluid/framework/op_registry.h" -#include "paddle/fluid/framework/program_desc.h" -#include "paddle/fluid/framework/scope.h" -#include "paddle/fluid/platform/init.h" extern "C" { diff --git a/paddle/fluid/framework/c/c_api.h b/paddle/fluid/framework/c/c_api.h index 04dbfbebe5d7646e93678fff3418c4eed6bc691a..a9ec402f381e43b51887b6467d8d1baccf98ad37 100644 --- a/paddle/fluid/framework/c/c_api.h +++ b/paddle/fluid/framework/c/c_api.h @@ -24,6 +24,15 @@ limitations under the License. */ #include "paddle/fluid/framework/op_info.h" #include "paddle/fluid/platform/device_context.h" +namespace paddle { +namespace framework { +class OpInfoMap; +} // namespace framework +namespace platform { +class DeviceContextPool; +} // namespace platform +} // namespace paddle + #ifdef __cplusplus extern "C" { #endif diff --git a/paddle/fluid/framework/channel.h b/paddle/fluid/framework/channel.h index 64a645bf8b28a84b153db74afd2ec268d79ff245..503f1513aad20c1598b034ef1fb90bd0aa1a0224 100644 --- a/paddle/fluid/framework/channel.h +++ b/paddle/fluid/framework/channel.h @@ -277,7 +277,7 @@ class ChannelObject { size_t finished = 0; while (finished < n && WaitForWrite(lock)) { size_t m = - std::min(n - finished, capacity_ + reading_count_ - data_.size()); + (std::min)(n - finished, capacity_ + reading_count_ - data_.size()); for (size_t i = 0; i < m; i++) { data_.push_back(std::move(p[finished++])); } diff --git a/paddle/fluid/framework/copy_same_tensor_test.cc b/paddle/fluid/framework/copy_same_tensor_test.cc index 9350c387a6e49122c6b4c3fe01f5de782a1ae5e4..5b89166e2f4826fe836c74a570abcb8a1790f58e 100644 --- a/paddle/fluid/framework/copy_same_tensor_test.cc +++ b/paddle/fluid/framework/copy_same_tensor_test.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include + #include "gflags/gflags.h" #include "gtest/gtest.h" #include "paddle/fluid/framework/tensor.h" diff --git a/paddle/fluid/framework/data_device_transform.h b/paddle/fluid/framework/data_device_transform.h index 8ff97646cfce7979b1c9c570e6de4f1bd26916c3..60b52a5e7069fb8fdd0664bcfa99eaa000dbff12 100644 --- a/paddle/fluid/framework/data_device_transform.h +++ b/paddle/fluid/framework/data_device_transform.h @@ -21,6 +21,8 @@ limitations under the License. */ namespace paddle { namespace framework { +class Tensor; + void TransDataDevice(const Tensor& in, const platform::Place& dst_place, Tensor* out); diff --git a/paddle/fluid/framework/data_feed.h b/paddle/fluid/framework/data_feed.h index b48d152fe35826363a77104a5cbe39ad800b5eb1..da156bfc5c79f6faf7544794675c40dfd10e7349 100644 --- a/paddle/fluid/framework/data_feed.h +++ b/paddle/fluid/framework/data_feed.h @@ -41,6 +41,15 @@ limitations under the License. */ #include "paddle/fluid/framework/variable.h" #include "paddle/fluid/string/string_helper.h" +namespace paddle { +namespace framework { +class DataFeedDesc; +class LoDTensor; +class Scope; +class Variable; +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { @@ -418,6 +427,7 @@ class MultiSlotType { std::string DebugString() { std::stringstream ss; + ss << "\ntype: " << type_ << "\n"; ss << "offset: "; ss << "["; diff --git a/paddle/fluid/framework/data_feed_factory.cc b/paddle/fluid/framework/data_feed_factory.cc index 1d8aec7624043f96c5aae908c5faa536e818b5a5..048d539f9b9e5039b7b3b5ec2ae672032f89be48 100644 --- a/paddle/fluid/framework/data_feed_factory.cc +++ b/paddle/fluid/framework/data_feed_factory.cc @@ -17,10 +17,10 @@ limitations under the License. */ #include #include -#include "paddle/fluid/framework/data_feed.h" - namespace paddle { namespace framework { +class DataFeed; + typedef std::shared_ptr (*Createdata_feedFunction)(); typedef std::unordered_map data_feedMap; data_feedMap g_data_feed_map; diff --git a/paddle/fluid/framework/data_feed_factory.h b/paddle/fluid/framework/data_feed_factory.h index 13678edb0b8d084a0b3016d93f6e1bc32ce0169a..49381a98706ddedb9bb0b5900fcb85ac4d4a3719 100644 --- a/paddle/fluid/framework/data_feed_factory.h +++ b/paddle/fluid/framework/data_feed_factory.h @@ -16,10 +16,13 @@ limitations under the License. */ #include #include + #include "paddle/fluid/framework/data_feed.h" namespace paddle { namespace framework { +class DataFeed; + class DataFeedFactory { public: static std::string DataFeedTypeList(); diff --git a/paddle/fluid/framework/data_layout_transform.cc b/paddle/fluid/framework/data_layout_transform.cc index f757e244e38ec965d62d673e63ed082ca70c63c7..108cd9ac6d1c0778b7f614116b5739502fcfb0ee 100644 --- a/paddle/fluid/framework/data_layout_transform.cc +++ b/paddle/fluid/framework/data_layout_transform.cc @@ -13,8 +13,8 @@ // limitations under the License. #include "paddle/fluid/framework/data_layout_transform.h" + #include -#include #include "paddle/fluid/operators/math/math_function.h" #ifdef PADDLE_WITH_MKLDNN diff --git a/paddle/fluid/framework/data_layout_transform.h b/paddle/fluid/framework/data_layout_transform.h index b92c47c2eb018603e1b3156921fb2c1702864c57..238f2d2e67914c7ae1443d09cf915439ebad4dd5 100644 --- a/paddle/fluid/framework/data_layout_transform.h +++ b/paddle/fluid/framework/data_layout_transform.h @@ -17,10 +17,18 @@ #include #include #include + #include "paddle/fluid/framework/op_kernel_type.h" #include "paddle/fluid/framework/tensor.h" #include "paddle/fluid/framework/variable.h" +namespace paddle { +namespace framework { +class OpKernelType; +class Tensor; +} // namespace framework +} // namespace paddle + #ifdef PADDLE_WITH_MKLDNN #include "paddle/fluid/platform/mkldnn_helper.h" #endif diff --git a/paddle/fluid/framework/data_layout_transform_test.cc b/paddle/fluid/framework/data_layout_transform_test.cc index 8dfad23db65178c46140b887811846e413bebd00..20443e9a3dcad62770e62d9a780960bf3db43111 100644 --- a/paddle/fluid/framework/data_layout_transform_test.cc +++ b/paddle/fluid/framework/data_layout_transform_test.cc @@ -15,7 +15,6 @@ #include "paddle/fluid/framework/data_layout_transform.h" #include "gtest/gtest.h" -#include "paddle/fluid/platform/device_context.h" TEST(DataTransform, DataLayoutFunction) { auto place = paddle::platform::CPUPlace(); diff --git a/paddle/fluid/framework/data_transform.cc b/paddle/fluid/framework/data_transform.cc index f54311eebfade312057224ddda075c03fdc0666d..3a40de6988f294314f83ba0308e9d57de84d60f7 100644 --- a/paddle/fluid/framework/data_transform.cc +++ b/paddle/fluid/framework/data_transform.cc @@ -18,8 +18,13 @@ limitations under the License. */ #include "paddle/fluid/framework/data_layout_transform.h" #include "paddle/fluid/framework/data_type_transform.h" +namespace paddle { +namespace framework { +class Variable; +} // namespace framework +} // namespace paddle + #ifdef PADDLE_WITH_MKLDNN -#include #include "paddle/fluid/platform/mkldnn_helper.h" #endif diff --git a/paddle/fluid/framework/data_transform.h b/paddle/fluid/framework/data_transform.h index ef2271d530d5f2c915467a08c00dae433284c663..2bbdac52ee49fd23bb036b4475f2310787a6ae14 100644 --- a/paddle/fluid/framework/data_transform.h +++ b/paddle/fluid/framework/data_transform.h @@ -30,6 +30,10 @@ limitations under the License. */ namespace paddle { namespace framework { +class OpKernelType; +class Tensor; +class Variable; + void TransformData(const OpKernelType &expected_kernel_type, const OpKernelType &kernel_type_for_var, const Tensor &input_tensor, Tensor *out); diff --git a/paddle/fluid/framework/data_type.cc b/paddle/fluid/framework/data_type.cc index 8188d5cde1b90436d040e8b9dcc1070ac85bf319..e4be866dca13585465610a3aff8bd7a4d54dd9c5 100644 --- a/paddle/fluid/framework/data_type.cc +++ b/paddle/fluid/framework/data_type.cc @@ -13,7 +13,6 @@ // limitations under the License. #include "paddle/fluid/framework/data_type.h" -#include #include #include diff --git a/paddle/fluid/framework/data_type.h b/paddle/fluid/framework/data_type.h index 720e422e114835f367317d4ba265254856885c15..4477a9cac09d8f060d6b8f2f7d5bf4dfd7b3f893 100644 --- a/paddle/fluid/framework/data_type.h +++ b/paddle/fluid/framework/data_type.h @@ -15,12 +15,19 @@ limitations under the License. */ #pragma once #include #include -#include "paddle/fluid/framework/framework.pb.h" -#include "paddle/fluid/platform/enforce.h" +#include "paddle/fluid/framework/framework.pb.h" #include "paddle/fluid/platform/bfloat16.h" +#include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/platform/float16.h" +namespace paddle { +namespace platform { +struct bfloat16; +struct float16; +} // namespace platform +} // namespace paddle + namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/data_type_test.cc b/paddle/fluid/framework/data_type_test.cc index 331596da33acc151810cd616ea6d5bdcae333b30..5599edcd222ba4748ae4b88a668d79530a1681d0 100644 --- a/paddle/fluid/framework/data_type_test.cc +++ b/paddle/fluid/framework/data_type_test.cc @@ -14,9 +14,17 @@ #include "paddle/fluid/framework/data_type.h" #include + #include "gtest/gtest.h" #include "paddle/fluid/framework/tensor.h" +namespace paddle { +namespace platform { +struct bfloat16; +struct float16; +} // namespace platform +} // namespace paddle + TEST(DataType, float16) { using paddle::framework::Tensor; using paddle::platform::CPUPlace; diff --git a/paddle/fluid/framework/data_type_transform.h b/paddle/fluid/framework/data_type_transform.h index 1c281b03ed61ac70e16a43d75a79854bdafd8836..b42b2f594aa7f36aeaff97d4b66d5924ba8ac60b 100644 --- a/paddle/fluid/framework/data_type_transform.h +++ b/paddle/fluid/framework/data_type_transform.h @@ -15,6 +15,7 @@ limitations under the License. */ #pragma once #include + #include "paddle/fluid/framework/op_kernel_type.h" #include "paddle/fluid/framework/tensor.h" #include "paddle/fluid/framework/variable.h" @@ -23,6 +24,9 @@ limitations under the License. */ namespace paddle { namespace framework { +class OpKernelType; +class Tensor; + using KernelTypePair = std::pair; void TransDataType(const OpKernelType& kernel_type_for_var, diff --git a/paddle/fluid/framework/dataset_factory.cc b/paddle/fluid/framework/dataset_factory.cc index 3a28c101d48342ef639956a974d59aee8ae42ed6..cdb513f70ad94861a1ba0cb6e90d72ace40213bb 100644 --- a/paddle/fluid/framework/dataset_factory.cc +++ b/paddle/fluid/framework/dataset_factory.cc @@ -13,12 +13,9 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/dataset_factory.h" -#include #include #include -#include "paddle/fluid/framework/data_set.h" - namespace paddle { namespace framework { typedef std::unique_ptr (*CreateDatasetFunction)(); diff --git a/paddle/fluid/framework/dataset_factory.h b/paddle/fluid/framework/dataset_factory.h index d4a36cec22fc0af27a38ee7cd810a2eaa7988ea1..425c488daa8689eb2faa56891c7d5c80d666fcf2 100644 --- a/paddle/fluid/framework/dataset_factory.h +++ b/paddle/fluid/framework/dataset_factory.h @@ -16,6 +16,7 @@ limitations under the License. */ #include #include + #include "paddle/fluid/framework/data_set.h" namespace paddle { diff --git a/paddle/fluid/framework/ddim.h b/paddle/fluid/framework/ddim.h index 29c4732f99118fe42f08317625ec07edf52ec217..e69fb4e761939d8e1ea490563c5921af1a30b7ef 100644 --- a/paddle/fluid/framework/ddim.h +++ b/paddle/fluid/framework/ddim.h @@ -18,6 +18,7 @@ limitations under the License. */ #include #include #include + #include "paddle/fluid/framework/dim.h" namespace paddle { diff --git a/paddle/fluid/framework/ddim_test.cc b/paddle/fluid/framework/ddim_test.cc index b7b42fa019f6b2243719ebdb1628ea83c220abf9..e89f77ae496c499b7408d4e0836c2abe5cff9660 100644 --- a/paddle/fluid/framework/ddim_test.cc +++ b/paddle/fluid/framework/ddim_test.cc @@ -12,7 +12,6 @@ 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 "gtest/gtest.h" #include "paddle/fluid/framework/ddim.h" diff --git a/paddle/fluid/framework/details/all_reduce_op_handle.h b/paddle/fluid/framework/details/all_reduce_op_handle.h index 36f5d3adfadfbb2bef12145042db104f9ee4c1e3..e0064ec264223cafff3c6b93bfde841799ee7c3a 100644 --- a/paddle/fluid/framework/details/all_reduce_op_handle.h +++ b/paddle/fluid/framework/details/all_reduce_op_handle.h @@ -20,6 +20,17 @@ #include "paddle/fluid/framework/details/op_handle_base.h" #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/scope.h" + +namespace paddle { +namespace framework { +namespace ir { +class Node; +} // namespace ir +} // namespace framework +namespace platform { +class NCCLCommunicator; +} // namespace platform +} // namespace paddle #if defined(PADDLE_WITH_NCCL) #include "paddle/fluid/framework/details/nccl_op_handle.h" #include "paddle/fluid/platform/nccl_helper.h" diff --git a/paddle/fluid/framework/details/broadcast_op_handle.h b/paddle/fluid/framework/details/broadcast_op_handle.h index 588248d6454fbc1645b75ea2a8b8a3c662f1bbda..1412e2cd9dbb8319c5161fe5fdf0eda694d7dfea 100644 --- a/paddle/fluid/framework/details/broadcast_op_handle.h +++ b/paddle/fluid/framework/details/broadcast_op_handle.h @@ -24,6 +24,20 @@ #include "paddle/fluid/framework/selected_rows.h" #include "paddle/fluid/platform/device_context.h" +namespace paddle { +namespace framework { +namespace details { +struct VarHandle; +} // namespace details +namespace ir { +class Node; +} // namespace ir +} // namespace framework +namespace platform { +struct NCCLContextMap; +} // namespace platform +} // namespace paddle + #if defined(PADDLE_WITH_NCCL) #include "paddle/fluid/platform/nccl_helper.h" #endif diff --git a/paddle/fluid/framework/details/broadcast_op_handle_test.h b/paddle/fluid/framework/details/broadcast_op_handle_test.h index 6d14c7e4e7bf23c2140195b5fb3a104fd9f3bb59..e455879a68f70b3f4f33fb5e6ede0fd9e9f22d5f 100644 --- a/paddle/fluid/framework/details/broadcast_op_handle_test.h +++ b/paddle/fluid/framework/details/broadcast_op_handle_test.h @@ -21,13 +21,15 @@ #include "gtest/gtest.h" #include "paddle/fluid/framework/details/broadcast_op_handle.h" - #include "paddle/fluid/platform/device_context.h" namespace paddle { namespace framework { namespace details { +struct DummyVarHandle; +struct VarHandle; + namespace f = paddle::framework; namespace p = paddle::platform; diff --git a/paddle/fluid/framework/details/build_strategy.h b/paddle/fluid/framework/details/build_strategy.h index 01d496d4ea7f7f0d0347b552e13d988fdc68e0c7..87b27eaa440cc4c546c5e5bfc38b01fc057d4991 100644 --- a/paddle/fluid/framework/details/build_strategy.h +++ b/paddle/fluid/framework/details/build_strategy.h @@ -27,6 +27,18 @@ #include "paddle/fluid/platform/device_context.h" #include "paddle/fluid/platform/enforce.h" +namespace paddle { +namespace framework { +namespace ir { +class Graph; +class PassBuilder; +} // namespace ir +} // namespace framework +namespace platform { +class NCCLCommunicator; +} // namespace platform +} // namespace paddle + #if defined(PADDLE_WITH_NCCL) #include "paddle/fluid/platform/nccl_helper.h" #endif diff --git a/paddle/fluid/framework/details/computation_op_handle.cc b/paddle/fluid/framework/details/computation_op_handle.cc index 0b653e57f6d48f9d919ee4f09db5b6ab6b2451b7..2256b826ed501f9974806d2ef20ef137d1ca0724 100644 --- a/paddle/fluid/framework/details/computation_op_handle.cc +++ b/paddle/fluid/framework/details/computation_op_handle.cc @@ -19,6 +19,8 @@ namespace paddle { namespace framework { namespace details { +struct VarHandleBase; + ComputationOpHandle::ComputationOpHandle(ir::Node *node, Scope *scope, platform::Place place, size_t scope_idx) diff --git a/paddle/fluid/framework/details/computation_op_handle.h b/paddle/fluid/framework/details/computation_op_handle.h index 41c51b95800f48afd25136d0521d0cfc4d2d8f6c..3c219ee27d3d6ed5e93e0d45acd457c84a77a38a 100644 --- a/paddle/fluid/framework/details/computation_op_handle.h +++ b/paddle/fluid/framework/details/computation_op_handle.h @@ -24,9 +24,21 @@ #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/platform/device_context.h" +namespace paddle { +namespace framework { +class OperatorBase; +class Scope; +namespace ir { +class Node; +} // namespace ir +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace details { +struct VarHandleBase; + class ComputationOpHandle : public OpHandleBase { public: ComputationOpHandle(ir::Node *node, Scope *scope, platform::Place place, diff --git a/paddle/fluid/framework/details/eager_deletion_op_handle.h b/paddle/fluid/framework/details/eager_deletion_op_handle.h index a048799a2807554f27ac54c400dc1bf8ae113e85..8edce6782de4aa7caeb7f324a375f568ea296c42 100644 --- a/paddle/fluid/framework/details/eager_deletion_op_handle.h +++ b/paddle/fluid/framework/details/eager_deletion_op_handle.h @@ -19,12 +19,23 @@ #include #include #include + #include "paddle/fluid/framework/details/op_handle_base.h" #include "paddle/fluid/framework/ir/memory_optimize_pass/reference_count_pass_helper.h" +namespace paddle { +namespace platform { +class CUDADeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace framework { class Scope; +class GarbageCollector; +namespace ir { +class Node; +} // namespace ir namespace ir { class MemOptVarInfo; diff --git a/paddle/fluid/framework/details/exception_holder_test.cc b/paddle/fluid/framework/details/exception_holder_test.cc index c20563a08605086d6fd65506b5d0176bb8dce8bb..3db358667ebe9035b21babf8d9e873b7390dc3ea 100644 --- a/paddle/fluid/framework/details/exception_holder_test.cc +++ b/paddle/fluid/framework/details/exception_holder_test.cc @@ -13,8 +13,7 @@ // limitations under the License. #include "paddle/fluid/framework/details/exception_holder.h" -#include -#include + #include "gtest/gtest.h" #include "paddle/fluid/memory/allocation/allocator.h" diff --git a/paddle/fluid/framework/details/fetch_async_op_handle.cc b/paddle/fluid/framework/details/fetch_async_op_handle.cc index 6aae523365ed50e78a78b318ac0990490c801eb3..09aedafc6bb2e1cc0223a4bcb67b8814616da121 100644 --- a/paddle/fluid/framework/details/fetch_async_op_handle.cc +++ b/paddle/fluid/framework/details/fetch_async_op_handle.cc @@ -15,9 +15,14 @@ #include "paddle/fluid/framework/details/fetch_async_op_handle.h" #include #include -#include #include "paddle/fluid/platform/profiler.h" +namespace paddle { +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace framework { namespace details { diff --git a/paddle/fluid/framework/details/fetch_async_op_handle.h b/paddle/fluid/framework/details/fetch_async_op_handle.h index 691a3286c270badad938610811cc6e73d63c2c04..ff9271942daa2b45fa5836ae0b0c94d23e5ebfef 100644 --- a/paddle/fluid/framework/details/fetch_async_op_handle.h +++ b/paddle/fluid/framework/details/fetch_async_op_handle.h @@ -22,6 +22,18 @@ #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/platform/device_context.h" +namespace paddle { +namespace framework { +class LoDTensor; +namespace ir { +class Node; +} // namespace ir +} // namespace framework +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace framework { namespace details { diff --git a/paddle/fluid/framework/details/fetch_barrier_op_handle.cc b/paddle/fluid/framework/details/fetch_barrier_op_handle.cc index 127183a32e938de57ce4f7cb5aed4e72f8f09682..fc836ade786dda556421b7623a93c31b0b08228d 100644 --- a/paddle/fluid/framework/details/fetch_barrier_op_handle.cc +++ b/paddle/fluid/framework/details/fetch_barrier_op_handle.cc @@ -19,6 +19,8 @@ namespace paddle { namespace framework { namespace details { +struct VarHandleBase; + FetchBarrierOpHandle::FetchBarrierOpHandle( ir::Node *node, const std::vector &local_scopes, const std::vector &places) diff --git a/paddle/fluid/framework/details/fetch_barrier_op_handle.h b/paddle/fluid/framework/details/fetch_barrier_op_handle.h index d1f7e08b28e7d8291c11bd61588c978f591060c2..7ce790f38e8cbb7ebb110dc3a01d9c1e22e73cfe 100644 --- a/paddle/fluid/framework/details/fetch_barrier_op_handle.h +++ b/paddle/fluid/framework/details/fetch_barrier_op_handle.h @@ -24,6 +24,15 @@ #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/platform/device_context.h" +namespace paddle { +namespace framework { +class Scope; +namespace ir { +class Node; +} // namespace ir +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace details { @@ -32,6 +41,8 @@ namespace details { // all places if there are multiple places, must init with // multiple dev_ctxes_ !!!! +struct VarHandleBase; + struct FetchBarrierOpHandle : public OpHandleBase { public: FetchBarrierOpHandle(ir::Node *node, const std::vector &local_scopes, diff --git a/paddle/fluid/framework/details/fetch_op_handle.h b/paddle/fluid/framework/details/fetch_op_handle.h index 31ffd1211d205ff943f5e65b95bddcfa76bcd05a..41deeb0af27f904c5ea892a2a42e3ab3cc3b7216 100644 --- a/paddle/fluid/framework/details/fetch_op_handle.h +++ b/paddle/fluid/framework/details/fetch_op_handle.h @@ -22,6 +22,17 @@ #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/platform/device_context.h" +namespace paddle { +namespace framework { +namespace ir { +class Node; +} // namespace ir +} // namespace framework +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace framework { namespace details { diff --git a/paddle/fluid/framework/details/fused_all_reduce_op_handle.h b/paddle/fluid/framework/details/fused_all_reduce_op_handle.h index 16c13ac1c03e340786c95ac11019abd8c6ff0ef9..9bed792a42fc797d0af396dcaf0423c7e06eafe4 100644 --- a/paddle/fluid/framework/details/fused_all_reduce_op_handle.h +++ b/paddle/fluid/framework/details/fused_all_reduce_op_handle.h @@ -17,10 +17,22 @@ #include #include #include + #include "paddle/fluid/framework/details/all_reduce_op_handle.h" #include "paddle/fluid/framework/details/op_handle_base.h" #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/scope.h" + +namespace paddle { +namespace framework { +namespace ir { +class Node; +} // namespace ir +} // namespace framework +namespace platform { +class NCCLCommunicator; +} // namespace platform +} // namespace paddle #if defined(PADDLE_WITH_NCCL) #include "paddle/fluid/framework/details/nccl_op_handle.h" #include "paddle/fluid/platform/nccl_helper.h" diff --git a/paddle/fluid/framework/details/fused_broadcast_op_handle.h b/paddle/fluid/framework/details/fused_broadcast_op_handle.h index 8a59d2bfa9acd7b541d4049d2088b0162d7a6350..8fd3ec56d18b64fdd157fdcd820897f4a1f7fc2f 100644 --- a/paddle/fluid/framework/details/fused_broadcast_op_handle.h +++ b/paddle/fluid/framework/details/fused_broadcast_op_handle.h @@ -25,6 +25,17 @@ #include "paddle/fluid/framework/selected_rows.h" #include "paddle/fluid/platform/device_context.h" +namespace paddle { +namespace framework { +namespace ir { +class Node; +} // namespace ir +} // namespace framework +namespace platform { +struct NCCLContextMap; +} // namespace platform +} // namespace paddle + #if defined(PADDLE_WITH_NCCL) #include "paddle/fluid/platform/nccl_helper.h" #endif diff --git a/paddle/fluid/framework/details/fused_broadcast_op_handle_test.cc b/paddle/fluid/framework/details/fused_broadcast_op_handle_test.cc index cbded074f205f423ac20580047503b50af0f368d..761a5b5a30a0e04690a7dc94752179130c85320a 100644 --- a/paddle/fluid/framework/details/fused_broadcast_op_handle_test.cc +++ b/paddle/fluid/framework/details/fused_broadcast_op_handle_test.cc @@ -17,11 +17,20 @@ #include #include "gtest/gtest.h" #include "paddle/fluid/framework/details/broadcast_op_handle_test.h" +#include "paddle/fluid/framework/details/op_handle_base.h" + +namespace paddle { +namespace framework { +class Scope; +} // namespace framework +} // namespace paddle namespace paddle { namespace framework { namespace details { +struct VarHandle; + struct TestFusedBroadcastOpHandle : TestBroadcastOpHandle { std::vector out_varnames_; std::vector> nodes_; diff --git a/paddle/fluid/framework/details/gather_op_handle.h b/paddle/fluid/framework/details/gather_op_handle.h index ac87b246b50f8e0df1d0cc082087d4128a79384b..9cbd94cd6b877b5392e31499720e61a0491acbe8 100644 --- a/paddle/fluid/framework/details/gather_op_handle.h +++ b/paddle/fluid/framework/details/gather_op_handle.h @@ -24,6 +24,14 @@ #include "paddle/fluid/framework/selected_rows.h" #include "paddle/fluid/platform/device_context.h" +namespace paddle { +namespace framework { +namespace ir { +class Node; +} // namespace ir +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace details { diff --git a/paddle/fluid/framework/details/gather_op_handle_test.cc b/paddle/fluid/framework/details/gather_op_handle_test.cc index 5d8562e7046fd2f1609ba34ce2dd71b9fa28be77..f3fcc1a436df38986e1202755cd88f14069028a8 100644 --- a/paddle/fluid/framework/details/gather_op_handle_test.cc +++ b/paddle/fluid/framework/details/gather_op_handle_test.cc @@ -17,11 +17,11 @@ #include #include "gtest/gtest.h" -#include "paddle/fluid/platform/device_context.h" - namespace paddle { namespace framework { namespace details { +struct DummyVarHandle; + namespace f = paddle::framework; namespace p = paddle::platform; diff --git a/paddle/fluid/framework/details/multi_devices_helper.h b/paddle/fluid/framework/details/multi_devices_helper.h index 21e781877a42754d215e48becb4bc7a1e6e2f262..c3a18433cf89d6241ca735e003c797535cc3b26c 100644 --- a/paddle/fluid/framework/details/multi_devices_helper.h +++ b/paddle/fluid/framework/details/multi_devices_helper.h @@ -20,16 +20,21 @@ #include #include #include + #include "paddle/fluid/framework/details/op_handle_base.h" #include "paddle/fluid/framework/details/var_handle.h" - +#include "paddle/fluid/framework/ir/graph.h" +#include "paddle/fluid/framework/ir/pass.h" #include "paddle/fluid/framework/op_desc.h" #include "paddle/fluid/framework/op_proto_maker.h" #include "paddle/fluid/framework/program_desc.h" #include "paddle/fluid/platform/place.h" -#include "paddle/fluid/framework/ir/graph.h" -#include "paddle/fluid/framework/ir/pass.h" +namespace paddle { +namespace framework { +class OpDesc; +} // namespace framework +} // namespace paddle namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/details/nan_inf_utils_detail.h b/paddle/fluid/framework/details/nan_inf_utils_detail.h index 15d00932f1c448bf25d49469e0ca4d85ca6f1e1c..b4459e5a7c1cc6ad6faa9e19f39bff47fe128344 100644 --- a/paddle/fluid/framework/details/nan_inf_utils_detail.h +++ b/paddle/fluid/framework/details/nan_inf_utils_detail.h @@ -19,6 +19,12 @@ #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/platform/place.h" +namespace paddle { +namespace framework { +class Tensor; +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace details { diff --git a/paddle/fluid/framework/details/op_handle_base.h b/paddle/fluid/framework/details/op_handle_base.h index 097f54d5d5891390fdd479d3e6f62ae0e97cd0d4..eb3d9c32ffc1f45ab843a8d9f00b0918acd5e0f6 100644 --- a/paddle/fluid/framework/details/op_handle_base.h +++ b/paddle/fluid/framework/details/op_handle_base.h @@ -24,10 +24,22 @@ #include "paddle/fluid/platform/device_context.h" #include "paddle/fluid/platform/macros.h" +namespace paddle { +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace framework { class Scope; +namespace details { +struct VarHandleBase; +} // namespace details +namespace ir { +class Node; +} // namespace ir namespace details { diff --git a/paddle/fluid/framework/details/reduce_op_handle.h b/paddle/fluid/framework/details/reduce_op_handle.h index 8b92bdef4757729b911aee409092eee15b902bfd..e76a48d207d9b477cb024c039025b61a88829b76 100644 --- a/paddle/fluid/framework/details/reduce_op_handle.h +++ b/paddle/fluid/framework/details/reduce_op_handle.h @@ -24,6 +24,21 @@ #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/framework/selected_rows.h" #include "paddle/fluid/platform/device_context.h" + +namespace paddle { +namespace framework { +class SelectedRows; +namespace details { +struct VarHandle; +} // namespace details +namespace ir { +class Node; +} // namespace ir +} // namespace framework +namespace platform { +struct NCCLContextMap; +} // namespace platform +} // namespace paddle #if defined(PADDLE_WITH_NCCL) #include "paddle/fluid/platform/nccl_helper.h" #endif diff --git a/paddle/fluid/framework/details/rpc_op_handle.h b/paddle/fluid/framework/details/rpc_op_handle.h index d86d33dd676ca066b8772ac2afbab05cf0d98b38..909f565f2c048b96181bf4b7112ccf44e271ab2d 100644 --- a/paddle/fluid/framework/details/rpc_op_handle.h +++ b/paddle/fluid/framework/details/rpc_op_handle.h @@ -24,6 +24,16 @@ #include "paddle/fluid/framework/operator.h" #include "paddle/fluid/framework/scope.h" +namespace paddle { +namespace framework { +class OpDesc; +class Scope; +namespace ir { +class Node; +} // namespace ir +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace details { diff --git a/paddle/fluid/framework/details/scale_loss_grad_op_handle.cc b/paddle/fluid/framework/details/scale_loss_grad_op_handle.cc index 6e2f2327abd62b12d9368992674ce399d50dff35..287667d5ee97ef8779f649761f93e367b5511b29 100644 --- a/paddle/fluid/framework/details/scale_loss_grad_op_handle.cc +++ b/paddle/fluid/framework/details/scale_loss_grad_op_handle.cc @@ -13,9 +13,17 @@ // limitations under the License. #include "paddle/fluid/framework/details/scale_loss_grad_op_handle.h" + #include + #include "paddle/fluid/platform/profiler.h" +namespace paddle { +namespace framework { +class Tensor; +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace details { diff --git a/paddle/fluid/framework/details/scale_loss_grad_op_handle.h b/paddle/fluid/framework/details/scale_loss_grad_op_handle.h index d4f28dbe2b261be9c5d48aa50e38edfe36bfcfd3..02e5aa88443df1222520f50ebd44db9cc26d8e3f 100644 --- a/paddle/fluid/framework/details/scale_loss_grad_op_handle.h +++ b/paddle/fluid/framework/details/scale_loss_grad_op_handle.h @@ -21,6 +21,18 @@ #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/scope.h" +namespace paddle { +namespace framework { +class Scope; +namespace ir { +class Node; +} // namespace ir +} // namespace framework +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace framework { namespace details { diff --git a/paddle/fluid/framework/details/scope_buffered_monitor.h b/paddle/fluid/framework/details/scope_buffered_monitor.h index 1246c35af6aedab16c2370aa881e85be5a773ddc..3a94534eff4587f595f8ad83217ab93896a91132 100644 --- a/paddle/fluid/framework/details/scope_buffered_monitor.h +++ b/paddle/fluid/framework/details/scope_buffered_monitor.h @@ -17,7 +17,9 @@ #include #include #include + #include "paddle/fluid/framework/scope.h" + namespace paddle { namespace framework { namespace details { diff --git a/paddle/fluid/framework/details/share_tensor_buffer_functor.cc b/paddle/fluid/framework/details/share_tensor_buffer_functor.cc index 5fbaf3cbfe028638ad9219d9e1286480ae16ee6b..bf93d8f85b16cbe47373c1982c4eff2d678158c8 100644 --- a/paddle/fluid/framework/details/share_tensor_buffer_functor.cc +++ b/paddle/fluid/framework/details/share_tensor_buffer_functor.cc @@ -22,6 +22,17 @@ #include "paddle/fluid/framework/selected_rows.h" #include "paddle/fluid/platform/enforce.h" +namespace paddle { +namespace framework { +class Scope; +class Tensor; +class Variable; +namespace ir { +class MemOptVarInfo; +} // namespace ir +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace details { diff --git a/paddle/fluid/framework/details/share_tensor_buffer_functor.h b/paddle/fluid/framework/details/share_tensor_buffer_functor.h index be49d1c432b2ab2b9741d873ba005b400e9f0829..0db69d07bf63a27b15d7541f88376ca42c2d1817 100644 --- a/paddle/fluid/framework/details/share_tensor_buffer_functor.h +++ b/paddle/fluid/framework/details/share_tensor_buffer_functor.h @@ -25,6 +25,15 @@ #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/framework/variable.h" +namespace paddle { +namespace framework { +class Scope; +namespace ir { +class MemOptVarInfo; +} // namespace ir +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace details { diff --git a/paddle/fluid/framework/details/share_tensor_buffer_op_handle.cc b/paddle/fluid/framework/details/share_tensor_buffer_op_handle.cc index be3f5515a971900258ab5914b579deffe5d5b7d6..3d53bb62855e092195fdff63e4b4a84fa2bb7eb3 100644 --- a/paddle/fluid/framework/details/share_tensor_buffer_op_handle.cc +++ b/paddle/fluid/framework/details/share_tensor_buffer_op_handle.cc @@ -23,10 +23,20 @@ #include "paddle/fluid/framework/selected_rows.h" #include "paddle/fluid/platform/enforce.h" +namespace paddle { +namespace framework { +namespace ir { +class MemOptVarInfo; +} // namespace ir +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace details { +class ComputationOpHandle; + ComputationOpHandle *GetUniquePendingComputationOpHandle( ShareTensorBufferOpHandle *share_tensor_op) { ComputationOpHandle *result_op = nullptr; diff --git a/paddle/fluid/framework/details/share_tensor_buffer_op_handle.h b/paddle/fluid/framework/details/share_tensor_buffer_op_handle.h index a02c346485eca813f0d0f0b432b8b647e2fe4414..d14cbc31d827906804959cb25a2208d6d3c338cd 100644 --- a/paddle/fluid/framework/details/share_tensor_buffer_op_handle.h +++ b/paddle/fluid/framework/details/share_tensor_buffer_op_handle.h @@ -22,10 +22,22 @@ #include "paddle/fluid/framework/details/op_handle_base.h" #include "paddle/fluid/framework/details/share_tensor_buffer_functor.h" +namespace paddle { +namespace framework { +class Scope; +namespace ir { +class MemOptVarInfo; +class Node; +} // namespace ir +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace details { +class ComputationOpHandle; + class ShareTensorBufferOpHandle : public OpHandleBase { public: ShareTensorBufferOpHandle( diff --git a/paddle/fluid/framework/details/sparse_all_reduce_op_handle.h b/paddle/fluid/framework/details/sparse_all_reduce_op_handle.h index b24b457d21d8b7a17d8e2ae615791090f3859a97..8bfea0f1ae8b8a63f5a220382f74b2a8e116f5ef 100644 --- a/paddle/fluid/framework/details/sparse_all_reduce_op_handle.h +++ b/paddle/fluid/framework/details/sparse_all_reduce_op_handle.h @@ -23,6 +23,17 @@ #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/platform/nccl_helper.h" +namespace paddle { +namespace framework { +namespace ir { +class Node; +} // namespace ir +} // namespace framework +namespace platform { +class NCCLCommunicator; +} // namespace platform +} // namespace paddle + namespace paddle { namespace framework { namespace details { diff --git a/paddle/fluid/framework/details/var_handle.h b/paddle/fluid/framework/details/var_handle.h index bb38424d3ae2d74f6f0a48e11df95b60dbf432f3..a35ac0bd732fd28faea862a860f82b6fe46cac67 100644 --- a/paddle/fluid/framework/details/var_handle.h +++ b/paddle/fluid/framework/details/var_handle.h @@ -24,6 +24,14 @@ #include "paddle/fluid/platform/macros.h" #include "paddle/fluid/platform/place.h" +namespace paddle { +namespace framework { +namespace ir { +class Node; +} // namespace ir +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace details { diff --git a/paddle/fluid/framework/details/variable_visitor.cc b/paddle/fluid/framework/details/variable_visitor.cc index fba0c1bf463ee0b9a434c350474af4be0c589e30..71e5dd28eded1c48ef49414df0a89fb072f0375c 100644 --- a/paddle/fluid/framework/details/variable_visitor.cc +++ b/paddle/fluid/framework/details/variable_visitor.cc @@ -15,6 +15,14 @@ #include "paddle/fluid/framework/details/variable_visitor.h" #include "paddle/fluid/framework/selected_rows.h" + +namespace paddle { +namespace framework { +class LoDTensor; +class Variable; +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace details { diff --git a/paddle/fluid/framework/details/variable_visitor.h b/paddle/fluid/framework/details/variable_visitor.h index ca9a19bdcf1be7bf0e1d2b0de560a38f528a2d2c..a882d5120bc66849dbdd5fc179b1aa530436808e 100644 --- a/paddle/fluid/framework/details/variable_visitor.h +++ b/paddle/fluid/framework/details/variable_visitor.h @@ -17,6 +17,13 @@ #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/variable.h" +namespace paddle { +namespace framework { +class Tensor; +class Variable; +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace details { diff --git a/paddle/fluid/framework/device_worker.cc b/paddle/fluid/framework/device_worker.cc index aeec6161714028352da3628027864e8660dad774..fbaae5a21c274780e79c6d7ac629b1874b6ae53f 100644 --- a/paddle/fluid/framework/device_worker.cc +++ b/paddle/fluid/framework/device_worker.cc @@ -13,11 +13,13 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/device_worker.h" -#include "xxhash.h" // NOLINT namespace paddle { namespace framework { +class LoDTensor; +class Scope; + void DeviceWorker::SetRootScope(Scope* root_scope) { root_scope_ = root_scope; } void DeviceWorker::SetDataFeed(DataFeed* data_feed) { diff --git a/paddle/fluid/framework/device_worker.h b/paddle/fluid/framework/device_worker.h index efe6fa1b2daffcbbaa2b7945e7139ac83f689bcd..ee2ef9a0c3d3595a26c248e63a9e19af784f8bf7 100644 --- a/paddle/fluid/framework/device_worker.h +++ b/paddle/fluid/framework/device_worker.h @@ -39,6 +39,18 @@ limitations under the License. */ #include "paddle/fluid/platform/port.h" #include "paddle/fluid/platform/timer.h" +namespace paddle { +namespace framework { +class LoDTensor; +class ProgramDesc; +class Scope; +class Tensor; +} // namespace framework +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle + #if defined(PADDLE_WITH_NCCL) #include "paddle/fluid/platform/nccl_helper.h" #endif diff --git a/paddle/fluid/framework/device_worker_factory.cc b/paddle/fluid/framework/device_worker_factory.cc index 67be8db6e80329de4323e4cb8f904a24753f56bc..3b60cb65e34b4f4728ce7fae11b77364f284935f 100644 --- a/paddle/fluid/framework/device_worker_factory.cc +++ b/paddle/fluid/framework/device_worker_factory.cc @@ -20,6 +20,8 @@ limitations under the License. */ namespace paddle { namespace framework { +class DeviceWorker; + typedef std::shared_ptr (*Createdevice_workerFunction)(); typedef std::unordered_map device_workerMap; diff --git a/paddle/fluid/framework/device_worker_factory.h b/paddle/fluid/framework/device_worker_factory.h index 9d0613385e78c9f482840677c71f621e53ed85b5..6a31c3ea7a414fb88eb1b5abb57911617f800acd 100644 --- a/paddle/fluid/framework/device_worker_factory.h +++ b/paddle/fluid/framework/device_worker_factory.h @@ -16,11 +16,14 @@ limitations under the License. */ #include #include + #include "paddle/fluid/framework/device_worker.h" namespace paddle { namespace framework { +class DeviceWorker; + class DeviceWorkerFactory { public: static std::string DeviceWorkerTypeList(); diff --git a/paddle/fluid/framework/device_worker_test.cc b/paddle/fluid/framework/device_worker_test.cc index b488e4cfe7a013375a55b19e854bde0f5024df21..461d329a371bfae700c238a009ec0821ed3a7297 100644 --- a/paddle/fluid/framework/device_worker_test.cc +++ b/paddle/fluid/framework/device_worker_test.cc @@ -13,9 +13,10 @@ // limitations under the License. #include "paddle/fluid/framework/device_worker.h" + #include + #include "paddle/fluid/framework/lod_tensor.h" -#include "paddle/fluid/framework/trainer.h" namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/dlpack_tensor.cc b/paddle/fluid/framework/dlpack_tensor.cc index 915589b3242b7d5675e630aca7310185fd109ec2..ac1e39ad2c1af6894d6bbaec563c487a6857f95a 100644 --- a/paddle/fluid/framework/dlpack_tensor.cc +++ b/paddle/fluid/framework/dlpack_tensor.cc @@ -11,10 +11,17 @@ // 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 "paddle/fluid/framework/dlpack_tensor.h" #include - #include "paddle/fluid/framework/data_type.h" -#include "paddle/fluid/framework/dlpack_tensor.h" + +namespace paddle { +namespace platform { +struct bfloat16; +struct float16; +} // namespace platform +} // namespace paddle + namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/dlpack_tensor.h b/paddle/fluid/framework/dlpack_tensor.h index 5346ba62894308ea8910739d565f2e3f0fa8c8c0..e342523718b34b3e32e54d0ffd14128a43df34f7 100644 --- a/paddle/fluid/framework/dlpack_tensor.h +++ b/paddle/fluid/framework/dlpack_tensor.h @@ -15,11 +15,14 @@ #pragma once #include + #include "paddle/fluid/framework/tensor.h" namespace paddle { namespace framework { +class Tensor; + class DLPackTensor { public: using LaneType = decltype(::DLTensor::dtype.lanes); // uint16_t diff --git a/paddle/fluid/framework/dlpack_tensor_test.cc b/paddle/fluid/framework/dlpack_tensor_test.cc index 4dead063b477980ace5dabfead1447cb297bbdd2..4a1f151f69b2d46f55d2bcf8a701e2ecc156b3df 100644 --- a/paddle/fluid/framework/dlpack_tensor_test.cc +++ b/paddle/fluid/framework/dlpack_tensor_test.cc @@ -17,6 +17,12 @@ #include #include +namespace paddle { +namespace platform { +struct float16; +} // namespace platform +} // namespace paddle + namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/downpour_worker.cc b/paddle/fluid/framework/downpour_worker.cc index 1c64bf1d3f7f31f42308395b5b054f62fd97b429..00f721701a4a55980c8df3079d88cbeeba116f49 100644 --- a/paddle/fluid/framework/downpour_worker.cc +++ b/paddle/fluid/framework/downpour_worker.cc @@ -13,10 +13,14 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/device_worker.h" -#include "paddle/fluid/framework/device_worker_factory.h" -#include "paddle/fluid/framework/fleet/fleet_wrapper.h" #include "paddle/fluid/platform/cpu_helper.h" -#include "paddle/fluid/string/string_helper.h" + +namespace paddle { +namespace framework { +class LoDTensor; +class Variable; +} // namespace framework +} // namespace paddle #if defined _WIN32 || defined __APPLE__ #else diff --git a/paddle/fluid/framework/downpour_worker_opt.cc b/paddle/fluid/framework/downpour_worker_opt.cc index b40a00ef9cb8cf3f51fdca4d71a905ac912db51f..afe6ddfa3d9a6361cbbb63047114c01bbe819b8c 100644 --- a/paddle/fluid/framework/downpour_worker_opt.cc +++ b/paddle/fluid/framework/downpour_worker_opt.cc @@ -12,18 +12,16 @@ 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 "paddle/fluid/framework/data_type.h" #include "paddle/fluid/framework/device_worker.h" -#include "paddle/fluid/framework/device_worker_factory.h" -#include "paddle/fluid/framework/fleet/fleet_wrapper.h" #include "paddle/fluid/platform/cpu_helper.h" -#include "paddle/fluid/platform/lodtensor_printer.h" namespace paddle { namespace framework { +class OpDesc; +class OperatorBase; +class ProgramDesc; + bool HasDependentOutput(const OpDesc& op_desc, const std::unordered_set& dependent_vars) { for (auto& var : op_desc.Outputs()) { diff --git a/paddle/fluid/framework/eigen.h b/paddle/fluid/framework/eigen.h index 0e3edfb95cb9b37543ce84ba9a22227d2761734a..a6abda8a83bc8484ccc9017d32bc04b7df32e90c 100644 --- a/paddle/fluid/framework/eigen.h +++ b/paddle/fluid/framework/eigen.h @@ -14,6 +14,8 @@ limitations under the License. */ #pragma once +#include + #include "paddle/fluid/framework/tensor.h" #include "unsupported/Eigen/CXX11/Tensor" diff --git a/paddle/fluid/framework/executor.h b/paddle/fluid/framework/executor.h index fa6a65d5892f0098a95d1e30b11501bc1043b14f..7593b60abfffcd9a0a3e9f743930660327c1409e 100644 --- a/paddle/fluid/framework/executor.h +++ b/paddle/fluid/framework/executor.h @@ -19,6 +19,7 @@ limitations under the License. */ #include #include #include + #include "paddle/fluid/framework/data_set.h" #include "paddle/fluid/framework/executor_gc_helper.h" #include "paddle/fluid/framework/garbage_collector.h" @@ -32,6 +33,11 @@ limitations under the License. */ namespace paddle { namespace framework { +class Dataset; +class ProgramDesc; +class Scope; +class TrainerBase; + struct ExecutorPrepareContext { ExecutorPrepareContext(const framework::ProgramDesc& prog, size_t block_id); diff --git a/paddle/fluid/framework/executor_gc_helper.cc b/paddle/fluid/framework/executor_gc_helper.cc index 706248229bc27e553fbc136116ab616f371eed5e..c80eedb1b86f771d1c6bf97442733e90bae374e0 100644 --- a/paddle/fluid/framework/executor_gc_helper.cc +++ b/paddle/fluid/framework/executor_gc_helper.cc @@ -13,16 +13,19 @@ // limitations under the License. #include "paddle/fluid/framework/executor_gc_helper.h" + #include #include -#include #include #include -#include + #include "glog/logging.h" -#include "paddle/fluid/framework/lod_tensor.h" -#include "paddle/fluid/framework/lod_tensor_array.h" -#include "paddle/fluid/framework/selected_rows.h" +#include "paddle/fluid/framework/block_desc.h" +#include "paddle/fluid/framework/framework.pb.h" +#include "paddle/fluid/framework/no_need_buffer_vars_inference.h" +#include "paddle/fluid/framework/op_info.h" +#include "paddle/fluid/framework/operator.h" +#include "paddle/fluid/framework/var_desc.h" #include "paddle/fluid/platform/enforce.h" namespace paddle { diff --git a/paddle/fluid/framework/executor_gc_helper.h b/paddle/fluid/framework/executor_gc_helper.h index a4c71c5304e05e3d0dca6ca08d955f39b779556b..e44edc5aa1c810f859942a62763e0c9179885987 100644 --- a/paddle/fluid/framework/executor_gc_helper.h +++ b/paddle/fluid/framework/executor_gc_helper.h @@ -18,6 +18,7 @@ #include #include #include + #include "paddle/fluid/framework/garbage_collector.h" #include "paddle/fluid/framework/operator.h" #include "paddle/fluid/framework/scope.h" @@ -26,6 +27,10 @@ namespace paddle { namespace framework { // Result map: op -> variable names that can be deleted after op runs +class GarbageCollector; +class OperatorBase; +class Scope; + std::unordered_map> GetUnusedVars(const BlockDesc &block, const std::vector> &ops, diff --git a/paddle/fluid/framework/feed_fetch_method.cc b/paddle/fluid/framework/feed_fetch_method.cc index fd857f7735c1db2b5b3678517e5301d4ab8700ef..3bd85b2b24b97b22132c9dae792361dc7b9ad734 100644 --- a/paddle/fluid/framework/feed_fetch_method.cc +++ b/paddle/fluid/framework/feed_fetch_method.cc @@ -13,16 +13,17 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/feed_fetch_method.h" + #include -#include + #include "glog/logging.h" -#include "paddle/fluid/framework/var_type.h" -#include "paddle/fluid/framework/variable.h" -#include "paddle/fluid/platform/place.h" namespace paddle { namespace framework { +class LoDTensor; +class Variable; + void SetFeedVariable(Scope* scope, const LoDTensor& input, const std::string& var_name, size_t index) { // If var_name Variable is not found in GlobalScope, a new variable will diff --git a/paddle/fluid/framework/feed_fetch_method.h b/paddle/fluid/framework/feed_fetch_method.h index 65c8b255ffb2fbe8a054dd871bccd665d284968d..a52ef517c8b7342522aeb7d699a19d22619d3d0b 100644 --- a/paddle/fluid/framework/feed_fetch_method.h +++ b/paddle/fluid/framework/feed_fetch_method.h @@ -15,12 +15,16 @@ limitations under the License. */ #pragma once #include + #include "paddle/fluid/framework/feed_fetch_type.h" #include "paddle/fluid/framework/scope.h" namespace paddle { namespace framework { +class LoDTensor; +class Scope; + void SetFeedVariable(Scope* scope, const LoDTensor& input, const std::string& var_name, size_t index); diff --git a/paddle/fluid/framework/fleet/fleet_wrapper.cc b/paddle/fluid/framework/fleet/fleet_wrapper.cc index 34fff042770c5f50a280408d8f7f925488b3879c..3c076805932d6489676bb9290468821c96931c3c 100644 --- a/paddle/fluid/framework/fleet/fleet_wrapper.cc +++ b/paddle/fluid/framework/fleet/fleet_wrapper.cc @@ -29,12 +29,6 @@ limitations under the License. */ #include "paddle/fluid/framework/fleet/fleet_wrapper.h" #include #include -#include "paddle/fluid/framework/channel.h" -#include "paddle/fluid/framework/data_feed.h" -#include "paddle/fluid/framework/io/fs.h" -#include "paddle/fluid/framework/op_registry.h" -#include "paddle/fluid/framework/scope.h" -#include "paddle/fluid/platform/timer.h" namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/fleet/fleet_wrapper.h b/paddle/fluid/framework/fleet/fleet_wrapper.h index cc13a50160a94c63345bcbd5633f2d3f8555ae0c..be87bdf1e755c63e55ba59d702f43f4aeba42130 100644 --- a/paddle/fluid/framework/fleet/fleet_wrapper.h +++ b/paddle/fluid/framework/fleet/fleet_wrapper.h @@ -35,6 +35,12 @@ limitations under the License. */ #include "paddle/fluid/framework/variable_helper.h" #include "paddle/fluid/platform/macros.h" // for DISABLE_COPY_AND_ASSIGN +namespace paddle { +namespace framework { +class Scope; +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/fleet/gloo_wrapper.cc b/paddle/fluid/framework/fleet/gloo_wrapper.cc index f195dde40843c8c4ee5168d11ad0b8eac8199f4e..f4b2d2d7d1881d2ad5e9ca50156923e27ce55316 100644 --- a/paddle/fluid/framework/fleet/gloo_wrapper.cc +++ b/paddle/fluid/framework/fleet/gloo_wrapper.cc @@ -10,10 +10,7 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/fleet/gloo_wrapper.h" -#include // NOLINT -#include #include "paddle/fluid/framework/io/fs.h" -#include "paddle/fluid/platform/errors.h" #include "paddle/fluid/string/string_helper.h" namespace gloo { diff --git a/paddle/fluid/framework/fleet/heter_wrapper.cc b/paddle/fluid/framework/fleet/heter_wrapper.cc index b70d5e5fc1ae6c90dac4ebf1d86353e38a79492d..7a27b6a9d7a7b82e84438d101774591dd2e732af 100644 --- a/paddle/fluid/framework/fleet/heter_wrapper.cc +++ b/paddle/fluid/framework/fleet/heter_wrapper.cc @@ -27,15 +27,6 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/fleet/heter_wrapper.h" -#include -#include -#include "paddle/fluid/framework/channel.h" -#include "paddle/fluid/framework/data_feed.h" -#include "paddle/fluid/framework/device_worker.h" -#include "paddle/fluid/framework/io/fs.h" -#include "paddle/fluid/framework/op_registry.h" -#include "paddle/fluid/framework/scope.h" -#include "paddle/fluid/platform/timer.h" #ifdef PADDLE_WITH_PSLIB namespace paddle { @@ -122,14 +113,15 @@ void HeterWrapper::SerializeToReq(const std::string& varname, Scope* scope, if (platform::is_cpu_place(tensor->place())) { memcpy(data_ptr, tensor->data(), tensor->numel() * SizeOfType(tensor->type())); - } #ifdef PADDLE_WITH_CUDA - else { + } else { memory::Copy(platform::CPUPlace(), data_ptr, BOOST_GET_CONST(platform::CUDAPlace, tensor->place()), tensor->data(), tensor->numel() * SizeOfType(tensor->type()), nullptr); } +#else + } #endif } @@ -239,7 +231,7 @@ void HeterWrapper::CallRemoteXpu(std::shared_ptr task, request.set_cur_batch(task->cur_batch_); OnHeterRpcDone* done = new OnHeterRpcDone([this, task, worker](void* done) { - auto* closure = (OnHeterRpcDone*)done; + auto* closure = reinterpret_cast(done); if (closure->cntl.Failed()) { VLOG(0) << "call xpu fail: " << closure->cntl.ErrorText(); } else { diff --git a/paddle/fluid/framework/fleet/nccl_wrapper.cc b/paddle/fluid/framework/fleet/nccl_wrapper.cc index 33a91388fd8cc97d181df46ab826d384860d38f5..ed92e2e9aadb36b026334c1074bdd60d11beeb1b 100644 --- a/paddle/fluid/framework/fleet/nccl_wrapper.cc +++ b/paddle/fluid/framework/fleet/nccl_wrapper.cc @@ -13,9 +13,6 @@ // limitations under the License. #include "paddle/fluid/framework/fleet/nccl_wrapper.h" -#include -#include "paddle/fluid/framework/data_feed.h" -#include "paddle/fluid/framework/scope.h" namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/fleet/nccl_wrapper.h b/paddle/fluid/framework/fleet/nccl_wrapper.h index a55921f1ac2a1204965433cac12ba2ca2e19367e..3725a225dbecfec0b6c6b934b259d895eb09c9cb 100644 --- a/paddle/fluid/framework/fleet/nccl_wrapper.h +++ b/paddle/fluid/framework/fleet/nccl_wrapper.h @@ -21,6 +21,7 @@ limitations under the License. */ #include #include #include + #include "paddle/fluid/framework/program_desc.h" #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/framework/variable_helper.h" @@ -29,6 +30,12 @@ limitations under the License. */ #endif #include "paddle/fluid/platform/macros.h" // for DISABLE_COPY_AND_ASSIGN +namespace paddle { +namespace framework { +class Scope; +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/garbage_collector.h b/paddle/fluid/framework/garbage_collector.h index 4f7739652822b9047b1798b6bd66261effbe2f49..884d230816b2ecae61c332f024fa8a4c9b0f2070 100644 --- a/paddle/fluid/framework/garbage_collector.h +++ b/paddle/fluid/framework/garbage_collector.h @@ -19,9 +19,16 @@ #include #include // NOLINT #include + #include "gflags/gflags.h" #include "paddle/fluid/platform/device_context.h" +namespace paddle { +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/generator.h b/paddle/fluid/framework/generator.h index a279c2e4e1458293b6579b7b7cb2111e440e5d5e..862e63c4c6af5a503a0fe04a8966d543ef23e55e 100644 --- a/paddle/fluid/framework/generator.h +++ b/paddle/fluid/framework/generator.h @@ -16,7 +16,6 @@ limitations under the License. */ #include #include - #include #include #include // temp for debug diff --git a/paddle/fluid/framework/hetercpu_worker.cc b/paddle/fluid/framework/hetercpu_worker.cc index 83838f4df67d0bcbd9fb8ec8fb6762641287d2c4..747fd434ae7833b999918a0a52928df6b28891e4 100644 --- a/paddle/fluid/framework/hetercpu_worker.cc +++ b/paddle/fluid/framework/hetercpu_worker.cc @@ -12,13 +12,6 @@ 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 "paddle/fluid/framework/device_worker.h" -#include "paddle/fluid/framework/device_worker_factory.h" -#include "paddle/fluid/framework/fleet/fleet_wrapper.h" -#include "paddle/fluid/framework/fleet/heter_wrapper.h" -#include "paddle/fluid/platform/cpu_helper.h" -#include "paddle/fluid/string/string_helper.h" - #ifdef PADDLE_WITH_PSLIB #if defined _WIN32 || defined __APPLE__ diff --git a/paddle/fluid/framework/heterxpu_trainer.cc b/paddle/fluid/framework/heterxpu_trainer.cc index 5ca1aa66319228fc95f63294b15c981dd3c8ba30..fbed74800b4ccd10d67f3d6d8212eca73a566629 100644 --- a/paddle/fluid/framework/heterxpu_trainer.cc +++ b/paddle/fluid/framework/heterxpu_trainer.cc @@ -12,16 +12,6 @@ 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 "io/fs.h" -#include "paddle/fluid/framework/data_feed_factory.h" -#include "paddle/fluid/framework/data_set.h" -#include "paddle/fluid/framework/device_worker_factory.h" -#include "paddle/fluid/framework/fleet/fleet_wrapper.h" -#include "paddle/fluid/framework/trainer.h" #if (defined PADDLE_WITH_CUDA) && (defined PADDLE_WITH_PSLIB) #include "paddle/fluid/platform/cuda_device_guard.h" @@ -334,7 +324,7 @@ int HeterXpuTrainer::RunTask(const HeterRequest* request, std::shared_ptr context = object_pool_.Get(); if (!context->scope_) { - int num = rand() % places_.size(); + int num = rand_r() % places_.size(); context->place_num_ = num; auto place = places_[num]; context->scope_ = &(place_scopes_[num]->NewScope()); diff --git a/paddle/fluid/framework/inlined_vector.h b/paddle/fluid/framework/inlined_vector.h index 2a7f26b9f9661ecc79112307bac2780e357a55b4..f8e937fa107bc6f4d7c10ec8fe59283f85796879 100644 --- a/paddle/fluid/framework/inlined_vector.h +++ b/paddle/fluid/framework/inlined_vector.h @@ -15,6 +15,7 @@ #pragma once #include #include + #include "paddle/fluid/platform/enforce.h" namespace paddle { diff --git a/paddle/fluid/framework/inlined_vector_test.cc b/paddle/fluid/framework/inlined_vector_test.cc index 003c0d7bbeac2b3d8ed62766fee09912c7a07bb2..581e7d8934ddec4b64d706d33448300f81ddbc91 100644 --- a/paddle/fluid/framework/inlined_vector_test.cc +++ b/paddle/fluid/framework/inlined_vector_test.cc @@ -13,10 +13,10 @@ // limitations under the License. #include "paddle/fluid/framework/inlined_vector.h" + #include #include -#include -#include + #include "gtest/gtest.h" namespace paddle { diff --git a/paddle/fluid/framework/io/crypto/cipher_utils.cc b/paddle/fluid/framework/io/crypto/cipher_utils.cc index e0c653e001628b17adcb09f9d70cfb183e09860e..ee9f06b2f3eb10d22a2f50c80827f0f80259bb35 100644 --- a/paddle/fluid/framework/io/crypto/cipher_utils.cc +++ b/paddle/fluid/framework/io/crypto/cipher_utils.cc @@ -15,8 +15,6 @@ #include "paddle/fluid/framework/io/crypto/cipher_utils.h" #include - -#include #include #include "paddle/fluid/platform/enforce.h" diff --git a/paddle/fluid/framework/io/crypto/cipher_utils.h b/paddle/fluid/framework/io/crypto/cipher_utils.h index 936f62f6ba65cfe26be56ed2dd828f1e42e8d1b2..52db03f530c34e58b963f48aa93c757fac534185 100644 --- a/paddle/fluid/framework/io/crypto/cipher_utils.h +++ b/paddle/fluid/framework/io/crypto/cipher_utils.h @@ -17,6 +17,7 @@ #include #include #include + namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/io/fs.h b/paddle/fluid/framework/io/fs.h index c88636e267422c27696341df145346e33018cdaf..bb6d720ca584c16aa5898cb72483e9ed83e77fcc 100644 --- a/paddle/fluid/framework/io/fs.h +++ b/paddle/fluid/framework/io/fs.h @@ -18,6 +18,7 @@ #include #include #include + #include "glog/logging.h" #include "paddle/fluid/framework/io/shell.h" #include "paddle/fluid/string/string_helper.h" diff --git a/paddle/fluid/framework/io/shell.h b/paddle/fluid/framework/io/shell.h index dc486275d6f58eaa7a360b8f17830acd664b11c7..7db5cd7661cd7670f90fc0d788eda6f98b46cf37 100644 --- a/paddle/fluid/framework/io/shell.h +++ b/paddle/fluid/framework/io/shell.h @@ -32,6 +32,7 @@ #include #include #include + #include "paddle/fluid/platform/port.h" #include "paddle/fluid/string/string_helper.h" diff --git a/paddle/fluid/framework/ir/attention_lstm_fuse_pass.h b/paddle/fluid/framework/ir/attention_lstm_fuse_pass.h index 47ed9f0393fb222e612ed3bce1afbc879edb410d..48e3989a5314c613209718a313b076f4ce208ebc 100644 --- a/paddle/fluid/framework/ir/attention_lstm_fuse_pass.h +++ b/paddle/fluid/framework/ir/attention_lstm_fuse_pass.h @@ -20,6 +20,8 @@ namespace paddle { namespace framework { namespace ir { +class Graph; + class AttentionLSTMFusePass : public FusePassBase { protected: void ApplyImpl(ir::Graph* graph) const override; diff --git a/paddle/fluid/framework/ir/conv_affine_channel_fuse_pass.cc b/paddle/fluid/framework/ir/conv_affine_channel_fuse_pass.cc index fd8b55a6b7deb9bf4685b27f8849a49ab77f64e9..9c984a23e377d749947a61793838956079a3678b 100644 --- a/paddle/fluid/framework/ir/conv_affine_channel_fuse_pass.cc +++ b/paddle/fluid/framework/ir/conv_affine_channel_fuse_pass.cc @@ -13,19 +13,28 @@ // limitations under the License. #include "paddle/fluid/framework/ir/conv_affine_channel_fuse_pass.h" + #include -#include -#include #include + #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/op_version_registry.h" #include "paddle/fluid/operators/math/cpu_vec.h" #include "paddle/fluid/platform/enforce.h" +namespace paddle { +namespace framework { +class LoDTensor; +class Scope; +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace ir { +class Node; + #define GET_CONV_BN_NODES(pattern_name) \ /* OPERATORS */ \ GET_IR_NODE_FROM_SUBGRAPH(conv, conv, pattern_name); \ diff --git a/paddle/fluid/framework/ir/conv_affine_channel_fuse_pass.h b/paddle/fluid/framework/ir/conv_affine_channel_fuse_pass.h index d607020a47b8c589775ac763f04e64272dfec4e0..916384ec44704537f472c8b99bc5766489bd1ced 100644 --- a/paddle/fluid/framework/ir/conv_affine_channel_fuse_pass.h +++ b/paddle/fluid/framework/ir/conv_affine_channel_fuse_pass.h @@ -15,6 +15,7 @@ #pragma once #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" @@ -26,6 +27,8 @@ namespace ir { /* * Fuse the Conv and ConvAffineChannel. */ +class Graph; + class ConvAffineChannelFusePass : public FusePassBase { public: virtual ~ConvAffineChannelFusePass() {} diff --git a/paddle/fluid/framework/ir/conv_bn_fuse_pass.cc b/paddle/fluid/framework/ir/conv_bn_fuse_pass.cc index fb787e08814429781bf64efda2f1eb915f185f63..a915015bf55bd8a93fcc8311abc871e11cb9402d 100644 --- a/paddle/fluid/framework/ir/conv_bn_fuse_pass.cc +++ b/paddle/fluid/framework/ir/conv_bn_fuse_pass.cc @@ -13,15 +13,22 @@ // limitations under the License. #include "paddle/fluid/framework/ir/conv_bn_fuse_pass.h" -#include -#include + #include #include + #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/op_version_registry.h" #include "paddle/fluid/operators/math/cpu_vec.h" #include "paddle/fluid/platform/enforce.h" +namespace paddle { +namespace framework { +class LoDTensor; +class Scope; +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace ir { diff --git a/paddle/fluid/framework/ir/conv_bn_fuse_pass.h b/paddle/fluid/framework/ir/conv_bn_fuse_pass.h index 57a9f69ca15af2759874a1e2a0b58399de652693..342cd8dad5fb959a11df6c50fda4f22bb73ec5ba 100644 --- a/paddle/fluid/framework/ir/conv_bn_fuse_pass.h +++ b/paddle/fluid/framework/ir/conv_bn_fuse_pass.h @@ -15,6 +15,7 @@ #pragma once #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" @@ -26,6 +27,8 @@ namespace ir { /* * Fuse the Conv and BatchNorm to a ConvBNMKLDNNOp. */ +class Graph; + class ConvBNFusePass : public FusePassBase { public: virtual ~ConvBNFusePass() {} diff --git a/paddle/fluid/framework/ir/conv_elementwise_add2_act_fuse_pass.h b/paddle/fluid/framework/ir/conv_elementwise_add2_act_fuse_pass.h index ea9e465d8d765a298215db29c77aa58e727fd15e..e68f57d4ae998203c6f34aee7cca11d69a5e6d3f 100644 --- a/paddle/fluid/framework/ir/conv_elementwise_add2_act_fuse_pass.h +++ b/paddle/fluid/framework/ir/conv_elementwise_add2_act_fuse_pass.h @@ -20,6 +20,8 @@ namespace paddle { namespace framework { namespace ir { +class Graph; + class ConvElementwiseAdd2ActFusePass : public FusePassBase { public: virtual ~ConvElementwiseAdd2ActFusePass() {} diff --git a/paddle/fluid/framework/ir/conv_elementwise_add_act_fuse_pass.cc b/paddle/fluid/framework/ir/conv_elementwise_add_act_fuse_pass.cc index c5fa47ec55fe9a15caca493a4b0c72c22f2cf5c7..93e6e13ff7092c80958d5defb11e2e456298c7b7 100644 --- a/paddle/fluid/framework/ir/conv_elementwise_add_act_fuse_pass.cc +++ b/paddle/fluid/framework/ir/conv_elementwise_add_act_fuse_pass.cc @@ -14,6 +14,7 @@ #include "paddle/fluid/framework/ir/conv_elementwise_add_act_fuse_pass.h" #include + #include "paddle/fluid/framework/ir/graph_viz_pass.h" #include "paddle/fluid/framework/op_version_registry.h" diff --git a/paddle/fluid/framework/ir/conv_elementwise_add_act_fuse_pass.h b/paddle/fluid/framework/ir/conv_elementwise_add_act_fuse_pass.h index 8b34c3551d8f9b54f01e52cc0fc896901cd7df99..933092c7db7d38d722af9392e71cd0c1797f0eee 100644 --- a/paddle/fluid/framework/ir/conv_elementwise_add_act_fuse_pass.h +++ b/paddle/fluid/framework/ir/conv_elementwise_add_act_fuse_pass.h @@ -20,6 +20,8 @@ namespace paddle { namespace framework { namespace ir { +class Graph; + class ConvElementwiseAddActFusePass : public FusePassBase { public: virtual ~ConvElementwiseAddActFusePass() {} diff --git a/paddle/fluid/framework/ir/conv_elementwise_add_fuse_pass.cc b/paddle/fluid/framework/ir/conv_elementwise_add_fuse_pass.cc index 38c0b773ddeddddea68ecefd6c8525449c52d7a6..e4396f227f7f5280cfd3057aebfed8d02480d154 100644 --- a/paddle/fluid/framework/ir/conv_elementwise_add_fuse_pass.cc +++ b/paddle/fluid/framework/ir/conv_elementwise_add_fuse_pass.cc @@ -14,6 +14,7 @@ #include "paddle/fluid/framework/ir/conv_elementwise_add_fuse_pass.h" #include + #include "paddle/fluid/framework/ir/graph_viz_pass.h" #include "paddle/fluid/framework/op_version_registry.h" diff --git a/paddle/fluid/framework/ir/conv_elementwise_add_fuse_pass.h b/paddle/fluid/framework/ir/conv_elementwise_add_fuse_pass.h index 66a562cdd1948980a6792a53713cac947d72e7d6..7198a7488e052b5bdbe52d662b903d9f90c51da0 100644 --- a/paddle/fluid/framework/ir/conv_elementwise_add_fuse_pass.h +++ b/paddle/fluid/framework/ir/conv_elementwise_add_fuse_pass.h @@ -20,6 +20,8 @@ namespace paddle { namespace framework { namespace ir { +class Graph; + class ConvElementwiseAddFusePass : public FusePassBase { public: virtual ~ConvElementwiseAddFusePass() {} diff --git a/paddle/fluid/framework/ir/cudnn_placement_pass.h b/paddle/fluid/framework/ir/cudnn_placement_pass.h index 99dd3a175d37adabe4fab3888e94fe080631086b..8d84c2bf707956c4a00454a6dc66efcb42bec816 100644 --- a/paddle/fluid/framework/ir/cudnn_placement_pass.h +++ b/paddle/fluid/framework/ir/cudnn_placement_pass.h @@ -16,6 +16,7 @@ limitations under the License. */ #include #include + #include "paddle/fluid/framework/ir/placement_pass_base.h" namespace paddle { diff --git a/paddle/fluid/framework/ir/delete_quant_dequant_op_pass.cc b/paddle/fluid/framework/ir/delete_quant_dequant_op_pass.cc index 4dfbd5e00c15cf713cc42a542bbb1a019b6490d9..886b080c6624c2577327db9753839f6a8c9740ad 100644 --- a/paddle/fluid/framework/ir/delete_quant_dequant_op_pass.cc +++ b/paddle/fluid/framework/ir/delete_quant_dequant_op_pass.cc @@ -12,10 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "paddle/fluid/framework/ir/delete_quant_dequant_op_pass.h" -#include "paddle/fluid/framework/ir/graph_viz_pass.h" +#include namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/ir/delete_quant_dequant_op_pass.h b/paddle/fluid/framework/ir/delete_quant_dequant_op_pass.h index 938ada6453edf4e3ce324aa787e9d23905869d93..fea0498fdecd26a723692338bdcd51b5335be501 100644 --- a/paddle/fluid/framework/ir/delete_quant_dequant_op_pass.h +++ b/paddle/fluid/framework/ir/delete_quant_dequant_op_pass.h @@ -14,6 +14,7 @@ #pragma once #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" @@ -21,6 +22,8 @@ namespace paddle { namespace framework { namespace ir { +class Graph; + class DeleteQuantDequantOpPass : public FusePassBase { public: virtual ~DeleteQuantDequantOpPass() {} diff --git a/paddle/fluid/framework/ir/embedding_eltwise_layernorm_fuse_pass.cc b/paddle/fluid/framework/ir/embedding_eltwise_layernorm_fuse_pass.cc index 3f88a460d140f6d7389194a29e37128f5ba5b458..51861b402d58aa1224fbbfbc1476ed848716d5f7 100644 --- a/paddle/fluid/framework/ir/embedding_eltwise_layernorm_fuse_pass.cc +++ b/paddle/fluid/framework/ir/embedding_eltwise_layernorm_fuse_pass.cc @@ -13,10 +13,10 @@ // limitations under the License. #include "paddle/fluid/framework/ir/embedding_eltwise_layernorm_fuse_pass.h" -#include #include #include #include + #include "paddle/fluid/framework/ddim.h" #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/op_version_registry.h" diff --git a/paddle/fluid/framework/ir/embedding_eltwise_layernorm_fuse_pass.h b/paddle/fluid/framework/ir/embedding_eltwise_layernorm_fuse_pass.h index 644eb1cf89221c4e6e22e3d767b4b802702d7b88..25049d7468b152e72ad5f32fb38d9204f7219dff 100644 --- a/paddle/fluid/framework/ir/embedding_eltwise_layernorm_fuse_pass.h +++ b/paddle/fluid/framework/ir/embedding_eltwise_layernorm_fuse_pass.h @@ -17,10 +17,19 @@ #include #include #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" +namespace paddle { +namespace framework { +namespace ir { +class Graph; +} // namespace ir +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace ir { diff --git a/paddle/fluid/framework/ir/embedding_fc_lstm_fuse_pass.h b/paddle/fluid/framework/ir/embedding_fc_lstm_fuse_pass.h index 65cb4439727b466506af35df1bed609b18c06ee0..a9cde13758b07066193992637e7048a67540c2fd 100644 --- a/paddle/fluid/framework/ir/embedding_fc_lstm_fuse_pass.h +++ b/paddle/fluid/framework/ir/embedding_fc_lstm_fuse_pass.h @@ -27,6 +27,8 @@ namespace ir { // Fusing of Embedding , FC and LSTM op // Just FC without bias +class Graph; + class EmbeddingFCLSTMFusePass : public FusePassBase { public: virtual ~EmbeddingFCLSTMFusePass() {} diff --git a/paddle/fluid/framework/ir/fc_elementwise_layernorm_fuse_pass.cc b/paddle/fluid/framework/ir/fc_elementwise_layernorm_fuse_pass.cc index 5c18a0d6c7ffe43a882f8f190f3449d6778c1bd0..bedb968964123df59b9cd68726c5718381a349b4 100644 --- a/paddle/fluid/framework/ir/fc_elementwise_layernorm_fuse_pass.cc +++ b/paddle/fluid/framework/ir/fc_elementwise_layernorm_fuse_pass.cc @@ -13,9 +13,11 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/ir/fc_elementwise_layernorm_fuse_pass.h" + #include #include #include + #include "paddle/fluid/framework/ir/graph_pattern_detector.h" namespace paddle { diff --git a/paddle/fluid/framework/ir/fc_elementwise_layernorm_fuse_pass.h b/paddle/fluid/framework/ir/fc_elementwise_layernorm_fuse_pass.h index ac4d0b39ee267c724636954263aa2dce9d9ec47f..12e4c44b84e87bb710774ebba0ba2853d8b37f5e 100644 --- a/paddle/fluid/framework/ir/fc_elementwise_layernorm_fuse_pass.h +++ b/paddle/fluid/framework/ir/fc_elementwise_layernorm_fuse_pass.h @@ -20,6 +20,8 @@ namespace paddle { namespace framework { namespace ir { +class Graph; + class FCElementwiseLayerNormFusePass : public FusePassBase { public: virtual ~FCElementwiseLayerNormFusePass() {} diff --git a/paddle/fluid/framework/ir/fc_fuse_pass.cc b/paddle/fluid/framework/ir/fc_fuse_pass.cc index d60510a4074997a028cd914ca7a0e76335801c80..0248aeedd0afeda155c19fb9ff59baf1d9197ea6 100644 --- a/paddle/fluid/framework/ir/fc_fuse_pass.cc +++ b/paddle/fluid/framework/ir/fc_fuse_pass.cc @@ -13,10 +13,10 @@ // limitations under the License. #include "paddle/fluid/framework/ir/fc_fuse_pass.h" -#include + #include -#include #include + #include "paddle/fluid/framework/ir/graph_helper.h" #include "paddle/fluid/framework/op_version_registry.h" #include "paddle/fluid/platform/enforce.h" diff --git a/paddle/fluid/framework/ir/fc_fuse_pass.h b/paddle/fluid/framework/ir/fc_fuse_pass.h index ef6636d109a69d32aa50044b9686254e5d7769a5..f564bbb151854fe325975285b18d25b517336014 100644 --- a/paddle/fluid/framework/ir/fc_fuse_pass.h +++ b/paddle/fluid/framework/ir/fc_fuse_pass.h @@ -26,6 +26,8 @@ namespace ir { /* * Fuse the MUL and ELEMENTWISE_ADD to a FCOp. */ +class Graph; + class FCFusePass : public FusePassBase { public: virtual ~FCFusePass() {} diff --git a/paddle/fluid/framework/ir/fc_gru_fuse_pass.cc b/paddle/fluid/framework/ir/fc_gru_fuse_pass.cc index f5fea90ac2fcee8e9c48ca21203b3b60cd7f7166..c4515bbc45538ca211382aa119bbec5721c56c5a 100644 --- a/paddle/fluid/framework/ir/fc_gru_fuse_pass.cc +++ b/paddle/fluid/framework/ir/fc_gru_fuse_pass.cc @@ -15,6 +15,7 @@ #include "paddle/fluid/framework/ir/fc_gru_fuse_pass.h" #include #include + #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/op_version_registry.h" @@ -22,6 +23,8 @@ namespace paddle { namespace framework { namespace ir { +class Node; + static int BuildFusion(Graph* graph, const std::string& name_scope, Scope* scope, bool with_fc_bias) { GraphPatternDetector gpd; diff --git a/paddle/fluid/framework/ir/fc_gru_fuse_pass.h b/paddle/fluid/framework/ir/fc_gru_fuse_pass.h index e11cdac7ea95219444c35bb8deef630fe29d3734..73f00504d34d5f1cfddbc3826f7a84e6925fc9f3 100644 --- a/paddle/fluid/framework/ir/fc_gru_fuse_pass.h +++ b/paddle/fluid/framework/ir/fc_gru_fuse_pass.h @@ -15,6 +15,7 @@ #pragma once #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" @@ -25,6 +26,8 @@ namespace ir { // The MulGRUFusePass and MulGRUFusePass will fuse to the same FusionGRU op. +class Graph; + class FCGRUFusePass : public FusePassBase { public: virtual ~FCGRUFusePass() {} diff --git a/paddle/fluid/framework/ir/fc_lstm_fuse_pass.cc b/paddle/fluid/framework/ir/fc_lstm_fuse_pass.cc index a3c57e14e1aedbed1e4cf462d4883cd83bf2fa10..2b451da7bfa8b089c0f891ce42fbc293b19ac4b1 100644 --- a/paddle/fluid/framework/ir/fc_lstm_fuse_pass.cc +++ b/paddle/fluid/framework/ir/fc_lstm_fuse_pass.cc @@ -15,6 +15,7 @@ #include "paddle/fluid/framework/ir/fc_lstm_fuse_pass.h" #include #include + #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/op_version_registry.h" @@ -22,6 +23,8 @@ namespace paddle { namespace framework { namespace ir { +class Node; + int BuildFusion(Graph* graph, const std::string& name_scope, Scope* scope, bool with_fc_bias) { GraphPatternDetector gpd; diff --git a/paddle/fluid/framework/ir/fc_lstm_fuse_pass.h b/paddle/fluid/framework/ir/fc_lstm_fuse_pass.h index 5dea7c91a860f0b9622610f12f195eafb9849555..d37f53b15f06b72e67c234baec3a314f0f462735 100644 --- a/paddle/fluid/framework/ir/fc_lstm_fuse_pass.h +++ b/paddle/fluid/framework/ir/fc_lstm_fuse_pass.h @@ -27,6 +27,8 @@ namespace ir { // The MulLstmFusePass and MulLstmFusePass will fuse to the same FusionLstm op. // Just FC without bias +class Graph; + class FCLstmFusePass : public FusePassBase { public: virtual ~FCLstmFusePass() {} diff --git a/paddle/fluid/framework/ir/fuse_bn_act_pass.cc b/paddle/fluid/framework/ir/fuse_bn_act_pass.cc index 54c05046a2c2f2f56c20a32b8ca32578abe7af31..db3c711201dc76766b4ec29c9ce1590567971939 100644 --- a/paddle/fluid/framework/ir/fuse_bn_act_pass.cc +++ b/paddle/fluid/framework/ir/fuse_bn_act_pass.cc @@ -15,12 +15,17 @@ #include "paddle/fluid/framework/ir/fuse_bn_act_pass.h" #include #include -#include -#include -#include #include "paddle/fluid/framework/framework.pb.h" #include "paddle/fluid/framework/operator.h" #include "paddle/fluid/platform/enforce.h" + +namespace paddle { +namespace framework { +namespace ir { +class Node; +} // namespace ir +} // namespace framework +} // namespace paddle #ifdef PADDLE_WITH_CUDA #include "paddle/fluid/platform/cudnn_helper.h" #endif diff --git a/paddle/fluid/framework/ir/fuse_bn_act_pass.h b/paddle/fluid/framework/ir/fuse_bn_act_pass.h index 427ff03a803c991ee908dcd4e17379f19fd873af..7e5f046ecaa01cb1398b15cc572fb5bd00d0a5fe 100644 --- a/paddle/fluid/framework/ir/fuse_bn_act_pass.h +++ b/paddle/fluid/framework/ir/fuse_bn_act_pass.h @@ -18,6 +18,7 @@ #include #include #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" @@ -30,6 +31,9 @@ namespace ir { /* * Fuse the BatchNorm and activation. */ +class Graph; +class Node; + class FuseBatchNormActPass : public FusePassBase { public: virtual ~FuseBatchNormActPass() {} diff --git a/paddle/fluid/framework/ir/fuse_elewise_add_act_pass.h b/paddle/fluid/framework/ir/fuse_elewise_add_act_pass.h index dc73f1fda03e130c6876819d91897b497b8b321e..d9356b7bd7221347eec3a9bc5f3ebb7ffd6ecde9 100644 --- a/paddle/fluid/framework/ir/fuse_elewise_add_act_pass.h +++ b/paddle/fluid/framework/ir/fuse_elewise_add_act_pass.h @@ -17,6 +17,7 @@ #include #include #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" @@ -29,6 +30,9 @@ namespace ir { /* * Fuse the ElewiseAdd and activation */ +class Graph; +class Node; + class FuseElewiseAddActPass : public FusePassBase { public: virtual ~FuseElewiseAddActPass() {} diff --git a/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_adam_op_pass.cc b/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_adam_op_pass.cc index c284c1f4587cd6dd5c8eacc43968f45e4fbef699..0094b674c2a176605f1fb13c2a759d75833f20a3 100644 --- a/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_adam_op_pass.cc +++ b/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_adam_op_pass.cc @@ -11,19 +11,22 @@ // 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 -#include +#include "glog/logging.h" #include "paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_optimizer_op_pass.h" -#include "paddle/fluid/framework/op_registry.h" +#include "paddle/fluid/framework/ir/graph.h" +#include "paddle/fluid/framework/ir/pass.h" +#include "paddle/fluid/framework/op_desc.h" +#include "paddle/fluid/platform/enforce.h" namespace paddle { namespace framework { namespace ir { +class Node; + class FuseAdamOpPass : public FuseOptimizerOpPass { private: const std::string GetOpType() const { return "adam"; } diff --git a/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_momentum_op_pass.cc b/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_momentum_op_pass.cc index 43ec8bff5edc10cbfc48c06a2e35a5a46ed7043c..f87d31cbc409c7c4db634e994738d106d2a8146e 100644 --- a/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_momentum_op_pass.cc +++ b/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_momentum_op_pass.cc @@ -12,18 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include -#include -#include +#include "glog/logging.h" #include "paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_optimizer_op_pass.h" -#include "paddle/fluid/framework/op_registry.h" +#include "paddle/fluid/framework/ir/graph.h" +#include "paddle/fluid/framework/ir/pass.h" +#include "paddle/fluid/framework/op_desc.h" +#include "paddle/fluid/platform/enforce.h" namespace paddle { namespace framework { namespace ir { +class Node; + class FuseMomentumOpPass : public FuseOptimizerOpPass { private: virtual const std::string GetOpType() const { return "momentum"; } diff --git a/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_optimizer_op_pass.h b/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_optimizer_op_pass.h index 0b5bf8a3a4ba5d2d819529718cf018530d67d017..5b7e1b7d384c8211e22ea09ffd5e730bb3d70d6a 100644 --- a/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_optimizer_op_pass.h +++ b/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_optimizer_op_pass.h @@ -19,14 +19,25 @@ #include #include #include + #include "paddle/fluid/framework/details/build_strategy.h" #include "paddle/fluid/framework/details/multi_devices_helper.h" #include "paddle/fluid/framework/ir/graph.h" +namespace paddle { +namespace framework { +class BlockDesc; +class VarDesc; +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace ir { +class Graph; +class Node; + constexpr char kGrad[] = "Grad"; constexpr char kParam[] = "Param"; constexpr char kLearningRate[] = "LearningRate"; diff --git a/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_sgd_op_pass.cc b/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_sgd_op_pass.cc index 70d4d2b865230078889115b809d8617b4415cc99..720d252c9a6b4bac733fa1d836e24ec168ca10ad 100644 --- a/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_sgd_op_pass.cc +++ b/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_sgd_op_pass.cc @@ -11,17 +11,21 @@ // 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 "glog/logging.h" #include "paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_optimizer_op_pass.h" -#include "paddle/fluid/framework/op_registry.h" +#include "paddle/fluid/framework/ir/graph.h" +#include "paddle/fluid/framework/ir/pass.h" +#include "paddle/fluid/framework/op_desc.h" +#include "paddle/fluid/platform/enforce.h" + namespace paddle { namespace framework { namespace ir { +class Node; + class FuseSgdOpPass : public FuseOptimizerOpPass { private: virtual const std::string GetOpType() const { return "sgd"; } diff --git a/paddle/fluid/framework/ir/fuse_pass_base.cc b/paddle/fluid/framework/ir/fuse_pass_base.cc index e6fb1302e275fa2635542baf824c5e3333c2f5c8..f3db4f02b1c5fd4f0a3ccab23fbeec767188e847 100644 --- a/paddle/fluid/framework/ir/fuse_pass_base.cc +++ b/paddle/fluid/framework/ir/fuse_pass_base.cc @@ -15,10 +15,18 @@ #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include +namespace paddle { +namespace framework { +class Scope; +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace ir { +class Graph; + void FusePassBase::Init(const std::string& repr, Graph* graph) const { repr_ = repr; graph_ = graph; diff --git a/paddle/fluid/framework/ir/fuse_pass_base.h b/paddle/fluid/framework/ir/fuse_pass_base.h index 3a1022bbcbd671391fb034bdff7c3cf97952f84d..ce7635bb35ce6108b4a5a356c8fb99269dbf2890 100644 --- a/paddle/fluid/framework/ir/fuse_pass_base.h +++ b/paddle/fluid/framework/ir/fuse_pass_base.h @@ -15,14 +15,24 @@ #pragma once #include + #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/pass.h" #include "paddle/fluid/framework/scope.h" +namespace paddle { +namespace framework { +class Scope; +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace ir { +class Graph; +class Node; + static const char kParamScopeAttr[] = "__param_scope__"; static const char kFuseStatisAttr[] = "__fuse_statis__"; // When we use trt or other third_party lib, the parameters are managed by diff --git a/paddle/fluid/framework/ir/fuse_relu_depthwise_conv_pass.h b/paddle/fluid/framework/ir/fuse_relu_depthwise_conv_pass.h index d37c153dd2a05ecfc8f0626626bbc3ed2f85968b..0b1dfaa6928b8d1bab7e08cc668e00ac30bbffff 100644 --- a/paddle/fluid/framework/ir/fuse_relu_depthwise_conv_pass.h +++ b/paddle/fluid/framework/ir/fuse_relu_depthwise_conv_pass.h @@ -15,6 +15,7 @@ #include #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" @@ -27,6 +28,8 @@ namespace ir { /* * Fuse the relu and depthwise conv */ +class Graph; + class FuseReluDepthwiseConvPass : public FusePassBase { public: virtual ~FuseReluDepthwiseConvPass() {} diff --git a/paddle/fluid/framework/ir/fusion_group/code_generator.h b/paddle/fluid/framework/ir/fusion_group/code_generator.h index 21773f239b9f6e5208aea45f481bf6f92745033f..15d21cf6829d40bfcdf143f1285ebefe43037056 100644 --- a/paddle/fluid/framework/ir/fusion_group/code_generator.h +++ b/paddle/fluid/framework/ir/fusion_group/code_generator.h @@ -19,6 +19,7 @@ limitations under the License. */ #include #include #include + #include "paddle/fluid/framework/ir/fusion_group/code_generator_helper.h" #include "paddle/fluid/framework/ir/fusion_group/subgraph.h" @@ -27,6 +28,8 @@ namespace framework { namespace ir { namespace fusion_group { +class SubGraph; + class CodeGenerator { public: CodeGenerator(); diff --git a/paddle/fluid/framework/ir/fusion_group/code_generator_tester.cc b/paddle/fluid/framework/ir/fusion_group/code_generator_tester.cc index ebc89b14c265d3491f0f9bc64a36f52c6c9f2a18..2a7a0748cf0e6569b9be61bc84c1c7e1b0a29820 100644 --- a/paddle/fluid/framework/ir/fusion_group/code_generator_tester.cc +++ b/paddle/fluid/framework/ir/fusion_group/code_generator_tester.cc @@ -12,18 +12,22 @@ 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 "paddle/fluid/framework/ir/fusion_group/code_generator.h" #include #include #include #include + +#include "paddle/fluid/framework/ir/fusion_group/code_generator.h" #include "paddle/fluid/framework/ir/fusion_group/operation.h" #include "paddle/fluid/framework/ir/pass_tester_helper.h" -#include "paddle/fluid/framework/lod_tensor.h" -#include "paddle/fluid/operators/math.h" #include "paddle/fluid/platform/device_code.h" #include "paddle/fluid/platform/float16.h" -#include "paddle/fluid/platform/init.h" + +namespace paddle { +namespace framework { +class LoDTensor; +} // namespace framework +} // namespace paddle #ifdef PADDLE_WITH_CUDA diff --git a/paddle/fluid/framework/ir/fusion_group/elementwise_group_detector.h b/paddle/fluid/framework/ir/fusion_group/elementwise_group_detector.h index 0861c2f7e96349d2d0d36d21e6ab19d98c2910e3..96b38f650131dae53450330b5f3368d42a7e52fa 100644 --- a/paddle/fluid/framework/ir/fusion_group/elementwise_group_detector.h +++ b/paddle/fluid/framework/ir/fusion_group/elementwise_group_detector.h @@ -15,9 +15,18 @@ limitations under the License. */ #pragma once #include + #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/node.h" +namespace paddle { +namespace framework { +namespace ir { +class Node; +} // namespace ir +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace ir { diff --git a/paddle/fluid/framework/ir/fusion_group/fusion_group_pass.h b/paddle/fluid/framework/ir/fusion_group/fusion_group_pass.h index 3438783c180d7c45c506a9244e6a612db0b67138..5ca785846a522aaa2cf41ed0f24edb1a8ae3fa45 100644 --- a/paddle/fluid/framework/ir/fusion_group/fusion_group_pass.h +++ b/paddle/fluid/framework/ir/fusion_group/fusion_group_pass.h @@ -16,6 +16,7 @@ limitations under the License. */ #include #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/fusion_group/subgraph.h" @@ -23,6 +24,11 @@ namespace paddle { namespace framework { namespace ir { +class Graph; +namespace fusion_group { +class SubGraph; +} // namespace fusion_group + class FusionGroupPass : public FusePassBase { protected: void ApplyImpl(Graph* graph) const override; diff --git a/paddle/fluid/framework/ir/fusion_group/operation.h b/paddle/fluid/framework/ir/fusion_group/operation.h index 74abbdaad0bdfbd6115f47cc1fc5f53608b7f744..d99fe737504e52e0867f531c7cfa03d0dfbf07a4 100644 --- a/paddle/fluid/framework/ir/fusion_group/operation.h +++ b/paddle/fluid/framework/ir/fusion_group/operation.h @@ -18,6 +18,7 @@ limitations under the License. */ #include #include #include + #include "paddle/fluid/platform/enforce.h" namespace paddle { diff --git a/paddle/fluid/framework/ir/graph.h b/paddle/fluid/framework/ir/graph.h index 137ab7a56d7c409326b4ed6d0f4b2b881f50eaea..593ac214e56f9722538c89ff80ec9d6b98fcd8ae 100644 --- a/paddle/fluid/framework/ir/graph.h +++ b/paddle/fluid/framework/ir/graph.h @@ -25,6 +25,13 @@ limitations under the License. */ #include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/platform/variant.h" +namespace paddle { +namespace framework { +class OpDesc; +class VarDesc; +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/ir/graph_helper.h b/paddle/fluid/framework/ir/graph_helper.h index 074ad320fb122bd49fe144f803b47ec9768b3504..0c43febca70b7d44be6c399263d11a5900f9b109 100644 --- a/paddle/fluid/framework/ir/graph_helper.h +++ b/paddle/fluid/framework/ir/graph_helper.h @@ -28,6 +28,8 @@ namespace framework { namespace ir { // Compare nodes via node id. +class Graph; + struct NodeComp { bool operator()(ir::Node *const &node1, ir::Node *const &node2) const { return node1->id() < node2->id(); diff --git a/paddle/fluid/framework/ir/graph_helper_test.cc b/paddle/fluid/framework/ir/graph_helper_test.cc index d8973d5aeda1a2e0650a506b4c916b4346f01e2d..0a2dcfed000c9f4bbddc280912dc8966044c265d 100644 --- a/paddle/fluid/framework/ir/graph_helper_test.cc +++ b/paddle/fluid/framework/ir/graph_helper_test.cc @@ -13,7 +13,6 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/ir/graph.h" -#include #include "gtest/gtest.h" #include "paddle/fluid/framework/ir/graph_helper.h" #include "paddle/fluid/framework/program_desc.h" diff --git a/paddle/fluid/framework/ir/graph_pattern_detector.h b/paddle/fluid/framework/ir/graph_pattern_detector.h index 053c1fe832b0088d2abdd3f8eb40a0042e5e2dfe..7116b8a2a6f353fc40fcba86e8cba3b2f37855bc 100644 --- a/paddle/fluid/framework/ir/graph_pattern_detector.h +++ b/paddle/fluid/framework/ir/graph_pattern_detector.h @@ -27,11 +27,21 @@ #include #include #include + #include "paddle/fluid/framework/framework.pb.h" #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/node.h" #include "paddle/fluid/inference/analysis/dot.h" +namespace paddle { +namespace framework { +namespace ir { +class Graph; +class Node; +} // namespace ir +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace ir { diff --git a/paddle/fluid/framework/ir/graph_pattern_detector_tester.cc b/paddle/fluid/framework/ir/graph_pattern_detector_tester.cc index 6c466fb21fb46e09961dc874e9e39655f83d17c6..5ac5a5d983992746c8bbbb318c41d04a0cf76fae 100644 --- a/paddle/fluid/framework/ir/graph_pattern_detector_tester.cc +++ b/paddle/fluid/framework/ir/graph_pattern_detector_tester.cc @@ -12,14 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/fluid/framework/ir/graph_pattern_detector.h" - #include +#include "paddle/fluid/framework/ir/graph_pattern_detector.h" + namespace paddle { namespace framework { namespace ir { +class Node; + void BuildGraph(Graph* g) { ir::Node* o1 = g->CreateEmptyNode("op1", Node::Type::kOperation); ir::Node* o2 = g->CreateEmptyNode("op2", Node::Type::kOperation); diff --git a/paddle/fluid/framework/ir/graph_to_program_pass.h b/paddle/fluid/framework/ir/graph_to_program_pass.h index 52c8f4e0fcafcd42647b323a20fee7c7cf167b3a..6b17c0076f6fd7c8b7e64f96cda4ee9835236913 100644 --- a/paddle/fluid/framework/ir/graph_to_program_pass.h +++ b/paddle/fluid/framework/ir/graph_to_program_pass.h @@ -20,6 +20,8 @@ namespace paddle { namespace framework { namespace ir { +class Graph; + const char kGraphToProgramVarsToRemove[] = "__graph_to_program_vars_to_remove__"; const char kGraphToProgramSortKind[] = "__graph_to_program_sort_kind__"; diff --git a/paddle/fluid/framework/ir/graph_to_program_pass_test.cc b/paddle/fluid/framework/ir/graph_to_program_pass_test.cc index 5ee6b8a5f1e4e7415adfac6b51e9d3ae8e3062a9..80d7839d700b6de370d1ad8eb0d3ec7884571d4b 100644 --- a/paddle/fluid/framework/ir/graph_to_program_pass_test.cc +++ b/paddle/fluid/framework/ir/graph_to_program_pass_test.cc @@ -13,7 +13,6 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/ir/graph_to_program_pass.h" - #include #include #include @@ -25,6 +24,8 @@ namespace paddle { namespace framework { namespace ir { +class Node; + void BuildNoCircleGraph(Graph* g) { OpDesc op1; op1.SetType("op1"); diff --git a/paddle/fluid/framework/ir/graph_traits.cc b/paddle/fluid/framework/ir/graph_traits.cc index 4b403c46260c6129451809f276aac67ccc17c4d4..3fa84554d99bc46f094fecabe67a58e5b1d7e73b 100644 --- a/paddle/fluid/framework/ir/graph_traits.cc +++ b/paddle/fluid/framework/ir/graph_traits.cc @@ -13,10 +13,7 @@ // limitations under the License. #include "paddle/fluid/framework/ir/graph_traits.h" - #include -#include -#include namespace paddle { namespace framework { @@ -25,6 +22,8 @@ namespace ir { // // NodesDFSIterator // +class Node; + NodesDFSIterator::NodesDFSIterator(const std::vector &source) { for (auto *x : source) stack_.push(x); } diff --git a/paddle/fluid/framework/ir/graph_traits.h b/paddle/fluid/framework/ir/graph_traits.h index bb4212bcd33d77cfe1c091b18387e18c4c3e5fa7..a54cc61a63fdee3e35b6fc38da71070b4411e26c 100644 --- a/paddle/fluid/framework/ir/graph_traits.h +++ b/paddle/fluid/framework/ir/graph_traits.h @@ -26,6 +26,9 @@ namespace paddle { namespace framework { namespace ir { +class Graph; +class Node; + template class iterator_range { IteratorT begin_, end_; diff --git a/paddle/fluid/framework/ir/graph_viz_pass.h b/paddle/fluid/framework/ir/graph_viz_pass.h index 7091aa6a95bd9ebde10bfbd45c98f8757b9d06c4..118c1bc6f3c78e6ec05c897939343df83b1c3851 100644 --- a/paddle/fluid/framework/ir/graph_viz_pass.h +++ b/paddle/fluid/framework/ir/graph_viz_pass.h @@ -28,6 +28,8 @@ namespace paddle { namespace framework { namespace ir { +class Graph; + const char kGraphvizMarkedNodeAttr[] = "__graphviz__marked_node__"; class GraphVizPass : public Pass { diff --git a/paddle/fluid/framework/ir/identity_scale_op_clean_pass.cc b/paddle/fluid/framework/ir/identity_scale_op_clean_pass.cc index c8dfa02f469a351a8d3495bf19238a723029bb4b..08d09fce5de9c932243f70b18a4c45dc88885b58 100644 --- a/paddle/fluid/framework/ir/identity_scale_op_clean_pass.cc +++ b/paddle/fluid/framework/ir/identity_scale_op_clean_pass.cc @@ -20,6 +20,8 @@ namespace paddle { namespace framework { namespace ir { +class Graph; + void IdentityScaleOpCleanPass::ApplyImpl(ir::Graph* graph) const { FusePassBase::Init("identity_scale_op_clean", graph); diff --git a/paddle/fluid/framework/ir/identity_scale_op_clean_pass.h b/paddle/fluid/framework/ir/identity_scale_op_clean_pass.h index d66b411257e530fa5188091702b0b309652ffaa4..7e3d4e19fa84deccce889d18a7840baeff21cfb3 100644 --- a/paddle/fluid/framework/ir/identity_scale_op_clean_pass.h +++ b/paddle/fluid/framework/ir/identity_scale_op_clean_pass.h @@ -20,6 +20,8 @@ namespace paddle { namespace framework { namespace ir { +class Graph; + class IdentityScaleOpCleanPass : public FusePassBase { protected: void ApplyImpl(ir::Graph* graph) const override; diff --git a/paddle/fluid/framework/ir/is_test_pass.cc b/paddle/fluid/framework/ir/is_test_pass.cc index bf6fe999c1e68c35bc2c19fe38646da93bb1e204..9c1640efcd851c3ba951aa0843c22ad7a000dce5 100644 --- a/paddle/fluid/framework/ir/is_test_pass.cc +++ b/paddle/fluid/framework/ir/is_test_pass.cc @@ -20,6 +20,8 @@ namespace paddle { namespace framework { namespace ir { +class Graph; + void IsTestPass::ApplyImpl(ir::Graph* graph) const { VLOG(3) << "Sets is_test attrbiute to true and if it is missing, inserts it " "for activations and pooling."; diff --git a/paddle/fluid/framework/ir/is_test_pass.h b/paddle/fluid/framework/ir/is_test_pass.h index 80cedbf9f850f6fe31c9f2898264e19ebf931c72..abf48480d71aefcf85ba6aec946750114cce5482 100644 --- a/paddle/fluid/framework/ir/is_test_pass.h +++ b/paddle/fluid/framework/ir/is_test_pass.h @@ -20,6 +20,8 @@ namespace paddle { namespace framework { namespace ir { +class Graph; + class IsTestPass : public Pass { protected: void ApplyImpl(ir::Graph* graph) const override; diff --git a/paddle/fluid/framework/ir/lock_free_optimize_pass.h b/paddle/fluid/framework/ir/lock_free_optimize_pass.h index f38f48fcd92a6b672254b3d1dda44671652b8ddb..26ec61fd36eb3c309d864221b41681f3d712d81f 100644 --- a/paddle/fluid/framework/ir/lock_free_optimize_pass.h +++ b/paddle/fluid/framework/ir/lock_free_optimize_pass.h @@ -27,6 +27,7 @@ namespace framework { namespace ir { class Node; +class Graph; /* * Remove the sum op of all gradients of the backward op. diff --git a/paddle/fluid/framework/ir/memory_optimize_pass/buffer_shared_cross_op_memory_reuse_pass.cc b/paddle/fluid/framework/ir/memory_optimize_pass/buffer_shared_cross_op_memory_reuse_pass.cc index b1afa47910fadfaf3560d15cb0bbe88ae0da7371..b12b84d4a491b3747a59b99b52903ddff2509fdf 100644 --- a/paddle/fluid/framework/ir/memory_optimize_pass/buffer_shared_cross_op_memory_reuse_pass.cc +++ b/paddle/fluid/framework/ir/memory_optimize_pass/buffer_shared_cross_op_memory_reuse_pass.cc @@ -12,24 +12,23 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include -#include -#include -#include + +#include "glog/logging.h" #include "paddle/fluid/framework/details/computation_op_handle.h" -#include "paddle/fluid/framework/details/multi_devices_helper.h" -#include "paddle/fluid/framework/details/share_tensor_buffer_op_handle.h" -#include "paddle/fluid/framework/ir/memory_optimize_pass/memory_optimization_var_info.h" +#include "paddle/fluid/framework/details/op_handle_base.h" +#include "paddle/fluid/framework/details/var_handle.h" #include "paddle/fluid/framework/ir/memory_optimize_pass/memory_reuse_pass.h" #include "paddle/fluid/framework/ir/memory_optimize_pass/op_graph_view.h" -#include "paddle/fluid/framework/ir/memory_optimize_pass/reference_count_pass_helper.h" #include "paddle/fluid/framework/ir/pass.h" +#include "paddle/fluid/platform/enforce.h" namespace paddle { namespace framework { namespace ir { +class Graph; + using OpHandleBase = details::OpHandleBase; using ComputationOpHandle = details::ComputationOpHandle; using VarHandle = details::VarHandle; diff --git a/paddle/fluid/framework/ir/memory_optimize_pass/buffer_shared_inplace_op_pass.cc b/paddle/fluid/framework/ir/memory_optimize_pass/buffer_shared_inplace_op_pass.cc index ce7f27d27559c70cf164f6bb641fa0ee6f02a2a0..0cdde5c757aaf0e73281f889dff63d2ca1049f52 100644 --- a/paddle/fluid/framework/ir/memory_optimize_pass/buffer_shared_inplace_op_pass.cc +++ b/paddle/fluid/framework/ir/memory_optimize_pass/buffer_shared_inplace_op_pass.cc @@ -13,6 +13,7 @@ // limitations under the License. #include + #include #include #include @@ -22,13 +23,15 @@ #include "paddle/fluid/framework/details/share_tensor_buffer_op_handle.h" #include "paddle/fluid/framework/ir/memory_optimize_pass/memory_optimization_var_info.h" #include "paddle/fluid/framework/ir/memory_optimize_pass/memory_reuse_pass.h" -#include "paddle/fluid/framework/ir/memory_optimize_pass/reference_count_pass_helper.h" #include "paddle/fluid/framework/ir/pass.h" +#include "paddle/fluid/platform/enforce.h" namespace paddle { namespace framework { namespace ir { +class Graph; + class BufferSharedInplaceOpPass : public MemoryReusePass { protected: std::string ReuseType() const override { return "inplace"; } diff --git a/paddle/fluid/framework/ir/memory_optimize_pass/memory_reuse_pass.cc b/paddle/fluid/framework/ir/memory_optimize_pass/memory_reuse_pass.cc index 3e3b9864a7b408267ac73de053c1692628e9a14c..72e29dfe156e83db06f78d025106b564064b955d 100644 --- a/paddle/fluid/framework/ir/memory_optimize_pass/memory_reuse_pass.cc +++ b/paddle/fluid/framework/ir/memory_optimize_pass/memory_reuse_pass.cc @@ -16,10 +16,15 @@ #include #include -#include -#include -#include -#include + +namespace paddle { +namespace framework { +namespace details { +class ComputationOpHandle; +class ShareTensorBufferOpHandle; +} // namespace details +} // namespace framework +} // namespace paddle namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/ir/memory_optimize_pass/memory_reuse_pass.h b/paddle/fluid/framework/ir/memory_optimize_pass/memory_reuse_pass.h index 1c0c6ae60205b14f97bd15bceeb126d0eb54f654..4a77d116f1e9bb425b5f3375b2d4c650017c2f75 100644 --- a/paddle/fluid/framework/ir/memory_optimize_pass/memory_reuse_pass.h +++ b/paddle/fluid/framework/ir/memory_optimize_pass/memory_reuse_pass.h @@ -28,6 +28,17 @@ #include "paddle/fluid/framework/ir/memory_optimize_pass/reference_count_pass_helper.h" #include "paddle/fluid/framework/ir/pass.h" +namespace paddle { +namespace framework { +class VarDesc; +namespace details { +class ComputationOpHandle; +class ShareTensorBufferOpHandle; +struct VarHandle; +} // namespace details +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace ir { @@ -71,6 +82,8 @@ namespace ir { * a pass to clean all ShareTensorBufferOpHandles and move sharing to * ComputationOpHandle::Run() in the future. */ +class Graph; + class MemoryReusePass : public Pass { protected: void ApplyImpl(Graph *graph) const final; diff --git a/paddle/fluid/framework/ir/memory_optimize_pass/op_graph_view.cc b/paddle/fluid/framework/ir/memory_optimize_pass/op_graph_view.cc index 11c2508afb5747b6f0f3bba06c68448fef7d384a..7de62d6e48249203ce22a8aaccc2f9b68b16c54c 100644 --- a/paddle/fluid/framework/ir/memory_optimize_pass/op_graph_view.cc +++ b/paddle/fluid/framework/ir/memory_optimize_pass/op_graph_view.cc @@ -13,8 +13,14 @@ // limitations under the License. #include "paddle/fluid/framework/ir/memory_optimize_pass/op_graph_view.h" -#include -#include + +namespace paddle { +namespace framework { +namespace details { +class OpHandleBase; +} // namespace details +} // namespace framework +} // namespace paddle namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/ir/memory_optimize_pass/op_graph_view.h b/paddle/fluid/framework/ir/memory_optimize_pass/op_graph_view.h index 5fb2caedba85d2892e18db5e84067c2d2ebada6e..d6f286afc559064fc97ddc7b936651878fa3a0d0 100644 --- a/paddle/fluid/framework/ir/memory_optimize_pass/op_graph_view.h +++ b/paddle/fluid/framework/ir/memory_optimize_pass/op_graph_view.h @@ -18,8 +18,17 @@ #include #include #include + #include "paddle/fluid/framework/details/op_handle_base.h" +namespace paddle { +namespace framework { +namespace details { +class OpHandleBase; +} // namespace details +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace ir { diff --git a/paddle/fluid/framework/ir/memory_optimize_pass/reference_count_pass_helper.cc b/paddle/fluid/framework/ir/memory_optimize_pass/reference_count_pass_helper.cc index ed87f73adf137fdf545209f36f996417031fcda4..e85be0272de7fc1eb997f0ff9385e41dc8514680 100644 --- a/paddle/fluid/framework/ir/memory_optimize_pass/reference_count_pass_helper.cc +++ b/paddle/fluid/framework/ir/memory_optimize_pass/reference_count_pass_helper.cc @@ -13,8 +13,6 @@ // limitations under the License. #include "paddle/fluid/framework/ir/memory_optimize_pass/reference_count_pass_helper.h" -#include "paddle/fluid/framework/details/var_handle.h" -#include "paddle/fluid/framework/var_desc.h" namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/ir/memory_optimize_pass/reference_count_pass_helper.h b/paddle/fluid/framework/ir/memory_optimize_pass/reference_count_pass_helper.h index 0e8f4e78d22db0aad8a8120b10ee916ade21829d..d00e4f53022f4c8084438fa9f36a58685672c30d 100644 --- a/paddle/fluid/framework/ir/memory_optimize_pass/reference_count_pass_helper.h +++ b/paddle/fluid/framework/ir/memory_optimize_pass/reference_count_pass_helper.h @@ -30,6 +30,9 @@ namespace paddle { namespace framework { class VarDesc; +namespace details { +struct VarHandle; +} // namespace details namespace ir { diff --git a/paddle/fluid/framework/ir/mkldnn/conv_activation_mkldnn_fuse_pass.cc b/paddle/fluid/framework/ir/mkldnn/conv_activation_mkldnn_fuse_pass.cc index 45ff275d530857690d1f169bbcf60a99952ae2c2..a5beec87c399d35130d7aa11ee6fdb89e604c6bf 100644 --- a/paddle/fluid/framework/ir/mkldnn/conv_activation_mkldnn_fuse_pass.cc +++ b/paddle/fluid/framework/ir/mkldnn/conv_activation_mkldnn_fuse_pass.cc @@ -13,14 +13,21 @@ // limitations under the License. #include "paddle/fluid/framework/ir/mkldnn/conv_activation_mkldnn_fuse_pass.h" -#include #include #include "paddle/fluid/platform/enforce.h" +namespace paddle { +namespace framework { +class OpDesc; +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace ir { +class Graph; + void ConvActivationFusePass::ApplyImpl(ir::Graph* graph) const { PADDLE_ENFORCE_NOT_NULL( graph, platform::errors::InvalidArgument("Graph cannot be nullptr.")); diff --git a/paddle/fluid/framework/ir/mkldnn/conv_activation_mkldnn_fuse_pass.h b/paddle/fluid/framework/ir/mkldnn/conv_activation_mkldnn_fuse_pass.h index ac15fc0451285d4d5575dbc08f430625912ac823..be6b1e07c022b718b1998b89044589ad2d3567d2 100644 --- a/paddle/fluid/framework/ir/mkldnn/conv_activation_mkldnn_fuse_pass.h +++ b/paddle/fluid/framework/ir/mkldnn/conv_activation_mkldnn_fuse_pass.h @@ -15,6 +15,7 @@ #pragma once #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" @@ -26,6 +27,8 @@ namespace ir { /* * Fuse Conv and Activation base class. */ +class Graph; + class ConvActivationFusePass : public FusePassBase { public: virtual ~ConvActivationFusePass() {} diff --git a/paddle/fluid/framework/ir/mkldnn/conv_bias_mkldnn_fuse_pass.cc b/paddle/fluid/framework/ir/mkldnn/conv_bias_mkldnn_fuse_pass.cc index f7a8e3e3f6c3c77e978c57eeb7515d8cfce86471..63524294b68ef1199d49bb9deeaf80f5526c6eff 100644 --- a/paddle/fluid/framework/ir/mkldnn/conv_bias_mkldnn_fuse_pass.cc +++ b/paddle/fluid/framework/ir/mkldnn/conv_bias_mkldnn_fuse_pass.cc @@ -14,7 +14,6 @@ #include "paddle/fluid/framework/ir/mkldnn/conv_bias_mkldnn_fuse_pass.h" #include -#include #include #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/op_version_registry.h" diff --git a/paddle/fluid/framework/ir/mkldnn/conv_bias_mkldnn_fuse_pass.h b/paddle/fluid/framework/ir/mkldnn/conv_bias_mkldnn_fuse_pass.h index 833fbc748ebd03377ebaa6a5fa72d334ff8b7d37..9a83310ebfb558f4744ae508155d8aa8d01a39c7 100644 --- a/paddle/fluid/framework/ir/mkldnn/conv_bias_mkldnn_fuse_pass.h +++ b/paddle/fluid/framework/ir/mkldnn/conv_bias_mkldnn_fuse_pass.h @@ -13,16 +13,20 @@ // limitations under the License. #pragma once #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" #include "paddle/fluid/framework/ir/pass.h" + namespace paddle { namespace framework { namespace ir { /* * Fuse the Conv and Elementwise_add to a ConvBiasOp. */ +class Graph; + class ConvBiasFusePass : public FusePassBase { public: virtual ~ConvBiasFusePass() {} diff --git a/paddle/fluid/framework/ir/mkldnn/conv_concat_relu_mkldnn_fuse_pass.cc b/paddle/fluid/framework/ir/mkldnn/conv_concat_relu_mkldnn_fuse_pass.cc index af64cb22054e9f2ea751bb993a39e8be563ae458..5fadd9607e9250c0bb890b0239c18b3a9096b55f 100644 --- a/paddle/fluid/framework/ir/mkldnn/conv_concat_relu_mkldnn_fuse_pass.cc +++ b/paddle/fluid/framework/ir/mkldnn/conv_concat_relu_mkldnn_fuse_pass.cc @@ -20,6 +20,8 @@ namespace paddle { namespace framework { namespace ir { +class Graph; + void ConvConcatReLUFusePass::FindConcatWithConvs( ir::Graph* graph, std::unordered_map* concat_with_convs_counter) const { diff --git a/paddle/fluid/framework/ir/mkldnn/conv_concat_relu_mkldnn_fuse_pass.h b/paddle/fluid/framework/ir/mkldnn/conv_concat_relu_mkldnn_fuse_pass.h index 91ff0760f0483c41cb5be5507426290c90142b13..f1faa84f3d59b736b35ee2c206976c899d3366bf 100644 --- a/paddle/fluid/framework/ir/mkldnn/conv_concat_relu_mkldnn_fuse_pass.h +++ b/paddle/fluid/framework/ir/mkldnn/conv_concat_relu_mkldnn_fuse_pass.h @@ -16,6 +16,7 @@ #include #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" @@ -30,6 +31,8 @@ namespace ir { * to a: * (multi ConvReLU) -> Concat -> next_op. */ +class Graph; + class ConvConcatReLUFusePass : public FusePassBase { public: virtual ~ConvConcatReLUFusePass() {} diff --git a/paddle/fluid/framework/ir/mkldnn/conv_elementwise_add_mkldnn_fuse_pass.h b/paddle/fluid/framework/ir/mkldnn/conv_elementwise_add_mkldnn_fuse_pass.h index b95aec34d30745d99f6066e36f19c883927e2b53..2ba4c80678f0890b05c6d4c9822d8c5c9a032dc4 100644 --- a/paddle/fluid/framework/ir/mkldnn/conv_elementwise_add_mkldnn_fuse_pass.h +++ b/paddle/fluid/framework/ir/mkldnn/conv_elementwise_add_mkldnn_fuse_pass.h @@ -28,6 +28,13 @@ namespace paddle { namespace framework { namespace ir { +class Graph; +class GraphPatternDetector; +class Node; +namespace patterns { +struct Conv; +} // namespace patterns + using graph_ptr = ir::Graph*; using GraphWithStats = std::pair; diff --git a/paddle/fluid/framework/ir/mkldnn/cpu_quantize_pass.cc b/paddle/fluid/framework/ir/mkldnn/cpu_quantize_pass.cc index aa0979b4be64ae3ccebbd7cc82abcf4a4712527a..0254b5e75735152e4720116e8d47b998608f1a01 100644 --- a/paddle/fluid/framework/ir/mkldnn/cpu_quantize_pass.cc +++ b/paddle/fluid/framework/ir/mkldnn/cpu_quantize_pass.cc @@ -13,12 +13,11 @@ // limitations under the License. #include "paddle/fluid/framework/ir/mkldnn/cpu_quantize_pass.h" -#include + #include #include #include -#include "paddle/fluid/framework/eigen.h" -#include "paddle/fluid/platform/errors.h" + #include "paddle/fluid/platform/mkldnn_helper.h" #include "paddle/fluid/string/pretty_log.h" diff --git a/paddle/fluid/framework/ir/mkldnn/cpu_quantize_pass.h b/paddle/fluid/framework/ir/mkldnn/cpu_quantize_pass.h index 21219e7dca8c712a09650779f7ef803052a85748..bd87b31b781ec6217f3b084990fb22390b08925e 100644 --- a/paddle/fluid/framework/ir/mkldnn/cpu_quantize_pass.h +++ b/paddle/fluid/framework/ir/mkldnn/cpu_quantize_pass.h @@ -18,6 +18,7 @@ #include #include #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" @@ -31,6 +32,9 @@ namespace ir { * bool denotes whether quantization of the variable should be done to unsigned * type. */ +class Graph; +class Node; + using VarQuantScale = std::unordered_map>; diff --git a/paddle/fluid/framework/ir/mkldnn/cpu_quantize_placement_pass.cc b/paddle/fluid/framework/ir/mkldnn/cpu_quantize_placement_pass.cc index bc268a834780cad843a18a74bb7f50a639db103d..2146d833ddf82d4086f5036f0148e87d51062431 100644 --- a/paddle/fluid/framework/ir/mkldnn/cpu_quantize_placement_pass.cc +++ b/paddle/fluid/framework/ir/mkldnn/cpu_quantize_placement_pass.cc @@ -13,13 +13,14 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/ir/mkldnn/cpu_quantize_placement_pass.h" -#include #include namespace paddle { namespace framework { namespace ir { +class Graph; + void CPUQuantizePlacementPass::ApplyImpl(ir::Graph* graph) const { VLOG(3) << "Marks operators which are to be quantized."; const auto& excluded_ids_list = diff --git a/paddle/fluid/framework/ir/mkldnn/cpu_quantize_placement_pass.h b/paddle/fluid/framework/ir/mkldnn/cpu_quantize_placement_pass.h index f3229e59d6ffb97514adb9c871d4fb981fc964e0..474fa63f60e413132421c6cc06942413658388ab 100644 --- a/paddle/fluid/framework/ir/mkldnn/cpu_quantize_placement_pass.h +++ b/paddle/fluid/framework/ir/mkldnn/cpu_quantize_placement_pass.h @@ -16,6 +16,7 @@ limitations under the License. */ #include #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" @@ -26,6 +27,8 @@ namespace ir { /* * Specifies which operators should be quantized. */ +class Graph; + class CPUQuantizePlacementPass : public FusePassBase { protected: void ApplyImpl(ir::Graph* graph) const override; diff --git a/paddle/fluid/framework/ir/mkldnn/cpu_quantize_squash_pass.cc b/paddle/fluid/framework/ir/mkldnn/cpu_quantize_squash_pass.cc index bc24c10d9d0ae545d0dc71160d66e02a9fdbd730..54ab244a99bd4cd555c37b47558b4492d46862f9 100644 --- a/paddle/fluid/framework/ir/mkldnn/cpu_quantize_squash_pass.cc +++ b/paddle/fluid/framework/ir/mkldnn/cpu_quantize_squash_pass.cc @@ -14,9 +14,10 @@ // limitations under the License. #include "paddle/fluid/framework/ir/mkldnn/cpu_quantize_squash_pass.h" -#include + #include #include + #include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/string/pretty_log.h" @@ -24,6 +25,8 @@ namespace paddle { namespace framework { namespace ir { +class Graph; + using string::PrettyLogDetail; void CPUQuantizeSquashPass::FindNodesToKeep( diff --git a/paddle/fluid/framework/ir/mkldnn/cpu_quantize_squash_pass.h b/paddle/fluid/framework/ir/mkldnn/cpu_quantize_squash_pass.h index 98a518e4e532bb250459448e864a4fb89d55686f..d1465f9da5cc2f7973cf67c1d455984e475d79e2 100644 --- a/paddle/fluid/framework/ir/mkldnn/cpu_quantize_squash_pass.h +++ b/paddle/fluid/framework/ir/mkldnn/cpu_quantize_squash_pass.h @@ -17,6 +17,7 @@ #include #include #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" @@ -29,6 +30,8 @@ namespace ir { /* * Squash dequantize->quantize pair pattern into requantize op */ +class Graph; + class CPUQuantizeSquashPass : public FusePassBase { public: virtual ~CPUQuantizeSquashPass() {} diff --git a/paddle/fluid/framework/ir/mkldnn/depthwise_conv_mkldnn_pass.cc b/paddle/fluid/framework/ir/mkldnn/depthwise_conv_mkldnn_pass.cc index df5ba3314e637fefe930d4c45f431314dd7d8493..b2c0afdc754fb7aa3b3ffaf09e5b1961c080bcd6 100644 --- a/paddle/fluid/framework/ir/mkldnn/depthwise_conv_mkldnn_pass.cc +++ b/paddle/fluid/framework/ir/mkldnn/depthwise_conv_mkldnn_pass.cc @@ -13,6 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/ir/mkldnn/depthwise_conv_mkldnn_pass.h" + #include "paddle/fluid/framework/ir/graph_pattern_detector.h" #include "paddle/fluid/framework/op_version_registry.h" @@ -20,6 +21,8 @@ namespace paddle { namespace framework { namespace ir { +class Graph; + #define GET_NODE(id, pattern) \ PADDLE_ENFORCE_NE(subgraph.count(pattern.RetrieveNode(#id)), 0, \ platform::errors::InvalidArgument( \ diff --git a/paddle/fluid/framework/ir/mkldnn/depthwise_conv_mkldnn_pass.h b/paddle/fluid/framework/ir/mkldnn/depthwise_conv_mkldnn_pass.h index ca314afde57bbc5a339b2016a2540309b31f0598..0f4ecc71ad72020b089821a0cadc4156718230e8 100644 --- a/paddle/fluid/framework/ir/mkldnn/depthwise_conv_mkldnn_pass.h +++ b/paddle/fluid/framework/ir/mkldnn/depthwise_conv_mkldnn_pass.h @@ -20,6 +20,8 @@ namespace paddle { namespace framework { namespace ir { +class Graph; + class DepthwiseConvMKLDNNPass : public FusePassBase { public: virtual ~DepthwiseConvMKLDNNPass() {} diff --git a/paddle/fluid/framework/ir/mkldnn/fc_mkldnn_pass.cc b/paddle/fluid/framework/ir/mkldnn/fc_mkldnn_pass.cc index 95afc5483763d11c07e7d316d9f5aa29f97172b8..6efa9f6b74995450f6758200acc414e1aa2bef7f 100644 --- a/paddle/fluid/framework/ir/mkldnn/fc_mkldnn_pass.cc +++ b/paddle/fluid/framework/ir/mkldnn/fc_mkldnn_pass.cc @@ -13,18 +13,21 @@ // limitations under the License. #include "paddle/fluid/framework/ir/mkldnn/fc_mkldnn_pass.h" -#include -#include -#include -#include -#include "paddle/fluid/framework/eigen.h" -#include "paddle/fluid/framework/lod_tensor.h" + #include "paddle/fluid/platform/enforce.h" +namespace paddle { +namespace framework { +class OpDesc; +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace ir { +class Graph; + void FCMKLDNNPass::ApplyImpl(ir::Graph* graph) const { PADDLE_ENFORCE_NOT_NULL(graph, platform::errors::InvalidArgument( diff --git a/paddle/fluid/framework/ir/mkldnn/fc_mkldnn_pass.h b/paddle/fluid/framework/ir/mkldnn/fc_mkldnn_pass.h index 97c6b242989591ccf24e52a969bfcedc4f377c3f..df02250394a191b9e863e2c0bd73578b235eb79d 100644 --- a/paddle/fluid/framework/ir/mkldnn/fc_mkldnn_pass.h +++ b/paddle/fluid/framework/ir/mkldnn/fc_mkldnn_pass.h @@ -13,6 +13,7 @@ // limitations under the License. #pragma once #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" @@ -25,6 +26,8 @@ namespace ir { /* * Transpose weights of FC to comply with MKL-DNN interface */ +class Graph; + class FCMKLDNNPass : public FusePassBase { public: virtual ~FCMKLDNNPass() {} diff --git a/paddle/fluid/framework/ir/mkldnn/matmul_transpose_reshape_fuse_pass.h b/paddle/fluid/framework/ir/mkldnn/matmul_transpose_reshape_fuse_pass.h index 77e30b353467c7baca7baaac80b56e47ffef81ef..ef469bac40c4edbc524ef4b24c8df932819f0a3a 100644 --- a/paddle/fluid/framework/ir/mkldnn/matmul_transpose_reshape_fuse_pass.h +++ b/paddle/fluid/framework/ir/mkldnn/matmul_transpose_reshape_fuse_pass.h @@ -15,6 +15,7 @@ #pragma once #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" @@ -22,6 +23,8 @@ namespace paddle { namespace framework { namespace ir { +class Graph; + class MatmulTransposeReshapeMKLDNNPass : public FusePassBase { public: virtual ~MatmulTransposeReshapeMKLDNNPass() {} @@ -30,6 +33,6 @@ class MatmulTransposeReshapeMKLDNNPass : public FusePassBase { void ApplyImpl(Graph* graph) const override; const std::string name_scope_{"matmul_transpose_reshape_fuse"}; }; -} +} // namespace ir } // namespace framework } // namespace paddle diff --git a/paddle/fluid/framework/ir/mkldnn/mkldnn_placement_pass.h b/paddle/fluid/framework/ir/mkldnn/mkldnn_placement_pass.h index de699430189bfab7ccc16f0651781304bc36f8da..ca56a8900ca4f7edac7be095a0968555bf628124 100644 --- a/paddle/fluid/framework/ir/mkldnn/mkldnn_placement_pass.h +++ b/paddle/fluid/framework/ir/mkldnn/mkldnn_placement_pass.h @@ -16,6 +16,7 @@ limitations under the License. */ #include #include + #include "paddle/fluid/framework/ir/placement_pass_base.h" namespace paddle { diff --git a/paddle/fluid/framework/ir/mkldnn/reshape_transpose_matmul_mkldnn_fuse_pass.h b/paddle/fluid/framework/ir/mkldnn/reshape_transpose_matmul_mkldnn_fuse_pass.h index eab9f095623029e79a0d0f9b2697f45ac30bf3a9..7a53b3c498413e43eea7b2e4697791d36fed1149 100644 --- a/paddle/fluid/framework/ir/mkldnn/reshape_transpose_matmul_mkldnn_fuse_pass.h +++ b/paddle/fluid/framework/ir/mkldnn/reshape_transpose_matmul_mkldnn_fuse_pass.h @@ -15,6 +15,7 @@ #pragma once #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" @@ -25,6 +26,8 @@ namespace ir { /* * Fuse Reshape->Transpose->MatMul when MatMul uses mkldnn. */ +class Graph; + class ReshapeTransposeMatmulMkldnnFusePass : public FusePassBase { public: virtual ~ReshapeTransposeMatmulMkldnnFusePass() {} diff --git a/paddle/fluid/framework/ir/mkldnn/scale_matmul_fuse_pass.cc b/paddle/fluid/framework/ir/mkldnn/scale_matmul_fuse_pass.cc index 6c87e437caa1b159c889a68b4d6f5b1790217ca1..790821e3fa4bbbcff23266f734d641169e231b70 100644 --- a/paddle/fluid/framework/ir/mkldnn/scale_matmul_fuse_pass.cc +++ b/paddle/fluid/framework/ir/mkldnn/scale_matmul_fuse_pass.cc @@ -13,8 +13,10 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/ir/mkldnn/scale_matmul_fuse_pass.h" + #include #include + #include "paddle/fluid/framework/ir/graph_pattern_detector.h" #include "paddle/fluid/string/pretty_log.h" @@ -22,6 +24,8 @@ namespace paddle { namespace framework { namespace ir { +class Graph; + using string::PrettyLogDetail; void ScaleMatmulFusePass::ApplyImpl(ir::Graph* graph) const { diff --git a/paddle/fluid/framework/ir/mkldnn/scale_matmul_fuse_pass.h b/paddle/fluid/framework/ir/mkldnn/scale_matmul_fuse_pass.h index fe97b9681ce7b1c489833baa96187a50e595af3d..32ff78d9a73683c700ceb31a1505538ff7ee6119 100644 --- a/paddle/fluid/framework/ir/mkldnn/scale_matmul_fuse_pass.h +++ b/paddle/fluid/framework/ir/mkldnn/scale_matmul_fuse_pass.h @@ -20,6 +20,8 @@ namespace paddle { namespace framework { namespace ir { +class Graph; + class ScaleMatmulFusePass : public FusePassBase { public: virtual ~ScaleMatmulFusePass() {} diff --git a/paddle/fluid/framework/ir/multi_batch_merge_pass.h b/paddle/fluid/framework/ir/multi_batch_merge_pass.h index a89616683d9c625111272fd8c1de237a5c9dbe8f..ae2e68c6003a1ce2e953c1231792e674ae7cafd7 100644 --- a/paddle/fluid/framework/ir/multi_batch_merge_pass.h +++ b/paddle/fluid/framework/ir/multi_batch_merge_pass.h @@ -31,6 +31,8 @@ namespace ir { // sync training, we can simulate even large batch size as if we have more // GPUs. +class Graph; + class BatchMergePass : public Pass { public: virtual ~BatchMergePass() {} diff --git a/paddle/fluid/framework/ir/multi_devices_graph_pass/multi_devices_graph_pass.h b/paddle/fluid/framework/ir/multi_devices_graph_pass/multi_devices_graph_pass.h index bb6c80790746ee16e39ef8f7e251d54ac563242a..bb3586ba8048081f8b990e9e7eb6c85c3f6e1026 100644 --- a/paddle/fluid/framework/ir/multi_devices_graph_pass/multi_devices_graph_pass.h +++ b/paddle/fluid/framework/ir/multi_devices_graph_pass/multi_devices_graph_pass.h @@ -20,17 +20,32 @@ #include #include #include + #include "paddle/fluid/framework/details/build_strategy.h" #include "paddle/fluid/framework/details/multi_devices_helper.h" #include "paddle/fluid/framework/ir/graph.h" +namespace paddle { +namespace framework { +namespace details { +class OpHandleBase; +struct VarHandle; +} // namespace details +namespace ir { +class Graph; +} // namespace ir +} // namespace framework +} // namespace paddle + namespace paddle { namespace platform { class NCCLContextMap; +class NCCLCommunicator; } namespace framework { class Scope; + namespace ir { constexpr char kLossVarName[] = "loss_var_name"; diff --git a/paddle/fluid/framework/ir/multi_devices_graph_pass/sequential_execution_pass.cc b/paddle/fluid/framework/ir/multi_devices_graph_pass/sequential_execution_pass.cc index bcbd1e066cc1fd056f7de018a697fb842ad195eb..78e90f82bfbef344d4c8514838ce7dc99c474ebf 100644 --- a/paddle/fluid/framework/ir/multi_devices_graph_pass/sequential_execution_pass.cc +++ b/paddle/fluid/framework/ir/multi_devices_graph_pass/sequential_execution_pass.cc @@ -12,13 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include -#include -#include #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/pass.h" -#include "paddle/fluid/framework/op_proto_maker.h" + +namespace paddle { +namespace framework { +class OpDesc; +} // namespace framework +} // namespace paddle namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/ir/multi_devices_graph_pass/set_reader_device_info_utils.h b/paddle/fluid/framework/ir/multi_devices_graph_pass/set_reader_device_info_utils.h index 0038790cae245805652ff58148cda2fea94b613b..d37b21f058434e8d46e0f00ad8613f353ccdfb42 100644 --- a/paddle/fluid/framework/ir/multi_devices_graph_pass/set_reader_device_info_utils.h +++ b/paddle/fluid/framework/ir/multi_devices_graph_pass/set_reader_device_info_utils.h @@ -17,10 +17,18 @@ #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/scope.h" +namespace paddle { +namespace framework { +class Scope; +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace ir { +class Graph; + void InitReaderQueueDeviceCount(Graph *graph, const Scope &scope, size_t dev_cnt); diff --git a/paddle/fluid/framework/ir/multihead_matmul_fuse_pass.cc b/paddle/fluid/framework/ir/multihead_matmul_fuse_pass.cc index 9d2b4ebaf8ccf33e175e46c08657e7eeed467055..d1fbc8396ba55523f3769a26ceaf9ef4e7fcf65e 100644 --- a/paddle/fluid/framework/ir/multihead_matmul_fuse_pass.cc +++ b/paddle/fluid/framework/ir/multihead_matmul_fuse_pass.cc @@ -13,11 +13,11 @@ // limitations under the License. #include "paddle/fluid/framework/ir/multihead_matmul_fuse_pass.h" -#include + #include #include #include -#include "paddle/fluid/framework/ddim.h" + #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/op_version_registry.h" #include "paddle/fluid/platform/errors.h" diff --git a/paddle/fluid/framework/ir/multihead_matmul_fuse_pass.h b/paddle/fluid/framework/ir/multihead_matmul_fuse_pass.h index 0afa00fc62aa79c8a63350bc63cfe464999ca0e4..f5327dc71080be9edff30855a157465e0b35712a 100644 --- a/paddle/fluid/framework/ir/multihead_matmul_fuse_pass.h +++ b/paddle/fluid/framework/ir/multihead_matmul_fuse_pass.h @@ -16,10 +16,19 @@ #include #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" +namespace paddle { +namespace framework { +namespace ir { +class Graph; +} // namespace ir +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace ir { diff --git a/paddle/fluid/framework/ir/node.cc b/paddle/fluid/framework/ir/node.cc index 45d81b937392244f678fbd01395b3ffffd07f710..7143c9a7a3e86c88920ebfc66f90650e68505c74 100644 --- a/paddle/fluid/framework/ir/node.cc +++ b/paddle/fluid/framework/ir/node.cc @@ -13,7 +13,6 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/ir/node.h" -#include "paddle/fluid/framework/op_info.h" namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/ir/node.h b/paddle/fluid/framework/ir/node.h index 87e7e64acb71a5059b2f3bf1539ff281ac322774..d0db3bd36e13fa69d6c549916adc5ca1365784c4 100644 --- a/paddle/fluid/framework/ir/node.h +++ b/paddle/fluid/framework/ir/node.h @@ -19,10 +19,18 @@ limitations under the License. */ #include #include #include + #include "paddle/fluid/framework/op_desc.h" #include "paddle/fluid/framework/var_desc.h" #include "paddle/fluid/platform/macros.h" +namespace paddle { +namespace framework { +class OpDesc; +class VarDesc; +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { namespace ir { diff --git a/paddle/fluid/framework/ir/pass.cc b/paddle/fluid/framework/ir/pass.cc index a5ca13f1ce252d2368e2fc765e49d397356660a7..0e5f5867f47b25f3efdcf648c4243cec310ad4ca 100644 --- a/paddle/fluid/framework/ir/pass.cc +++ b/paddle/fluid/framework/ir/pass.cc @@ -14,11 +14,15 @@ limitations under the License. */ #include "paddle/fluid/framework/ir/pass.h" -#include -#include - #include "paddle/fluid/framework/ir/graph_helper.h" -#include "paddle/fluid/platform/device_context.h" + +namespace paddle { +namespace framework { +namespace ir { +class Graph; +} // namespace ir +} // namespace framework +} // namespace paddle #ifdef PADDLE_WITH_MKLDNN #include "paddle/fluid/platform/mkldnn_helper.h" #endif diff --git a/paddle/fluid/framework/ir/pass.h b/paddle/fluid/framework/ir/pass.h index 0f5ef551f044d9e53b04b6efad3954d1a48a0ac3..668dc74eab20a17d3697ebe778a1a5bb63cdab48 100644 --- a/paddle/fluid/framework/ir/pass.h +++ b/paddle/fluid/framework/ir/pass.h @@ -21,6 +21,7 @@ limitations under the License. */ #include #include #include + #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/node.h" #include "paddle/fluid/framework/program_desc.h" @@ -29,6 +30,7 @@ limitations under the License. */ namespace paddle { namespace framework { namespace ir { +class Graph; template struct PassRegistrar; diff --git a/paddle/fluid/framework/ir/pass_builder.cc b/paddle/fluid/framework/ir/pass_builder.cc index 6457bd230c59cfebd19ab7951b2c04a1890e3fce..4e99271a2ec1e5d4a0c2f28e91939ce7f5855d37 100644 --- a/paddle/fluid/framework/ir/pass_builder.cc +++ b/paddle/fluid/framework/ir/pass_builder.cc @@ -20,6 +20,8 @@ namespace paddle { namespace framework { namespace ir { +class Pass; + std::shared_ptr PassBuilder::AppendPass(const std::string& pass_type) { VLOG(1) << "Append " << pass_type; auto pass = ir::PassRegistry::Instance().Get(pass_type); diff --git a/paddle/fluid/framework/ir/pass_builder.h b/paddle/fluid/framework/ir/pass_builder.h index 733d3a3ad1ab8989ea30fe45cd7e1ffe9432de13..0e68767db3fa8e49d946d523043cc57c32b0ee99 100644 --- a/paddle/fluid/framework/ir/pass_builder.h +++ b/paddle/fluid/framework/ir/pass_builder.h @@ -14,6 +14,7 @@ limitations under the License. */ #pragma once +#include #include #include #include "paddle/fluid/framework/ir/pass.h" @@ -22,6 +23,8 @@ namespace paddle { namespace framework { namespace ir { +class Pass; + class PassBuilder { public: PassBuilder() {} diff --git a/paddle/fluid/framework/ir/pass_test.cc b/paddle/fluid/framework/ir/pass_test.cc index 0c5286b3f77e10876b0240e1245ca343471770d5..65b9c427869ee52572beb6e1696279e9892286ce 100644 --- a/paddle/fluid/framework/ir/pass_test.cc +++ b/paddle/fluid/framework/ir/pass_test.cc @@ -13,15 +13,17 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/ir/pass.h" -#include + #include -#include + #include "gtest/gtest.h" -#include "paddle/fluid/framework/ir/graph.h" namespace paddle { namespace framework { namespace ir { +class Graph; +class Node; + void BuildCircleGraph(Graph* g) { ir::Node* o1 = g->CreateEmptyNode("op1", Node::Type::kOperation); ir::Node* o2 = g->CreateEmptyNode("op2", Node::Type::kOperation); diff --git a/paddle/fluid/framework/ir/placement_pass_base.h b/paddle/fluid/framework/ir/placement_pass_base.h index 5cdd7963e54b9668165fd5e71d8164d71206ecaf..ef1a920db3fd169904d4ebbd8fe0635444d17bd7 100644 --- a/paddle/fluid/framework/ir/placement_pass_base.h +++ b/paddle/fluid/framework/ir/placement_pass_base.h @@ -16,6 +16,7 @@ limitations under the License. */ #include #include + #include "paddle/fluid/framework/ir/pass.h" namespace paddle { @@ -25,6 +26,8 @@ namespace ir { /* * Specifies which operators should use cuDNN. */ +class Graph; + class PlacementPassBase : public Pass { protected: void ApplyImpl(ir::Graph* graph) const override; diff --git a/paddle/fluid/framework/ir/repeated_fc_relu_fuse_pass.cc b/paddle/fluid/framework/ir/repeated_fc_relu_fuse_pass.cc index 9f6032ffa5b87daece107ad6bd3d5f9444719e44..af4a2f4060572fdffbfaa9fdf2647aa025df9957 100644 --- a/paddle/fluid/framework/ir/repeated_fc_relu_fuse_pass.cc +++ b/paddle/fluid/framework/ir/repeated_fc_relu_fuse_pass.cc @@ -13,10 +13,11 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/ir/repeated_fc_relu_fuse_pass.h" -#include // for max +#include #include #include #include + #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/op_version_registry.h" diff --git a/paddle/fluid/framework/ir/repeated_fc_relu_fuse_pass.h b/paddle/fluid/framework/ir/repeated_fc_relu_fuse_pass.h index ae777bccebec9f99b4752fe495f96d3da38aac23..0be217cc748a248f4e5bf8d98922cb8ebdbd3e3c 100644 --- a/paddle/fluid/framework/ir/repeated_fc_relu_fuse_pass.h +++ b/paddle/fluid/framework/ir/repeated_fc_relu_fuse_pass.h @@ -15,6 +15,7 @@ #pragma once #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" @@ -26,6 +27,8 @@ namespace ir { /** * Fuse Repeated FC Relu */ +class Graph; + class RepeatedFCReluFusePass : public FusePassBase { public: virtual ~RepeatedFCReluFusePass() {} diff --git a/paddle/fluid/framework/ir/runtime_context_cache_pass.h b/paddle/fluid/framework/ir/runtime_context_cache_pass.h index e4783166e0cbde0be9037df5afe3e903a40a2065..741adcce8d76713001d1c2385d7acf8855092d3e 100644 --- a/paddle/fluid/framework/ir/runtime_context_cache_pass.h +++ b/paddle/fluid/framework/ir/runtime_context_cache_pass.h @@ -15,12 +15,15 @@ limitations under the License. */ #pragma once #include + #include "paddle/fluid/framework/ir/pass.h" namespace paddle { namespace framework { namespace ir { +class Graph; + class RuntimeContextCachePass : public Pass { protected: void ApplyImpl(ir::Graph* graph) const override; diff --git a/paddle/fluid/framework/ir/seq_concat_fc_fuse_pass.cc b/paddle/fluid/framework/ir/seq_concat_fc_fuse_pass.cc index 19ec2d818a3db5140031287618f054f8468970fe..7daa9b5eff7d7ba25f38726efc88b23e072c491d 100644 --- a/paddle/fluid/framework/ir/seq_concat_fc_fuse_pass.cc +++ b/paddle/fluid/framework/ir/seq_concat_fc_fuse_pass.cc @@ -16,10 +16,7 @@ #include #include #include -#include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" -#include "paddle/fluid/framework/ir/graph_viz_pass.h" -#include "paddle/fluid/framework/lod_tensor.h" namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/ir/seq_concat_fc_fuse_pass.h b/paddle/fluid/framework/ir/seq_concat_fc_fuse_pass.h index d68840a554777e64082f7f9e467221bc0948d9dd..a70411536455757b49292e990d27e372651b88c9 100644 --- a/paddle/fluid/framework/ir/seq_concat_fc_fuse_pass.h +++ b/paddle/fluid/framework/ir/seq_concat_fc_fuse_pass.h @@ -22,6 +22,8 @@ namespace paddle { namespace framework { namespace ir { +class Graph; + class SeqConcatFcFusePass : public FusePassBase { public: virtual ~SeqConcatFcFusePass() {} diff --git a/paddle/fluid/framework/ir/seqconv_eltadd_relu_fuse_pass.cc b/paddle/fluid/framework/ir/seqconv_eltadd_relu_fuse_pass.cc index 75ab04f1b9130dccd42cea39dc0e074e2e2838eb..d9a1348e05a1291cb1bf8e398c187afaebecfca6 100644 --- a/paddle/fluid/framework/ir/seqconv_eltadd_relu_fuse_pass.cc +++ b/paddle/fluid/framework/ir/seqconv_eltadd_relu_fuse_pass.cc @@ -15,6 +15,7 @@ #include "paddle/fluid/framework/ir/seqconv_eltadd_relu_fuse_pass.h" #include #include + #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/op_version_registry.h" @@ -22,6 +23,8 @@ namespace paddle { namespace framework { namespace ir { +class Node; + int BuildFusion(Graph* graph, const std::string& name_scope, Scope* scope) { GraphPatternDetector gpd; auto* pattern = gpd.mutable_pattern(); diff --git a/paddle/fluid/framework/ir/seqconv_eltadd_relu_fuse_pass.h b/paddle/fluid/framework/ir/seqconv_eltadd_relu_fuse_pass.h index fde9b586c85712b14d285cec49f9e09efad78fc7..6f623625f51d8217370f2eabfb6820eebeb6e07a 100644 --- a/paddle/fluid/framework/ir/seqconv_eltadd_relu_fuse_pass.h +++ b/paddle/fluid/framework/ir/seqconv_eltadd_relu_fuse_pass.h @@ -15,6 +15,7 @@ #pragma once #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" @@ -23,6 +24,8 @@ namespace paddle { namespace framework { namespace ir { +class Graph; + class SeqConvEltAddReluFusePass : public FusePassBase { public: virtual ~SeqConvEltAddReluFusePass() {} diff --git a/paddle/fluid/framework/ir/seqpool_concat_fuse_pass.cc b/paddle/fluid/framework/ir/seqpool_concat_fuse_pass.cc index 1c220ee4d571815eaf26255db2c519dc4821068c..b6badf745c6bd5a972f3aef438517015228fe612 100644 --- a/paddle/fluid/framework/ir/seqpool_concat_fuse_pass.cc +++ b/paddle/fluid/framework/ir/seqpool_concat_fuse_pass.cc @@ -16,7 +16,14 @@ #include #include #include -#include "paddle/fluid/framework/lod_tensor.h" + +namespace paddle { +namespace framework { +namespace ir { +class Node; +} // namespace ir +} // namespace framework +} // namespace paddle #define MAX_CONCAT_INPUTS 200 diff --git a/paddle/fluid/framework/ir/seqpool_concat_fuse_pass.h b/paddle/fluid/framework/ir/seqpool_concat_fuse_pass.h index 40a9edc5e642320996f5bd3451479fe347f24081..482fd5cb5802d5e685dcf0eb41f23bd4d66b40db 100644 --- a/paddle/fluid/framework/ir/seqpool_concat_fuse_pass.h +++ b/paddle/fluid/framework/ir/seqpool_concat_fuse_pass.h @@ -15,6 +15,7 @@ #pragma once #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" @@ -37,6 +38,8 @@ namespace ir { * FusionSeqPoolConcat * | */ +class Graph; + class SeqPoolConcatFusePass : public FusePassBase { public: virtual ~SeqPoolConcatFusePass() {} diff --git a/paddle/fluid/framework/ir/seqpool_cvm_concat_fuse_pass.cc b/paddle/fluid/framework/ir/seqpool_cvm_concat_fuse_pass.cc index 8261bfc15348f90af4ed7acb9e5b68373dc5e715..d639d410466d947caeb32cada32c185d376a61c1 100644 --- a/paddle/fluid/framework/ir/seqpool_cvm_concat_fuse_pass.cc +++ b/paddle/fluid/framework/ir/seqpool_cvm_concat_fuse_pass.cc @@ -13,16 +13,17 @@ * limitations under the License. */ #include "paddle/fluid/framework/ir/seqpool_cvm_concat_fuse_pass.h" -#include #include #include #include -#include "paddle/fluid/framework/lod_tensor.h" namespace paddle { namespace framework { namespace ir { +class Graph; +class Node; + namespace { static PDNode* BuildCVMConcatPattern(PDPattern* pattern) { auto cvm_behind_x = [](Node* x) -> bool { diff --git a/paddle/fluid/framework/ir/seqpool_cvm_concat_fuse_pass.h b/paddle/fluid/framework/ir/seqpool_cvm_concat_fuse_pass.h index 88a41983c6bf7b4e76d7912dbb3821b2c2ed533b..b0a3573fb59f975400e43b6ae842c23ad262e2ff 100644 --- a/paddle/fluid/framework/ir/seqpool_cvm_concat_fuse_pass.h +++ b/paddle/fluid/framework/ir/seqpool_cvm_concat_fuse_pass.h @@ -15,6 +15,7 @@ #pragma once #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" @@ -39,6 +40,8 @@ namespace ir { * FusionSeqPoolCVMConcat * | */ +class Graph; + class SeqPoolCVMConcatFusePass : public FusePassBase { public: virtual ~SeqPoolCVMConcatFusePass() {} diff --git a/paddle/fluid/framework/ir/shuffle_channel_detect_pass.cc b/paddle/fluid/framework/ir/shuffle_channel_detect_pass.cc index 8bdf3940928c768fc7b0a9c7fa3d084d95f60859..92e995579fa9e5594718c88586322038b1688047 100644 --- a/paddle/fluid/framework/ir/shuffle_channel_detect_pass.cc +++ b/paddle/fluid/framework/ir/shuffle_channel_detect_pass.cc @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - -#include "paddle/fluid/framework/ir/graph_viz_pass.h" #include "paddle/fluid/framework/ir/shuffle_channel_detect_pass.h" #include "paddle/fluid/framework/op_version_registry.h" diff --git a/paddle/fluid/framework/ir/shuffle_channel_detect_pass.h b/paddle/fluid/framework/ir/shuffle_channel_detect_pass.h index 008f8013efd28b3cdc5a846662653e07e45e3985..dc375988cdd5d42b1e1a030952fbf8ecb4fdc675 100644 --- a/paddle/fluid/framework/ir/shuffle_channel_detect_pass.h +++ b/paddle/fluid/framework/ir/shuffle_channel_detect_pass.h @@ -14,6 +14,7 @@ #pragma once #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" diff --git a/paddle/fluid/framework/ir/simplify_with_basic_ops_pass.cc b/paddle/fluid/framework/ir/simplify_with_basic_ops_pass.cc index 2e5c18d3352bc655756522b32cbfd92f7ad4b4cb..5cc6b6171ac3be3951c550fb160115c982dbdb7d 100644 --- a/paddle/fluid/framework/ir/simplify_with_basic_ops_pass.cc +++ b/paddle/fluid/framework/ir/simplify_with_basic_ops_pass.cc @@ -15,7 +15,6 @@ limitations under the License. */ #include "paddle/fluid/framework/ir/simplify_with_basic_ops_pass.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" -#include "paddle/fluid/framework/ir/pass_tester_helper.h" namespace paddle { namespace framework { @@ -30,6 +29,8 @@ namespace ir { * - remove dropout_op (upscale_in_train) or * replace dropout_op with scale_op (downgrade_in_infer) when is_test is true */ +class Graph; + void SimplifyWithBasicOpsPass::ApplyImpl(Graph* graph) const { VLOG(3) << "Simplify the Graph with basic ops."; std::unordered_set del_node_set; diff --git a/paddle/fluid/framework/ir/simplify_with_basic_ops_pass.h b/paddle/fluid/framework/ir/simplify_with_basic_ops_pass.h index f5185622468055939103876387662f6402a45bfe..6a245c444a7ec8dd800d8432693d2fa247360634 100644 --- a/paddle/fluid/framework/ir/simplify_with_basic_ops_pass.h +++ b/paddle/fluid/framework/ir/simplify_with_basic_ops_pass.h @@ -16,12 +16,16 @@ limitations under the License. */ #include #include + #include "paddle/fluid/framework/ir/pass.h" namespace paddle { namespace framework { namespace ir { +class Graph; +class Node; + class SimplifyWithBasicOpsPass : public Pass { protected: void ApplyImpl(Graph* graph) const override; diff --git a/paddle/fluid/framework/ir/skip_layernorm_fuse_pass.cc b/paddle/fluid/framework/ir/skip_layernorm_fuse_pass.cc index 2e3cd16d5ce49fdd6186f98c72d77c75c4053559..e5f348dfeb13e97632aa4901b6109576a21f67af 100644 --- a/paddle/fluid/framework/ir/skip_layernorm_fuse_pass.cc +++ b/paddle/fluid/framework/ir/skip_layernorm_fuse_pass.cc @@ -13,9 +13,10 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/ir/skip_layernorm_fuse_pass.h" + #include #include -#include + #include "paddle/fluid/framework/ir/graph_pattern_detector.h" #include "paddle/fluid/framework/op_version_registry.h" diff --git a/paddle/fluid/framework/ir/skip_layernorm_fuse_pass.h b/paddle/fluid/framework/ir/skip_layernorm_fuse_pass.h index 2de8d3762219ffc0ff5500996f53dd8e3117dc61..3a3e50052396a538aebb9027cb444b819129af95 100644 --- a/paddle/fluid/framework/ir/skip_layernorm_fuse_pass.h +++ b/paddle/fluid/framework/ir/skip_layernorm_fuse_pass.h @@ -29,6 +29,8 @@ namespace ir { // | | // other_op3 // | +class Graph; + class SkipLayerNormFusePass : public FusePassBase { public: virtual ~SkipLayerNormFusePass() {} diff --git a/paddle/fluid/framework/ir/squared_mat_sub_fuse_pass.h b/paddle/fluid/framework/ir/squared_mat_sub_fuse_pass.h index 56b7ec9b84314bd3634c406c31e20dd421f7fa92..90def957df4bf0907a306798fbb1e9ba53c37919 100644 --- a/paddle/fluid/framework/ir/squared_mat_sub_fuse_pass.h +++ b/paddle/fluid/framework/ir/squared_mat_sub_fuse_pass.h @@ -15,6 +15,7 @@ #pragma once #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" @@ -26,6 +27,8 @@ namespace ir { /** * Fuse ( (A * B).^2 - (A.^2 * B.^2) ) .* scalar */ +class Graph; + class SquaredMatSubFusePass : public FusePassBase { public: virtual ~SquaredMatSubFusePass() {} diff --git a/paddle/fluid/framework/ir/subgraph_detector.cc b/paddle/fluid/framework/ir/subgraph_detector.cc index 7979953d7be827ffc944ae939782923504802bbc..6ebe900e26baad40d69beeb082e76b072a863621 100644 --- a/paddle/fluid/framework/ir/subgraph_detector.cc +++ b/paddle/fluid/framework/ir/subgraph_detector.cc @@ -13,18 +13,17 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/ir/subgraph_detector.h" -#include #include #include #include -#include "paddle/fluid/framework/ir/graph_helper.h" -#include "paddle/fluid/framework/ir/graph_pattern_detector.h" -#include "paddle/fluid/framework/ir/node.h" namespace paddle { namespace framework { namespace ir { +class Graph; +class Node; + std::pair, std::vector> ExtractInputAndOutputOfSubGraph(std::vector &graph) { // NOLINT std::unordered_set nodes(graph.begin(), graph.end()); diff --git a/paddle/fluid/framework/ir/subgraph_detector.h b/paddle/fluid/framework/ir/subgraph_detector.h index 3d279e27e6ae97978e46f7282f58d4a4ca1efdde..6bd73c758b377c9653b23b4ac4ad3b08fb1aea8f 100644 --- a/paddle/fluid/framework/ir/subgraph_detector.h +++ b/paddle/fluid/framework/ir/subgraph_detector.h @@ -16,6 +16,7 @@ limitations under the License. */ #include #include + #include "paddle/fluid/framework/ir/graph.h" #include "paddle/fluid/framework/ir/graph_traits.h" #include "paddle/fluid/framework/ir/node.h" @@ -24,6 +25,9 @@ namespace paddle { namespace framework { namespace ir { +class Graph; +class Node; + const char kIsFunctionNode[] = "__is_function_node__"; const char kFunctionNodeSubGraph[] = "__function_node_sub_graph__"; const char kSubgraphSplitterMarkerAttrName[] = diff --git a/paddle/fluid/framework/ir/sync_batch_norm_pass.cc b/paddle/fluid/framework/ir/sync_batch_norm_pass.cc index 222c73761b4f5d960b1efafdb2e4368c17519fec..3fa008c300c5c8d0741bcdb1c4b3ef2dc8b0c0fc 100644 --- a/paddle/fluid/framework/ir/sync_batch_norm_pass.cc +++ b/paddle/fluid/framework/ir/sync_batch_norm_pass.cc @@ -12,15 +12,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 "paddle/fluid/framework/ir/pass.h" namespace paddle { namespace framework { namespace ir { +class Graph; + class SyncBatchNormPass : public Pass { protected: void ApplyImpl(ir::Graph *graph) const override { diff --git a/paddle/fluid/framework/ir/transpose_flatten_concat_fuse_pass.cc b/paddle/fluid/framework/ir/transpose_flatten_concat_fuse_pass.cc index 405cefa99ebbbe147fc96f63567e13607732780e..2db6d0230e3f9265be8a6d150f75ad5c04b3fef0 100644 --- a/paddle/fluid/framework/ir/transpose_flatten_concat_fuse_pass.cc +++ b/paddle/fluid/framework/ir/transpose_flatten_concat_fuse_pass.cc @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include #include #include diff --git a/paddle/fluid/framework/lod_rank_table.h b/paddle/fluid/framework/lod_rank_table.h index 8c6e8b0c66ead96f0e53b56ee951887730b0d77f..9a7c1285e305cf3527265f75db0d3b5c02d5f507 100644 --- a/paddle/fluid/framework/lod_rank_table.h +++ b/paddle/fluid/framework/lod_rank_table.h @@ -15,6 +15,7 @@ limitations under the License. */ #pragma once #include #include + #include "paddle/fluid/framework/lod_tensor.h" namespace paddle { diff --git a/paddle/fluid/framework/lod_tensor.cc b/paddle/fluid/framework/lod_tensor.cc index 40615d772e555bb9e2ac44a6339de9f3be3c9562..a044812dd3153b5752201ed57513e04cef8aecf4 100644 --- a/paddle/fluid/framework/lod_tensor.cc +++ b/paddle/fluid/framework/lod_tensor.cc @@ -12,19 +12,16 @@ 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 "paddle/fluid/framework/lod_tensor.h" #include -#include #include -#include - -#include "paddle/fluid/framework/data_type.h" -#include "paddle/fluid/framework/framework.pb.h" -#include "paddle/fluid/framework/lod_tensor.h" -#include "paddle/fluid/framework/var_type.h" #include "paddle/fluid/framework/version.h" -#include "paddle/fluid/memory/memcpy.h" -#include "paddle/fluid/memory/memory.h" +namespace paddle { +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/lod_tensor.h b/paddle/fluid/framework/lod_tensor.h index da97efb616840b6663677475c4ca5dab68d7ccfe..e09a628f491604e74449965ccc3e19a25a78e66d 100644 --- a/paddle/fluid/framework/lod_tensor.h +++ b/paddle/fluid/framework/lod_tensor.h @@ -24,6 +24,7 @@ limitations under the License. */ #endif #include + #include "paddle/fluid/framework/ddim.h" #include "paddle/fluid/framework/mixed_vector.h" #include "paddle/fluid/framework/tensor.h" @@ -31,6 +32,15 @@ limitations under the License. */ #include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/platform/place.h" +namespace paddle { +namespace framework { +class LoDTensor; +} // namespace framework +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/lod_tensor_test.cc b/paddle/fluid/framework/lod_tensor_test.cc index c93c3f2673b1d80ef1e1a9dd68ad50501ba16f42..e3223e67fc94df883dc4ef2fcea3a6ecb7ef9512 100644 --- a/paddle/fluid/framework/lod_tensor_test.cc +++ b/paddle/fluid/framework/lod_tensor_test.cc @@ -14,9 +14,6 @@ #include #include -#include -#include -#include #include "paddle/fluid/framework/lod_tensor.h" diff --git a/paddle/fluid/framework/mixed_vector.h b/paddle/fluid/framework/mixed_vector.h index 280996d34dd73e067e4e42848ea52dbbd6745caa..3a6e80f718d18f392e0548d883c13288ef38eb47 100644 --- a/paddle/fluid/framework/mixed_vector.h +++ b/paddle/fluid/framework/mixed_vector.h @@ -20,14 +20,14 @@ limitations under the License. */ #include // NOLINT #include #include + +#include "glog/logging.h" #include "paddle/fluid/framework/details/cow_ptr.h" #include "paddle/fluid/framework/tensor.h" #include "paddle/fluid/framework/tensor_util.h" #include "paddle/fluid/memory/malloc.h" #include "paddle/fluid/memory/memcpy.h" -#include "glog/logging.h" - namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/mixed_vector_test.cc b/paddle/fluid/framework/mixed_vector_test.cc index 0599c8d384641606b0a5ebb5ba1781b56f539e63..a40a3ff33fe354fd50b2e9cc24dd6a73da01a62a 100644 --- a/paddle/fluid/framework/mixed_vector_test.cc +++ b/paddle/fluid/framework/mixed_vector_test.cc @@ -12,11 +12,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -#include - +#include "paddle/fluid/framework/mixed_vector.h" #include "glog/logging.h" #include "gtest/gtest.h" -#include "paddle/fluid/framework/mixed_vector.h" template using vec = paddle::framework::Vector; diff --git a/paddle/fluid/framework/naive_executor.h b/paddle/fluid/framework/naive_executor.h index 81402a650a3e334e273c18b279c241282ac5bf1f..75677ef5243da698caff0788a200c206b47dc875 100644 --- a/paddle/fluid/framework/naive_executor.h +++ b/paddle/fluid/framework/naive_executor.h @@ -14,8 +14,10 @@ #pragma once +#include #include #include + #include "paddle/fluid/framework/operator.h" #include "paddle/fluid/framework/program_desc.h" #include "paddle/fluid/framework/scope.h" @@ -28,6 +30,10 @@ namespace framework { * Simple, intuitive and effective. Only single thread is supported, and * currently designed for inference. */ +class LoDTensor; +class ProgramDesc; +class Scope; + class NaiveExecutor { public: explicit NaiveExecutor(const platform::Place& place) : place_(place) {} diff --git a/paddle/fluid/framework/no_need_buffer_vars_inference.h b/paddle/fluid/framework/no_need_buffer_vars_inference.h index 5d30f34090e230f1766a38992674dd9d0dc9a137..21ba0381fe6ccfc9b5643e2963828b816ea6d96d 100644 --- a/paddle/fluid/framework/no_need_buffer_vars_inference.h +++ b/paddle/fluid/framework/no_need_buffer_vars_inference.h @@ -18,6 +18,7 @@ #include #include #include + #include "paddle/fluid/framework/type_defs.h" #include "paddle/fluid/imperative/type_defs.h" #include "paddle/fluid/platform/enforce.h" diff --git a/paddle/fluid/framework/op_call_stack.h b/paddle/fluid/framework/op_call_stack.h index d48cf27285a0a5040b5e375a27ccf6a8b00bd8c0..f633538e700b242469bce6d76dfb58e89f9cdbe8 100644 --- a/paddle/fluid/framework/op_call_stack.h +++ b/paddle/fluid/framework/op_call_stack.h @@ -15,9 +15,16 @@ limitations under the License. */ #pragma once #include + #include "paddle/fluid/framework/type_defs.h" #include "paddle/fluid/platform/enforce.h" +namespace paddle { +namespace platform { +struct EnforceNotMet; +} // namespace platform +} // namespace paddle + namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/op_compatible_info.h b/paddle/fluid/framework/op_compatible_info.h index 08b5734b5bfe33d4269c06d639448eefd26fcb06..01fbdef99cbbc287d0d473b48fd42ca0706445af 100644 --- a/paddle/fluid/framework/op_compatible_info.h +++ b/paddle/fluid/framework/op_compatible_info.h @@ -14,6 +14,7 @@ #include #include + #include "paddle/fluid/framework/program_desc.h" #pragma once @@ -21,6 +22,10 @@ namespace paddle { namespace framework { +namespace proto { +class OpCompatibleMap; +} // namespace proto + enum class OpCompatibleType { compatible = 0, // support previous version DEFIN_NOT = 1, // definitely can't support previous version diff --git a/paddle/fluid/framework/op_compatible_info_test.cc b/paddle/fluid/framework/op_compatible_info_test.cc index 43959c8b2abd868a705b5e21950cdca2faaebe5c..98f3f5071ad285feaadcdf2b13a3c756477b2f18 100644 --- a/paddle/fluid/framework/op_compatible_info_test.cc +++ b/paddle/fluid/framework/op_compatible_info_test.cc @@ -13,14 +13,17 @@ // limitations under the License. #include "paddle/fluid/framework/op_compatible_info.h" -#include + #include "gtest/gtest.h" #include "paddle/fluid/framework/program_desc.h" -#include "paddle/fluid/platform/macros.h" namespace paddle { namespace framework { +namespace proto { +class OpCompatibleMap; +} // namespace proto + TEST(test_op_compatible_info, test_op_compatible) { auto comp_map = OpCompatibleMap(); comp_map.InitOpCompatibleMap(); diff --git a/paddle/fluid/framework/op_desc.h b/paddle/fluid/framework/op_desc.h index e15f0012fdc2ebfecec8daebbd3c04b917cd7a84..95c33bca6c7f1df6ad71a3b4c2f82d726cafb5fc 100644 --- a/paddle/fluid/framework/op_desc.h +++ b/paddle/fluid/framework/op_desc.h @@ -18,6 +18,7 @@ limitations under the License. */ #include #include #include + #include "paddle/fluid/framework/attribute.h" #include "paddle/fluid/framework/type_defs.h" #include "paddle/fluid/framework/var_desc.h" @@ -27,6 +28,7 @@ namespace framework { class BlockDesc; class ProgramDesc; + class OpDesc { public: OpDesc() {} diff --git a/paddle/fluid/framework/op_info.cc b/paddle/fluid/framework/op_info.cc index c815e194d43e149f9efe0daec820c42e87f81d0c..820a83586b31701cf0cc4e6b968be2fd48fe2f96 100644 --- a/paddle/fluid/framework/op_info.cc +++ b/paddle/fluid/framework/op_info.cc @@ -14,8 +14,6 @@ limitations under the License. */ #include "paddle/fluid/framework/op_info.h" #include -#include -#include namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/op_info.h b/paddle/fluid/framework/op_info.h index 89b499975790060a3a3e3f665c35f8545922e6a7..af657232e91a68aa26ab85faf63acdd1b8f191d1 100644 --- a/paddle/fluid/framework/op_info.h +++ b/paddle/fluid/framework/op_info.h @@ -20,13 +20,18 @@ limitations under the License. */ #include #include "paddle/fluid/framework/attribute.h" +#include "paddle/fluid/framework/framework.pb.h" #include "paddle/fluid/framework/no_need_buffer_vars_inference.h" #include "paddle/fluid/framework/type_defs.h" +#include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/platform/macros.h" namespace paddle { namespace framework { +class InferShapeContext; +class OpAttrChecker; + class InferShapeBase { public: virtual ~InferShapeBase() = default; diff --git a/paddle/fluid/framework/op_kernel_type.h b/paddle/fluid/framework/op_kernel_type.h index 9edc1a3e150027b5a3dbd8483dc8b58d1d4ab918..f4e60bb9b78547e84941a1caf60399044ec79143 100644 --- a/paddle/fluid/framework/op_kernel_type.h +++ b/paddle/fluid/framework/op_kernel_type.h @@ -15,6 +15,7 @@ limitations under the License. */ #pragma once #include + #include "paddle/fluid/framework/data_layout.h" #include "paddle/fluid/framework/data_type.h" #include "paddle/fluid/framework/library_type.h" diff --git a/paddle/fluid/framework/op_kernel_type_test.cc b/paddle/fluid/framework/op_kernel_type_test.cc index 40db85400d2c8776b82ce0fa2fb4deed993b0255..2979750fba792495e143e070523472a192ee12de 100644 --- a/paddle/fluid/framework/op_kernel_type_test.cc +++ b/paddle/fluid/framework/op_kernel_type_test.cc @@ -13,8 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/op_kernel_type.h" + #include -#include TEST(OpKernelType, ToString) { using OpKernelType = paddle::framework::OpKernelType; diff --git a/paddle/fluid/framework/op_proto_maker_test.cc b/paddle/fluid/framework/op_proto_maker_test.cc index a8030d377fdb4d4aef74b315e21792dad10fac96..56f940e399776a08626863d6f2b72ef37a294233 100644 --- a/paddle/fluid/framework/op_proto_maker_test.cc +++ b/paddle/fluid/framework/op_proto_maker_test.cc @@ -16,6 +16,12 @@ limitations under the License. */ #include "gtest/gtest.h" +namespace paddle { +namespace platform { +struct EnforceNotMet; +} // namespace platform +} // namespace paddle + class TestAttrProtoMaker : public paddle::framework::OpProtoAndCheckerMaker { public: void Make() { diff --git a/paddle/fluid/framework/op_registry.cc b/paddle/fluid/framework/op_registry.cc index 81cfaf92e391de28356dec05fd7b94cce3e51440..72dd6fa6bbd139c489ccea62ba46c73772f72033 100644 --- a/paddle/fluid/framework/op_registry.cc +++ b/paddle/fluid/framework/op_registry.cc @@ -14,8 +14,6 @@ limitations under the License. */ #include "paddle/fluid/framework/op_registry.h" -#include - namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/op_registry.h b/paddle/fluid/framework/op_registry.h index 6408fadf90ae32adf048156d1369cf22a76d20ea..77383386fa11d5bb297ac5636c8ec122a69a7e6b 100644 --- a/paddle/fluid/framework/op_registry.h +++ b/paddle/fluid/framework/op_registry.h @@ -35,6 +35,12 @@ limitations under the License. */ #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/framework/shape_inference.h" +namespace paddle { +namespace framework { +class ExecutionContext; +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/op_version_registry_test.cc b/paddle/fluid/framework/op_version_registry_test.cc index 239dbc4357854a8962567129b259a64260308b49..d6b18751cefe56c75da8d0f6d6070b849e872bfc 100644 --- a/paddle/fluid/framework/op_version_registry_test.cc +++ b/paddle/fluid/framework/op_version_registry_test.cc @@ -12,7 +12,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -#include #include #include "paddle/fluid/framework/op_version_registry.h" diff --git a/paddle/fluid/framework/operator.h b/paddle/fluid/framework/operator.h index bd52d7ffef5040f596bfb5ca9521a6e1062bb5aa..d493f350e69736fddc2cbda56a8e3967235bce8a 100644 --- a/paddle/fluid/framework/operator.h +++ b/paddle/fluid/framework/operator.h @@ -39,6 +39,15 @@ limitations under the License. */ #include "paddle/fluid/platform/device_context.h" #include "paddle/fluid/platform/variant.h" +namespace paddle { +namespace framework { +class InferShapeContext; +class OpInfo; +class Scope; +class Variable; +} // namespace framework +} // namespace paddle + DECLARE_int32(inner_op_parallelism); namespace paddle { @@ -105,8 +114,8 @@ inline std::string GradOriginalVarName(const std::string& grad_var_name) { const Tensor* GetLoDTensorOrSelectedRowsValueFromVar(const Variable& var); Tensor* GetMutableLoDTensorOrSelectedRowsValueFromVar(Variable* var); -class OperatorBase; class ExecutionContext; +class OperatorBase; class RuntimeContext { public: diff --git a/paddle/fluid/framework/program_desc.h b/paddle/fluid/framework/program_desc.h index d5e9c755f1298bcd31ea9093b5912a46133d0228..5cafc9111da6734405b2150328f3f356c92c69fd 100644 --- a/paddle/fluid/framework/program_desc.h +++ b/paddle/fluid/framework/program_desc.h @@ -17,6 +17,7 @@ limitations under the License. */ #include #include #include + #include "paddle/fluid/framework/block_desc.h" #include "paddle/fluid/framework/framework.pb.h" #include "paddle/fluid/framework/proto_desc.h" diff --git a/paddle/fluid/framework/program_desc_test.cc b/paddle/fluid/framework/program_desc_test.cc index 48bde2785e6a51afc0d2905ac31fe20a3c3019b6..0ba1099b03231443d59c0dc820af140ab6ab4053 100644 --- a/paddle/fluid/framework/program_desc_test.cc +++ b/paddle/fluid/framework/program_desc_test.cc @@ -13,11 +13,13 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/program_desc.h" + #include "gtest/gtest.h" -#include "paddle/fluid/framework/block_desc.h" namespace paddle { namespace framework { +class VarDesc; + TEST(ProgramDesc, copy_ctor) { ProgramDesc program; auto* global_block = program.MutableBlock(0); diff --git a/paddle/fluid/framework/prune.h b/paddle/fluid/framework/prune.h index 63e8aaad73575e7561428a9de43b86f75c22e65e..57f282536bf46e374cab24339790a715f4669e7b 100644 --- a/paddle/fluid/framework/prune.h +++ b/paddle/fluid/framework/prune.h @@ -19,6 +19,7 @@ limitations under the License. */ #include #include #include + #include "paddle/fluid/framework/framework.pb.h" #include "paddle/fluid/framework/program_desc.h" #include "paddle/fluid/platform/enforce.h" diff --git a/paddle/fluid/framework/prune_test.cc b/paddle/fluid/framework/prune_test.cc index 12fa0c61f8121d475a0cf2aa78e4bb995a01b132..618eaba3c5b8bb09a4e413b32db62f3a80d3c557 100644 --- a/paddle/fluid/framework/prune_test.cc +++ b/paddle/fluid/framework/prune_test.cc @@ -15,13 +15,9 @@ limitations under the License. */ #include "paddle/fluid/framework/prune.h" #include -#include #include #include -#include "paddle/fluid/framework/attribute.h" -#include "paddle/fluid/framework/operator.h" - #include "paddle/fluid/framework/block_desc.h" #include "paddle/fluid/framework/op_desc.h" #include "paddle/fluid/framework/program_desc.h" diff --git a/paddle/fluid/framework/pull_dense_worker.cc b/paddle/fluid/framework/pull_dense_worker.cc index 9f4c817db7d81ff6d8a9afb9d5cee7b4f1dd0ed2..c399c5d02eb19d08f929168de0804ecea18cde37 100644 --- a/paddle/fluid/framework/pull_dense_worker.cc +++ b/paddle/fluid/framework/pull_dense_worker.cc @@ -12,12 +12,16 @@ 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 "paddle/fluid/framework/device_worker.h" -#include "paddle/fluid/framework/fleet/fleet_wrapper.h" namespace paddle { namespace framework { +class LoDTensor; +class Scope; +class Variable; + std::shared_ptr PullDenseWorker::s_instance_ = NULL; std::mutex PullDenseWorker::mutex_for_version_; std::map PullDenseWorker::last_versions_; diff --git a/paddle/fluid/framework/rw_lock_test.cc b/paddle/fluid/framework/rw_lock_test.cc index 16f9cbb65229f10912ee90436c3557aaaca169b8..601b10787bea15cc96b47c051f6c3f42df5697e5 100644 --- a/paddle/fluid/framework/rw_lock_test.cc +++ b/paddle/fluid/framework/rw_lock_test.cc @@ -14,7 +14,6 @@ limitations under the License. */ #include "paddle/fluid/framework/rw_lock.h" #include -#include // NOLINT #include // NOLINT #include diff --git a/paddle/fluid/framework/save_load_util.h b/paddle/fluid/framework/save_load_util.h index 6b50c93ddbd2be8aba65cbdd8942278a2e1af3a2..0b96e002e30acf986ee853e49ba9b70cf2a47d27 100644 --- a/paddle/fluid/framework/save_load_util.h +++ b/paddle/fluid/framework/save_load_util.h @@ -28,6 +28,8 @@ namespace paddle { namespace framework { +class Scope; + bool SaveStaticNameListToDisk( const std::string& file_name, const std::vector& vec_tensor_name_list, const Scope& scope); diff --git a/paddle/fluid/framework/save_load_util_test.cc b/paddle/fluid/framework/save_load_util_test.cc index 4a54e2d46684936bf32d8b87181dd746fd1b142c..10a34d7ce91ad27a271b8a112a1af1e39da52e31 100644 --- a/paddle/fluid/framework/save_load_util_test.cc +++ b/paddle/fluid/framework/save_load_util_test.cc @@ -13,12 +13,9 @@ // limitations under the License. #include #include -#include -#include #include "gtest/gtest.h" #include "paddle/fluid/framework/save_load_util.h" -#include "paddle/fluid/platform/macros.h" namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/scope.h b/paddle/fluid/framework/scope.h index db7010ecceb3e7c39cdfd78c5e82074dba199fc7..922e9a9b272727ec0eaaf3c8dea5172552af95d1 100644 --- a/paddle/fluid/framework/scope.h +++ b/paddle/fluid/framework/scope.h @@ -30,6 +30,12 @@ extern "C" { #include "paddle/fluid/framework/variable.h" #include "paddle/fluid/platform/macros.h" +namespace paddle { +namespace framework { +class Variable; +} // namespace framework +} // namespace paddle + namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/scope_pool.cc b/paddle/fluid/framework/scope_pool.cc index 4bb077a2c52f0853b01a7af30308a0fa737500cb..cf0b3ebcddd2fbc86d54cd732cef96871b8592fd 100644 --- a/paddle/fluid/framework/scope_pool.cc +++ b/paddle/fluid/framework/scope_pool.cc @@ -11,10 +11,8 @@ // 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 "paddle/fluid/framework/scope_pool.h" -#include "paddle/fluid/framework/threadpool.h" +#include namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/scope_pool.h b/paddle/fluid/framework/scope_pool.h index a8b468699abe148d44a395cf888158aefab4380b..19faa9aa6a45fc0212dd212304bfb6603c9791a8 100644 --- a/paddle/fluid/framework/scope_pool.h +++ b/paddle/fluid/framework/scope_pool.h @@ -14,6 +14,7 @@ #pragma once +#include #include // NOLINT #include #include "paddle/fluid/framework/scope.h" @@ -21,6 +22,8 @@ namespace paddle { namespace framework { +class Scope; + class ScopePool { public: static ScopePool &Instance(); // NOLINT diff --git a/paddle/fluid/framework/scope_test.cc b/paddle/fluid/framework/scope_test.cc index 26817fc558dfab6926b67ee744b0a2ef548b4ffb..a61e68279a2d30f7128547aab2d7a5fab2c3f06b 100644 --- a/paddle/fluid/framework/scope_test.cc +++ b/paddle/fluid/framework/scope_test.cc @@ -13,9 +13,15 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/scope.h" -#include "glog/logging.h" + #include "gtest/gtest.h" +namespace paddle { +namespace framework { +class Variable; +} // namespace framework +} // namespace paddle + using paddle::framework::Scope; using paddle::framework::Variable; diff --git a/paddle/fluid/framework/selected_rows.cc b/paddle/fluid/framework/selected_rows.cc index 1f402ea9dd33626a43a4d03b96256b2c2841c8b4..4c30c40ad58375fb08f23e2c7bdef27fdaea7384 100644 --- a/paddle/fluid/framework/selected_rows.cc +++ b/paddle/fluid/framework/selected_rows.cc @@ -14,6 +14,12 @@ limitations under the License. */ #include "paddle/fluid/framework/selected_rows.h" +namespace paddle { +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/selected_rows.h b/paddle/fluid/framework/selected_rows.h index 285af1d55302a49cae058fccdd5edd13aa28137e..48353b43f56cacbb71512b9e743af281b09fc531 100644 --- a/paddle/fluid/framework/selected_rows.h +++ b/paddle/fluid/framework/selected_rows.h @@ -26,9 +26,18 @@ limitations under the License. */ #include "paddle/fluid/framework/tensor.h" #include "paddle/fluid/memory/memcpy.h" +namespace paddle { +namespace platform { +class DeviceContext; +class Place; +} // namespace platform +} // namespace paddle + namespace paddle { namespace framework { +class Tensor; + class SelectedRows { /* * @brief We can use the SelectedRows structure to reproduce a sparse table. diff --git a/paddle/fluid/framework/shape_inference.cc b/paddle/fluid/framework/shape_inference.cc index f5bb3f68007043ad37ea32e7047c5fc546b80931..02e4ce914b887f07e1e34cfbda533f71cec6bc06 100644 --- a/paddle/fluid/framework/shape_inference.cc +++ b/paddle/fluid/framework/shape_inference.cc @@ -13,11 +13,6 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/shape_inference.h" -#include -#include -#include -#include "paddle/fluid/framework/grad_op_desc_maker.h" -#include "paddle/fluid/framework/operator.h" namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/tensor.cc b/paddle/fluid/framework/tensor.cc index 0b22bab26789a3e2ebd20428adc236faa8b38dee..9f5d8d30c9cdea0cfa9db1793e18874bcd42aae0 100644 --- a/paddle/fluid/framework/tensor.cc +++ b/paddle/fluid/framework/tensor.cc @@ -13,7 +13,14 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/tensor.h" -#include "paddle/fluid/framework/var_type.h" + +namespace paddle { +namespace memory { +namespace allocation { +class Allocation; +} // namespace allocation +} // namespace memory +} // namespace paddle namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/tensor.h b/paddle/fluid/framework/tensor.h index f2ccff2c133a238d02e25c65faf41dd519fdb506..faecba6295d35fd9b6d841181a450a5a540a7074 100644 --- a/paddle/fluid/framework/tensor.h +++ b/paddle/fluid/framework/tensor.h @@ -20,6 +20,7 @@ limitations under the License. */ #include #include #include + #include "paddle/fluid/framework/data_layout.h" #include "paddle/fluid/framework/ddim.h" #include "paddle/fluid/framework/framework.pb.h" @@ -28,6 +29,14 @@ limitations under the License. */ #include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/platform/place.h" +namespace paddle { +namespace memory { +namespace allocation { +class Allocation; +} // namespace allocation +} // namespace memory +} // namespace paddle + namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/tensor_test.cc b/paddle/fluid/framework/tensor_test.cc index cc972dd93d032c19015c86debebc27f7c8c0d155..92a29d5165ce790bbbc9673979c5994317bb3dfb 100644 --- a/paddle/fluid/framework/tensor_test.cc +++ b/paddle/fluid/framework/tensor_test.cc @@ -13,9 +13,15 @@ // limitations under the License. #include "paddle/fluid/framework/tensor.h" + #include #include -#include "paddle/fluid/platform/float16.h" + +namespace paddle { +namespace platform { +struct float16; +} // namespace platform +} // namespace paddle namespace framework = paddle::framework; namespace platform = paddle::platform; diff --git a/paddle/fluid/framework/tensor_util.cc b/paddle/fluid/framework/tensor_util.cc index 0e3d11b9f0257905cbede334afd0ad84ff15cb5c..a073dbd733f0b1f1bb1b94221b99d477cb8dfadb 100644 --- a/paddle/fluid/framework/tensor_util.cc +++ b/paddle/fluid/framework/tensor_util.cc @@ -664,7 +664,7 @@ void TensorToStream(std::ostream& os, const Tensor& tensor, uint64_t size = tensor.numel() * framework::SizeOfType(tensor.type()); auto* data_ptr = tensor.data(); - PADDLE_ENFORCE_LT(size, std::numeric_limits::max(), + PADDLE_ENFORCE_LT(size, (std::numeric_limits::max)(), platform::errors::ResourceExhausted( "tensor size %d overflow when writing tensor", size)); if (platform::is_gpu_place(tensor.place())) { diff --git a/paddle/fluid/framework/tensor_util.h b/paddle/fluid/framework/tensor_util.h index a0408dbc3dbb4ffca70ef322d93b662f1b953f7b..1e811a41e90af5f35562eae682669292922a6d69 100644 --- a/paddle/fluid/framework/tensor_util.h +++ b/paddle/fluid/framework/tensor_util.h @@ -14,6 +14,7 @@ limitations under the License. */ #pragma once #include + #include "paddle/fluid/framework/data_type.h" #include "paddle/fluid/framework/dlpack_tensor.h" #include "paddle/fluid/framework/eigen.h" @@ -30,6 +31,8 @@ namespace framework { // If ctx_place and src_place are the same, src_ctx.Wait() is added // after memory::Copy; if ctx_place and dst_place are the same, // src_ctx.Wait() is added before memory::Copy. +class Tensor; + void TensorCopy(const Tensor& src, const platform::Place& dst_place, const platform::DeviceContext& ctx, Tensor* dst); diff --git a/paddle/fluid/framework/tensor_util_test.cc b/paddle/fluid/framework/tensor_util_test.cc index ef9964b3ae75fd65ded0fb5d94f9a97d06c138d5..e389cb34679a2459b547497a46e97586c7cd72bd 100644 --- a/paddle/fluid/framework/tensor_util_test.cc +++ b/paddle/fluid/framework/tensor_util_test.cc @@ -13,9 +13,9 @@ // limitations under the License. #include "paddle/fluid/framework/tensor_util.h" + #include #include -#include namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/threadpool.cc b/paddle/fluid/framework/threadpool.cc index 4682bfc264b68997abd0a87233c5ed39e7e50a63..3db8f3e36b7fbdac140487d00476f1c493a4b900 100644 --- a/paddle/fluid/framework/threadpool.cc +++ b/paddle/fluid/framework/threadpool.cc @@ -13,8 +13,6 @@ limitations under the License. */ #include "paddle/fluid/framework/threadpool.h" -#include -#include #include "gflags/gflags.h" #include "paddle/fluid/platform/enforce.h" diff --git a/paddle/fluid/framework/threadpool.h b/paddle/fluid/framework/threadpool.h index 09528b6fc35bf49ac3110440a62aba3200341e15..7fecf07475b1457bf6d19279493517c55f057194 100644 --- a/paddle/fluid/framework/threadpool.h +++ b/paddle/fluid/framework/threadpool.h @@ -23,6 +23,7 @@ limitations under the License. */ #include // NOLINT #include #include + #include "glog/logging.h" #include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/platform/macros.h" // for DISABLE_COPY_AND_ASSIGN diff --git a/paddle/fluid/framework/trainer.h b/paddle/fluid/framework/trainer.h index 077fe75172022c8fe501bd1143895115298417bf..d041ef48e2c04a8e6db6bee7fe1c762de89bc9eb 100644 --- a/paddle/fluid/framework/trainer.h +++ b/paddle/fluid/framework/trainer.h @@ -14,14 +14,15 @@ limitations under the License. */ #pragma once +#include #include +#include #include #include // NOLINT #include #include // NOLINT #include -#include #include "paddle/fluid/framework/data_feed.h" #include "paddle/fluid/framework/data_set.h" #include "paddle/fluid/framework/device_worker.h" @@ -38,6 +39,15 @@ limitations under the License. */ namespace paddle { namespace framework { +class Dataset; +class LoDTensor; +class ProgramDesc; +class PullDenseWorker; +class Scope; +class VarDesc; +template +class ChannelObject; + class TrainerBase { public: TrainerBase() {} diff --git a/paddle/fluid/framework/trainer_factory.cc b/paddle/fluid/framework/trainer_factory.cc index 31ac11e78cff15f12660b84b96a007690aa77ae3..15584620d86b62c05e5fef841fc26058e8610c21 100644 --- a/paddle/fluid/framework/trainer_factory.cc +++ b/paddle/fluid/framework/trainer_factory.cc @@ -17,11 +17,11 @@ limitations under the License. */ #include #include -#include "paddle/fluid/framework/trainer.h" - namespace paddle { namespace framework { +class TrainerBase; + typedef std::shared_ptr (*CreatetrainerFunction)(); typedef std::unordered_map trainerMap; trainerMap g_trainer_map; diff --git a/paddle/fluid/framework/trainer_factory.h b/paddle/fluid/framework/trainer_factory.h index 9c772a4f19ed9ba50f704ed62ef361555b1285fb..3ef61c03817523d153d966102ca43a30bfdcbb6b 100644 --- a/paddle/fluid/framework/trainer_factory.h +++ b/paddle/fluid/framework/trainer_factory.h @@ -16,11 +16,14 @@ limitations under the License. */ #include #include + #include "paddle/fluid/framework/trainer.h" namespace paddle { namespace framework { +class TrainerBase; + class TrainerFactory { public: static std::string TrainerTypeList(); diff --git a/paddle/fluid/framework/transfer_scope_cache.h b/paddle/fluid/framework/transfer_scope_cache.h index 9a5d45263219adacddb9e9280feec40cfb1ff903..7ff6020ff2abf1f666ed6332d3014caece072cdd 100644 --- a/paddle/fluid/framework/transfer_scope_cache.h +++ b/paddle/fluid/framework/transfer_scope_cache.h @@ -17,12 +17,16 @@ #include // NOLINT #include #include + #include "paddle/fluid/framework/op_kernel_type.h" #include "paddle/fluid/framework/scope.h" namespace paddle { namespace framework { +class OpKernelType; +class Scope; + std::unordered_map& global_transfer_data_cache(); std::unordered_set& global_transfer_scope_cache(); diff --git a/paddle/fluid/framework/tuple.h b/paddle/fluid/framework/tuple.h index 508ee931c6ed7f66e09abd8f0e4b33c3d3c135fd..35b8220d453addb14a9947cd0828e6c4208fe563 100644 --- a/paddle/fluid/framework/tuple.h +++ b/paddle/fluid/framework/tuple.h @@ -17,6 +17,7 @@ limitations under the License. */ #include #include #include + #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/tensor.h" #include "paddle/fluid/framework/var_desc.h" diff --git a/paddle/fluid/framework/tuple_test.cc b/paddle/fluid/framework/tuple_test.cc index cfdd4dc56e4c006f6c614bda143d5cc11e666732..9060bd3fc89bd8ca2aa7e05a09b0494ceabd3eaa 100644 --- a/paddle/fluid/framework/tuple_test.cc +++ b/paddle/fluid/framework/tuple_test.cc @@ -11,11 +11,8 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include -#include - -#include "gtest/gtest.h" #include "paddle/fluid/framework/tuple.h" +#include "gtest/gtest.h" TEST(Tuple, Make) { std::vector element_type; diff --git a/paddle/fluid/framework/unroll_array_ops.h b/paddle/fluid/framework/unroll_array_ops.h index ab17641080551166f246c69d42ed85df3892a3e0..a9c047cc6c6acfa5df157389fcd6055957c7bf4c 100644 --- a/paddle/fluid/framework/unroll_array_ops.h +++ b/paddle/fluid/framework/unroll_array_ops.h @@ -15,6 +15,7 @@ #pragma once #include #include + #include "paddle/fluid/platform/hostdevice.h" namespace paddle { diff --git a/paddle/fluid/framework/unroll_array_ops_test.cc b/paddle/fluid/framework/unroll_array_ops_test.cc index be811478eec17e0986ae7579ff323d94dea3155a..c4fdfdb425f23eb0e1aef3f2414b26afd421bac4 100644 --- a/paddle/fluid/framework/unroll_array_ops_test.cc +++ b/paddle/fluid/framework/unroll_array_ops_test.cc @@ -13,10 +13,9 @@ // limitations under the License. #include "paddle/fluid/framework/unroll_array_ops.h" + #include -#include #include -#include namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/unused_var_check.cc b/paddle/fluid/framework/unused_var_check.cc index e7e964b41818597404d9a6e510c0743f4f8c3f7e..ac455b9ffd7c1231003b337e47a3fa17ec052b9a 100644 --- a/paddle/fluid/framework/unused_var_check.cc +++ b/paddle/fluid/framework/unused_var_check.cc @@ -16,11 +16,11 @@ limitations under the License. */ #include #include - #include -#include #include +#include "paddle/fluid/framework/no_need_buffer_vars_inference.h" +#include "paddle/fluid/framework/op_info.h" #include "paddle/fluid/framework/operator.h" #include "paddle/fluid/platform/enforce.h" diff --git a/paddle/fluid/framework/unused_var_check.h b/paddle/fluid/framework/unused_var_check.h index 2f44a3bcde0bc2e6fe8b33247444166728d03ad4..d78b4d928f3ec85fe768f2de1316111533579bec 100644 --- a/paddle/fluid/framework/unused_var_check.h +++ b/paddle/fluid/framework/unused_var_check.h @@ -16,7 +16,6 @@ limitations under the License. */ #include #include - #include #include diff --git a/paddle/fluid/framework/var_desc.cc b/paddle/fluid/framework/var_desc.cc index 2ee0b17b64b6df7a2f66b208f5b5879683db6656..457c0c77b3c427501eebdf27b4d01d47b116c519 100644 --- a/paddle/fluid/framework/var_desc.cc +++ b/paddle/fluid/framework/var_desc.cc @@ -12,8 +12,6 @@ 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 "paddle/fluid/framework/var_desc.h" #include "paddle/fluid/platform/enforce.h" diff --git a/paddle/fluid/framework/var_desc.h b/paddle/fluid/framework/var_desc.h index 6e8be0fdd42e038bf55bd0c63e47fe3cb006cbf4..b37a09a17a985c29d92e0f5dafc7db16cdafc9fc 100644 --- a/paddle/fluid/framework/var_desc.h +++ b/paddle/fluid/framework/var_desc.h @@ -17,6 +17,7 @@ limitations under the License. */ #include #include #include + #include "glog/logging.h" #include "paddle/fluid/framework/framework.pb.h" diff --git a/paddle/fluid/framework/var_type_inference.h b/paddle/fluid/framework/var_type_inference.h index 9312ac075dec3e240e6fa56a632b50509c0c2632..f649c9388f0f6518dc4f8a587f5c9f9c01451373 100644 --- a/paddle/fluid/framework/var_type_inference.h +++ b/paddle/fluid/framework/var_type_inference.h @@ -17,6 +17,7 @@ limitations under the License. */ #include #include #include + #include "paddle/fluid/framework/block_desc.h" #include "paddle/fluid/framework/op_desc.h" #include "paddle/fluid/framework/type_defs.h" @@ -24,8 +25,8 @@ limitations under the License. */ namespace paddle { namespace framework { -class OpDesc; class BlockDesc; +class OpDesc; class StaticGraphVarTypeInference; // default infer var type context diff --git a/paddle/fluid/framework/var_type_inference_test.cc b/paddle/fluid/framework/var_type_inference_test.cc index dc86d58f600b83a8ed59f22d9cd73fac7fab13b3..5483ef01c08445b1ee2e44a5288994d7769cf303 100644 --- a/paddle/fluid/framework/var_type_inference_test.cc +++ b/paddle/fluid/framework/var_type_inference_test.cc @@ -13,7 +13,9 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/var_type_inference.h" + #include + #include "gtest/gtest.h" #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/framework/operator.h" @@ -22,6 +24,8 @@ limitations under the License. */ namespace paddle { namespace framework { +class Scope; + class NOP : public OperatorBase { public: NOP(const std::string& type, const VariableNameMap& inputs, diff --git a/paddle/fluid/framework/var_type_traits.h b/paddle/fluid/framework/var_type_traits.h index 4875956096a09bea7f9feb3eaf12a16dc28ee255..07387f87411af9c9413e5c83351c8b5836df8284 100644 --- a/paddle/fluid/framework/var_type_traits.h +++ b/paddle/fluid/framework/var_type_traits.h @@ -19,6 +19,7 @@ #include #include #include + #include "paddle/fluid/framework/feed_fetch_type.h" #include "paddle/fluid/framework/framework.pb.h" #include "paddle/fluid/framework/lod_tensor_array.h" @@ -43,12 +44,12 @@ class NCCLCommunicator; } // namespace platform namespace framework { -class Tensor; -class LoDTensor; -class SelectedRows; class LoDRankTable; +class LoDTensor; class ReaderHolder; class Scope; +class SelectedRows; +class Tensor; } // namespace framework namespace operators { diff --git a/paddle/fluid/framework/variable_helper.h b/paddle/fluid/framework/variable_helper.h index 01a5d09e0728b2af6e9bf650f0d58af43a9a53ab..6e65bc2c932877e5365f4533631d50afae4465b3 100644 --- a/paddle/fluid/framework/variable_helper.h +++ b/paddle/fluid/framework/variable_helper.h @@ -21,6 +21,8 @@ limitations under the License. */ namespace paddle { namespace framework { +class Variable; + void InitializeVariable(Variable* var, proto::VarType::Type var_type); void CopyVariable(const Variable& src_var, Variable* dst_var); diff --git a/paddle/fluid/framework/variable_test.cc b/paddle/fluid/framework/variable_test.cc index 511c9c52146ece4b90905cc9d49565103589c1ec..98a8ff9cf3ebf5c877b4611f2cf27d2fe6b1ec20 100644 --- a/paddle/fluid/framework/variable_test.cc +++ b/paddle/fluid/framework/variable_test.cc @@ -12,12 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include - -#include "gtest/gtest.h" -#include "paddle/fluid/framework/tensor.h" #include "paddle/fluid/framework/variable.h" +#include "gtest/gtest.h" namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/version.cc b/paddle/fluid/framework/version.cc index 7ba00f52e67f5431bb0dc70dbd5b743ca611fff8..92042e47259861151333e3c1073fc2a85a5f68f2 100644 --- a/paddle/fluid/framework/version.cc +++ b/paddle/fluid/framework/version.cc @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/version.h" -#include + #include namespace paddle { diff --git a/paddle/fluid/imperative/all_reduce.h b/paddle/fluid/imperative/all_reduce.h index 81880d0fb89b7e372f5b0b158ae9a206eb64215d..249fb4e11f12beb0c7543d96732ffcae6143c8da 100644 --- a/paddle/fluid/imperative/all_reduce.h +++ b/paddle/fluid/imperative/all_reduce.h @@ -25,9 +25,17 @@ #include "paddle/fluid/framework/variable.h" #include "paddle/fluid/imperative/nccl_context.h" +namespace paddle { +namespace framework { +class Variable; +} // namespace framework +} // namespace paddle + namespace paddle { namespace imperative { +struct ParallelStrategy; + void AllReduce(const framework::Variable &src, framework::Variable *dst, const ParallelStrategy &strategy); diff --git a/paddle/fluid/imperative/amp_auto_cast.cc b/paddle/fluid/imperative/amp_auto_cast.cc index c980b014b823e21f117bc6e44037349b06a1fdfd..d4a1519b07e8ca5c3fecee2b276aed27fc4e0c44 100644 --- a/paddle/fluid/imperative/amp_auto_cast.cc +++ b/paddle/fluid/imperative/amp_auto_cast.cc @@ -14,20 +14,17 @@ #include "paddle/fluid/imperative/amp_auto_cast.h" -#include #include -#include #include -#include #include -#include "paddle/fluid/imperative/layer.h" #include "paddle/fluid/imperative/tracer.h" -#include "paddle/fluid/imperative/variable_wrapper.h" namespace paddle { namespace imperative { +class VarBase; + AmpOperators::AmpOperators() : allow_ops_(new std::unordered_set()), block_ops_(new std::unordered_set()) {} diff --git a/paddle/fluid/imperative/amp_auto_cast.h b/paddle/fluid/imperative/amp_auto_cast.h index d1da97e5a39057aed3ed0b4a450bd4a4f5c06984..7ab876c1ce82905dec19380ff33f33e23be7c023 100644 --- a/paddle/fluid/imperative/amp_auto_cast.h +++ b/paddle/fluid/imperative/amp_auto_cast.h @@ -26,6 +26,8 @@ namespace paddle { namespace imperative { // Singleton implementation with C++ 11 +class Tracer; + class AmpOperators { public: ~AmpOperators(); diff --git a/paddle/fluid/imperative/data_loader.cc b/paddle/fluid/imperative/data_loader.cc index 3b8239e566d21b2a15f0829c52b92ba2aa23d4f3..a2fccf7901ffa430e8d8ecb05c6fd1e32b3b45b6 100644 --- a/paddle/fluid/imperative/data_loader.cc +++ b/paddle/fluid/imperative/data_loader.cc @@ -16,13 +16,9 @@ #include "paddle/fluid/imperative/data_loader.h" -#include #include - -#include #include #include -#include #include "paddle/fluid/memory/allocation/mmap_allocator.h" #include "paddle/fluid/platform/enforce.h" diff --git a/paddle/fluid/imperative/jit/op_desc_meta.cc b/paddle/fluid/imperative/jit/op_desc_meta.cc index f5c009859003c8047ceb44370e01f51527a57591..d256dafb8919a5ee2025ee3bb061d5d688d23b4b 100644 --- a/paddle/fluid/imperative/jit/op_desc_meta.cc +++ b/paddle/fluid/imperative/jit/op_desc_meta.cc @@ -13,7 +13,6 @@ // limitations under the License. #include "paddle/fluid/imperative/jit/op_desc_meta.h" -#include "paddle/fluid/framework/op_info.h" namespace paddle { namespace imperative { diff --git a/paddle/fluid/imperative/jit/op_desc_meta.h b/paddle/fluid/imperative/jit/op_desc_meta.h index 506afee6a99b034b1cc1d3ce209d12dd30fce43d..c59b2c885d2b46524288cd983ca55620a6ba9009 100644 --- a/paddle/fluid/imperative/jit/op_desc_meta.h +++ b/paddle/fluid/imperative/jit/op_desc_meta.h @@ -15,6 +15,7 @@ #pragma once #include + #include "paddle/fluid/imperative/layer.h" #include "paddle/fluid/imperative/type_defs.h" diff --git a/paddle/fluid/imperative/jit/program_desc_tracer.cc b/paddle/fluid/imperative/jit/program_desc_tracer.cc index be93a787d46035838d4d956a8d6881d802b93430..9f4cf713f7c19c0d8bebdaf023d512a4f593d8e4 100644 --- a/paddle/fluid/imperative/jit/program_desc_tracer.cc +++ b/paddle/fluid/imperative/jit/program_desc_tracer.cc @@ -15,7 +15,12 @@ #include "paddle/fluid/imperative/jit/program_desc_tracer.h" #include #include -#include + +namespace paddle { +namespace imperative { +class VarBase; +} // namespace imperative +} // namespace paddle namespace paddle { namespace imperative { diff --git a/paddle/fluid/imperative/jit/program_desc_tracer.h b/paddle/fluid/imperative/jit/program_desc_tracer.h index d07acec22305e5a340a698ad85dbf15c183e9ccb..8e2e59a49ed7be473a1f89aaefde6bf123a9dea9 100644 --- a/paddle/fluid/imperative/jit/program_desc_tracer.h +++ b/paddle/fluid/imperative/jit/program_desc_tracer.h @@ -21,12 +21,19 @@ #include #include #include + #include "paddle/fluid/framework/program_desc.h" #include "paddle/fluid/imperative/jit/op_desc_meta.h" #include "paddle/fluid/imperative/layer.h" #include "paddle/fluid/imperative/type_defs.h" #include "paddle/fluid/platform/macros.h" +namespace paddle { +namespace imperative { +class VarBase; +} // namespace imperative +} // namespace paddle + namespace paddle { namespace imperative { namespace jit { diff --git a/paddle/fluid/imperative/layer.h b/paddle/fluid/imperative/layer.h index 03e83301d44a35dc98e9a1aee0e1b22ef2380d50..d4df052a40d307c31978c33d9e14aef9ed4b3b82 100644 --- a/paddle/fluid/imperative/layer.h +++ b/paddle/fluid/imperative/layer.h @@ -24,6 +24,7 @@ #include #include #include + #include "paddle/fluid/framework/operator.h" #include "paddle/fluid/framework/type_defs.h" #include "paddle/fluid/framework/var_type.h" @@ -35,10 +36,18 @@ #include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/platform/macros.h" +namespace paddle { +namespace framework { +class Variable; +} // namespace framework +} // namespace paddle + namespace paddle { namespace imperative { class OpBase; +class GradOpNode; +class VariableWrapper; class ThreadSafeNameSet { public: diff --git a/paddle/fluid/imperative/prepared_operator.h b/paddle/fluid/imperative/prepared_operator.h index bf02eebdbb6be6638592017b264f0ef5054537ff..3bf032e642bb72f00f4bc045f7ffccff0c7e0263 100644 --- a/paddle/fluid/imperative/prepared_operator.h +++ b/paddle/fluid/imperative/prepared_operator.h @@ -17,12 +17,23 @@ #include #include #include + #include "paddle/fluid/framework/data_transform.h" #include "paddle/fluid/framework/op_kernel_type.h" #include "paddle/fluid/framework/operator.h" #include "paddle/fluid/imperative/layer.h" #include "paddle/fluid/imperative/type_defs.h" +namespace paddle { +namespace framework { +class Tensor; +class Variable; +} // namespace framework +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace imperative { diff --git a/paddle/fluid/imperative/profiler.cc b/paddle/fluid/imperative/profiler.cc index 34570b3a60ec83fdeb1577789271942125b16eb1..85063a6821680f6c990282f8492b3fe9f54bfbf5 100644 --- a/paddle/fluid/imperative/profiler.cc +++ b/paddle/fluid/imperative/profiler.cc @@ -19,8 +19,7 @@ #endif #include #include -#include // NOLINT -#include // NOLINT +#include // NOLINT DEFINE_string( tracer_profile_fname, "xxgperf", diff --git a/paddle/fluid/imperative/tests/nccl_context_test.cc b/paddle/fluid/imperative/tests/nccl_context_test.cc index 8ce257a6c37d7d4b0fa5bc3610ee7283fdcf0659..93ea988d638e4b67dde4707ca51f8ff1088d9059 100644 --- a/paddle/fluid/imperative/tests/nccl_context_test.cc +++ b/paddle/fluid/imperative/tests/nccl_context_test.cc @@ -13,8 +13,8 @@ // limitations under the License. #include "paddle/fluid/imperative/nccl_context.h" + #include "gtest/gtest.h" -#include "paddle/fluid/platform/device_context.h" namespace imperative = paddle::imperative; namespace platform = paddle::platform; diff --git a/paddle/fluid/inference/analysis/ir_passes/subgraph_util.cc b/paddle/fluid/inference/analysis/ir_passes/subgraph_util.cc index ebb19fd486cc89c69d70de3fa98954b9ee415f1a..ee1093104834d5758b7abc1a0a538aa9a84d64fe 100644 --- a/paddle/fluid/inference/analysis/ir_passes/subgraph_util.cc +++ b/paddle/fluid/inference/analysis/ir_passes/subgraph_util.cc @@ -18,7 +18,14 @@ limitations under the License. */ #include "paddle/fluid/inference/analysis/ir_passes/subgraph_util.h" #include -#include + +namespace paddle { +namespace framework { +namespace ir { +class Node; +} // namespace ir +} // namespace framework +} // namespace paddle namespace paddle { namespace inference { diff --git a/paddle/fluid/inference/analysis/ir_passes/subgraph_util.h b/paddle/fluid/inference/analysis/ir_passes/subgraph_util.h index 1257562972eec85e6503a47fbb7bb3be40d2b83c..621c631b8539beb9b35dcd33f3d14ef5e5745396 100644 --- a/paddle/fluid/inference/analysis/ir_passes/subgraph_util.h +++ b/paddle/fluid/inference/analysis/ir_passes/subgraph_util.h @@ -27,6 +27,12 @@ limitations under the License. */ #include "paddle/fluid/framework/ir/graph_traits.h" #include "paddle/fluid/framework/ir/node.h" +namespace paddle { +namespace framework { +class BlockDesc; +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace analysis { diff --git a/paddle/fluid/inference/analysis/ir_passes/tensorrt_subgraph_pass.h b/paddle/fluid/inference/analysis/ir_passes/tensorrt_subgraph_pass.h index b6b67ce8eceb40cbf0aa98fe56684d76ce6c9602..bb0248008e0306d28a67ab134abb9ce39587f5c2 100644 --- a/paddle/fluid/inference/analysis/ir_passes/tensorrt_subgraph_pass.h +++ b/paddle/fluid/inference/analysis/ir_passes/tensorrt_subgraph_pass.h @@ -18,11 +18,21 @@ #include #include #include + #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/pass.h" #include "paddle/fluid/inference/analysis/ir_passes/subgraph_util.h" #include "paddle/fluid/inference/api/paddle_analysis_config.h" +namespace paddle { +namespace framework { +namespace ir { +class Graph; +class Node; +} // namespace ir +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace analysis { diff --git a/paddle/fluid/inference/analysis/passes/adjust_cudnn_workspace_size_pass.h b/paddle/fluid/inference/analysis/passes/adjust_cudnn_workspace_size_pass.h index 65d1c545313e110028a92776e73a070d32010420..66d5667a37ce8f9e43b01d204df5ea9014b54564 100644 --- a/paddle/fluid/inference/analysis/passes/adjust_cudnn_workspace_size_pass.h +++ b/paddle/fluid/inference/analysis/passes/adjust_cudnn_workspace_size_pass.h @@ -30,6 +30,8 @@ namespace analysis { * The default cudnn workspace is 4G, we set it to 64M in this pass, which * is applicable for most inference tasks. */ +struct Argument; + class AdjustCudnnWorkSpacePass : public AnalysisPass { public: void RunImpl(Argument *argument) override; diff --git a/paddle/fluid/inference/analysis/passes/inference_op_replace_pass.h b/paddle/fluid/inference/analysis/passes/inference_op_replace_pass.h index 7fbdd88e014ba83277e45798b98ab90af3191f99..bbdf8b1009a55f84710778c575a1848798869734 100644 --- a/paddle/fluid/inference/analysis/passes/inference_op_replace_pass.h +++ b/paddle/fluid/inference/analysis/passes/inference_op_replace_pass.h @@ -32,6 +32,8 @@ namespace analysis { * So, We added the corresponding inference impl to these ops separately. * This pass replaces these ops with corresponding inference ops. */ +struct Argument; + class InferenceOpReplacePass : public AnalysisPass { public: void RunImpl(Argument *argument) override; diff --git a/paddle/fluid/inference/analysis/passes/ir_graph_clean_pass.h b/paddle/fluid/inference/analysis/passes/ir_graph_clean_pass.h index a9d58aa2f4cbb5d135221b0d02c633f6f78c8190..a4d60e91e8455c2c27fd9a146a30d03207ff3dc2 100644 --- a/paddle/fluid/inference/analysis/passes/ir_graph_clean_pass.h +++ b/paddle/fluid/inference/analysis/passes/ir_graph_clean_pass.h @@ -16,12 +16,15 @@ #include #include + #include "paddle/fluid/inference/analysis/analysis_pass.h" namespace paddle { namespace inference { namespace analysis { +struct Argument; + class IrInferCleanGraphPass : public AnalysisPass { public: void RunImpl(Argument *argument) override; diff --git a/paddle/fluid/inference/analysis/passes/ir_graph_to_program_pass.h b/paddle/fluid/inference/analysis/passes/ir_graph_to_program_pass.h index 838ebdbc9d71eb3a73882e4c4c3e4bf6078150e4..613eb04497e61824e1b64b5dbfb4c80c81932227 100644 --- a/paddle/fluid/inference/analysis/passes/ir_graph_to_program_pass.h +++ b/paddle/fluid/inference/analysis/passes/ir_graph_to_program_pass.h @@ -14,12 +14,15 @@ #pragma once +#include #include "paddle/fluid/inference/analysis/analysis_pass.h" namespace paddle { namespace inference { namespace analysis { +struct Argument; + class IrGraphToProgramPass : public AnalysisPass { public: void RunImpl(Argument *argument) override; diff --git a/paddle/fluid/inference/analysis/passes/memory_optimize_pass.cc b/paddle/fluid/inference/analysis/passes/memory_optimize_pass.cc index f432188131eddc402e696091ab3723697216aadf..defa0a525f6885a6206f54e6a27190ba181b74a2 100644 --- a/paddle/fluid/inference/analysis/passes/memory_optimize_pass.cc +++ b/paddle/fluid/inference/analysis/passes/memory_optimize_pass.cc @@ -13,23 +13,24 @@ // limitations under the License. #include "paddle/fluid/inference/analysis/passes/memory_optimize_pass.h" + #include -#include #include #include -#include #include #include -#include #include -#include + #include "paddle/fluid/framework/ir/graph_helper.h" -#include "paddle/fluid/framework/ir/graph_pattern_detector.h" -#include "paddle/fluid/framework/ir/graph_to_program_pass.h" -#include "paddle/fluid/framework/ir/graph_traits.h" -#include "paddle/fluid/inference/analysis/helper.h" -#include "paddle/fluid/inference/api/helper.h" -#include "paddle/fluid/string/pretty_log.h" + +namespace paddle { +namespace framework { +namespace ir { +class Graph; +class Node; +} // namespace ir +} // namespace framework +} // namespace paddle namespace paddle { namespace inference { diff --git a/paddle/fluid/inference/analysis/passes/memory_optimize_pass.h b/paddle/fluid/inference/analysis/passes/memory_optimize_pass.h index 77da5d40d8dea96e6d7ae833501626894c6d7b37..6d20aee295b7c1d2fe533bf8cd5195cb105afe2a 100644 --- a/paddle/fluid/inference/analysis/passes/memory_optimize_pass.h +++ b/paddle/fluid/inference/analysis/passes/memory_optimize_pass.h @@ -18,9 +18,18 @@ #include #include #include + #include "paddle/fluid/inference/analysis/analysis_pass.h" #include "paddle/fluid/platform/port.h" +namespace paddle { +namespace framework { +namespace ir { +class Graph; +} // namespace ir +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace analysis { diff --git a/paddle/fluid/inference/api/analysis_config.cc b/paddle/fluid/inference/api/analysis_config.cc index 2184574aa1fe3c66728b41f221c1b0bf5fd464e7..4abe293c930e23d4896adb3af25ad0532d95c12c 100644 --- a/paddle/fluid/inference/api/analysis_config.cc +++ b/paddle/fluid/inference/api/analysis_config.cc @@ -12,14 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/fluid/framework/lod_tensor.h" -#include "paddle/fluid/framework/scope.h" #include "paddle/fluid/inference/api/paddle_analysis_config.h" #include "paddle/fluid/inference/api/paddle_pass_builder.h" #include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/platform/gpu_info.h" namespace paddle { +struct MkldnnQuantizerConfig; + extern const std::vector kTRTSubgraphPasses; extern const std::vector kLiteSubgraphPasses; diff --git a/paddle/fluid/inference/api/api_impl.h b/paddle/fluid/inference/api/api_impl.h index 96b94777304382a9d4be115a84f80ead69249863..be771ac48fc155c4e53dfcd46e8dd707ad9593bd 100644 --- a/paddle/fluid/inference/api/api_impl.h +++ b/paddle/fluid/inference/api/api_impl.h @@ -19,18 +19,26 @@ limitations under the License. */ #include #include #include + #include "paddle/fluid/framework/ddim.h" #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/lod_tensor_array.h" #include "paddle/fluid/framework/naive_executor.h" #include "paddle/fluid/inference/api/details/reset_tensor_array.h" +#include "paddle/fluid/inference/api/paddle_api.h" #include "paddle/fluid/inference/api/paddle_inference_api.h" #include "paddle/fluid/inference/io.h" #include "paddle/fluid/platform/init.h" +#include "paddle/fluid/platform/place.h" #include "paddle/fluid/platform/profiler.h" namespace paddle { +namespace framework { +class LoDTensor; +class Scope; +} // namespace framework + class NativePaddlePredictor : public PaddlePredictor { public: explicit NativePaddlePredictor(const NativeConfig &config) diff --git a/paddle/fluid/inference/api/details/reset_tensor_array.cc b/paddle/fluid/inference/api/details/reset_tensor_array.cc index 03c2aa3fb8094ce2996f513b90589de0ef903ae8..ee5c10b7bf6753b3b6983ce9c96c5e1205a0a1a3 100644 --- a/paddle/fluid/inference/api/details/reset_tensor_array.cc +++ b/paddle/fluid/inference/api/details/reset_tensor_array.cc @@ -14,6 +14,12 @@ #include "paddle/fluid/inference/api/details/reset_tensor_array.h" +namespace paddle { +namespace framework { +class Scope; +} // namespace framework +} // namespace paddle + namespace paddle { namespace details { diff --git a/paddle/fluid/inference/api/details/reset_tensor_array.h b/paddle/fluid/inference/api/details/reset_tensor_array.h index 213c6891d0e2320689c8c69266d40611f295edc8..be5fe1d64f9e7fbba207878c9ca6740109a41b7c 100644 --- a/paddle/fluid/inference/api/details/reset_tensor_array.h +++ b/paddle/fluid/inference/api/details/reset_tensor_array.h @@ -16,10 +16,18 @@ #include #include + #include "paddle/fluid/framework/lod_tensor_array.h" #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/framework/variable.h" +namespace paddle { +namespace framework { +class LoDTensor; +class Scope; +} // namespace framework +} // namespace paddle + namespace paddle { namespace details { diff --git a/paddle/fluid/inference/api/helper.h b/paddle/fluid/inference/api/helper.h index 014985661fd927debb48c699a157c0e05265842c..061b83e1d1e4a5180b281c672cf81f6e6a0c51bd 100644 --- a/paddle/fluid/inference/api/helper.h +++ b/paddle/fluid/inference/api/helper.h @@ -27,6 +27,7 @@ #include #include #include + #include "paddle/fluid/framework/data_type.h" #include "paddle/fluid/inference/api/paddle_inference_api.h" #include "paddle/fluid/platform/enforce.h" diff --git a/paddle/fluid/inference/api/mkldnn_quantizer_config.cc b/paddle/fluid/inference/api/mkldnn_quantizer_config.cc index 76cf1661f305443592c345e879f2d4514dc914d9..30c6c21ec87f36cdfe0f4ef7950236763c13191a 100644 --- a/paddle/fluid/inference/api/mkldnn_quantizer_config.cc +++ b/paddle/fluid/inference/api/mkldnn_quantizer_config.cc @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include + #include "paddle/fluid/inference/api/paddle_mkldnn_quantizer_config.h" namespace paddle { diff --git a/paddle/fluid/inference/api/paddle_pass_builder.h b/paddle/fluid/inference/api/paddle_pass_builder.h index 9073253520466a3711089bc7b7da04a9191e0a42..b10c290b226a7da8c2b55097dae5d6ffe34fc180 100644 --- a/paddle/fluid/inference/api/paddle_pass_builder.h +++ b/paddle/fluid/inference/api/paddle_pass_builder.h @@ -17,6 +17,7 @@ #include #include #include + #include "paddle_infer_declare.h" // NOLINT /// diff --git a/paddle/fluid/inference/tensorrt/convert/activation_op.cc b/paddle/fluid/inference/tensorrt/convert/activation_op.cc index 1a428e205cb0773697855c382d917778c41be205..57aeee99ba2bf80eb21773b24b47c23f1911ed53 100644 --- a/paddle/fluid/inference/tensorrt/convert/activation_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/activation_op.cc @@ -12,8 +12,27 @@ 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 "paddle/fluid/framework/op_registry.h" +#include + +#include "glog/logging.h" +#include "paddle/fluid/framework/op_desc.h" #include "paddle/fluid/inference/tensorrt/convert/op_converter.h" +#include "paddle/fluid/inference/tensorrt/engine.h" +#include "paddle/fluid/inference/tensorrt/helper.h" +#include "paddle/fluid/platform/enforce.h" + +namespace nvinfer1 { +class IActivationLayer; +class ITensor; +} // namespace nvinfer1 +namespace paddle { +namespace framework { +class Scope; +namespace proto { +class OpDesc; +} // namespace proto +} // namespace framework +} // namespace paddle namespace paddle { namespace inference { diff --git a/paddle/fluid/inference/tensorrt/convert/batch_norm_op.cc b/paddle/fluid/inference/tensorrt/convert/batch_norm_op.cc index f67370b33828b77fec166017331c550698eaa658..2f4f9320607e3d77b7b2aaa31dca7e64c76d73a7 100644 --- a/paddle/fluid/inference/tensorrt/convert/batch_norm_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/batch_norm_op.cc @@ -12,9 +12,20 @@ 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 "paddle/fluid/inference/tensorrt/convert/op_converter.h" +namespace nvinfer1 { +class IScaleLayer; +} // namespace nvinfer1 +namespace paddle { +namespace framework { +class Scope; +namespace proto { +class OpDesc; +} // namespace proto +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace tensorrt { diff --git a/paddle/fluid/inference/tensorrt/convert/concat_op.cc b/paddle/fluid/inference/tensorrt/convert/concat_op.cc index 5d63aa2ace86cb89917126f3a6fef9d0e9839e8c..5ecf19233887754c1a38c9c74c4b75d345609f67 100644 --- a/paddle/fluid/inference/tensorrt/convert/concat_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/concat_op.cc @@ -14,6 +14,15 @@ limitations under the License. */ #include "paddle/fluid/inference/tensorrt/convert/op_converter.h" +namespace paddle { +namespace framework { +class Scope; +namespace proto { +class OpDesc; +} // namespace proto +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace tensorrt { diff --git a/paddle/fluid/inference/tensorrt/convert/conv2d_op.cc b/paddle/fluid/inference/tensorrt/convert/conv2d_op.cc index aa03bc44bd629513d96cda541c0b7162629bfdc8..f582d7e07055bd2083bf375b89ac98bee4990711 100644 --- a/paddle/fluid/inference/tensorrt/convert/conv2d_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/conv2d_op.cc @@ -14,6 +14,15 @@ limitations under the License. */ #include "paddle/fluid/inference/tensorrt/convert/op_converter.h" +namespace paddle { +namespace framework { +class Scope; +namespace proto { +class OpDesc; +} // namespace proto +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace tensorrt { diff --git a/paddle/fluid/inference/tensorrt/convert/dropout_op.cc b/paddle/fluid/inference/tensorrt/convert/dropout_op.cc index 0541d8917057c3a96ea3b2ffbb0bec283e00f683..d11dbc16e87d25e86abcf5b8425cf7036550b6e4 100644 --- a/paddle/fluid/inference/tensorrt/convert/dropout_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/dropout_op.cc @@ -14,6 +14,15 @@ limitations under the License. */ #include "paddle/fluid/inference/tensorrt/convert/op_converter.h" +namespace paddle { +namespace framework { +class Scope; +namespace proto { +class OpDesc; +} // namespace proto +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace tensorrt { diff --git a/paddle/fluid/inference/tensorrt/convert/emb_eltwise_layernorm.cc b/paddle/fluid/inference/tensorrt/convert/emb_eltwise_layernorm.cc index 9fff558c583596215c191a31e95b4e9b2aad058b..b846b3033f6742a20cc42529db8f9eb302b7a71f 100644 --- a/paddle/fluid/inference/tensorrt/convert/emb_eltwise_layernorm.cc +++ b/paddle/fluid/inference/tensorrt/convert/emb_eltwise_layernorm.cc @@ -13,6 +13,15 @@ limitations under the License. */ #include "paddle/fluid/inference/tensorrt/helper.h" #include "paddle/fluid/inference/tensorrt/plugin/emb_eltwise_layernorm_plugin.h" +namespace paddle { +namespace framework { +class Scope; +namespace proto { +class OpDesc; +} // namespace proto +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace tensorrt { diff --git a/paddle/fluid/inference/tensorrt/convert/fc_op.cc b/paddle/fluid/inference/tensorrt/convert/fc_op.cc index 0dccd3cc6390af736aa4d205a12577fd9ee14f11..cd16ed7396532cb987263bc8a9c510e516dc7bc1 100644 --- a/paddle/fluid/inference/tensorrt/convert/fc_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/fc_op.cc @@ -14,6 +14,15 @@ limitations under the License. */ #include "paddle/fluid/inference/tensorrt/convert/op_converter.h" +namespace paddle { +namespace framework { +class Scope; +namespace proto { +class OpDesc; +} // namespace proto +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace tensorrt { diff --git a/paddle/fluid/inference/tensorrt/convert/gelu_op.cc b/paddle/fluid/inference/tensorrt/convert/gelu_op.cc index 7927b6cd1bb559b1c4ce81d2846942a0db31e5fc..aad822b33546e68d67912ac9f9f2581cd2f8e5e8 100644 --- a/paddle/fluid/inference/tensorrt/convert/gelu_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/gelu_op.cc @@ -15,6 +15,18 @@ limitations under the License. */ #include "paddle/fluid/inference/tensorrt/convert/op_converter.h" #include "paddle/fluid/inference/tensorrt/plugin/gelu_op_plugin.h" +namespace nvinfer1 { +class ILayer; +} // namespace nvinfer1 +namespace paddle { +namespace framework { +class Scope; +namespace proto { +class OpDesc; +} // namespace proto +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace tensorrt { diff --git a/paddle/fluid/inference/tensorrt/convert/hard_sigmoid_op.cc b/paddle/fluid/inference/tensorrt/convert/hard_sigmoid_op.cc index 3b6e464a117d3eedb4848dcaaf5c06fdb453fac1..f2c1bafb4ae781ea340cc84f4465733948c35ded 100644 --- a/paddle/fluid/inference/tensorrt/convert/hard_sigmoid_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/hard_sigmoid_op.cc @@ -14,6 +14,15 @@ limitations under the License. */ #include "paddle/fluid/inference/tensorrt/convert/op_converter.h" +namespace paddle { +namespace framework { +class Scope; +namespace proto { +class OpDesc; +} // namespace proto +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace tensorrt { diff --git a/paddle/fluid/inference/tensorrt/convert/hard_swish_op.cc b/paddle/fluid/inference/tensorrt/convert/hard_swish_op.cc index 39820068ca848c0fc758290b031867447b113795..967f79a1643a59df38721b8f7d9158e56391f2d4 100644 --- a/paddle/fluid/inference/tensorrt/convert/hard_swish_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/hard_swish_op.cc @@ -15,6 +15,18 @@ limitations under the License. */ #include "paddle/fluid/inference/tensorrt/convert/op_converter.h" #include "paddle/fluid/inference/tensorrt/plugin/hard_swish_op_plugin.h" +namespace nvinfer1 { +class ILayer; +} // namespace nvinfer1 +namespace paddle { +namespace framework { +class Scope; +namespace proto { +class OpDesc; +} // namespace proto +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace tensorrt { diff --git a/paddle/fluid/inference/tensorrt/convert/instance_norm_op.cc b/paddle/fluid/inference/tensorrt/convert/instance_norm_op.cc index 8a0b50f4744c456647688c6d6b0533518cec0bf4..d746c51c5c5706eea14f371eaa74f0e76adfed34 100644 --- a/paddle/fluid/inference/tensorrt/convert/instance_norm_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/instance_norm_op.cc @@ -15,6 +15,18 @@ limitations under the License. */ #include "paddle/fluid/inference/tensorrt/convert/op_converter.h" #include "paddle/fluid/inference/tensorrt/plugin/instance_norm_op_plugin.h" +namespace nvinfer1 { +class IPluginLayer; +} // namespace nvinfer1 +namespace paddle { +namespace framework { +class Scope; +namespace proto { +class OpDesc; +} // namespace proto +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace tensorrt { diff --git a/paddle/fluid/inference/tensorrt/convert/leaky_relu_op.cc b/paddle/fluid/inference/tensorrt/convert/leaky_relu_op.cc index 29826909c3ce34e8ac1d780352e412a776feb1d6..e348de9877f463e22b317c658d60f5723942afd1 100644 --- a/paddle/fluid/inference/tensorrt/convert/leaky_relu_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/leaky_relu_op.cc @@ -14,6 +14,18 @@ limitations under the License. */ #include "paddle/fluid/inference/tensorrt/convert/op_converter.h" +namespace nvinfer1 { +class ILayer; +} // namespace nvinfer1 +namespace paddle { +namespace framework { +class Scope; +namespace proto { +class OpDesc; +} // namespace proto +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace tensorrt { diff --git a/paddle/fluid/inference/tensorrt/convert/mul_op.cc b/paddle/fluid/inference/tensorrt/convert/mul_op.cc index 5b6aaad49833cedbd8d1ee0ec5d24c7f983190e6..c99528b207b6c02675b213977fb5f161cef21be5 100644 --- a/paddle/fluid/inference/tensorrt/convert/mul_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/mul_op.cc @@ -14,6 +14,15 @@ limitations under the License. */ #include "paddle/fluid/inference/tensorrt/convert/op_converter.h" +namespace paddle { +namespace framework { +class Scope; +namespace proto { +class OpDesc; +} // namespace proto +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace tensorrt { diff --git a/paddle/fluid/inference/tensorrt/convert/pad_op.cc b/paddle/fluid/inference/tensorrt/convert/pad_op.cc index dd594404d3316ada6e20624c074368f241ca5cdd..7ddedf969fd1c16b20ef42e97835f04eb819dcc0 100644 --- a/paddle/fluid/inference/tensorrt/convert/pad_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/pad_op.cc @@ -14,6 +14,15 @@ limitations under the License. */ #include "paddle/fluid/inference/tensorrt/convert/op_converter.h" +namespace paddle { +namespace framework { +class Scope; +namespace proto { +class OpDesc; +} // namespace proto +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace tensorrt { diff --git a/paddle/fluid/inference/tensorrt/convert/pool2d_op.cc b/paddle/fluid/inference/tensorrt/convert/pool2d_op.cc index 864e440920e3b49feee7c7e9a839a15f3a961f9c..c031630f36d789bb205c23ae7a899089761f5391 100644 --- a/paddle/fluid/inference/tensorrt/convert/pool2d_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/pool2d_op.cc @@ -15,6 +15,15 @@ limitations under the License. */ #include "paddle/fluid/inference/tensorrt/convert/op_converter.h" #include "paddle/fluid/inference/tensorrt/plugin/pool_op_plugin.h" +namespace paddle { +namespace framework { +class Scope; +namespace proto { +class OpDesc; +} // namespace proto +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace tensorrt { diff --git a/paddle/fluid/inference/tensorrt/convert/scale_op.cc b/paddle/fluid/inference/tensorrt/convert/scale_op.cc index f9a1fe41ddc046aad8cc3a5397453b0f68c1a112..18c97890d72a51de412421b6ae48f382728ae8fc 100644 --- a/paddle/fluid/inference/tensorrt/convert/scale_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/scale_op.cc @@ -14,6 +14,15 @@ limitations under the License. */ #include "paddle/fluid/inference/tensorrt/convert/op_converter.h" +namespace paddle { +namespace framework { +class Scope; +namespace proto { +class OpDesc; +} // namespace proto +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace tensorrt { diff --git a/paddle/fluid/inference/tensorrt/convert/shuffle_channel_op.cc b/paddle/fluid/inference/tensorrt/convert/shuffle_channel_op.cc index 326915dfff528db8a373e04dc4dde26e37766fee..7090e298ddc3de453fe9177a841ca9d605f15094 100644 --- a/paddle/fluid/inference/tensorrt/convert/shuffle_channel_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/shuffle_channel_op.cc @@ -14,6 +14,15 @@ limitations under the License. */ #include "paddle/fluid/inference/tensorrt/convert/op_converter.h" +namespace paddle { +namespace framework { +class Scope; +namespace proto { +class OpDesc; +} // namespace proto +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace tensorrt { diff --git a/paddle/fluid/inference/tensorrt/convert/softmax_op.cc b/paddle/fluid/inference/tensorrt/convert/softmax_op.cc index 9f4a048961f8d285f9280161e3ea3e3630b63556..0388154427e3a63d03d3c07aaadbc360454a6001 100644 --- a/paddle/fluid/inference/tensorrt/convert/softmax_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/softmax_op.cc @@ -14,6 +14,15 @@ limitations under the License. */ #include "paddle/fluid/inference/tensorrt/convert/op_converter.h" +namespace paddle { +namespace framework { +class Scope; +namespace proto { +class OpDesc; +} // namespace proto +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace tensorrt { diff --git a/paddle/fluid/inference/tensorrt/convert/swish_op.cc b/paddle/fluid/inference/tensorrt/convert/swish_op.cc index e220d80f0d79da5eab98aa7a18a5093f9f4a55c4..ab82a6578fb4dd367628808d894e54f6741a73d1 100644 --- a/paddle/fluid/inference/tensorrt/convert/swish_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/swish_op.cc @@ -15,6 +15,18 @@ limitations under the License. */ #include "paddle/fluid/inference/tensorrt/convert/op_converter.h" #include "paddle/fluid/inference/tensorrt/plugin/swish_op_plugin.h" +namespace nvinfer1 { +class ILayer; +} // namespace nvinfer1 +namespace paddle { +namespace framework { +class Scope; +namespace proto { +class OpDesc; +} // namespace proto +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace tensorrt { diff --git a/paddle/fluid/inference/tensorrt/engine.cc b/paddle/fluid/inference/tensorrt/engine.cc index 754979f77acd7a3b4818cdf16ef9c525bf1d82ea..1f7ea7ea04404712a29ef486004601f63510ea74 100644 --- a/paddle/fluid/inference/tensorrt/engine.cc +++ b/paddle/fluid/inference/tensorrt/engine.cc @@ -15,10 +15,9 @@ limitations under the License. */ #include "paddle/fluid/inference/tensorrt/engine.h" #include -#include #include #include -#include "paddle/fluid/inference/analysis/helper.h" + #include "paddle/fluid/inference/tensorrt/helper.h" #include "paddle/fluid/platform/enforce.h" @@ -26,6 +25,10 @@ namespace paddle { namespace inference { namespace tensorrt { +namespace plugin { +class PluginTensorRT; +} // namespace plugin + int TensorRTEngine::runtime_batch_ = 1; void TensorRTEngine::InitNetwork() { diff --git a/paddle/fluid/inference/tensorrt/engine.h b/paddle/fluid/inference/tensorrt/engine.h index a85ed483c1d12c3f2eecc5ed4bcb99937397a765..71625210054b36938f1da942066e5e346ef2beb5 100644 --- a/paddle/fluid/inference/tensorrt/engine.h +++ b/paddle/fluid/inference/tensorrt/engine.h @@ -23,6 +23,7 @@ limitations under the License. */ #include #include #include + #include "paddle/fluid/framework/tensor.h" #include "paddle/fluid/framework/tensor_util.h" #include "paddle/fluid/inference/api/paddle_analysis_config.h" @@ -33,10 +34,20 @@ limitations under the License. */ #include "paddle/fluid/inference/tensorrt/trt_int8_calibrator.h" #include "paddle/fluid/inference/utils/singleton.h" +namespace paddle { +namespace framework { +class Tensor; +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace tensorrt { +namespace plugin { +class PluginTensorRT; +} // namespace plugin + using FluidDT = framework::proto::VarType_Type; using TRT_DT = nvinfer1::DataType; @@ -94,6 +105,7 @@ nvinfer1::Dims Vec2TRT_Dims(const std::vector& shape, std::string input, } // NOLINT class TRTInt8Calibrator; + /* * TensorRT Engine. * diff --git a/paddle/fluid/inference/tensorrt/op_teller.cc b/paddle/fluid/inference/tensorrt/op_teller.cc index 31128ba8c5d42acac0dff321adbc40dbb0ce0c19..23aacedd693b4d7ea0622374d83c199d964a25e4 100644 --- a/paddle/fluid/inference/tensorrt/op_teller.cc +++ b/paddle/fluid/inference/tensorrt/op_teller.cc @@ -14,6 +14,12 @@ #include "paddle/fluid/inference/tensorrt/op_teller.h" +namespace paddle { +namespace framework { +class OpDesc; +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace tensorrt { diff --git a/paddle/fluid/inference/tensorrt/op_teller.h b/paddle/fluid/inference/tensorrt/op_teller.h index 76784c7445e841952ea34a763bbdd5a679a366cc..9113525a5c94fda633f08188687e822822bb7bce 100644 --- a/paddle/fluid/inference/tensorrt/op_teller.h +++ b/paddle/fluid/inference/tensorrt/op_teller.h @@ -17,9 +17,16 @@ #include #include #include + #include "paddle/fluid/framework/op_desc.h" #include "paddle/fluid/inference/tensorrt/engine.h" +namespace paddle { +namespace framework { +class OpDesc; +} // namespace framework +} // namespace paddle + namespace paddle { namespace inference { namespace tensorrt { diff --git a/paddle/fluid/inference/tensorrt/plugin/trt_plugin_factory.h b/paddle/fluid/inference/tensorrt/plugin/trt_plugin_factory.h index ed825801fc4b64e3c220a0d357dc7e5c5bde9c90..076dfbcf8f095ff15a265239c7b267db952b14be 100644 --- a/paddle/fluid/inference/tensorrt/plugin/trt_plugin_factory.h +++ b/paddle/fluid/inference/tensorrt/plugin/trt_plugin_factory.h @@ -26,6 +26,7 @@ #include "paddle/fluid/inference/tensorrt/plugin/trt_plugin_utils.h" #include "paddle/fluid/inference/utils/singleton.h" #include "paddle/fluid/platform/enforce.h" +#include "paddle/fluid/platform/variant.h" namespace paddle { namespace inference { diff --git a/paddle/fluid/inference/tensorrt/test_engine.cc b/paddle/fluid/inference/tensorrt/test_engine.cc index 72962c733ecf6a7bc6871fd3a5c65d6156b084d4..7c763858bb2101543af1dce0f3b81e964257a696 100644 --- a/paddle/fluid/inference/tensorrt/test_engine.cc +++ b/paddle/fluid/inference/tensorrt/test_engine.cc @@ -12,13 +12,10 @@ 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 "paddle/fluid/framework/tensor.h" -#include "paddle/fluid/framework/tensor_util.h" #include "paddle/fluid/inference/tensorrt/engine.h" #include "paddle/fluid/platform/enforce.h" diff --git a/paddle/fluid/inference/tensorrt/trt_int8_calibrator.h b/paddle/fluid/inference/tensorrt/trt_int8_calibrator.h index 5815bc9a1464293e0a56f05e34183580eac96cea..b4b7ee50dc3511cef1ef2e5dbef9251f7ea7fd67 100644 --- a/paddle/fluid/inference/tensorrt/trt_int8_calibrator.h +++ b/paddle/fluid/inference/tensorrt/trt_int8_calibrator.h @@ -23,6 +23,7 @@ #include #include #include + #include "paddle/fluid/framework/tensor.h" #include "paddle/fluid/inference/tensorrt/engine.h" #include "paddle/fluid/platform/place.h" diff --git a/paddle/fluid/inference/utils/benchmark.cc b/paddle/fluid/inference/utils/benchmark.cc index 074a397e323b5bfa0d09cd6684d093556b1093f5..8c76a03d29861defecc3b41130edebef6b767746 100644 --- a/paddle/fluid/inference/utils/benchmark.cc +++ b/paddle/fluid/inference/utils/benchmark.cc @@ -13,7 +13,7 @@ // limitations under the License. #include "paddle/fluid/inference/utils/benchmark.h" -#include + #include "paddle/fluid/platform/enforce.h" namespace paddle { diff --git a/paddle/fluid/inference/utils/io_utils.h b/paddle/fluid/inference/utils/io_utils.h index 853aba168b524eb289d4f57645bcaee809acdd0b..de2c7b26d3382daba0a549fa71b73c2bbc6c6631 100644 --- a/paddle/fluid/inference/utils/io_utils.h +++ b/paddle/fluid/inference/utils/io_utils.h @@ -16,9 +16,14 @@ #include #include + #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/inference/api/paddle_api.h" +namespace paddle { +struct PaddleTensor; +} // namespace paddle + namespace paddle { namespace inference { diff --git a/paddle/fluid/memory/allocation/aligned_allocator.h b/paddle/fluid/memory/allocation/aligned_allocator.h index 71250766034753e17687c9529d9fe1c314b6b662..6fef5cae8d6af32a8b5b2eff0c74ab94410bd070 100644 --- a/paddle/fluid/memory/allocation/aligned_allocator.h +++ b/paddle/fluid/memory/allocation/aligned_allocator.h @@ -15,6 +15,7 @@ #pragma once #include #include + #include "paddle/fluid/memory/allocation/allocator.h" namespace paddle { diff --git a/paddle/fluid/memory/allocation/allocator.h b/paddle/fluid/memory/allocation/allocator.h index 379c8d00960947880e048c6990e7ba856ddc68dd..e54748a53679d1363246896a0982275c4ef09535 100644 --- a/paddle/fluid/memory/allocation/allocator.h +++ b/paddle/fluid/memory/allocation/allocator.h @@ -18,6 +18,7 @@ #include #include #include + #include "paddle/fluid/framework/inlined_vector.h" #include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/platform/place.h" diff --git a/paddle/fluid/memory/allocation/allocator_facade_abs_flags_test.cc b/paddle/fluid/memory/allocation/allocator_facade_abs_flags_test.cc index 3e10be037bd317f3bca8b2d8519a40df97303bc7..0029991116200a64db84c57afcb0edb17065a098 100644 --- a/paddle/fluid/memory/allocation/allocator_facade_abs_flags_test.cc +++ b/paddle/fluid/memory/allocation/allocator_facade_abs_flags_test.cc @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/fluid/memory/allocation/allocator_facade.h" -#include #include +#include "paddle/fluid/memory/allocation/allocator_facade.h" + #ifdef PADDLE_WITH_CUDA DECLARE_double(fraction_of_gpu_memory_to_use); DECLARE_double(fraction_of_cuda_pinned_memory_to_use); diff --git a/paddle/fluid/memory/allocation/allocator_facade_frac_flags_test.cc b/paddle/fluid/memory/allocation/allocator_facade_frac_flags_test.cc index 3748805b1ceb9e392a767e8c08577c1f47bfe436..1e793d1617af38c3e69d5c5690b40524b031b3c7 100644 --- a/paddle/fluid/memory/allocation/allocator_facade_frac_flags_test.cc +++ b/paddle/fluid/memory/allocation/allocator_facade_frac_flags_test.cc @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/fluid/memory/allocation/allocator_facade.h" -#include #include +#include "paddle/fluid/memory/allocation/allocator_facade.h" + #ifdef PADDLE_WITH_CUDA DECLARE_double(fraction_of_gpu_memory_to_use); DECLARE_double(fraction_of_cuda_pinned_memory_to_use); diff --git a/paddle/fluid/memory/allocation/allocator_strategy.cc b/paddle/fluid/memory/allocation/allocator_strategy.cc index e1c7b243becaa16531912c64c9f3d95e76cf5092..518b31e943048d51584dfa894fbf0aed96ee35f9 100644 --- a/paddle/fluid/memory/allocation/allocator_strategy.cc +++ b/paddle/fluid/memory/allocation/allocator_strategy.cc @@ -13,8 +13,8 @@ // limitations under the License. #include "paddle/fluid/memory/allocation/allocator_strategy.h" + #include "gflags/gflags.h" -#include "glog/logging.h" #include "paddle/fluid/platform/enforce.h" DECLARE_string(allocator_strategy); diff --git a/paddle/fluid/memory/allocation/auto_growth_best_fit_allocator.h b/paddle/fluid/memory/allocation/auto_growth_best_fit_allocator.h index 27257883d558e7b3a09f8aeb5264d093e7d5c480..cbc126264ac2c09ef2532bf21834a648c02473ec 100644 --- a/paddle/fluid/memory/allocation/auto_growth_best_fit_allocator.h +++ b/paddle/fluid/memory/allocation/auto_growth_best_fit_allocator.h @@ -19,6 +19,7 @@ #include #include // NOLINT #include + #include "paddle/fluid/memory/allocation/allocator.h" namespace paddle { diff --git a/paddle/fluid/memory/allocation/auto_growth_best_fit_allocator_test.cc b/paddle/fluid/memory/allocation/auto_growth_best_fit_allocator_test.cc index 8865bf0b0db27f6c23ecf486daa076126223daf6..685248a88f71d695095bd844dea06558e5cbcee6 100644 --- a/paddle/fluid/memory/allocation/auto_growth_best_fit_allocator_test.cc +++ b/paddle/fluid/memory/allocation/auto_growth_best_fit_allocator_test.cc @@ -13,8 +13,10 @@ // limitations under the License. #include "paddle/fluid/memory/allocation/auto_growth_best_fit_allocator.h" + #include #include + #include "gtest/gtest.h" DECLARE_bool(free_idle_chunk); diff --git a/paddle/fluid/memory/allocation/best_fit_allocator.cc b/paddle/fluid/memory/allocation/best_fit_allocator.cc index 957dac4d03e33b7e40d7781a033a77da3a814bdc..2b8d2164f68ad0b9ff6d000f8ddee74ddce6434d 100644 --- a/paddle/fluid/memory/allocation/best_fit_allocator.cc +++ b/paddle/fluid/memory/allocation/best_fit_allocator.cc @@ -13,11 +13,7 @@ // limitations under the License. #include "paddle/fluid/memory/allocation/best_fit_allocator.h" - -#include -#include -#include -#include +#include namespace paddle { namespace memory { diff --git a/paddle/fluid/memory/allocation/best_fit_allocator.h b/paddle/fluid/memory/allocation/best_fit_allocator.h index 64a552e4fd2af1f661e3174e5041ffc71f74fa2c..a6015417b1227b00a77373d4cc108253e44c10e1 100644 --- a/paddle/fluid/memory/allocation/best_fit_allocator.h +++ b/paddle/fluid/memory/allocation/best_fit_allocator.h @@ -16,8 +16,15 @@ #include #include #include + #include "paddle/fluid/memory/allocation/allocator.h" +namespace paddle { +namespace platform { +class Place; +} // namespace platform +} // namespace paddle + namespace paddle { namespace memory { namespace allocation { diff --git a/paddle/fluid/memory/allocation/buffered_allocator.cc b/paddle/fluid/memory/allocation/buffered_allocator.cc index 7eed81a712ad3505b5c0833370df8b603c7d3953..d463ad1f5ebb1f5e31008a716f40b99b55895496 100644 --- a/paddle/fluid/memory/allocation/buffered_allocator.cc +++ b/paddle/fluid/memory/allocation/buffered_allocator.cc @@ -13,9 +13,6 @@ // limitations under the License. #include "paddle/fluid/memory/allocation/buffered_allocator.h" - -#include -#include #include namespace paddle { diff --git a/paddle/fluid/memory/allocation/buffered_allocator.h b/paddle/fluid/memory/allocation/buffered_allocator.h index fd0996f7748ef407262dba7bca705af9b5fb9674..5e1733bd839de2c0e219a40c569e492b1aca1d56 100644 --- a/paddle/fluid/memory/allocation/buffered_allocator.h +++ b/paddle/fluid/memory/allocation/buffered_allocator.h @@ -18,6 +18,7 @@ #include #include #include + #include "paddle/fluid/memory/allocation/allocator.h" #include "paddle/fluid/platform/lock_guard_ptr.h" diff --git a/paddle/fluid/memory/allocation/cpu_allocator.cc b/paddle/fluid/memory/allocation/cpu_allocator.cc index b096fbc112c55a482e522ed27734232f18c73afa..407f0f25935bf1dde5159aab8c4e9954f6fb6ccb 100644 --- a/paddle/fluid/memory/allocation/cpu_allocator.cc +++ b/paddle/fluid/memory/allocation/cpu_allocator.cc @@ -16,8 +16,6 @@ #include -#include - namespace paddle { namespace memory { namespace allocation { diff --git a/paddle/fluid/memory/allocation/locked_allocator.h b/paddle/fluid/memory/allocation/locked_allocator.h index 4af77e6e057f54d15dcb0248ba6cf36f6f00c2f1..1b8418bc8494a270645935f13dd3c8ea62849ed2 100644 --- a/paddle/fluid/memory/allocation/locked_allocator.h +++ b/paddle/fluid/memory/allocation/locked_allocator.h @@ -15,6 +15,7 @@ #include #include // NOLINT #include // NOLINT + #include "paddle/fluid/memory/allocation/allocator.h" namespace paddle { diff --git a/paddle/fluid/memory/allocation/mmap_allocator.cc b/paddle/fluid/memory/allocation/mmap_allocator.cc index 0ef084bafd0c9f9edb9c290653fe5448771f3df2..77e8d9943d00f7badd24cdb8603d16094ba9e84b 100644 --- a/paddle/fluid/memory/allocation/mmap_allocator.cc +++ b/paddle/fluid/memory/allocation/mmap_allocator.cc @@ -19,13 +19,8 @@ #include #include #include -#include -#include -#include - #include #include -#include namespace paddle { namespace memory { diff --git a/paddle/fluid/memory/allocation/mmap_allocator_test.cc b/paddle/fluid/memory/allocation/mmap_allocator_test.cc index 5b66920be2a0dc988794cdd1156dc64fb201aa5d..bcb02e0479290c92ab064ae1a995758c1d079161 100644 --- a/paddle/fluid/memory/allocation/mmap_allocator_test.cc +++ b/paddle/fluid/memory/allocation/mmap_allocator_test.cc @@ -16,8 +16,6 @@ #include "paddle/fluid/memory/allocation/mmap_allocator.h" -#include - #include "gtest/gtest.h" namespace paddle { diff --git a/paddle/fluid/memory/allocation/naive_best_fit_allocator.h b/paddle/fluid/memory/allocation/naive_best_fit_allocator.h index 913d583099c3f403a8262ff716fcd4c9ab930d22..4cf1bd6123e5fb3b99c60cc0a2750ef6295ab870 100644 --- a/paddle/fluid/memory/allocation/naive_best_fit_allocator.h +++ b/paddle/fluid/memory/allocation/naive_best_fit_allocator.h @@ -18,8 +18,10 @@ #include #include #include + #include "paddle/fluid/memory/allocation/allocator.h" #include "paddle/fluid/platform/place.h" + namespace paddle { namespace memory { namespace allocation { diff --git a/paddle/fluid/memory/allocation/pinned_allocator.cc b/paddle/fluid/memory/allocation/pinned_allocator.cc index 3ea2ecf3538892589dc2636f00c91619640eb798..42dd50af7293dc7f52add81eee7b6a98071bb072 100644 --- a/paddle/fluid/memory/allocation/pinned_allocator.cc +++ b/paddle/fluid/memory/allocation/pinned_allocator.cc @@ -14,9 +14,6 @@ #include "paddle/fluid/memory/allocation/pinned_allocator.h" -#include -#include - namespace paddle { namespace memory { namespace allocation { diff --git a/paddle/fluid/memory/allocation/thread_local_allocator.h b/paddle/fluid/memory/allocation/thread_local_allocator.h index bc07ad0c4dce3fccb3570d35b31e111b7253cd58..10ca4b828a4bb508ed91d15f2649c3d0d5e1da9a 100644 --- a/paddle/fluid/memory/allocation/thread_local_allocator.h +++ b/paddle/fluid/memory/allocation/thread_local_allocator.h @@ -16,6 +16,7 @@ #include #include + #include "paddle/fluid/memory/allocation/allocator.h" #include "paddle/fluid/memory/detail/buddy_allocator.h" #include "paddle/fluid/memory/detail/system_allocator.h" diff --git a/paddle/fluid/memory/detail/buddy_allocator.cc b/paddle/fluid/memory/detail/buddy_allocator.cc index faa87f1f01a8bb0188f41d904cf48176c2a9067d..6ac99744d79380803925f973c5b39262685e1ff0 100644 --- a/paddle/fluid/memory/detail/buddy_allocator.cc +++ b/paddle/fluid/memory/detail/buddy_allocator.cc @@ -13,10 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/memory/detail/buddy_allocator.h" - #include #include - #include "glog/logging.h" #ifdef PADDLE_WITH_CUDA diff --git a/paddle/fluid/memory/detail/buddy_allocator_test.cc b/paddle/fluid/memory/detail/buddy_allocator_test.cc index 780126f57c52f97844aaac0c0b4b09ead9b14577..1722acd10aa38e33f3c11aa8eac7cb50dce9fed4 100644 --- a/paddle/fluid/memory/detail/buddy_allocator_test.cc +++ b/paddle/fluid/memory/detail/buddy_allocator_test.cc @@ -21,12 +21,9 @@ limitations under the License. */ #endif #include "gflags/gflags.h" #include "gtest/gtest.h" -#include "paddle/fluid/memory/detail/system_allocator.h" #include "paddle/fluid/platform/gpu_info.h" #ifdef PADDLE_WITH_CUDA -#include - #include #include diff --git a/paddle/fluid/memory/detail/system_allocator_test.cc b/paddle/fluid/memory/detail/system_allocator_test.cc index 34bb40d549dff1d711cd8924630cdf528f41ed76..ea4897494f72b96e85911e03b651af1b4eac3298 100644 --- a/paddle/fluid/memory/detail/system_allocator_test.cc +++ b/paddle/fluid/memory/detail/system_allocator_test.cc @@ -15,7 +15,6 @@ limitations under the License. */ #include "paddle/fluid/memory/detail/system_allocator.h" #include -#include #include "gflags/gflags.h" #include "gtest/gtest.h" diff --git a/paddle/fluid/memory/malloc.h b/paddle/fluid/memory/malloc.h index 9ba572acaca9eba2b913847c52e5a54e19d79bdf..73487795f752eab69e660154c2e35817b2c80368 100644 --- a/paddle/fluid/memory/malloc.h +++ b/paddle/fluid/memory/malloc.h @@ -15,8 +15,10 @@ limitations under the License. */ #pragma once #include + #include "paddle/fluid/memory/allocation/allocator.h" #include "paddle/fluid/platform/place.h" + namespace paddle { namespace platform { diff --git a/paddle/fluid/operators/activation_cudnn_op.cu.cc b/paddle/fluid/operators/activation_cudnn_op.cu.cc index 33d8fb828f86e1f689ad4f67ad0033b45ce2671e..1903b9e30d80022c7351b155c1e0c149cf562a5b 100644 --- a/paddle/fluid/operators/activation_cudnn_op.cu.cc +++ b/paddle/fluid/operators/activation_cudnn_op.cu.cc @@ -12,13 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include -#include #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/operators/activation_op.h" #include "paddle/fluid/platform/cudnn_desc.h" +namespace paddle { +namespace platform { +struct CUDAPlace; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { using framework::Tensor; diff --git a/paddle/fluid/operators/array_to_lod_tensor_op.cc b/paddle/fluid/operators/array_to_lod_tensor_op.cc index ea1a93b5826496aafc7a092d91ad4b4a4bad7215..89475e3a2ec072d6b331ef8136c0e5e29f45e25d 100644 --- a/paddle/fluid/operators/array_to_lod_tensor_op.cc +++ b/paddle/fluid/operators/array_to_lod_tensor_op.cc @@ -12,20 +12,27 @@ 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 "paddle/fluid/framework/lod_rank_table.h" -#include "paddle/fluid/framework/lod_tensor_array.h" #include "paddle/fluid/framework/op_registry.h" -#include "paddle/fluid/memory/memcpy.h" #include "paddle/fluid/platform/device_context.h" +namespace paddle { +namespace framework { +class OpDesc; +class Scope; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle + namespace paddle { namespace operators { using LoD = framework::LoD; struct ArrayToLoDFunctor; + template struct ArrayToLoDFunctorImpl { const ArrayToLoDFunctor *prev_functor_; diff --git a/paddle/fluid/operators/assert_op.cc b/paddle/fluid/operators/assert_op.cc index da0e5fda63633084d766dab763d675d6943a828d..3e4250389fcfce26ddb4a845fd681955650b98ee 100644 --- a/paddle/fluid/operators/assert_op.cc +++ b/paddle/fluid/operators/assert_op.cc @@ -13,10 +13,24 @@ limitations under the License. */ #include "paddle/fluid/framework/op_registry.h" -#include "paddle/fluid/framework/var_type.h" #include "paddle/fluid/operators/controlflow/while_op_helper.h" #include "paddle/fluid/operators/tensor_formatter.h" +namespace paddle { +namespace framework { +class InferShapeContext; +class LoDTensor; +class OpDesc; +class Scope; +class Variable; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle + const char kCond[] = "Cond"; const char kData[] = "Data"; const char kSummarize[] = "summarize"; diff --git a/paddle/fluid/operators/assign_op.cc b/paddle/fluid/operators/assign_op.cc index f8c1216e9722b085314885c5714a3dd58d6e7176..e5bceae1c9520901a4d18e6e8321c00f922e2d8f 100644 --- a/paddle/fluid/operators/assign_op.cc +++ b/paddle/fluid/operators/assign_op.cc @@ -14,9 +14,23 @@ limitations under the License. */ #include "paddle/fluid/operators/assign_op.h" -#include #include +namespace paddle { +namespace framework { +class OpDesc; +class Variable; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +struct CPUPlace; +struct CUDAPlace; +struct float16; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/assign_op.h b/paddle/fluid/operators/assign_op.h index c2154f78bbe97418f2c7388a000dc833134d0c84..ed4ba24a74bea2aaedbbef4908904e2696826290 100644 --- a/paddle/fluid/operators/assign_op.h +++ b/paddle/fluid/operators/assign_op.h @@ -19,6 +19,13 @@ limitations under the License. */ #include "paddle/fluid/framework/var_type.h" #include "paddle/fluid/platform/device_context.h" +namespace paddle { +namespace framework { +class LoDTensor; +class Variable; +} // namespace framework +} // namespace paddle + namespace paddle { namespace operators { class AssignFunctor { diff --git a/paddle/fluid/operators/assign_op_test.cc b/paddle/fluid/operators/assign_op_test.cc index 58f360ad6059e4fe9743439cd0a16b1d7b9e241f..f0ec04a1f209c747f147f4069746e7935a85ccec 100644 --- a/paddle/fluid/operators/assign_op_test.cc +++ b/paddle/fluid/operators/assign_op_test.cc @@ -14,8 +14,6 @@ limitations under the License. */ #include "paddle/fluid/operators/assign_op.h" #include -#include -#include #include #include "paddle/fluid/framework/ddim.h" diff --git a/paddle/fluid/operators/assign_value_op.cc b/paddle/fluid/operators/assign_value_op.cc index a35e5a80a9eefaa537a4e16e899c24c370db0ba9..1589f9e8911f324d7a930ebb69cba8b2e8fe1c07 100644 --- a/paddle/fluid/operators/assign_value_op.cc +++ b/paddle/fluid/operators/assign_value_op.cc @@ -13,8 +13,23 @@ // limitations under the License. #include "paddle/fluid/operators/assign_value_op.h" + #include -#include + +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +struct CPUPlace; +} // namespace platform +} // namespace paddle namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/assign_value_op.h b/paddle/fluid/operators/assign_value_op.h index 1418d96b67b75ea3a2d4b3d95d3e4bdfb17618ee..6c2e5b9ad68987c99675330b9f5591f39244d270 100644 --- a/paddle/fluid/operators/assign_value_op.h +++ b/paddle/fluid/operators/assign_value_op.h @@ -16,6 +16,7 @@ #include #include + #include "paddle/fluid/framework/eigen.h" #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/platform/enforce.h" diff --git a/paddle/fluid/operators/beam_search_decode_op.cc b/paddle/fluid/operators/beam_search_decode_op.cc index c177dad8028222da39ba85a78ba684f8933e07b5..3cb3f1d48bfa7108f739463b40bf23f17c18f651 100644 --- a/paddle/fluid/operators/beam_search_decode_op.cc +++ b/paddle/fluid/operators/beam_search_decode_op.cc @@ -12,12 +12,24 @@ 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 "paddle/fluid/operators/beam_search_decode_op.h" #include "paddle/fluid/platform/device_context.h" +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +class Scope; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/collective/c_allreduce_max_op.cc b/paddle/fluid/operators/collective/c_allreduce_max_op.cc index bcb529f1570828d2bcca6d4275a213be4d5633eb..835b49e57bc0922a0d0be7895b57275ba31d2173 100644 --- a/paddle/fluid/operators/collective/c_allreduce_max_op.cc +++ b/paddle/fluid/operators/collective/c_allreduce_max_op.cc @@ -14,6 +14,21 @@ limitations under the License. */ #include "paddle/fluid/operators/collective/c_allreduce_op.h" +namespace paddle { +namespace framework { +class OpDesc; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +struct CPUPlace; +struct float16; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/collective/c_allreduce_max_op.cu.cc b/paddle/fluid/operators/collective/c_allreduce_max_op.cu.cc index 34054103aa0cf195ed394df860a8219ff3aa0157..ec8d651819502021c488d20c4a297e95ec664387 100644 --- a/paddle/fluid/operators/collective/c_allreduce_max_op.cu.cc +++ b/paddle/fluid/operators/collective/c_allreduce_max_op.cu.cc @@ -14,6 +14,13 @@ limitations under the License. */ #include "paddle/fluid/operators/collective/c_allreduce_op.h" +namespace paddle { +namespace platform { +struct CUDAPlace; +struct float16; +} // namespace platform +} // namespace paddle + namespace ops = paddle::operators; namespace plat = paddle::platform; diff --git a/paddle/fluid/operators/collective/c_allreduce_min_op.cc b/paddle/fluid/operators/collective/c_allreduce_min_op.cc index 9d27a9ceb30704463270b3922c3584febcc05c9e..efc19659c83ec35c9650d3184654f97d23940745 100644 --- a/paddle/fluid/operators/collective/c_allreduce_min_op.cc +++ b/paddle/fluid/operators/collective/c_allreduce_min_op.cc @@ -14,6 +14,21 @@ limitations under the License. */ #include "paddle/fluid/operators/collective/c_allreduce_op.h" +namespace paddle { +namespace framework { +class OpDesc; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +struct CPUPlace; +struct float16; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/collective/c_allreduce_min_op.cu.cc b/paddle/fluid/operators/collective/c_allreduce_min_op.cu.cc index 4e8b6f9d0a937ec4a5e7205bbd9ae834a2d305db..7935a1f722e553ff66bfaeb2f1cf2bb7876f95fb 100644 --- a/paddle/fluid/operators/collective/c_allreduce_min_op.cu.cc +++ b/paddle/fluid/operators/collective/c_allreduce_min_op.cu.cc @@ -14,6 +14,13 @@ limitations under the License. */ #include "paddle/fluid/operators/collective/c_allreduce_op.h" +namespace paddle { +namespace platform { +struct CUDAPlace; +struct float16; +} // namespace platform +} // namespace paddle + namespace ops = paddle::operators; namespace plat = paddle::platform; diff --git a/paddle/fluid/operators/collective/c_allreduce_prod_op.cc b/paddle/fluid/operators/collective/c_allreduce_prod_op.cc index 3cfb1723f18d326b33ed6c332f595010c5241f9a..5ab07ef026bac5bef7386b0789803933cd8fdf2a 100644 --- a/paddle/fluid/operators/collective/c_allreduce_prod_op.cc +++ b/paddle/fluid/operators/collective/c_allreduce_prod_op.cc @@ -14,6 +14,21 @@ limitations under the License. */ #include "paddle/fluid/operators/collective/c_allreduce_op.h" +namespace paddle { +namespace framework { +class OpDesc; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +struct CPUPlace; +struct float16; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/collective/c_allreduce_prod_op.cu.cc b/paddle/fluid/operators/collective/c_allreduce_prod_op.cu.cc index 61f76c178d03afad6eddf6848badb5894b51dcd8..1a78427cd19ee20440f1f47515c663191431b587 100644 --- a/paddle/fluid/operators/collective/c_allreduce_prod_op.cu.cc +++ b/paddle/fluid/operators/collective/c_allreduce_prod_op.cu.cc @@ -14,6 +14,13 @@ limitations under the License. */ #include "paddle/fluid/operators/collective/c_allreduce_op.h" +namespace paddle { +namespace platform { +struct CUDAPlace; +struct float16; +} // namespace platform +} // namespace paddle + namespace ops = paddle::operators; namespace plat = paddle::platform; diff --git a/paddle/fluid/operators/collective/c_allreduce_sum_op.cc b/paddle/fluid/operators/collective/c_allreduce_sum_op.cc index c9ed8b67647eab2b3de8bd132bb70cd2bf16edc0..68061e6ae6bea097b7a2bc5ee19d58c05fd21848 100644 --- a/paddle/fluid/operators/collective/c_allreduce_sum_op.cc +++ b/paddle/fluid/operators/collective/c_allreduce_sum_op.cc @@ -14,6 +14,19 @@ limitations under the License. */ #include "paddle/fluid/operators/collective/c_allreduce_op.h" +namespace paddle { +namespace framework { +class OpDesc; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +struct CPUPlace; +struct float16; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/collective/c_allreduce_sum_op.cu.cc b/paddle/fluid/operators/collective/c_allreduce_sum_op.cu.cc index 8fe7fce21e465af8af4d045c29dbc12ab9bc3c84..06e90cdff80455c688d990f30bd6f88910be3cce 100644 --- a/paddle/fluid/operators/collective/c_allreduce_sum_op.cu.cc +++ b/paddle/fluid/operators/collective/c_allreduce_sum_op.cu.cc @@ -14,6 +14,13 @@ limitations under the License. */ #include "paddle/fluid/operators/collective/c_allreduce_op.h" +namespace paddle { +namespace platform { +struct CUDAPlace; +struct float16; +} // namespace platform +} // namespace paddle + namespace ops = paddle::operators; namespace plat = paddle::platform; diff --git a/paddle/fluid/operators/collective/c_comm_init_op.cc b/paddle/fluid/operators/collective/c_comm_init_op.cc index a3bf1f4dfb1cb09fc864f891dda793ecde9027c6..ccad96320a757295b8c5256260852660fc3dcde8 100644 --- a/paddle/fluid/operators/collective/c_comm_init_op.cc +++ b/paddle/fluid/operators/collective/c_comm_init_op.cc @@ -14,19 +14,17 @@ limitations under the License. */ #if defined(PADDLE_WITH_NCCL) #include #endif -#include -#include #include -#include "paddle/fluid/framework/executor.h" -#include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/op_registry.h" -#include "paddle/fluid/framework/threadpool.h" -#include "paddle/fluid/operators/distributed/distributed.h" -#include "paddle/fluid/operators/distributed/request_handler_impl.h" + +namespace paddle { +namespace framework { +class Scope; +} // namespace framework +} // namespace paddle #if defined(PADDLE_WITH_NCCL) #include "paddle/fluid/platform/collective_helper.h" -#include "paddle/fluid/platform/nccl_helper.h" #endif namespace paddle { diff --git a/paddle/fluid/operators/collective/c_gen_nccl_id_op.cc b/paddle/fluid/operators/collective/c_gen_nccl_id_op.cc index e2b09be5a9dfff0111ab80d89bdd76b99517738f..2822129b19886e230b7bcbc09429168b49240c92 100644 --- a/paddle/fluid/operators/collective/c_gen_nccl_id_op.cc +++ b/paddle/fluid/operators/collective/c_gen_nccl_id_op.cc @@ -11,25 +11,23 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ - -#if defined(PADDLE_WITH_NCCL) -#include -#endif - -#include -#include #include +#include "glog/logging.h" #include "paddle/fluid/framework/executor.h" -#include "paddle/fluid/framework/lod_tensor.h" +#include "paddle/fluid/framework/op_proto_maker.h" #include "paddle/fluid/framework/op_registry.h" -#include "paddle/fluid/framework/threadpool.h" +#include "paddle/fluid/framework/operator.h" +#include "paddle/fluid/framework/program_desc.h" +#include "paddle/fluid/framework/scope.h" +#include "paddle/fluid/framework/var_type_traits.h" #include "paddle/fluid/operators/distributed/distributed.h" +#include "paddle/fluid/operators/distributed/request_handler.h" #include "paddle/fluid/operators/distributed/request_handler_impl.h" - -#if defined(PADDLE_WITH_NCCL) -#include "paddle/fluid/platform/nccl_helper.h" -#endif +#include "paddle/fluid/operators/distributed/rpc_client.h" +#include "paddle/fluid/platform/device_context.h" +#include "paddle/fluid/platform/enforce.h" +#include "paddle/fluid/platform/place.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/collective/c_reduce_max_op.cc b/paddle/fluid/operators/collective/c_reduce_max_op.cc index 425351877689f7e3ad8e0a46d2226f5f751a4016..41a07f94399514b5ba8b207e5b5c21bd9793ce92 100644 --- a/paddle/fluid/operators/collective/c_reduce_max_op.cc +++ b/paddle/fluid/operators/collective/c_reduce_max_op.cc @@ -14,6 +14,21 @@ limitations under the License. */ #include "paddle/fluid/operators/collective/c_reduce_op.h" +namespace paddle { +namespace framework { +class OpDesc; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +struct CPUPlace; +struct float16; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/collective/c_reduce_max_op.cu.cc b/paddle/fluid/operators/collective/c_reduce_max_op.cu.cc index 7e260346b4bdd8aced0df59c72f5adb4c479e8d0..e03da37360f4749e9375e59fa79a65adb3a077a0 100644 --- a/paddle/fluid/operators/collective/c_reduce_max_op.cu.cc +++ b/paddle/fluid/operators/collective/c_reduce_max_op.cu.cc @@ -14,6 +14,13 @@ limitations under the License. */ #include "paddle/fluid/operators/collective/c_reduce_op.h" +namespace paddle { +namespace platform { +struct CUDAPlace; +struct float16; +} // namespace platform +} // namespace paddle + namespace ops = paddle::operators; namespace plat = paddle::platform; diff --git a/paddle/fluid/operators/collective/c_reduce_min_op.cc b/paddle/fluid/operators/collective/c_reduce_min_op.cc index 8e849641e639eeceb48fc95656b269988c827006..77bb96347f94335ae481df16108d7b294590d4db 100644 --- a/paddle/fluid/operators/collective/c_reduce_min_op.cc +++ b/paddle/fluid/operators/collective/c_reduce_min_op.cc @@ -14,6 +14,21 @@ limitations under the License. */ #include "paddle/fluid/operators/collective/c_reduce_op.h" +namespace paddle { +namespace framework { +class OpDesc; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +struct CPUPlace; +struct float16; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/collective/c_reduce_min_op.cu.cc b/paddle/fluid/operators/collective/c_reduce_min_op.cu.cc index 77a75ed0b7af2a7946c02bfa0f33038aa0090c5b..83f7fce1ec6b7d73d3b0451b8a2d83d87be9408e 100644 --- a/paddle/fluid/operators/collective/c_reduce_min_op.cu.cc +++ b/paddle/fluid/operators/collective/c_reduce_min_op.cu.cc @@ -14,6 +14,13 @@ limitations under the License. */ #include "paddle/fluid/operators/collective/c_reduce_op.h" +namespace paddle { +namespace platform { +struct CUDAPlace; +struct float16; +} // namespace platform +} // namespace paddle + namespace ops = paddle::operators; namespace plat = paddle::platform; diff --git a/paddle/fluid/operators/collective/c_reduce_prod_op.cc b/paddle/fluid/operators/collective/c_reduce_prod_op.cc index 64935df856ec79f427bdcd21e03b7c493c31ac1e..f6c1c5d50e864fd02d65f7993257857a1d36e2ab 100644 --- a/paddle/fluid/operators/collective/c_reduce_prod_op.cc +++ b/paddle/fluid/operators/collective/c_reduce_prod_op.cc @@ -14,6 +14,21 @@ limitations under the License. */ #include "paddle/fluid/operators/collective/c_reduce_op.h" +namespace paddle { +namespace framework { +class OpDesc; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +struct CPUPlace; +struct float16; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/collective/c_reduce_prod_op.cu.cc b/paddle/fluid/operators/collective/c_reduce_prod_op.cu.cc index 07e431f7bc838caa9bc3abdcd0be1beb94b96635..83db107b36faf721f7a8e3a1ef40b960c93f97eb 100644 --- a/paddle/fluid/operators/collective/c_reduce_prod_op.cu.cc +++ b/paddle/fluid/operators/collective/c_reduce_prod_op.cu.cc @@ -14,6 +14,13 @@ limitations under the License. */ #include "paddle/fluid/operators/collective/c_reduce_op.h" +namespace paddle { +namespace platform { +struct CUDAPlace; +struct float16; +} // namespace platform +} // namespace paddle + namespace ops = paddle::operators; namespace plat = paddle::platform; diff --git a/paddle/fluid/operators/collective/c_reduce_sum_op.cc b/paddle/fluid/operators/collective/c_reduce_sum_op.cc index 3e20cee7e186a462aedc1881c6e34cacc8d09de0..e59ec85fefd13a5454127dab6a27fd5ed2c6b253 100644 --- a/paddle/fluid/operators/collective/c_reduce_sum_op.cc +++ b/paddle/fluid/operators/collective/c_reduce_sum_op.cc @@ -14,6 +14,21 @@ limitations under the License. */ #include "paddle/fluid/operators/collective/c_reduce_op.h" +namespace paddle { +namespace framework { +class OpDesc; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +struct CPUPlace; +struct float16; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/collective/c_reduce_sum_op.cu.cc b/paddle/fluid/operators/collective/c_reduce_sum_op.cu.cc index d9826422c16cb67f9f7101643918a83898c606b3..39c8716a92a36efdec75d4b159709fdaabe9a00b 100644 --- a/paddle/fluid/operators/collective/c_reduce_sum_op.cu.cc +++ b/paddle/fluid/operators/collective/c_reduce_sum_op.cu.cc @@ -14,6 +14,13 @@ limitations under the License. */ #include "paddle/fluid/operators/collective/c_reduce_op.h" +namespace paddle { +namespace platform { +struct CUDAPlace; +struct float16; +} // namespace platform +} // namespace paddle + namespace ops = paddle::operators; namespace plat = paddle::platform; diff --git a/paddle/fluid/operators/collective/c_sync_calc_stream_op.cc b/paddle/fluid/operators/collective/c_sync_calc_stream_op.cc index 64b60165722a5e5b978c4ead29d2c0fdb344354f..00f366e62120d5cb1adfdf384c3a0759ffbfa12d 100644 --- a/paddle/fluid/operators/collective/c_sync_calc_stream_op.cc +++ b/paddle/fluid/operators/collective/c_sync_calc_stream_op.cc @@ -11,19 +11,15 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ - -#if defined(PADDLE_WITH_NCCL) -#include -#endif - #include -#include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/op_registry.h" -#if defined(PADDLE_WITH_NCCL) -#include "paddle/fluid/platform/collective_helper.h" -#endif +namespace paddle { +namespace framework { +class Scope; +} // namespace framework +} // namespace paddle namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/collective/c_sync_comm_stream_op.cc b/paddle/fluid/operators/collective/c_sync_comm_stream_op.cc index 5405ea70ef65505fe02bb6f2a3d3b7ee79ce6bfa..d8617492fb12b356f673db42b6315ad89a34e9a5 100644 --- a/paddle/fluid/operators/collective/c_sync_comm_stream_op.cc +++ b/paddle/fluid/operators/collective/c_sync_comm_stream_op.cc @@ -11,18 +11,17 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ - -#if defined(PADDLE_WITH_NCCL) -#include -#endif - #include -#include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/op_registry.h" + +namespace paddle { +namespace framework { +class Scope; +} // namespace framework +} // namespace paddle #if defined(PADDLE_WITH_NCCL) #include "paddle/fluid/platform/collective_helper.h" -#include "paddle/fluid/platform/nccl_helper.h" #endif namespace paddle { diff --git a/paddle/fluid/operators/common_infer_shape_functions.cc b/paddle/fluid/operators/common_infer_shape_functions.cc index 22b212fc1b9f8844f0ae3555ac6d63af1f48d1cd..ce622d7501f90d0b6d1e9f4f50627fe0038f013e 100644 --- a/paddle/fluid/operators/common_infer_shape_functions.cc +++ b/paddle/fluid/operators/common_infer_shape_functions.cc @@ -13,10 +13,15 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/common_infer_shape_functions.h" - #include #include +namespace paddle { +namespace framework { +class InferShapeContext; +} // namespace framework +} // namespace paddle + // This file almostly contains all the infershape functions that are used in // operators. diff --git a/paddle/fluid/operators/common_infer_shape_functions.h b/paddle/fluid/operators/common_infer_shape_functions.h index 2cb9eab2865ce068a4f776bc63070c59bf029481..922d5262abc42dfb19f72ddaa47c85e448b84208 100644 --- a/paddle/fluid/operators/common_infer_shape_functions.h +++ b/paddle/fluid/operators/common_infer_shape_functions.h @@ -17,6 +17,12 @@ limitations under the License. */ #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/framework/operator.h" +namespace paddle { +namespace framework { +class InferShapeContext; +} // namespace framework +} // namespace paddle + // This file almostly contains all the infershape functions that are used in // operators. diff --git a/paddle/fluid/operators/controlflow/conditional_block_infer_op.cc b/paddle/fluid/operators/controlflow/conditional_block_infer_op.cc index aa31b8875620d967f115a4d18b5022ca3eb21804..62019be26cdef8214fe0e7c3e063c9387a30c91a 100644 --- a/paddle/fluid/operators/controlflow/conditional_block_infer_op.cc +++ b/paddle/fluid/operators/controlflow/conditional_block_infer_op.cc @@ -14,6 +14,18 @@ limitations under the License. */ #include "paddle/fluid/operators/controlflow/conditional_block_op.h" +namespace paddle { +namespace framework { +class OpDesc; +class Scope; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/controlflow/conditional_block_op.h b/paddle/fluid/operators/controlflow/conditional_block_op.h index 659e098c6dd20840e0efcea5ad0c5ee37300f4f4..c8ab2c91e912241457a8ab2f5455ef886b3b18ae 100644 --- a/paddle/fluid/operators/controlflow/conditional_block_op.h +++ b/paddle/fluid/operators/controlflow/conditional_block_op.h @@ -18,6 +18,7 @@ limitations under the License. */ #include #include #include + #include "paddle/fluid/framework/executor.h" #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/framework/var_type.h" diff --git a/paddle/fluid/operators/controlflow/conditional_block_op_helper.cc b/paddle/fluid/operators/controlflow/conditional_block_op_helper.cc index 155a5dbfec31f3a689fe199827f8ccf1c783d4e6..00b86121c0ddab5d53bf4c417ce27885ae0deb88 100644 --- a/paddle/fluid/operators/controlflow/conditional_block_op_helper.cc +++ b/paddle/fluid/operators/controlflow/conditional_block_op_helper.cc @@ -13,12 +13,19 @@ // limitations under the License. #include "paddle/fluid/operators/controlflow/conditional_block_op_helper.h" + #include #include #include -#include + #include "paddle/fluid/operators/controlflow/op_variant.h" +namespace paddle { +namespace framework { +class ProgramDesc; +} // namespace framework +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/controlflow/conditional_block_op_helper.h b/paddle/fluid/operators/controlflow/conditional_block_op_helper.h index f7dfba6f364e197a97cc5e061e42cd5cc84309db..abaaa8976065ca5636369036a0701d3d5bdfab00 100644 --- a/paddle/fluid/operators/controlflow/conditional_block_op_helper.h +++ b/paddle/fluid/operators/controlflow/conditional_block_op_helper.h @@ -16,9 +16,16 @@ #include #include + #include "paddle/fluid/framework/operator.h" #include "paddle/fluid/operators/controlflow/conditional_block_op.h" +namespace paddle { +namespace framework { +class ProgramDesc; +} // namespace framework +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/controlflow/conditional_block_op_test.cc b/paddle/fluid/operators/controlflow/conditional_block_op_test.cc index a5ca4a289deb1eb9a4666e84775bb26c0bdf030c..068d853f1cc7259c54defa8ee9519aa4e5e1e98e 100644 --- a/paddle/fluid/operators/controlflow/conditional_block_op_test.cc +++ b/paddle/fluid/operators/controlflow/conditional_block_op_test.cc @@ -13,14 +13,10 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/controlflow/conditional_block_op.h" -#include -#include -#include + #include "gtest/gtest.h" -#include "paddle/fluid/framework/executor.h" #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/framework/scope.h" -#include "paddle/fluid/framework/var_type.h" USE_NO_KERNEL_OP(conditional_block); USE_NO_KERNEL_OP(conditional_block_grad); diff --git a/paddle/fluid/operators/controlflow/feed_op.cc b/paddle/fluid/operators/controlflow/feed_op.cc index 088413ce223594ac8a32f0d06662dd3b8342c096..9597dd25ec530f6f2cb32ee12a08b05feb5b8bfa 100644 --- a/paddle/fluid/operators/controlflow/feed_op.cc +++ b/paddle/fluid/operators/controlflow/feed_op.cc @@ -12,10 +12,21 @@ 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 "paddle/fluid/framework/feed_fetch_type.h" #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/framework/operator.h" +namespace paddle { +namespace framework { +class OpDesc; +class Scope; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle + namespace paddle { namespace operators { class FeedOp : public framework::OperatorBase { diff --git a/paddle/fluid/operators/controlflow/get_places_op.cc b/paddle/fluid/operators/controlflow/get_places_op.cc index 4ab9f9fc863a6979496707ba4cc6794a56c37b30..e8829e1e1fa4628ac1c1989e91d6ee8048eb2a3d 100644 --- a/paddle/fluid/operators/controlflow/get_places_op.cc +++ b/paddle/fluid/operators/controlflow/get_places_op.cc @@ -12,9 +12,21 @@ 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 // NOLINT #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/platform/place.h" + +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +class Scope; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle #ifdef PADDLE_WITH_CUDA #include "paddle/fluid/platform/gpu_info.h" #endif diff --git a/paddle/fluid/operators/controlflow/op_variant.h b/paddle/fluid/operators/controlflow/op_variant.h index 9af993f1006c1e0107951c89460abe76c1561064..28c27437de12e37eaa94cef677fe3c9fc292c7c7 100644 --- a/paddle/fluid/operators/controlflow/op_variant.h +++ b/paddle/fluid/operators/controlflow/op_variant.h @@ -20,6 +20,13 @@ #include "paddle/fluid/framework/program_desc.h" #include "paddle/fluid/platform/variant.h" +namespace paddle { +namespace framework { +class OpDesc; +class OperatorBase; +} // namespace framework +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/controlflow/recurrent_op_helper.cc b/paddle/fluid/operators/controlflow/recurrent_op_helper.cc index f2973add84e89f931aaec09515c17cf5725d8759..c96b7c6a08c79c188d8254282d1e29b4ec105c03 100644 --- a/paddle/fluid/operators/controlflow/recurrent_op_helper.cc +++ b/paddle/fluid/operators/controlflow/recurrent_op_helper.cc @@ -13,14 +13,15 @@ // limitations under the License. #include "paddle/fluid/operators/controlflow/recurrent_op_helper.h" - #include #include -#include -#include -#include "paddle/fluid/framework/program_desc.h" -#include "paddle/fluid/operators/recurrent_op.h" +namespace paddle { +namespace framework { +class BlockDesc; +class ProgramDesc; +} // namespace framework +} // namespace paddle namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/controlflow/recurrent_op_helper.h b/paddle/fluid/operators/controlflow/recurrent_op_helper.h index aacca0762ca1d45634d36da572448dae7e9fe195..3d9404e57aa2715fe893879ac82735dc09006875 100644 --- a/paddle/fluid/operators/controlflow/recurrent_op_helper.h +++ b/paddle/fluid/operators/controlflow/recurrent_op_helper.h @@ -26,6 +26,12 @@ #include "paddle/fluid/platform/variant.h" #include "paddle/fluid/string/string_helper.h" +namespace paddle { +namespace framework { +class ProgramDesc; +} // namespace framework +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/controlflow/tensor_array_read_write_op.cc b/paddle/fluid/operators/controlflow/tensor_array_read_write_op.cc index 9f7702a5d6b63cc689535f2f1c880058e6211709..c4451c3b583c72fc6b7b1d4a257bd484fe9e3e53 100644 --- a/paddle/fluid/operators/controlflow/tensor_array_read_write_op.cc +++ b/paddle/fluid/operators/controlflow/tensor_array_read_write_op.cc @@ -12,7 +12,16 @@ 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 "paddle/fluid/operators/array_operator.h" -#include "paddle/fluid/operators/math/math_function.h" + +namespace paddle { +namespace framework { +class OpDesc; +class Scope; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/controlflow/while_op.cc b/paddle/fluid/operators/controlflow/while_op.cc index e4a1397f5c426a31b19c04aa8fb97c516a759c36..b85e740ada9bde7c7a9f4190082cf91def37f8cf 100644 --- a/paddle/fluid/operators/controlflow/while_op.cc +++ b/paddle/fluid/operators/controlflow/while_op.cc @@ -12,14 +12,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include "paddle/fluid/framework/executor.h" -#include "paddle/fluid/framework/lod_tensor_array.h" #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/framework/operator.h" -#include "paddle/fluid/framework/var_type.h" #include "paddle/fluid/operators/controlflow/while_op_helper.h" +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +class VarDesc; +} // namespace framework +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/controlflow/while_op_helper.h b/paddle/fluid/operators/controlflow/while_op_helper.h index 4f9d93c91f6f3f167fcda66d25addd0b6ac3ec6d..d2e9953e6477ad10c297adca13f4d8604a1f6f5d 100644 --- a/paddle/fluid/operators/controlflow/while_op_helper.h +++ b/paddle/fluid/operators/controlflow/while_op_helper.h @@ -17,9 +17,17 @@ #include #include #include + #include "paddle/fluid/framework/operator.h" #include "paddle/fluid/platform/variant.h" +namespace paddle { +namespace framework { +class LoDTensor; +class ProgramDesc; +} // namespace framework +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/cudnn_lstm_op.cu.cc b/paddle/fluid/operators/cudnn_lstm_op.cu.cc index 6457d9295dcbfa99d18f63fbda3dae048d7713cd..6ac75b78d7058eda4bf3564c184a8b0588a40578 100644 --- a/paddle/fluid/operators/cudnn_lstm_op.cu.cc +++ b/paddle/fluid/operators/cudnn_lstm_op.cu.cc @@ -16,8 +16,13 @@ limitations under the License. */ #include "paddle/fluid/operators/cudnn_lstm_cache.h" #include "paddle/fluid/operators/math/math_function.h" #include "paddle/fluid/operators/utils.h" -#include "paddle/fluid/platform/cudnn_desc.h" -#include "paddle/fluid/platform/cudnn_helper.h" + +namespace paddle { +namespace platform { +class CUDADeviceContext; +struct CUDAPlace; +} // namespace platform +} // namespace paddle namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/delete_var_op.cc b/paddle/fluid/operators/delete_var_op.cc index ec60569be200a4ed09aff046233f9977f47b5195..aa5649e4e9ce29f831f7f88a36c6e0ec70162929 100644 --- a/paddle/fluid/operators/delete_var_op.cc +++ b/paddle/fluid/operators/delete_var_op.cc @@ -12,6 +12,19 @@ limitations under the License. */ #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/framework/operator.h" +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +class Scope; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle + namespace paddle { namespace operators { class DeleteVarOp : public framework::OperatorBase { diff --git a/paddle/fluid/operators/dequantize_abs_max_op.cc b/paddle/fluid/operators/dequantize_abs_max_op.cc index 0d4d68d9f622fef9df4819d6092411a4d7db65f7..c8bca25b6b0f0e34fbfad5c2192faac24bd22ffa 100644 --- a/paddle/fluid/operators/dequantize_abs_max_op.cc +++ b/paddle/fluid/operators/dequantize_abs_max_op.cc @@ -13,8 +13,23 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/dequantize_abs_max_op.h" + #include -#include + +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +struct CPUPlace; +} // namespace platform +} // namespace paddle namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/dequantize_abs_max_op.h b/paddle/fluid/operators/dequantize_abs_max_op.h index 796ca93b0008180d602afe8e9c73efa7a749bc66..0d9d20fc120ca43e3127aa6a18abb475bd2af5b4 100644 --- a/paddle/fluid/operators/dequantize_abs_max_op.h +++ b/paddle/fluid/operators/dequantize_abs_max_op.h @@ -15,10 +15,17 @@ limitations under the License. */ #pragma once #include + #include "paddle/fluid/framework/ddim.h" #include "paddle/fluid/framework/eigen.h" #include "paddle/fluid/framework/op_registry.h" +namespace paddle { +namespace framework { +class Tensor; +} // namespace framework +} // namespace paddle + namespace paddle { namespace operators { @@ -35,6 +42,7 @@ class DequantizeMaxAbsKernel : public framework::OpKernel { virtual void Compute(const framework::ExecutionContext& ctx) const { auto* in = ctx.Input("X"); auto* scale = ctx.Input("Scale"); + auto* out = ctx.Output("Out"); float max_range = ctx.Attr("max_range"); diff --git a/paddle/fluid/operators/dequantize_log_op.cc b/paddle/fluid/operators/dequantize_log_op.cc index 2ecd54f7edde63ab5f5256694117cfb15be69384..c12dd9e6d218a251850eb828668a8613fe0ab3b5 100644 --- a/paddle/fluid/operators/dequantize_log_op.cc +++ b/paddle/fluid/operators/dequantize_log_op.cc @@ -13,9 +13,23 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/dequantize_log_op.h" -#include + #include -#include + +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +struct CPUPlace; +} // namespace platform +} // namespace paddle namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/dequantize_log_op.h b/paddle/fluid/operators/dequantize_log_op.h index f6590ecf61fe6e4c0ad1b667bb5c712b36a1bc45..67ce9cc84d3a8548e87e6554129f82baae2e2009 100644 --- a/paddle/fluid/operators/dequantize_log_op.h +++ b/paddle/fluid/operators/dequantize_log_op.h @@ -15,9 +15,16 @@ limitations under the License. */ #pragma once #include + #include "paddle/fluid/framework/ddim.h" #include "paddle/fluid/framework/op_registry.h" +namespace paddle { +namespace framework { +class Tensor; +} // namespace framework +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/distributed/async_sparse_param_update_recorder.h b/paddle/fluid/operators/distributed/async_sparse_param_update_recorder.h index eadd842c7f6ead56006fd0c34814b1b7bd9b62f4..cef6590ae21e84d16143e149820cd5ad033808bf 100644 --- a/paddle/fluid/operators/distributed/async_sparse_param_update_recorder.h +++ b/paddle/fluid/operators/distributed/async_sparse_param_update_recorder.h @@ -14,6 +14,7 @@ #pragma once +#include #include #include // NOLINT #include @@ -23,8 +24,6 @@ #include #include -#include - #include "paddle/fluid/platform/enforce.h" namespace paddle { diff --git a/paddle/fluid/operators/distributed/async_sparse_param_update_recorder_test.cc b/paddle/fluid/operators/distributed/async_sparse_param_update_recorder_test.cc index 17d8973303ba6b2ec8d39179e3052d184d44464c..2d78559625c91fadec1fbb282b08e542a07d964a 100644 --- a/paddle/fluid/operators/distributed/async_sparse_param_update_recorder_test.cc +++ b/paddle/fluid/operators/distributed/async_sparse_param_update_recorder_test.cc @@ -13,9 +13,7 @@ // limitations under the License. #include "paddle/fluid/operators/distributed/async_sparse_param_update_recorder.h" - #include - #include "gtest/gtest.h" namespace paddle { diff --git a/paddle/fluid/operators/distributed/collective_client.cc b/paddle/fluid/operators/distributed/collective_client.cc index 6d3f53431113621fc859eda8e7448383772d20a3..fcd3e6abead510393736a9253af2ae1068357a68 100644 --- a/paddle/fluid/operators/distributed/collective_client.cc +++ b/paddle/fluid/operators/distributed/collective_client.cc @@ -12,11 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include // NOLINT -#include -#include "gflags/gflags.h" - #include "paddle/fluid/operators/distributed/collective_client.h" +#include +#include "gflags/gflags.h" DECLARE_int32(rpc_deadline); diff --git a/paddle/fluid/operators/distributed/collective_client.h b/paddle/fluid/operators/distributed/collective_client.h index 6a3a450a1fd2e52c341f824f4816ca13784bda85..e7d8bb8df9834728682ea131f3ef0d60786908e5 100644 --- a/paddle/fluid/operators/distributed/collective_client.h +++ b/paddle/fluid/operators/distributed/collective_client.h @@ -15,16 +15,27 @@ #pragma once #include // NOLINT +#include #include #include -#include "gflags/gflags.h" +#include "gflags/gflags.h" #include "paddle/fluid/framework/data_type.h" #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/operators/distributed/distributed.h" #include "paddle/fluid/operators/distributed/request_handler.h" +namespace paddle { +namespace framework { +class Scope; +class SelectedRows; +} // namespace framework +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle + DECLARE_int32(rpc_deadline); namespace paddle { diff --git a/paddle/fluid/operators/distributed/collective_server.cc b/paddle/fluid/operators/distributed/collective_server.cc index c95652400c27acd406ca3f70a0dfa8d329e94358..cdd37742d2d5a5a882320cbff1e67a353b4af5f8 100644 --- a/paddle/fluid/operators/distributed/collective_server.cc +++ b/paddle/fluid/operators/distributed/collective_server.cc @@ -12,14 +12,8 @@ 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 // for removing the port file -#include -#include -#include -#include // NOLINT -#include - #include "paddle/fluid/operators/distributed/collective_server.h" +#include DEFINE_int32(collective_get_thread_num, 5, "number of threads for rpc get"); diff --git a/paddle/fluid/operators/distributed/collective_server.h b/paddle/fluid/operators/distributed/collective_server.h index 03c688a78e1cbaba4afe4585e619956188a767a1..1015007ba0c566499e3459758cf3a911f661cee0 100644 --- a/paddle/fluid/operators/distributed/collective_server.h +++ b/paddle/fluid/operators/distributed/collective_server.h @@ -15,6 +15,7 @@ limitations under the License. */ #pragma once #include +#include #include #include #include // NOLINT @@ -22,12 +23,17 @@ limitations under the License. */ #include #include "gflags/gflags.h" - #include "paddle/fluid/operators/distributed/distributed.h" #include "paddle/fluid/operators/distributed/request_handler.h" #include "paddle/fluid/operators/distributed/request_handler_impl.h" #include "paddle/fluid/operators/distributed/rpc_server.h" +namespace paddle { +namespace framework { +class Variable; +} // namespace framework +} // namespace paddle + namespace paddle { namespace operators { namespace distributed { diff --git a/paddle/fluid/operators/distributed/collective_server_test.cc b/paddle/fluid/operators/distributed/collective_server_test.cc index be8c7a7dd40697d4abb8e53215ce09ae6619f18e..92b2eb4b51e59fec0991712ec4f6d6829b76cfb4 100644 --- a/paddle/fluid/operators/distributed/collective_server_test.cc +++ b/paddle/fluid/operators/distributed/collective_server_test.cc @@ -13,22 +13,18 @@ See the License for the specific language governing permissions and limitations under the License. */ #include -#include #include #include -#include // NOLINT #include "gtest/gtest.h" -#include "paddle/fluid/framework/block_desc.h" -#include "paddle/fluid/framework/op_registry.h" -#include "paddle/fluid/framework/operator.h" -#include "paddle/fluid/framework/tensor_util.h" - #include "paddle/fluid/operators/distributed/collective_client.h" #include "paddle/fluid/operators/distributed/collective_server.h" -#include "paddle/fluid/operators/distributed/distributed.h" -#include "paddle/fluid/operators/distributed/request_handler_impl.h" -#include "paddle/fluid/operators/math/math_function.h" + +namespace paddle { +namespace framework { +class Variable; +} // namespace framework +} // namespace paddle namespace framework = paddle::framework; namespace platform = paddle::platform; diff --git a/paddle/fluid/operators/distributed/communicator.h b/paddle/fluid/operators/distributed/communicator.h index 4a9a9eb1701f5a9102de9de164a7679999ee2a3e..07fd4ed496000d949e11663b7c2b758f9f23587d 100644 --- a/paddle/fluid/operators/distributed/communicator.h +++ b/paddle/fluid/operators/distributed/communicator.h @@ -15,6 +15,7 @@ limitations under the License. */ #pragma once #include +#include #include #include #include @@ -26,8 +27,8 @@ limitations under the License. */ #include #include #include -#include "gflags/gflags.h" +#include "gflags/gflags.h" #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/framework/variable.h" #include "paddle/fluid/framework/variable_helper.h" diff --git a/paddle/fluid/operators/distributed/communicator_test.cc b/paddle/fluid/operators/distributed/communicator_test.cc index b9a6afa4cc351b59e5bd91e483bd654a7aade041..38b7c8b00317e6880434e975438c72ba9248aee2 100644 --- a/paddle/fluid/operators/distributed/communicator_test.cc +++ b/paddle/fluid/operators/distributed/communicator_test.cc @@ -12,11 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include -#include -#include -#include #include "paddle/fluid/operators/distributed/communicator.h" diff --git a/paddle/fluid/operators/distributed/grpc/grpc_bytebuffer_stream.cc b/paddle/fluid/operators/distributed/grpc/grpc_bytebuffer_stream.cc index c2cb0d7f04eb67275030e841740f0cdb291d9f87..7d6756b41363d12af68402817cfee1df408b8827 100644 --- a/paddle/fluid/operators/distributed/grpc/grpc_bytebuffer_stream.cc +++ b/paddle/fluid/operators/distributed/grpc/grpc_bytebuffer_stream.cc @@ -19,6 +19,10 @@ limitations under the License. */ #include "paddle/fluid/operators/distributed/grpc/grpc_bytebuffer_stream.h" +namespace grpc { +class ByteBuffer; +} // namespace grpc + namespace paddle { namespace operators { namespace distributed { diff --git a/paddle/fluid/operators/distributed/grpc/grpc_bytebuffer_stream.h b/paddle/fluid/operators/distributed/grpc/grpc_bytebuffer_stream.h index e9074574cdd163bbf7e62939df9283352706f840..486870de7a554e675bb01492e775654bbcb34da3 100644 --- a/paddle/fluid/operators/distributed/grpc/grpc_bytebuffer_stream.h +++ b/paddle/fluid/operators/distributed/grpc/grpc_bytebuffer_stream.h @@ -26,8 +26,12 @@ limitations under the License. */ #include "grpc++/grpc++.h" #include "paddle/fluid/operators/distributed/variable_response.h" +struct grpc_byte_buffer; + namespace grpc { // A ZeroCopyInputStream that reads from grpc_byte_buffer +class ByteBuffer; + class GrpcBufferReader final : public ::google::protobuf::io::ZeroCopyInputStream { typedef void (CoreCodegenInterface::*OldReaderInitAPI)( diff --git a/paddle/fluid/operators/distributed/grpc/grpc_client.h b/paddle/fluid/operators/distributed/grpc/grpc_client.h index 6b6249540c6d15954743c414a60472bf1f831151..22ca74a67e72b44216348e8df3914d2d23ae75c3 100644 --- a/paddle/fluid/operators/distributed/grpc/grpc_client.h +++ b/paddle/fluid/operators/distributed/grpc/grpc_client.h @@ -16,7 +16,6 @@ limitations under the License. */ #include #include - #include // NOLINT #include // NOLINT #include @@ -47,6 +46,18 @@ limitations under the License. */ #include "paddle/fluid/operators/distributed/sendrecvop_utils.h" #include "paddle/fluid/platform/macros.h" // for DISABLE_COPY_AND_ASSIGN +namespace grpc { +class Channel; +} // namespace grpc +namespace paddle { +namespace framework { +class Scope; +} // namespace framework +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { namespace distributed { diff --git a/paddle/fluid/operators/distributed/grpc/grpc_serde.cc b/paddle/fluid/operators/distributed/grpc/grpc_serde.cc index eddd89cf20c2eb91e88d666a6ffe4a045df7298b..0372846ce0debeba6614fd0aac30fd9c1561f763 100644 --- a/paddle/fluid/operators/distributed/grpc/grpc_serde.cc +++ b/paddle/fluid/operators/distributed/grpc/grpc_serde.cc @@ -17,19 +17,26 @@ limitations under the License. */ #endif #include #include -#include // NOLINT - -#include "google/protobuf/io/coded_stream.h" -#include "google/protobuf/io/zero_copy_stream.h" -#include "paddle/fluid/framework/data_type.h" -#include "paddle/fluid/operators/distributed/grpc/grpc_bytebuffer_stream.h" +#include "grpcpp/impl/codegen/byte_buffer.h" +#include "grpcpp/impl/codegen/slice.h" #include "paddle/fluid/operators/distributed/grpc/grpc_serde.h" #include "paddle/fluid/operators/distributed/grpc/grpc_variable_response.h" #include "paddle/fluid/operators/distributed/proto_encoder_helper.h" +#include "paddle/fluid/operators/distributed/send_recv.pb.h" #include "paddle/fluid/operators/distributed/sendrecvop_utils.h" -#include "paddle/fluid/platform/port.h" +#include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/platform/profiler.h" +namespace paddle { +namespace framework { +class Scope; +class Variable; +} // namespace framework +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { namespace distributed { diff --git a/paddle/fluid/operators/distributed/grpc/grpc_serde.h b/paddle/fluid/operators/distributed/grpc/grpc_serde.h index 30e6907656e25bc7bcae77d3bd02638f6bb7601d..932f3e2f069a2bfe1dec9318446e1bf064d2e317 100644 --- a/paddle/fluid/operators/distributed/grpc/grpc_serde.h +++ b/paddle/fluid/operators/distributed/grpc/grpc_serde.h @@ -24,10 +24,22 @@ limitations under the License. */ #include "paddle/fluid/framework/selected_rows.h" #include "paddle/fluid/framework/tensor_util.h" #include "paddle/fluid/framework/var_type.h" +#include "paddle/fluid/operators/distributed/distributed_pb.h" #include "paddle/fluid/operators/distributed/sendrecvop_utils.h" #include "paddle/fluid/platform/port.h" -#include "paddle/fluid/operators/distributed/distributed_pb.h" +namespace grpc { +class ByteBuffer; +} // namespace grpc +namespace paddle { +namespace framework { +class Scope; +class Variable; +} // namespace framework +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/distributed/grpc/grpc_server.cc b/paddle/fluid/operators/distributed/grpc/grpc_server.cc index 5c0232a50a9066f782be5269b4041958748c2e23..47e114ff4b235a39d29f7061c8dbd7db1c9eb09a 100644 --- a/paddle/fluid/operators/distributed/grpc/grpc_server.cc +++ b/paddle/fluid/operators/distributed/grpc/grpc_server.cc @@ -20,6 +20,20 @@ limitations under the License. */ #include "paddle/fluid/operators/distributed/grpc/grpc_serde.h" #include "paddle/fluid/operators/distributed/grpc/grpc_server.h" +namespace grpc { +class ChannelArguments; +} // namespace grpc +namespace paddle { +namespace framework { +class Variable; +} // namespace framework +namespace operators { +namespace distributed { +class GRPCVariableResponse; +} // namespace distributed +} // namespace operators +} // namespace paddle + using ::grpc::ServerAsyncResponseWriter; DECLARE_bool(rpc_disable_reuse_port); diff --git a/paddle/fluid/operators/distributed/grpc/grpc_server.h b/paddle/fluid/operators/distributed/grpc/grpc_server.h index ee6950205b31d9e2d3cd8722daf1c12117a17029..3d68b7e8cebb400680458a1163d52b01f8c8dc2e 100644 --- a/paddle/fluid/operators/distributed/grpc/grpc_server.h +++ b/paddle/fluid/operators/distributed/grpc/grpc_server.h @@ -37,6 +37,10 @@ limitations under the License. */ #include "paddle/fluid/operators/distributed/sendrecvop_utils.h" #include "paddle/fluid/platform/profiler.h" +namespace grpc { +class ServerCompletionQueue; +} // namespace grpc + namespace paddle { namespace operators { namespace distributed { diff --git a/paddle/fluid/operators/distributed/grpc/grpc_variable_response.cc b/paddle/fluid/operators/distributed/grpc/grpc_variable_response.cc index e46d2fbe01c16a8b0cbf402f6ffff4907adf7356..7d7723f19454c0c5c03b26a0737bcc8241c94889 100644 --- a/paddle/fluid/operators/distributed/grpc/grpc_variable_response.cc +++ b/paddle/fluid/operators/distributed/grpc/grpc_variable_response.cc @@ -12,16 +12,29 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include #include -#ifdef PADDLE_WITH_NCCL -#include -#endif +#include "google/protobuf/io/coded_stream.h" +#include "paddle/fluid/operators/distributed/grpc/grpc_bytebuffer_stream.h" #include "paddle/fluid/operators/distributed/grpc/grpc_variable_response.h" +#include "paddle/fluid/operators/distributed/send_recv.pb.h" +#include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/platform/profiler.h" +namespace google { +namespace protobuf { +namespace io { +class ZeroCopyInputStream; +} // namespace io +} // namespace protobuf +} // namespace google +namespace grpc { +class ByteBuffer; +} // namespace grpc + namespace paddle { namespace operators { namespace distributed { diff --git a/paddle/fluid/operators/distributed/grpc/grpc_variable_response.h b/paddle/fluid/operators/distributed/grpc/grpc_variable_response.h index 3ca1d89f750313791c833a9f1f58760406e690c2..4d12b4a4bacd7ffee6ac7725951b967f7eb2da15 100644 --- a/paddle/fluid/operators/distributed/grpc/grpc_variable_response.h +++ b/paddle/fluid/operators/distributed/grpc/grpc_variable_response.h @@ -16,19 +16,30 @@ #include +#include "google/protobuf/io/coded_stream.h" +#include "google/protobuf/io/zero_copy_stream.h" #include "paddle/fluid/framework/data_type.h" #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/framework/selected_rows.h" -#include "paddle/fluid/framework/var_type.h" - -#include "google/protobuf/io/coded_stream.h" -#include "google/protobuf/io/zero_copy_stream.h" #include "paddle/fluid/framework/tensor.h" +#include "paddle/fluid/framework/var_type.h" #include "paddle/fluid/operators/distributed/distributed_pb.h" #include "paddle/fluid/operators/distributed/grpc/grpc_bytebuffer_stream.h" #include "paddle/fluid/operators/distributed/variable_response.h" +namespace grpc { +class ByteBuffer; +} // namespace grpc +namespace paddle { +namespace framework { +class Scope; +} // namespace framework +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { namespace distributed { diff --git a/paddle/fluid/operators/distributed/heart_beat_monitor.cc b/paddle/fluid/operators/distributed/heart_beat_monitor.cc index 6736ea4336ba40c077352dac9f7f0ff3660ff3b1..84ba9793c4e00a59081e28dc63506ba2ac995de5 100644 --- a/paddle/fluid/operators/distributed/heart_beat_monitor.cc +++ b/paddle/fluid/operators/distributed/heart_beat_monitor.cc @@ -13,7 +13,7 @@ // limitations under the License. #include "paddle/fluid/operators/distributed/heart_beat_monitor.h" -#include // NOLINT + #include namespace paddle { diff --git a/paddle/fluid/operators/distributed/heart_beat_monitor.h b/paddle/fluid/operators/distributed/heart_beat_monitor.h index 211e40757fc752ecd8846a45fae73db143f481e3..cfef492de0e16dfe75fa0c331ce35a6e9aaf81b5 100644 --- a/paddle/fluid/operators/distributed/heart_beat_monitor.h +++ b/paddle/fluid/operators/distributed/heart_beat_monitor.h @@ -14,21 +14,18 @@ #pragma once +#include #include - #include #include // NOLINT #include #include +#include // NOLINT #include #include #include #include -#include // NOLINT - -#include - #include "paddle/fluid/platform/enforce.h" namespace paddle { diff --git a/paddle/fluid/operators/distributed/heart_beat_monitor_test.cc b/paddle/fluid/operators/distributed/heart_beat_monitor_test.cc index 699c03f6f288919b2e1ab622e9be8283dce4e808..7c2c0fbff11befa353a024241c99b0a7f6144566 100644 --- a/paddle/fluid/operators/distributed/heart_beat_monitor_test.cc +++ b/paddle/fluid/operators/distributed/heart_beat_monitor_test.cc @@ -14,9 +14,6 @@ #include "paddle/fluid/operators/distributed/heart_beat_monitor.h" -#include -#include // NOLINT - #include "gtest/gtest.h" namespace paddle { diff --git a/paddle/fluid/operators/distributed/large_scale_kv.h b/paddle/fluid/operators/distributed/large_scale_kv.h index 9e39e68cba779de4dc598046e45f7d35e292bb79..b4388c0002a78b3ad66efeeb9fee2ad3c7f65c1e 100644 --- a/paddle/fluid/operators/distributed/large_scale_kv.h +++ b/paddle/fluid/operators/distributed/large_scale_kv.h @@ -16,7 +16,6 @@ #include #include - #include #include // NOLINT #include diff --git a/paddle/fluid/operators/distributed/parameter_prefetch.cc b/paddle/fluid/operators/distributed/parameter_prefetch.cc index a9378d61c3ca39bd43b558633cc4d04c40175cac..6b33c1f5fcdca85271c3d4110e057523b5415fb6 100644 --- a/paddle/fluid/operators/distributed/parameter_prefetch.cc +++ b/paddle/fluid/operators/distributed/parameter_prefetch.cc @@ -12,30 +12,28 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include "paddle/fluid/operators/distributed/parameter_prefetch.h" #include #include -#include #include #include -#include - -#include "paddle/fluid/operators/distributed/parameter_prefetch.h" - #include "paddle/fluid/framework/lod_tensor.h" -#include "paddle/fluid/framework/scope.h" #include "paddle/fluid/framework/selected_rows.h" -#include "paddle/fluid/framework/tensor.h" - #include "paddle/fluid/operators/distributed/distributed.h" -#include "paddle/fluid/operators/distributed/rpc_client.h" -#include "paddle/fluid/operators/distributed/variable_response.h" -#include "paddle/fluid/operators/distributed_ops/send_recv_util.h" + +namespace paddle { +namespace framework { +class ExecutionContext; +class Scope; +} // namespace framework +} // namespace paddle namespace paddle { namespace operators { namespace distributed { +class RPCClient; + using LoDTensor = framework::LoDTensor; using LoDTensor = framework::LoDTensor; using SelectedRows = framework::SelectedRows; diff --git a/paddle/fluid/operators/distributed/parameter_prefetch.h b/paddle/fluid/operators/distributed/parameter_prefetch.h index 8605bcdcd86759d5c5b45fdcbb1e68407621fc08..6fd3a998813c0ba32b8b694b6655e1c73f45d62b 100644 --- a/paddle/fluid/operators/distributed/parameter_prefetch.h +++ b/paddle/fluid/operators/distributed/parameter_prefetch.h @@ -20,6 +20,13 @@ #include "paddle/fluid/framework/operator.h" +namespace paddle { +namespace framework { +class ExecutionContext; +class Scope; +} // namespace framework +} // namespace paddle + namespace paddle { namespace operators { namespace distributed { diff --git a/paddle/fluid/operators/distributed/parameter_recv.cc b/paddle/fluid/operators/distributed/parameter_recv.cc index 3b8479c91b0b619430ebde26b26f0ae6c9fc59cb..a91df5b3c471e234dd1ae72771c287e21ebf7af0 100644 --- a/paddle/fluid/operators/distributed/parameter_recv.cc +++ b/paddle/fluid/operators/distributed/parameter_recv.cc @@ -12,29 +12,28 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include -#include -#include -#include - -#include "paddle/fluid/operators/distributed/parameter_recv.h" +#include "glog/logging.h" +#include "paddle/fluid/framework/ddim.h" #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/framework/selected_rows.h" -#include "paddle/fluid/framework/tensor.h" - +#include "paddle/fluid/operators/distributed/communicator_common.h" #include "paddle/fluid/operators/distributed/distributed.h" -#include "paddle/fluid/operators/distributed/rpc_client.h" -#include "paddle/fluid/operators/distributed/variable_response.h" -#include "paddle/fluid/operators/distributed_ops/send_recv_util.h" -#include "paddle/fluid/operators/strided_memcpy.h" +#include "paddle/fluid/operators/distributed/parameter_recv.h" +#include "paddle/fluid/platform/device_context.h" +#include "paddle/fluid/platform/enforce.h" +#include "paddle/fluid/platform/place.h" namespace paddle { namespace operators { namespace distributed { +class RPCClient; + using LoDTensor = framework::LoDTensor; using LoDTensor = framework::LoDTensor; using SelectedRows = framework::SelectedRows; diff --git a/paddle/fluid/operators/distributed/parameter_send.cc b/paddle/fluid/operators/distributed/parameter_send.cc index 545b1f5e803c60f8c68005849336e1d3e4893df7..99af06bc7cc6f83fda0714f6ed13a2afb5641e8e 100644 --- a/paddle/fluid/operators/distributed/parameter_send.cc +++ b/paddle/fluid/operators/distributed/parameter_send.cc @@ -14,26 +14,31 @@ #include "paddle/fluid/operators/distributed/parameter_send.h" #include -#include -#include #include -#include - +#include "glog/logging.h" +#include "paddle/fluid/framework/ddim.h" #include "paddle/fluid/framework/lod_tensor.h" -#include "paddle/fluid/framework/scope.h" #include "paddle/fluid/framework/selected_rows.h" -#include "paddle/fluid/framework/tensor.h" - +#include "paddle/fluid/operators/distributed/communicator_common.h" #include "paddle/fluid/operators/distributed/distributed.h" -#include "paddle/fluid/operators/distributed/rpc_client.h" -#include "paddle/fluid/operators/distributed/variable_response.h" -#include "paddle/fluid/operators/distributed_ops/send_recv_util.h" -#include "paddle/fluid/string/printf.h" +#include "paddle/fluid/operators/distributed/request_handler.h" +#include "paddle/fluid/platform/device_context.h" +#include "paddle/fluid/platform/enforce.h" +#include "paddle/fluid/platform/place.h" + +namespace paddle { +namespace framework { +class Scope; +class Tensor; +} // namespace framework +} // namespace paddle namespace paddle { namespace operators { namespace distributed { +class RPCClient; + using LoDTensor = framework::LoDTensor; using LoDTensor = framework::LoDTensor; using SelectedRows = framework::SelectedRows; diff --git a/paddle/fluid/operators/distributed/request_handler_impl.h b/paddle/fluid/operators/distributed/request_handler_impl.h index 42621724e68f40617bebd2b01e2af5dd23387163..6d239673f9104131c3129ea822e5c9f892845ea1 100644 --- a/paddle/fluid/operators/distributed/request_handler_impl.h +++ b/paddle/fluid/operators/distributed/request_handler_impl.h @@ -15,7 +15,6 @@ #pragma once #include - #include #include #include @@ -33,6 +32,13 @@ #include "paddle/fluid/framework/var_type.h" #include "paddle/fluid/operators/distributed/request_handler.h" +namespace paddle { +namespace framework { +class Scope; +class Variable; +} // namespace framework +} // namespace paddle + namespace paddle { namespace operators { namespace distributed { diff --git a/paddle/fluid/operators/distributed/rpc_client.h b/paddle/fluid/operators/distributed/rpc_client.h index 69a5e3274318337f5424afa6492da829e04daa69..6a6a795a46b52c6b0ea289ee3e15c827af8688cf 100644 --- a/paddle/fluid/operators/distributed/rpc_client.h +++ b/paddle/fluid/operators/distributed/rpc_client.h @@ -17,13 +17,22 @@ #include // NOLINT #include #include -#include "gflags/gflags.h" +#include "gflags/gflags.h" #include "paddle/fluid/framework/data_type.h" #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/operators/distributed/request_handler.h" +namespace paddle { +namespace framework { +class Scope; +} // namespace framework +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle + DECLARE_int32(rpc_deadline); DECLARE_int32(rpc_retry_times); diff --git a/paddle/fluid/operators/distributed/rpc_server.cc b/paddle/fluid/operators/distributed/rpc_server.cc index 691c2c1048f77866fe3e0e6a22cf6a6daebf0040..52b4456f7b1eb904ddf85dc6e8f3088964da444a 100644 --- a/paddle/fluid/operators/distributed/rpc_server.cc +++ b/paddle/fluid/operators/distributed/rpc_server.cc @@ -15,15 +15,23 @@ #include "paddle/fluid/operators/distributed/rpc_server.h" #include -#include -#include #include -#include "paddle/fluid/platform/profiler.h" + +namespace paddle { +namespace framework { +class Scope; +} // namespace framework +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle namespace paddle { namespace operators { namespace distributed { +class RequestHandler; + void RPCServer::ShutDown() { VLOG(3) << "RPCServer ShutDown "; ShutDownImpl(); diff --git a/paddle/fluid/operators/distributed/rpc_server.h b/paddle/fluid/operators/distributed/rpc_server.h index 8c7b7f1d7eeeced24d2ade2bcff4261b24587624..f83144f626881642e8da2685841881c2bff86390 100644 --- a/paddle/fluid/operators/distributed/rpc_server.h +++ b/paddle/fluid/operators/distributed/rpc_server.h @@ -18,6 +18,7 @@ #include #include #include // NOLINT +#include #include #include @@ -25,10 +26,21 @@ #include "paddle/fluid/operators/distributed/request_handler.h" #include "paddle/fluid/platform/device_context.h" +namespace paddle { +namespace framework { +class Scope; +} // namespace framework +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { namespace distributed { +class RequestHandler; + struct MonomerHandle { std::string var_name_; std::string rpc_name_; diff --git a/paddle/fluid/operators/distributed/sendrecvop_utils.cc b/paddle/fluid/operators/distributed/sendrecvop_utils.cc index b52fb93e5bf7fb27faa0ccc4e2fb4b08112ba6b9..2e9d958ebfba6f4211e7af886af22d92487542f1 100644 --- a/paddle/fluid/operators/distributed/sendrecvop_utils.cc +++ b/paddle/fluid/operators/distributed/sendrecvop_utils.cc @@ -11,17 +11,20 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ - -#ifdef PADDLE_WITH_NCCL -#include -#endif #include -#include // NOLINT -#include "paddle/fluid/framework/data_type.h" #include "paddle/fluid/operators/distributed/sendrecvop_utils.h" -#include "paddle/fluid/operators/distributed/variable_response.h" -#include "paddle/fluid/platform/port.h" + +namespace paddle { +namespace framework { +class Variable; +} // namespace framework +namespace memory { +namespace allocation { +class Allocation; +} // namespace allocation +} // namespace memory +} // namespace paddle DEFINE_bool(rpc_disable_reuse_port, false, "Disable SO_REUSEPORT or not."); DEFINE_int32(rpc_retry_bind_port, 3, diff --git a/paddle/fluid/operators/distributed/sendrecvop_utils.h b/paddle/fluid/operators/distributed/sendrecvop_utils.h index 5457101a5c9f3eb22f76877676f4a8a750a0f914..8a382baa5be7c15a1bd4215ef4702e96e0045f85 100644 --- a/paddle/fluid/operators/distributed/sendrecvop_utils.h +++ b/paddle/fluid/operators/distributed/sendrecvop_utils.h @@ -14,6 +14,7 @@ limitations under the License. */ #pragma once #include +#include #include #include #include @@ -27,6 +28,21 @@ limitations under the License. */ #include "paddle/fluid/operators/distributed/distributed_pb.h" #include "paddle/fluid/platform/port.h" +namespace paddle { +namespace framework { +class Tensor; +class Variable; +} // namespace framework +namespace memory { +namespace allocation { +class Allocation; +} // namespace allocation +} // namespace memory +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { namespace distributed { diff --git a/paddle/fluid/operators/distributed/varhandle_test.cc b/paddle/fluid/operators/distributed/varhandle_test.cc index a0fcaf886475c5e03d959ffd6af22b2123526b9f..7c52ef74b4c2e5e060a2a46ea8c2ebc727f0cbae 100644 --- a/paddle/fluid/operators/distributed/varhandle_test.cc +++ b/paddle/fluid/operators/distributed/varhandle_test.cc @@ -12,11 +12,6 @@ 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 // NOLINT - -#include "google/protobuf/text_format.h" #include "gtest/gtest.h" #include "paddle/fluid/operators/distributed/request_handler.h" diff --git a/paddle/fluid/operators/distributed/variable_response.h b/paddle/fluid/operators/distributed/variable_response.h index d979cd8a881ec7d697eae06b4911d597730b6908..be67a2396f7d713aad3b6bc46210cd9345d3dc55 100644 --- a/paddle/fluid/operators/distributed/variable_response.h +++ b/paddle/fluid/operators/distributed/variable_response.h @@ -16,17 +16,33 @@ #include +#include "google/protobuf/io/coded_stream.h" +#include "google/protobuf/io/zero_copy_stream.h" #include "paddle/fluid/framework/data_type.h" #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/framework/selected_rows.h" -#include "paddle/fluid/framework/var_type.h" - -#include "google/protobuf/io/coded_stream.h" -#include "google/protobuf/io/zero_copy_stream.h" #include "paddle/fluid/framework/tensor.h" +#include "paddle/fluid/framework/var_type.h" #include "paddle/fluid/operators/distributed/distributed_pb.h" +namespace google { +namespace protobuf { +namespace io { +class CodedInputStream; +class ZeroCopyInputStream; +} // namespace io +} // namespace protobuf +} // namespace google +namespace paddle { +namespace framework { +class Variable; +} // namespace framework +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle + DECLARE_string(rpc_server_profile_path); namespace paddle { diff --git a/paddle/fluid/operators/distributed_ops/checkpoint_notify_op.cc b/paddle/fluid/operators/distributed_ops/checkpoint_notify_op.cc index 2ed2acb96dc842b6a60bf31701d39ac94dab9804..abc8d912840dba6f3da8acd3a911769c8748b2a8 100644 --- a/paddle/fluid/operators/distributed_ops/checkpoint_notify_op.cc +++ b/paddle/fluid/operators/distributed_ops/checkpoint_notify_op.cc @@ -9,15 +9,21 @@ 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 // NOLINT -#include - -#include "paddle/fluid/framework/data_type.h" -#include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/operators/distributed/distributed.h" -#include "paddle/fluid/operators/distributed_ops/send_recv_util.h" -#include "paddle/fluid/string/printf.h" + +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +class Scope; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/distributed_ops/fetch_barrier_op.cc b/paddle/fluid/operators/distributed_ops/fetch_barrier_op.cc index c9f9daf3b3c0442e379cd7a22fcf48dbe3acbb5d..755cbf017d9d4be5e4d75024e29b09beecf53db4 100644 --- a/paddle/fluid/operators/distributed_ops/fetch_barrier_op.cc +++ b/paddle/fluid/operators/distributed_ops/fetch_barrier_op.cc @@ -12,19 +12,29 @@ 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 // NOLINT -#include - -#include "paddle/fluid/framework/data_type.h" -#include "paddle/fluid/framework/framework.pb.h" -#include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/operators/distributed/distributed.h" -#include "paddle/fluid/platform/profiler.h" + +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +class Scope; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle namespace paddle { namespace operators { +namespace distributed { +class RPCClient; +} // namespace distributed + class FetchBarrierOp : public framework::OperatorBase { public: FetchBarrierOp(const std::string& type, diff --git a/paddle/fluid/operators/distributed_ops/fl_listen_and_serv_op.h b/paddle/fluid/operators/distributed_ops/fl_listen_and_serv_op.h index 1199a63d16a4ecddf04eef468aea42d147608783..25ad16e3fce37837838af5360f79b9bece337373 100644 --- a/paddle/fluid/operators/distributed_ops/fl_listen_and_serv_op.h +++ b/paddle/fluid/operators/distributed_ops/fl_listen_and_serv_op.h @@ -31,9 +31,25 @@ limitations under the License. */ #include "paddle/fluid/operators/distributed/rpc_server.h" #include "paddle/fluid/platform/device_context.h" +namespace paddle { +namespace framework { +class Executor; +class ProgramDesc; +class Scope; +} // namespace framework +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { +namespace distributed { +class RPCServer; +class RequestHandler; +} // namespace distributed + constexpr char kOptimizeBlocks[] = "optimize_blocks"; void FlRunServer(std::shared_ptr service); diff --git a/paddle/fluid/operators/distributed_ops/gen_nccl_id_op.cc b/paddle/fluid/operators/distributed_ops/gen_nccl_id_op.cc index e63f882478351cde16bde969b86e020181d6d4e5..db8c2f3f2d8660b0390cb35d76b2ef800c631788 100644 --- a/paddle/fluid/operators/distributed_ops/gen_nccl_id_op.cc +++ b/paddle/fluid/operators/distributed_ops/gen_nccl_id_op.cc @@ -12,18 +12,24 @@ 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 "glog/logging.h" #include "paddle/fluid/framework/executor.h" -#include "paddle/fluid/framework/lod_tensor.h" +#include "paddle/fluid/framework/op_proto_maker.h" #include "paddle/fluid/framework/op_registry.h" -#include "paddle/fluid/framework/threadpool.h" +#include "paddle/fluid/framework/operator.h" +#include "paddle/fluid/framework/program_desc.h" +#include "paddle/fluid/framework/scope.h" +#include "paddle/fluid/framework/var_type_traits.h" #include "paddle/fluid/operators/distributed/distributed.h" +#include "paddle/fluid/operators/distributed/request_handler.h" #include "paddle/fluid/operators/distributed/request_handler_impl.h" -#include "paddle/fluid/platform/nccl_helper.h" +#include "paddle/fluid/operators/distributed/rpc_client.h" +#include "paddle/fluid/platform/device_context.h" +#include "paddle/fluid/platform/enforce.h" +#include "paddle/fluid/platform/place.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/distributed_ops/listen_and_serv_op.h b/paddle/fluid/operators/distributed_ops/listen_and_serv_op.h index b41e4e87722f638e6661a5116ebdfbc02c32710f..bacfd32cc739193a18317cb7d57c16953a4b5c84 100644 --- a/paddle/fluid/operators/distributed_ops/listen_and_serv_op.h +++ b/paddle/fluid/operators/distributed_ops/listen_and_serv_op.h @@ -31,9 +31,25 @@ limitations under the License. */ #include "paddle/fluid/operators/distributed/rpc_server.h" #include "paddle/fluid/platform/device_context.h" +namespace paddle { +namespace framework { +class Executor; +class ProgramDesc; +class Scope; +} // namespace framework +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { +namespace distributed { +class RPCServer; +class RequestHandler; +} // namespace distributed + constexpr char kOptimizeBlocks[] = "optimize_blocks"; constexpr char kPrefetchVarNameToBlockId[] = "prefetch_var_name_to_block_id"; constexpr char kCheckpointBlockId[] = "checkpint_block_id"; diff --git a/paddle/fluid/operators/distributed_ops/prefetch_op.cc b/paddle/fluid/operators/distributed_ops/prefetch_op.cc index 6037ab1523ec347574db4b18aa1de732acbd3336..007dbbbfbf5105b052598c9454dfcdc15319d658 100644 --- a/paddle/fluid/operators/distributed_ops/prefetch_op.cc +++ b/paddle/fluid/operators/distributed_ops/prefetch_op.cc @@ -12,18 +12,29 @@ 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 // NOLINT -#include - -#include "paddle/fluid/framework/data_type.h" -#include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/operators/distributed/distributed.h" -#include "paddle/fluid/operators/distributed_ops/send_recv_util.h" + +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +class Scope; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle namespace paddle { namespace operators { +namespace distributed { +class RPCClient; +} // namespace distributed + class PrefetchOp : public framework::OperatorBase { public: PrefetchOp(const std::string& type, const framework::VariableNameMap& inputs, diff --git a/paddle/fluid/operators/distributed_ops/recv_op.cc b/paddle/fluid/operators/distributed_ops/recv_op.cc index 2547ba3acb16031245ceae622e11893597bb9b9b..9729d0dadd7ed8e68056e7c87437944425efdfe0 100644 --- a/paddle/fluid/operators/distributed_ops/recv_op.cc +++ b/paddle/fluid/operators/distributed_ops/recv_op.cc @@ -12,22 +12,30 @@ 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 // NOLINT -#include - -#include "paddle/fluid/framework/data_type.h" -#include "paddle/fluid/framework/framework.pb.h" -#include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/operators/distributed/communicator.h" -#include "paddle/fluid/operators/distributed/communicator_common.h" #include "paddle/fluid/operators/distributed/distributed.h" -#include "paddle/fluid/operators/distributed/parameter_recv.h" -#include "paddle/fluid/platform/profiler.h" + +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +class Scope; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle namespace paddle { namespace operators { +namespace distributed { +class RPCClient; +} // namespace distributed + class RecvOp : public framework::OperatorBase { public: RecvOp(const std::string &type, const framework::VariableNameMap &inputs, diff --git a/paddle/fluid/operators/distributed_ops/ref_by_trainer_id_op.cc b/paddle/fluid/operators/distributed_ops/ref_by_trainer_id_op.cc index befdf4e938850cad4180d3d7a66cc67ea1b2e810..4727b3bb249de8a49b6955d581109e6eee3e3f8b 100644 --- a/paddle/fluid/operators/distributed_ops/ref_by_trainer_id_op.cc +++ b/paddle/fluid/operators/distributed_ops/ref_by_trainer_id_op.cc @@ -13,8 +13,21 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/distributed_ops/ref_by_trainer_id_op.h" + #include +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/distributed_ops/ref_by_trainer_id_op.h b/paddle/fluid/operators/distributed_ops/ref_by_trainer_id_op.h index 43dd9c3c98a0ab454a8114d8cdf58606db0684a4..d8639627c3ef66d3d5a9be86a1c6ada640efc533 100644 --- a/paddle/fluid/operators/distributed_ops/ref_by_trainer_id_op.h +++ b/paddle/fluid/operators/distributed_ops/ref_by_trainer_id_op.h @@ -15,6 +15,7 @@ limitations under the License. */ #pragma once #include + #include "paddle/fluid/framework/op_registry.h" namespace paddle { diff --git a/paddle/fluid/operators/distributed_ops/send_barrier_op.cc b/paddle/fluid/operators/distributed_ops/send_barrier_op.cc index a8e9379d214d8f85fd9847fa79046275fe595a18..5aa2ba26aa4d6eef73e52ea64041d57c24ec47c1 100644 --- a/paddle/fluid/operators/distributed_ops/send_barrier_op.cc +++ b/paddle/fluid/operators/distributed_ops/send_barrier_op.cc @@ -12,20 +12,29 @@ 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 // NOLINT -#include - -#include "paddle/fluid/framework/data_type.h" -#include "paddle/fluid/framework/framework.pb.h" -#include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/operators/distributed/distributed.h" -#include "paddle/fluid/platform/profiler.h" +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +class Scope; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle namespace paddle { namespace operators { +namespace distributed { +class RPCClient; +} // namespace distributed + class SendBarrierOp : public framework::OperatorBase { public: SendBarrierOp(const std::string& type, diff --git a/paddle/fluid/operators/distributed_ops/send_op.cc b/paddle/fluid/operators/distributed_ops/send_op.cc index 53e3d70f960938bed77cba4112e22692dd7ed87b..a4192c18afae50033b40490e5a831a184caaa1b3 100644 --- a/paddle/fluid/operators/distributed_ops/send_op.cc +++ b/paddle/fluid/operators/distributed_ops/send_op.cc @@ -12,23 +12,29 @@ 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 // NOLINT -#include - -#include "paddle/fluid/framework/blocking_queue.h" -#include "paddle/fluid/framework/data_type.h" -#include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/op_registry.h" -#include "paddle/fluid/operators/distributed/communicator.h" -#include "paddle/fluid/operators/distributed/communicator_common.h" #include "paddle/fluid/operators/distributed/distributed.h" -#include "paddle/fluid/operators/distributed/parameter_send.h" -#include "paddle/fluid/operators/distributed_ops/send_recv_util.h" -#include "paddle/fluid/platform/profiler.h" + +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +class Scope; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle namespace paddle { namespace operators { +namespace distributed { +class RPCClient; +} // namespace distributed + class SendOp : public framework::OperatorBase { public: SendOp(const std::string& type, const framework::VariableNameMap& inputs, diff --git a/paddle/fluid/operators/elementwise/elementwise_add_op.cc b/paddle/fluid/operators/elementwise/elementwise_add_op.cc index 97624944ca109f27322f151f0742c72447fd5c39..68a98e7c6bc2a7cd405a6d1bc4448c0f084d0f0f 100644 --- a/paddle/fluid/operators/elementwise/elementwise_add_op.cc +++ b/paddle/fluid/operators/elementwise/elementwise_add_op.cc @@ -20,6 +20,19 @@ limitations under the License. */ #include "paddle/fluid/framework/op_version_registry.h" #include "paddle/fluid/operators/elementwise/elementwise_op.h" +namespace paddle { +namespace framework { +class OpDesc; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +class CPUDeviceContext; +struct CPUPlace; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/elementwise/elementwise_add_op.h b/paddle/fluid/operators/elementwise/elementwise_add_op.h index 152f20273a1820e709f562d2c72b6cbc7e29dfb0..c4efc4ab72d6308d89220ef9e49ad2240b2ddef2 100644 --- a/paddle/fluid/operators/elementwise/elementwise_add_op.h +++ b/paddle/fluid/operators/elementwise/elementwise_add_op.h @@ -17,6 +17,7 @@ limitations under the License. */ #include "paddle/fluid/operators/elementwise/elementwise_op_function.cu.h" #include "paddle/fluid/operators/elementwise/elementwise_op_function.h" #include "paddle/fluid/operators/math/blas.h" + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/elementwise/elementwise_floordiv_op.cc b/paddle/fluid/operators/elementwise/elementwise_floordiv_op.cc index 5a398fa50febe2efffd588ce8f3612f1f9cec0b6..ddd69203fd316b41cd4b2b3077df6f4ac12f1a64 100644 --- a/paddle/fluid/operators/elementwise/elementwise_floordiv_op.cc +++ b/paddle/fluid/operators/elementwise/elementwise_floordiv_op.cc @@ -13,9 +13,26 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/elementwise/elementwise_floordiv_op.h" + #include + #include "paddle/fluid/operators/elementwise/elementwise_op.h" +namespace paddle { +namespace framework { +class OpDesc; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +class CPUDeviceContext; +struct CPUPlace; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { class ElementwiseFloorDivOpMaker : public ElementwiseOpMaker { diff --git a/paddle/fluid/operators/elementwise/elementwise_max_op.cc b/paddle/fluid/operators/elementwise/elementwise_max_op.cc index 692bc015c5b6fc47502b37412a2be2d90237c672..be6a63305475e9e44bcb0499b6438bdc3354677a 100644 --- a/paddle/fluid/operators/elementwise/elementwise_max_op.cc +++ b/paddle/fluid/operators/elementwise/elementwise_max_op.cc @@ -13,10 +13,24 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/elementwise/elementwise_max_op.h" -#include + #include + #include "paddle/fluid/operators/elementwise/elementwise_op.h" +namespace paddle { +namespace framework { +class OpDesc; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +class CPUDeviceContext; +struct CPUPlace; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/elementwise/elementwise_min_op.cc b/paddle/fluid/operators/elementwise/elementwise_min_op.cc index 1b2364a5a53d1817d18dccfe7363f2e37be5b1b7..bd40763e05a281e4042c3193b8fb763b9aea8909 100644 --- a/paddle/fluid/operators/elementwise/elementwise_min_op.cc +++ b/paddle/fluid/operators/elementwise/elementwise_min_op.cc @@ -13,10 +13,24 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/elementwise/elementwise_min_op.h" -#include + #include + #include "paddle/fluid/operators/elementwise/elementwise_op.h" +namespace paddle { +namespace framework { +class OpDesc; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +class CPUDeviceContext; +struct CPUPlace; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/elementwise/elementwise_min_op.h b/paddle/fluid/operators/elementwise/elementwise_min_op.h index 1a49a6013987ae1ec685ec91ca656e4756ba7c32..5a3e7f90f3c3dbee093c17fd4c5cf863ad1f4d24 100644 --- a/paddle/fluid/operators/elementwise/elementwise_min_op.h +++ b/paddle/fluid/operators/elementwise/elementwise_min_op.h @@ -16,6 +16,7 @@ limitations under the License. */ #include "paddle/fluid/operators/elementwise/elementwise_op.h" #include "paddle/fluid/operators/elementwise/elementwise_op_function.h" + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/elementwise/elementwise_mod_op.cc b/paddle/fluid/operators/elementwise/elementwise_mod_op.cc index 8c2e62bed195f27e228d5dd460ba21ed87c3f5d2..d8ad0a353c9cbebe7b40e70e5e2f293f38931376 100644 --- a/paddle/fluid/operators/elementwise/elementwise_mod_op.cc +++ b/paddle/fluid/operators/elementwise/elementwise_mod_op.cc @@ -13,9 +13,26 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/elementwise/elementwise_mod_op.h" + #include + #include "paddle/fluid/operators/elementwise/elementwise_op.h" +namespace paddle { +namespace framework { +class OpDesc; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +class CPUDeviceContext; +struct CPUPlace; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { class ElementwiseModOpMaker : public ElementwiseOpMaker { diff --git a/paddle/fluid/operators/elementwise/elementwise_pow_op.cc b/paddle/fluid/operators/elementwise/elementwise_pow_op.cc index 1321eee8457173cd310b8ff66092386641d631fc..ea0e8e7c0138770fb45b12411f9acac9ce97777e 100644 --- a/paddle/fluid/operators/elementwise/elementwise_pow_op.cc +++ b/paddle/fluid/operators/elementwise/elementwise_pow_op.cc @@ -10,10 +10,24 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/elementwise/elementwise_pow_op.h" -#include + #include + #include "paddle/fluid/operators/elementwise/elementwise_op.h" +namespace paddle { +namespace framework { +class OpDesc; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +class CPUDeviceContext; +struct CPUPlace; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/elementwise/elementwise_pow_op.h b/paddle/fluid/operators/elementwise/elementwise_pow_op.h index a910c326196bc61758c3be7db3b8ac5d85b0095c..535d838209d0e418554d7f6facc932af6fff6185 100755 --- a/paddle/fluid/operators/elementwise/elementwise_pow_op.h +++ b/paddle/fluid/operators/elementwise/elementwise_pow_op.h @@ -13,6 +13,7 @@ limitations under the License. */ #include #include + #include "paddle/fluid/operators/elementwise/elementwise_op.h" #include "paddle/fluid/operators/elementwise/elementwise_op_function.h" diff --git a/paddle/fluid/operators/elementwise/elementwise_sub_op.cc b/paddle/fluid/operators/elementwise/elementwise_sub_op.cc index 9603b022d5d8c4672219b7199d1bfe4fb6bfe3e9..90f4ebb99ec7d7be09ab4129fd89391be1037b1c 100644 --- a/paddle/fluid/operators/elementwise/elementwise_sub_op.cc +++ b/paddle/fluid/operators/elementwise/elementwise_sub_op.cc @@ -13,10 +13,24 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/elementwise/elementwise_sub_op.h" -#include + #include + #include "paddle/fluid/operators/elementwise/elementwise_op.h" +namespace paddle { +namespace framework { +class OpDesc; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +class CPUDeviceContext; +struct CPUPlace; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/elementwise/mkldnn/elementwise_add_mkldnn_op.cc b/paddle/fluid/operators/elementwise/mkldnn/elementwise_add_mkldnn_op.cc index caaaf2c931de04e9e489130eae0491d450cd2dab..3dcf5bf6a32fadef88df647d898e237a6dcbe34c 100644 --- a/paddle/fluid/operators/elementwise/mkldnn/elementwise_add_mkldnn_op.cc +++ b/paddle/fluid/operators/elementwise/mkldnn/elementwise_add_mkldnn_op.cc @@ -14,6 +14,16 @@ #include "paddle/fluid/operators/elementwise/mkldnn/elementwise_mkldnn_op.h" +namespace paddle { +namespace framework { +class ExecutionContext; +} // namespace framework +namespace platform { +class CPUDeviceContext; +struct CPUPlace; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { template diff --git a/paddle/fluid/operators/elementwise/test_elementwise_add_grad_grad.cc b/paddle/fluid/operators/elementwise/test_elementwise_add_grad_grad.cc index be8b8d6c2f7c0d70c997b4759ffb6a6943491192..15c31a4cece5c538e35f25565a85a9b6b32f5c30 100644 --- a/paddle/fluid/operators/elementwise/test_elementwise_add_grad_grad.cc +++ b/paddle/fluid/operators/elementwise/test_elementwise_add_grad_grad.cc @@ -12,20 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include -#include -#include -#include -#include #include "gtest/gtest.h" -#include "paddle/fluid/framework/lod_tensor.h" +#include "paddle/fluid/framework/ddim.h" #include "paddle/fluid/framework/op_registry.h" -#include "paddle/fluid/framework/operator.h" -#include "paddle/fluid/framework/scope.h" #include "paddle/fluid/operators/elementwise/test_elementwise_op_grad_grad.h" -#include "paddle/fluid/platform/device_context.h" -#include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/platform/place.h" USE_OP(elementwise_add); diff --git a/paddle/fluid/operators/elementwise/test_elementwise_add_op_inplace.cc b/paddle/fluid/operators/elementwise/test_elementwise_add_op_inplace.cc index 6ec8f2c2355ee098aed4a6b92410bcc60bca4736..cf9e9dbb04b03902ae9f96809d084b9126f15f94 100644 --- a/paddle/fluid/operators/elementwise/test_elementwise_add_op_inplace.cc +++ b/paddle/fluid/operators/elementwise/test_elementwise_add_op_inplace.cc @@ -12,14 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include -#include #include + #include "gtest/gtest.h" #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/op_registry.h" -#include "paddle/fluid/framework/operator.h" #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/platform/device_context.h" #include "paddle/fluid/platform/enforce.h" diff --git a/paddle/fluid/operators/enqueue_op.cc b/paddle/fluid/operators/enqueue_op.cc index 9b367a72fb5f4c46366323497bbf6ca0cc167cbb..a7920488f2e05618bddb302f38f391ae4eb838bd 100644 --- a/paddle/fluid/operators/enqueue_op.cc +++ b/paddle/fluid/operators/enqueue_op.cc @@ -13,13 +13,24 @@ // limitations under the License. #include -#include + #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/framework/operator.h" -#include "paddle/fluid/framework/var_type.h" +#include "paddle/fluid/framework/var_type_traits.h" #include "paddle/fluid/operators/reader/lod_tensor_blocking_queue.h" +namespace paddle { +namespace framework { +class OpDesc; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle + using LoDTensor = paddle::framework::LoDTensor; using LoDTensorBlockingQueueHolder = paddle::operators::reader::LoDTensorBlockingQueueHolder; diff --git a/paddle/fluid/operators/eye_op.h b/paddle/fluid/operators/eye_op.h index 0eefe7d2163bb967596480f2427b995a6a87ff6e..d5ad27596d6ba399a88059cb18d83933e8171ea2 100644 --- a/paddle/fluid/operators/eye_op.h +++ b/paddle/fluid/operators/eye_op.h @@ -51,7 +51,7 @@ class EyeKernel : public framework::OpKernel { auto& dev_ctx = ctx.template device_context(); set_zero(dev_ctx, out_tensor, static_cast(0)); - int64_t num_eyes = std::min(num_rows, num_columns); + int64_t num_eyes = (std::min)(num_rows, num_columns); platform::ForRange for_range(dev_ctx, num_eyes); EyeFunctor functor(num_columns, out_data); for_range(functor); diff --git a/paddle/fluid/operators/fused/fusion_transpose_flatten_concat_op.cu.cc b/paddle/fluid/operators/fused/fusion_transpose_flatten_concat_op.cu.cc index 17cb4556d45ef3adee2adc0d2f19ea048e096982..37a442a78157166764b786215d97e11d661df894 100644 --- a/paddle/fluid/operators/fused/fusion_transpose_flatten_concat_op.cu.cc +++ b/paddle/fluid/operators/fused/fusion_transpose_flatten_concat_op.cu.cc @@ -13,10 +13,15 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/fused/fusion_transpose_flatten_concat_op.h" -#include #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/platform/cudnn_helper.h" +namespace paddle { +namespace platform { +struct CUDAPlace; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/gather_test.cc b/paddle/fluid/operators/gather_test.cc index f6b156eb30dae154395b34dcfc26319cd89edbca..ea1fa813928daed1f661834c766e8cb2a362986f 100644 --- a/paddle/fluid/operators/gather_test.cc +++ b/paddle/fluid/operators/gather_test.cc @@ -13,10 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ #include -#include -#include -#include "paddle/fluid/framework/ddim.h" #include "paddle/fluid/framework/tensor.h" #include "paddle/fluid/operators/gather.h" #include "paddle/fluid/platform/place.h" diff --git a/paddle/fluid/operators/grid_sampler_cudnn_op.cu.cc b/paddle/fluid/operators/grid_sampler_cudnn_op.cu.cc index 93f9e108723fbd56e0d3bf5d439614c2c20bb393..f0903bdfce9206981b13b9a1b61ca3eedf3195a0 100644 --- a/paddle/fluid/operators/grid_sampler_cudnn_op.cu.cc +++ b/paddle/fluid/operators/grid_sampler_cudnn_op.cu.cc @@ -15,6 +15,12 @@ limitations under the License. */ #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/platform/cudnn_helper.h" +namespace paddle { +namespace framework { +class Tensor; +} // namespace framework +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/gru_op.cu.cc b/paddle/fluid/operators/gru_op.cu.cc index ba918b3def22e3c60c4155f77ecbaad85d520928..bdc5debaea790c740f2e133b66e2cfb9e334dc3e 100644 --- a/paddle/fluid/operators/gru_op.cu.cc +++ b/paddle/fluid/operators/gru_op.cu.cc @@ -14,6 +14,13 @@ limitations under the License. */ #include "paddle/fluid/operators/gru_op.h" +namespace paddle { +namespace platform { +class CUDADeviceContext; +struct CUDAPlace; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/hash_op.cc b/paddle/fluid/operators/hash_op.cc index b6017a6eafc03921883e9427732cf0c2c769bcab..47b480c11c28f265e74c2ef6c103e71f642eed2f 100644 --- a/paddle/fluid/operators/hash_op.cc +++ b/paddle/fluid/operators/hash_op.cc @@ -13,8 +13,24 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/hash_op.h" + #include +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +struct CPUPlace; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/hash_op.h b/paddle/fluid/operators/hash_op.h index c2d530004912287b0720ab5d00da90c4e1b5cbc7..b5b3f3de70c280c7c135ad55793b1b64c608233d 100644 --- a/paddle/fluid/operators/hash_op.h +++ b/paddle/fluid/operators/hash_op.h @@ -18,6 +18,7 @@ extern "C" { #include } #include + #include "paddle/fluid/framework/eigen.h" #include "paddle/fluid/framework/op_registry.h" diff --git a/paddle/fluid/operators/increment_op.cc b/paddle/fluid/operators/increment_op.cc index b4f33dad927222869af3b99bee1368699982c1a4..e8edfb99f9f306d7057afcdf935cad5a5e4a73d6 100644 --- a/paddle/fluid/operators/increment_op.cc +++ b/paddle/fluid/operators/increment_op.cc @@ -13,9 +13,23 @@ // limitations under the License. #include "paddle/fluid/operators/increment_op.h" -#include + #include +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +class CPUDeviceContext; +struct CPUPlace; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/isfinite_op.cc b/paddle/fluid/operators/isfinite_op.cc index 9b92ce3e538aa660dedda67de0cabaa4adbdc8c7..1ac1c26796cf360e40e56bbe24d0217ae9d4cc36 100644 --- a/paddle/fluid/operators/isfinite_op.cc +++ b/paddle/fluid/operators/isfinite_op.cc @@ -13,8 +13,24 @@ // limitations under the License. #include "paddle/fluid/operators/isfinite_op.h" + #include -#include + +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +class CPUDeviceContext; +struct CPUPlace; +} // namespace platform +} // namespace paddle namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/isfinite_op.h b/paddle/fluid/operators/isfinite_op.h index 2fc0d58669bae428d811c7200e025f36f087b905..a54134910d0b86eac19ec2d1217cbcc2dab23212 100644 --- a/paddle/fluid/operators/isfinite_op.h +++ b/paddle/fluid/operators/isfinite_op.h @@ -15,12 +15,19 @@ #pragma once #include + #include "paddle/fluid/framework/eigen.h" #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/framework/tensor_util.h" #include "paddle/fluid/platform/float16.h" #include "paddle/fluid/platform/transform.h" +namespace paddle { +namespace framework { +class Tensor; +} // namespace framework +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/isfinite_v2_op.cc b/paddle/fluid/operators/isfinite_v2_op.cc index 72da43e3bc63c1c585fe19d703892c23ce7b0ec2..fcbb4c5bf6a0b32e403672a1f40b4c8141bc84e3 100644 --- a/paddle/fluid/operators/isfinite_v2_op.cc +++ b/paddle/fluid/operators/isfinite_v2_op.cc @@ -13,10 +13,31 @@ // limitations under the License. #include "paddle/fluid/operators/isfinite_v2_op.h" + #include -#include + #include "paddle/fluid/operators/common_infer_shape_functions.h" -#include "paddle/fluid/platform/float16.h" + +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace operators { +template +class OverflowKernel; +} // namespace operators +namespace platform { +class CPUDeviceContext; +struct CPUPlace; +struct float16; +} // namespace platform +} // namespace paddle namespace plat = paddle::platform; diff --git a/paddle/fluid/operators/isfinite_v2_op.h b/paddle/fluid/operators/isfinite_v2_op.h index 9f0aa63ce80248ee9f7839890f611b9d5293789e..332c50d75513f80cc2b042e513f36c13a3244ccf 100644 --- a/paddle/fluid/operators/isfinite_v2_op.h +++ b/paddle/fluid/operators/isfinite_v2_op.h @@ -15,6 +15,7 @@ #pragma once #include + #include "paddle/fluid/framework/eigen.h" #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/framework/tensor_util.h" @@ -22,6 +23,12 @@ #include "paddle/fluid/platform/float16.h" #include "paddle/fluid/platform/transform.h" +namespace paddle { +namespace framework { +class Tensor; +} // namespace framework +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/jit/gen/act.h b/paddle/fluid/operators/jit/gen/act.h index 585196e939c3d2bb30d33189411c06e459d655fe..cd360caa39b4da483cdf50abab49d8658a309f0d 100644 --- a/paddle/fluid/operators/jit/gen/act.h +++ b/paddle/fluid/operators/jit/gen/act.h @@ -15,6 +15,7 @@ #pragma once #include + #include "glog/logging.h" #include "paddle/fluid/operators/jit/gen/jitcode.h" #include "paddle/fluid/platform/enforce.h" diff --git a/paddle/fluid/operators/jit/gen/blas.h b/paddle/fluid/operators/jit/gen/blas.h index ff4a13a367994c1d08c4681bc64da4fcbfe143d7..d3d9eddd2ee78f61652ab392decb75ca0bf8f5d9 100644 --- a/paddle/fluid/operators/jit/gen/blas.h +++ b/paddle/fluid/operators/jit/gen/blas.h @@ -15,6 +15,7 @@ #pragma once #include + #include "glog/logging.h" #include "paddle/fluid/operators/jit/gen/jitcode.h" #include "paddle/fluid/platform/enforce.h" diff --git a/paddle/fluid/operators/jit/gen/embseqpool.cc b/paddle/fluid/operators/jit/gen/embseqpool.cc index 331a4b0d0753b37843c3d112256abfbabe9a4913..b4e63d87eac064c7f29855cefc3dbe875ccee28f 100644 --- a/paddle/fluid/operators/jit/gen/embseqpool.cc +++ b/paddle/fluid/operators/jit/gen/embseqpool.cc @@ -13,10 +13,11 @@ * limitations under the License. */ #include "paddle/fluid/operators/jit/gen/embseqpool.h" + #include // offsetof #include #include -#include "paddle/fluid/operators/jit/gen/act.h" // for exp_float_consts ones + #include "paddle/fluid/operators/jit/registry.h" #include "paddle/fluid/platform/cpu_info.h" diff --git a/paddle/fluid/operators/jit/gen/embseqpool.h b/paddle/fluid/operators/jit/gen/embseqpool.h index 67a393509523da5e4e34a233d501cc5bc0d11cd8..8353e5846f7811d00b492a6708c68d62a7c990ce 100644 --- a/paddle/fluid/operators/jit/gen/embseqpool.h +++ b/paddle/fluid/operators/jit/gen/embseqpool.h @@ -15,6 +15,7 @@ #pragma once #include + #include "glog/logging.h" #include "paddle/fluid/operators/jit/gen/jitcode.h" #include "paddle/fluid/platform/enforce.h" diff --git a/paddle/fluid/operators/jit/gen/gru.cc b/paddle/fluid/operators/jit/gen/gru.cc index b5b0cffa80612c61829766027013f172962b5069..fbdf49d5d585f718bef608abb8eed12a34b90897 100644 --- a/paddle/fluid/operators/jit/gen/gru.cc +++ b/paddle/fluid/operators/jit/gen/gru.cc @@ -13,8 +13,10 @@ * limitations under the License. */ #include "paddle/fluid/operators/jit/gen/gru.h" + #include // offsetof #include + #include "paddle/fluid/operators/jit/registry.h" #include "paddle/fluid/platform/cpu_info.h" diff --git a/paddle/fluid/operators/jit/gen/gru.h b/paddle/fluid/operators/jit/gen/gru.h index e047a65cb4b1e3ef7fd2368c5b94c360a79eb666..588d11820b20e92091d391303d61dc6a0a8bf968 100644 --- a/paddle/fluid/operators/jit/gen/gru.h +++ b/paddle/fluid/operators/jit/gen/gru.h @@ -15,6 +15,7 @@ #pragma once #include + #include "glog/logging.h" #include "paddle/fluid/operators/jit/gen/act.h" #include "paddle/fluid/operators/jit/gen/jitcode.h" diff --git a/paddle/fluid/operators/jit/gen/hopv.h b/paddle/fluid/operators/jit/gen/hopv.h index 575dec68a582deb15ae240ae8b4d6cd409403649..113c66a2558aac061062ee7f477b613fd70b8251 100644 --- a/paddle/fluid/operators/jit/gen/hopv.h +++ b/paddle/fluid/operators/jit/gen/hopv.h @@ -15,6 +15,7 @@ #pragma once #include + #include "glog/logging.h" #include "paddle/fluid/operators/jit/gen/jitcode.h" #include "paddle/fluid/platform/enforce.h" diff --git a/paddle/fluid/operators/jit/gen/lstm.cc b/paddle/fluid/operators/jit/gen/lstm.cc index 2c3bc985e9a8b224835d848d30e0a3ef641ed2f9..211dfc5ecad3cec1f9269c6298912c57483f5c80 100644 --- a/paddle/fluid/operators/jit/gen/lstm.cc +++ b/paddle/fluid/operators/jit/gen/lstm.cc @@ -13,8 +13,10 @@ * limitations under the License. */ #include "paddle/fluid/operators/jit/gen/lstm.h" + #include // offsetof #include + #include "paddle/fluid/operators/jit/registry.h" #include "paddle/fluid/platform/cpu_info.h" diff --git a/paddle/fluid/operators/jit/gen/lstm.h b/paddle/fluid/operators/jit/gen/lstm.h index 6f232906569fd0f0783f1a1a16421eefdd36f3c2..c980670d482c48641491c094a92602438c31ff55 100644 --- a/paddle/fluid/operators/jit/gen/lstm.h +++ b/paddle/fluid/operators/jit/gen/lstm.h @@ -15,6 +15,7 @@ #pragma once #include + #include "glog/logging.h" #include "paddle/fluid/operators/jit/gen/act.h" #include "paddle/fluid/operators/jit/gen/jitcode.h" diff --git a/paddle/fluid/operators/jit/gen/matmul.cc b/paddle/fluid/operators/jit/gen/matmul.cc index 3a455334f588da40cc39a153414658a8a68c9f38..047d0d3e1caa2290111104d5799e67cea7b7eed2 100644 --- a/paddle/fluid/operators/jit/gen/matmul.cc +++ b/paddle/fluid/operators/jit/gen/matmul.cc @@ -13,9 +13,10 @@ * limitations under the License. */ #include "paddle/fluid/operators/jit/gen/matmul.h" + #include // offsetof #include -#include + #include "paddle/fluid/operators/jit/registry.h" #include "paddle/fluid/platform/cpu_info.h" diff --git a/paddle/fluid/operators/jit/gen/matmul.h b/paddle/fluid/operators/jit/gen/matmul.h index 881cea581acc27a7aa7d395c041d40a4d3281947..4f04f7606d2deb8ba58809f9e07e60ba19182a71 100644 --- a/paddle/fluid/operators/jit/gen/matmul.h +++ b/paddle/fluid/operators/jit/gen/matmul.h @@ -17,6 +17,7 @@ #include // for malloc and free #include #include + #include "glog/logging.h" #include "paddle/fluid/operators/jit/gen/jitcode.h" #include "paddle/fluid/platform/enforce.h" diff --git a/paddle/fluid/operators/jit/gen/seqpool.h b/paddle/fluid/operators/jit/gen/seqpool.h index a0f1bb8299ab8a087150540945a1e49bac8d301d..cb562c4c9a6c6be5c5881cb6273ca7426a6c2a10 100644 --- a/paddle/fluid/operators/jit/gen/seqpool.h +++ b/paddle/fluid/operators/jit/gen/seqpool.h @@ -15,6 +15,7 @@ #pragma once #include + #include "glog/logging.h" #include "paddle/fluid/operators/jit/gen/jitcode.h" #include "paddle/fluid/platform/enforce.h" diff --git a/paddle/fluid/operators/jit/gen/sgd.cc b/paddle/fluid/operators/jit/gen/sgd.cc index 40f8298af39826ef3823e837f57c8e4e6209cd53..1452d4139b0d7994e5304680d63a63cb28bb606b 100644 --- a/paddle/fluid/operators/jit/gen/sgd.cc +++ b/paddle/fluid/operators/jit/gen/sgd.cc @@ -13,9 +13,10 @@ * limitations under the License. */ #include "paddle/fluid/operators/jit/gen/sgd.h" + #include // offsetof #include -#include + #include "paddle/fluid/operators/jit/registry.h" #include "paddle/fluid/platform/cpu_info.h" diff --git a/paddle/fluid/operators/jit/gen/sgd.h b/paddle/fluid/operators/jit/gen/sgd.h index 80b1809bbbfd32d1d12a5f6bddd45a51026bdb57..403d97b8fec7c44b9ed39f043bbad4349b5fe1d7 100644 --- a/paddle/fluid/operators/jit/gen/sgd.h +++ b/paddle/fluid/operators/jit/gen/sgd.h @@ -15,6 +15,7 @@ #pragma once #include + #include "glog/logging.h" #include "paddle/fluid/operators/jit/gen/jitcode.h" #include "paddle/fluid/platform/enforce.h" diff --git a/paddle/fluid/operators/jit/gen/vbroadcast.h b/paddle/fluid/operators/jit/gen/vbroadcast.h index 27c75f6f710e9514c7d91181e7f447d9dd997081..7d30fe5751bd462fcb5e0824e913d6f4f0b89a66 100644 --- a/paddle/fluid/operators/jit/gen/vbroadcast.h +++ b/paddle/fluid/operators/jit/gen/vbroadcast.h @@ -15,6 +15,7 @@ #pragma once #include + #include "glog/logging.h" #include "paddle/fluid/operators/jit/gen/jitcode.h" diff --git a/paddle/fluid/operators/jit/gen_base.h b/paddle/fluid/operators/jit/gen_base.h index 033c603c07c288ba621ceaa912ea0c476fe86cd6..27b857634155c9b31768c5187f214f72b9a0112d 100644 --- a/paddle/fluid/operators/jit/gen_base.h +++ b/paddle/fluid/operators/jit/gen_base.h @@ -18,6 +18,7 @@ #include // for unique_ptr #include #include + #include "paddle/fluid/operators/jit/kernel_base.h" DECLARE_bool(dump_jitcode); diff --git a/paddle/fluid/operators/jit/helper.h b/paddle/fluid/operators/jit/helper.h index 39e5ee2be1538e7884118a2280ed2e02c5de3bff..b6dd49b77728c48c1075109934699545bb282420 100644 --- a/paddle/fluid/operators/jit/helper.h +++ b/paddle/fluid/operators/jit/helper.h @@ -21,6 +21,7 @@ #include #include // for std::move #include + #include "paddle/fluid/operators/jit/gen_base.h" #include "paddle/fluid/operators/jit/kernel_base.h" #include "paddle/fluid/operators/jit/kernel_key.h" @@ -31,6 +32,8 @@ namespace paddle { namespace operators { namespace jit { +class GenBase; + template inline typename std::enable_if< std::is_same::value && diff --git a/paddle/fluid/operators/jit/kernel_pool.cc b/paddle/fluid/operators/jit/kernel_pool.cc index f1719be987348b6b8f0ba5c1212808f20c922c78..7b6b13c3d989291176640066b16e9dbb340f8805 100644 --- a/paddle/fluid/operators/jit/kernel_pool.cc +++ b/paddle/fluid/operators/jit/kernel_pool.cc @@ -13,9 +13,6 @@ * limitations under the License. */ #include "paddle/fluid/operators/jit/kernel_pool.h" -#include // for shared_ptr -#include -#include namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/jit/kernel_pool.h b/paddle/fluid/operators/jit/kernel_pool.h index 48435cf6ef25448b548836e5da581609c63dd08f..763be7d3cf51f622e5ac4f654b83c9e82d1f458d 100644 --- a/paddle/fluid/operators/jit/kernel_pool.h +++ b/paddle/fluid/operators/jit/kernel_pool.h @@ -20,6 +20,7 @@ #include #include // for move #include + #include "paddle/fluid/operators/jit/gen_base.h" #include "paddle/fluid/operators/jit/kernel_base.h" #include "paddle/fluid/operators/jit/kernel_key.h" @@ -29,6 +30,8 @@ namespace paddle { namespace operators { namespace jit { +struct KernelKey; + extern std::map>& GetJITCodesMap(); template diff --git a/paddle/fluid/operators/jit/more/intrinsic/crf_decoding.h b/paddle/fluid/operators/jit/more/intrinsic/crf_decoding.h index 49b1a1fea4b16f435120bb37c7d9c8c07a4cc4f5..6e0c972e27ac7b981111db03c9e8ba60e75a6c23 100644 --- a/paddle/fluid/operators/jit/more/intrinsic/crf_decoding.h +++ b/paddle/fluid/operators/jit/more/intrinsic/crf_decoding.h @@ -15,6 +15,7 @@ #pragma once #include + #include "paddle/fluid/operators/jit/kernel_base.h" namespace paddle { diff --git a/paddle/fluid/operators/jit/more/intrinsic/layer_norm.h b/paddle/fluid/operators/jit/more/intrinsic/layer_norm.h index 7b9f676050d806314edd1e46611416a8b7170add..6a44bb256129487ac194798f959c32c578e49e82 100644 --- a/paddle/fluid/operators/jit/more/intrinsic/layer_norm.h +++ b/paddle/fluid/operators/jit/more/intrinsic/layer_norm.h @@ -15,6 +15,7 @@ #pragma once #include + #include "paddle/fluid/operators/jit/kernel_base.h" namespace paddle { diff --git a/paddle/fluid/operators/jit/more/mix/mix.h b/paddle/fluid/operators/jit/more/mix/mix.h index 035425317edca95bc574807fa029ff373a7e10b8..240cbbcda4fbd0dc2a99b300b0a4c91dbb115b28 100644 --- a/paddle/fluid/operators/jit/more/mix/mix.h +++ b/paddle/fluid/operators/jit/more/mix/mix.h @@ -15,6 +15,7 @@ #pragma once #include + #include "paddle/fluid/operators/jit/kernel_base.h" namespace paddle { diff --git a/paddle/fluid/operators/jit/more/mkl/mkl.h b/paddle/fluid/operators/jit/more/mkl/mkl.h index b38cc107b8e3038e04db4ed809d647e9a20d45fc..ee31c8df2f882d092783cf0408564a39ca6fafa1 100644 --- a/paddle/fluid/operators/jit/more/mkl/mkl.h +++ b/paddle/fluid/operators/jit/more/mkl/mkl.h @@ -17,6 +17,7 @@ #include #include #include + #include "paddle/fluid/operators/jit/kernel_base.h" #include "paddle/fluid/platform/enforce.h" diff --git a/paddle/fluid/operators/jit/refer/refer.h b/paddle/fluid/operators/jit/refer/refer.h index 136b99e0aeffec8e93e11c2e5e4f7bd35dd1c8d4..b8d5e2c24071f6a14b070f4120f8c987110ed4f7 100644 --- a/paddle/fluid/operators/jit/refer/refer.h +++ b/paddle/fluid/operators/jit/refer/refer.h @@ -17,6 +17,7 @@ #include #include #include + #include "paddle/fluid/operators/jit/helper.h" #include "paddle/fluid/operators/jit/kernel_base.h" #include "paddle/fluid/platform/enforce.h" diff --git a/paddle/fluid/operators/label_smooth_op.cc b/paddle/fluid/operators/label_smooth_op.cc index ac0405b9a6e64a3ea53203533ae4e6787a24c2fe..231ff941278c72ce6bb2bf07315be25a32f5bc37 100644 --- a/paddle/fluid/operators/label_smooth_op.cc +++ b/paddle/fluid/operators/label_smooth_op.cc @@ -13,9 +13,23 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/label_smooth_op.h" -#include + #include +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +class CPUDeviceContext; +struct CPUPlace; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/layer_norm_op.h b/paddle/fluid/operators/layer_norm_op.h index 6968c1a5b131211a8fc7a474df8d1692d6a5ed0f..931cd6d1794910cfa26fe03f713001c426736fad 100644 --- a/paddle/fluid/operators/layer_norm_op.h +++ b/paddle/fluid/operators/layer_norm_op.h @@ -16,6 +16,7 @@ limitations under the License. */ #include #include + #include "paddle/fluid/framework/eigen.h" #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/operators/elementwise/elementwise_op_function.cu.h" @@ -27,6 +28,14 @@ limitations under the License. */ #endif #include "paddle/fluid/operators/math/math_function.h" +namespace paddle { +namespace platform { +class CPUDeviceContext; +class CUDADeviceContext; +class DeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/lod_array_length_op.cc b/paddle/fluid/operators/lod_array_length_op.cc index 49e8cbbbaabe75987196f27d1713be389233373f..70da0149cadc46c602a02b9511705d6d82cfbd13 100644 --- a/paddle/fluid/operators/lod_array_length_op.cc +++ b/paddle/fluid/operators/lod_array_length_op.cc @@ -12,9 +12,21 @@ 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 "paddle/fluid/framework/lod_tensor_array.h" #include "paddle/fluid/framework/op_registry.h" +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +class Scope; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/lod_rank_table_op.cc b/paddle/fluid/operators/lod_rank_table_op.cc index 7cbfbd03e1dcb4983863445f6a9cd2c9ee17a8b0..a9128b15bdbad28e9d24891ed96c073a82b8f4bf 100644 --- a/paddle/fluid/operators/lod_rank_table_op.cc +++ b/paddle/fluid/operators/lod_rank_table_op.cc @@ -11,8 +11,21 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "paddle/fluid/framework/lod_rank_table.h" #include "paddle/fluid/framework/op_registry.h" + +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +class Scope; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/lod_tensor_to_array_op.cc b/paddle/fluid/operators/lod_tensor_to_array_op.cc index b130e84933bc9a26653b5eb164ccc450fdb7b63e..db07a104a89cdb669bd39ff42e5df6acfc44f4bf 100644 --- a/paddle/fluid/operators/lod_tensor_to_array_op.cc +++ b/paddle/fluid/operators/lod_tensor_to_array_op.cc @@ -11,14 +11,19 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include -#include -#include "paddle/fluid/framework/lod_rank_table.h" -#include "paddle/fluid/framework/lod_tensor_array.h" #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/operators/math/concat_and_split.h" #include "paddle/fluid/platform/device_context.h" -#include "paddle/fluid/platform/port.h" + +namespace paddle { +namespace framework { +class OpDesc; +class Scope; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/math/beam_search.cc b/paddle/fluid/operators/math/beam_search.cc index 550de1aadde2935fae34226dba78cc06d82cd1f3..5271da91b8c151dfef50810c4ae46bdf27d7a2af 100644 --- a/paddle/fluid/operators/math/beam_search.cc +++ b/paddle/fluid/operators/math/beam_search.cc @@ -13,8 +13,16 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/math/beam_search.h" -#include -#include + +namespace paddle { +namespace framework { +class LoDTensor; +class Tensor; +} // namespace framework +namespace platform { +class CPUDeviceContext; +} // namespace platform +} // namespace paddle namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/math/beam_search_test.cc b/paddle/fluid/operators/math/beam_search_test.cc index 7ea8eb8b00db328ca13d3d33d751aca4eac66dae..97ce3d3f87832494900f041773bbdee1fb0639af 100644 --- a/paddle/fluid/operators/math/beam_search_test.cc +++ b/paddle/fluid/operators/math/beam_search_test.cc @@ -13,8 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/math/beam_search.h" + #include -#include void PrepareCPUTensors(paddle::framework::LoDTensor* ids, paddle::framework::LoDTensor* scores, diff --git a/paddle/fluid/operators/math/blas.cc b/paddle/fluid/operators/math/blas.cc index 2a7ce83967f0f74f4c2178dd4277e6a1687b5ec7..3bc1b4f4048eb02b1417e697c98f1e93b1106093 100644 --- a/paddle/fluid/operators/math/blas.cc +++ b/paddle/fluid/operators/math/blas.cc @@ -13,8 +13,8 @@ // limitations under the License. #include "paddle/fluid/operators/math/blas.h" - #include + namespace paddle { namespace operators { namespace math { diff --git a/paddle/fluid/operators/math/blas.h b/paddle/fluid/operators/math/blas.h index 42a60e9220cf848ba766a19cb7b4d13edc460c11..562e2de3bd3111c3cdea1b18c1fa64f6bd9911ea 100644 --- a/paddle/fluid/operators/math/blas.h +++ b/paddle/fluid/operators/math/blas.h @@ -17,6 +17,13 @@ #include "paddle/fluid/framework/operator.h" #include "paddle/fluid/framework/tensor.h" +namespace paddle { +namespace framework { +class ExecutionContext; +class Tensor; +} // namespace framework +} // namespace paddle + #ifdef PADDLE_WITH_MKLML #include "paddle/fluid/platform/dynload/mklml.h" #endif diff --git a/paddle/fluid/operators/math/blas_impl.h b/paddle/fluid/operators/math/blas_impl.h index 515d6a2435e86fe07ffe1309628ef2fbeefdc6f0..c53c453897fbae76745fd5c3aaf3e3a836527ded 100644 --- a/paddle/fluid/operators/math/blas_impl.h +++ b/paddle/fluid/operators/math/blas_impl.h @@ -695,9 +695,9 @@ void Blas::BatchedGEMM( CBLAS_TRANSPOSE transA, CBLAS_TRANSPOSE transB, int M, int N, int K, T alpha, const T **A, const T **B, T beta, T **C, int batchCount) const { #ifdef PADDLE_WITH_MKLML - const int lda = std::max((transA == CblasNoTrans) ? K : M, 1); - const int ldb = std::max((transB == CblasNoTrans) ? N : K, 1); - const int ldc = std::max(N, 1); + const int lda = (std::max)((transA == CblasNoTrans) ? K : M, 1); + const int ldb = (std::max)((transB == CblasNoTrans) ? N : K, 1); + const int ldc = (std::max)(N, 1); CBlas::GEMM_BATCH(CblasRowMajor, &transA, &transB, &M, &N, &K, &alpha, A, &lda, B, &ldb, &beta, C, &ldc, 1 /* group_count */, &batchCount); diff --git a/paddle/fluid/operators/math/concat_and_split.cc b/paddle/fluid/operators/math/concat_and_split.cc index b6bd58d118e9fc8b2d8f831660a3c93f8c59e605..3b0c3c1686af6fd9da6864b535c6c75e252485ea 100644 --- a/paddle/fluid/operators/math/concat_and_split.cc +++ b/paddle/fluid/operators/math/concat_and_split.cc @@ -13,7 +13,17 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/math/concat_and_split.h" -#include + +namespace paddle { +namespace framework { +class Tensor; +} // namespace framework +namespace platform { +class CPUDeviceContext; +struct bfloat16; +struct float16; +} // namespace platform +} // namespace paddle namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/math/concat_test.cc b/paddle/fluid/operators/math/concat_test.cc index 270a9d3f80a80d5ea2c8b97d4a69125355ddef61..094e2059c4d4c4b16c79817bac9dc84703a2b013 100644 --- a/paddle/fluid/operators/math/concat_test.cc +++ b/paddle/fluid/operators/math/concat_test.cc @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ #include -#include + #include "paddle/fluid/framework/tensor_util.h" #include "paddle/fluid/operators/math/concat_and_split.h" diff --git a/paddle/fluid/operators/math/context_project.cc b/paddle/fluid/operators/math/context_project.cc index 537d0b47868fb68d59e3b3556a54ba85d5f06960..927d610e2ce47e4206615ee435377d01d8ea9db3 100644 --- a/paddle/fluid/operators/math/context_project.cc +++ b/paddle/fluid/operators/math/context_project.cc @@ -14,6 +14,12 @@ limitations under the License. */ #include "paddle/fluid/operators/math/context_project.h" +namespace paddle { +namespace platform { +class CPUDeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { namespace math { diff --git a/paddle/fluid/operators/math/context_project.h b/paddle/fluid/operators/math/context_project.h index 051c6019d74f7d2820dc0ba668da3cafe8864346..08bb555c593787cd733a0c81efda5e72e0929f93 100644 --- a/paddle/fluid/operators/math/context_project.h +++ b/paddle/fluid/operators/math/context_project.h @@ -16,8 +16,10 @@ limitations under the License. */ #include #include + #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/operators/math/blas.h" + #include "paddle/fluid/operators/math/im2col.h" namespace paddle { diff --git a/paddle/fluid/operators/math/cos_sim_functor.cc b/paddle/fluid/operators/math/cos_sim_functor.cc index cbe16999124a67ac764afade92f7320a12129cd1..f7770050bee442ae3bcfe826be606a85d35608eb 100644 --- a/paddle/fluid/operators/math/cos_sim_functor.cc +++ b/paddle/fluid/operators/math/cos_sim_functor.cc @@ -14,6 +14,12 @@ limitations under the License. */ #include "paddle/fluid/operators/math/cos_sim_functor.h" +namespace paddle { +namespace platform { +class CPUDeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { namespace math { diff --git a/paddle/fluid/operators/math/cos_sim_functor.h b/paddle/fluid/operators/math/cos_sim_functor.h index d74662e68e770f0b5d83a150e60156a61cefcf58..9a24bfc3312665be296f2a6c89da27758d43550e 100644 --- a/paddle/fluid/operators/math/cos_sim_functor.h +++ b/paddle/fluid/operators/math/cos_sim_functor.h @@ -15,6 +15,7 @@ limitations under the License. */ #pragma once #include #include + #include "paddle/fluid/platform/device_context.h" #include "paddle/fluid/platform/hostdevice.h" @@ -43,6 +44,7 @@ struct CosSimFunctor { tep_x = x[i]; tep_y = y[i]; xx += tep_x * tep_x; + yy += tep_y * tep_y; xy += tep_x * tep_y; } diff --git a/paddle/fluid/operators/math/cpu_vec.h b/paddle/fluid/operators/math/cpu_vec.h index 925f3b6161ae8506107f917196e77ecb2d9c5593..eb7c622e596ce4781f30bb6cc071a5a7adb09350 100644 --- a/paddle/fluid/operators/math/cpu_vec.h +++ b/paddle/fluid/operators/math/cpu_vec.h @@ -16,6 +16,7 @@ limitations under the License. */ #include #include #include + #include "paddle/fluid/platform/cpu_info.h" #include "paddle/fluid/platform/enforce.h" diff --git a/paddle/fluid/operators/math/cpu_vec_test.cc b/paddle/fluid/operators/math/cpu_vec_test.cc index 6490d81cec7c70ee5332c2667a5fb79f01e10311..07fe9c30f39bf44c3ec7aa33a3f3dd63f50a1e9a 100644 --- a/paddle/fluid/operators/math/cpu_vec_test.cc +++ b/paddle/fluid/operators/math/cpu_vec_test.cc @@ -16,12 +16,10 @@ limitations under the License. */ #include #include #include -#include "gflags/gflags.h" + #include "glog/logging.h" #include "gtest/gtest.h" - #include "paddle/fluid/operators/math/cpu_vec.h" -#include "paddle/fluid/platform/port.h" inline double GetCurrentUS() { struct timeval time; diff --git a/paddle/fluid/operators/math/cross_entropy.cc b/paddle/fluid/operators/math/cross_entropy.cc index 7a1ed47d182a080e10aa7ce5d95f605eb2a151a1..23840143a443da106349214966aee78f50b25088 100644 --- a/paddle/fluid/operators/math/cross_entropy.cc +++ b/paddle/fluid/operators/math/cross_entropy.cc @@ -14,6 +14,12 @@ limitations under the License. */ #include "paddle/fluid/operators/math/cross_entropy.h" +namespace paddle { +namespace platform { +class CPUDeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { namespace math { diff --git a/paddle/fluid/operators/math/gru_compute.cc b/paddle/fluid/operators/math/gru_compute.cc index 07c5cbf33378e6f6cee8a82448f55399966a2574..4b8a6274cceaccaad9000c8d0a415a486b44b2f0 100644 --- a/paddle/fluid/operators/math/gru_compute.cc +++ b/paddle/fluid/operators/math/gru_compute.cc @@ -10,10 +10,17 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/math/gru_compute.h" + #include "paddle/fluid/operators/math/blas.h" #include "paddle/fluid/operators/math/detail/gru_cpu_kernel.h" #include "paddle/fluid/operators/math/detail/gru_kernel.h" +namespace paddle { +namespace platform { +class CPUDeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { namespace math { diff --git a/paddle/fluid/operators/math/im2col.cc b/paddle/fluid/operators/math/im2col.cc index 6fb393d791cc2a077dbcd0a912bcf31b5d59ad65..8efd35ca108100e4d224890846433433702c57a9 100644 --- a/paddle/fluid/operators/math/im2col.cc +++ b/paddle/fluid/operators/math/im2col.cc @@ -13,9 +13,15 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/math/im2col.h" -#include + #include "paddle/fluid/operators/math/im2col_cfo_cpu.h" +namespace paddle { +namespace platform { +class CPUDeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { namespace math { diff --git a/paddle/fluid/operators/math/lstm_compute.cc b/paddle/fluid/operators/math/lstm_compute.cc index 94bbcbb50670d9f0b11b77cf6a54a99c227521bf..7e74f6880196d343b2901fd86e5bc82f12247d5c 100644 --- a/paddle/fluid/operators/math/lstm_compute.cc +++ b/paddle/fluid/operators/math/lstm_compute.cc @@ -13,9 +13,16 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/math/lstm_compute.h" + #include "paddle/fluid/operators/math/detail/lstm_cpu_kernel.h" #include "paddle/fluid/operators/math/detail/lstm_kernel.h" +namespace paddle { +namespace platform { +class CPUDeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { namespace math { diff --git a/paddle/fluid/operators/math/matrix_bit_code.cc b/paddle/fluid/operators/math/matrix_bit_code.cc index d6f51c6e5c693becb14ff0bac0088bb9dc2b2f55..7c50ba630dbd91ef8c6d51cbde862336b5ab83cb 100644 --- a/paddle/fluid/operators/math/matrix_bit_code.cc +++ b/paddle/fluid/operators/math/matrix_bit_code.cc @@ -13,8 +13,6 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/math/matrix_bit_code.h" -#include -#include namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/math/matrix_inverse.cu.cc b/paddle/fluid/operators/math/matrix_inverse.cu.cc index 614f89a048c4e92e758ddb39da43322be284f9e5..950aed0aa497416665d4ebc8b7dfc95f812bfb7d 100644 --- a/paddle/fluid/operators/math/matrix_inverse.cu.cc +++ b/paddle/fluid/operators/math/matrix_inverse.cu.cc @@ -12,14 +12,21 @@ 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 "paddle/fluid/operators/math/matrix_inverse.h" -#include "paddle/fluid/memory/malloc.h" #include "paddle/fluid/operators/math/blas.h" +namespace paddle { +namespace platform { +class CUDADeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { namespace math { +template +class MatrixInverseFunctor; + template class MatrixInverseFunctor { public: diff --git a/paddle/fluid/operators/math/pooling.cc b/paddle/fluid/operators/math/pooling.cc index 1e86c2e7a32bcc6fb4e080885dfdfb94e4f8a2e2..40cea7483f39781a46689ecd1aa21d0bf8cf2c07 100644 --- a/paddle/fluid/operators/math/pooling.cc +++ b/paddle/fluid/operators/math/pooling.cc @@ -13,9 +13,6 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/math/pooling.h" #include -#include -#include -#include "paddle/fluid/operators/math/math_function.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/math/sample_prob.cc b/paddle/fluid/operators/math/sample_prob.cc index 99aa318453eae161807353198a78e11085cd6237..16342493e45977e1b42b60be6857a1b6116cf121 100644 --- a/paddle/fluid/operators/math/sample_prob.cc +++ b/paddle/fluid/operators/math/sample_prob.cc @@ -14,6 +14,12 @@ limitations under the License. */ #include "paddle/fluid/operators/math/sample_prob.h" +namespace paddle { +namespace platform { +class CPUDeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { namespace math { diff --git a/paddle/fluid/operators/math/sample_prob.h b/paddle/fluid/operators/math/sample_prob.h index e5a6d84cb2b0527c606e62a19ef02d669945ecb1..7b08df660a0bb74b3f641e5aef7275b28ca9d9d7 100644 --- a/paddle/fluid/operators/math/sample_prob.h +++ b/paddle/fluid/operators/math/sample_prob.h @@ -16,10 +16,17 @@ limitations under the License. */ #include #include #include + #include "paddle/fluid/framework/ddim.h" #include "paddle/fluid/framework/eigen.h" + #include "paddle/fluid/framework/tensor.h" #include "paddle/fluid/operators/math/sampler.h" +namespace paddle { +namespace platform { +class CUDADeviceContext; +} // namespace platform +} // namespace paddle namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/math/selected_rows_functor_test.cu.cc b/paddle/fluid/operators/math/selected_rows_functor_test.cu.cc index 81ad620466ee3d9fcd9d3e057cfd0dd9053089f0..5cb1cc5dc037146bbfa17f81753aee0c02997477 100644 --- a/paddle/fluid/operators/math/selected_rows_functor_test.cu.cc +++ b/paddle/fluid/operators/math/selected_rows_functor_test.cu.cc @@ -13,7 +13,6 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/math/selected_rows_functor.h" -#include #include "gtest/gtest.h" #include "paddle/fluid/operators/math/math_function.h" diff --git a/paddle/fluid/operators/math/sequence2batch.cc b/paddle/fluid/operators/math/sequence2batch.cc index 300a3692012ab9631d7049d2042e91fb99ad3c21..852700fa7ff3c1f992eb48b5c684cfaad96cfc31 100644 --- a/paddle/fluid/operators/math/sequence2batch.cc +++ b/paddle/fluid/operators/math/sequence2batch.cc @@ -14,6 +14,12 @@ limitations under the License. */ #include "paddle/fluid/operators/math/sequence2batch.h" +namespace paddle { +namespace platform { +class CPUDeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { namespace math { diff --git a/paddle/fluid/operators/math/sequence_padding.cc b/paddle/fluid/operators/math/sequence_padding.cc index 076df0176429c7bbd350698af0137fbcca18f806..e29313e9f742ca27f56649278b6a1583e8cabb02 100644 --- a/paddle/fluid/operators/math/sequence_padding.cc +++ b/paddle/fluid/operators/math/sequence_padding.cc @@ -14,6 +14,16 @@ limitations under the License. */ #include "paddle/fluid/operators/math/sequence_padding.h" +namespace paddle { +namespace framework { +class LoDTensor; +class Tensor; +} // namespace framework +namespace platform { +class CPUDeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { namespace math { diff --git a/paddle/fluid/operators/math/sequence_padding_test.cc b/paddle/fluid/operators/math/sequence_padding_test.cc index eab4553ae8b9745b71a21198d0e5ccf1b8a62a35..8892a17886a736d8a4490d1240861e178afc27d4 100644 --- a/paddle/fluid/operators/math/sequence_padding_test.cc +++ b/paddle/fluid/operators/math/sequence_padding_test.cc @@ -13,8 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/math/sequence_padding.h" + #include -#include template void TestSequencePadding(const DeviceContext &context, diff --git a/paddle/fluid/operators/math/sequence_scale.cc b/paddle/fluid/operators/math/sequence_scale.cc index ee5b22ca855b4fa26e9626aadb84fa9b93b72952..78cbdf311ad1982a5de8913e3fb432e2d824b643 100644 --- a/paddle/fluid/operators/math/sequence_scale.cc +++ b/paddle/fluid/operators/math/sequence_scale.cc @@ -14,6 +14,12 @@ limitations under the License. */ #include "paddle/fluid/operators/math/sequence_scale.h" +namespace paddle { +namespace framework { +class LoDTensor; +} // namespace framework +} // namespace paddle + namespace paddle { namespace operators { namespace math { diff --git a/paddle/fluid/operators/math/sequence_scale.h b/paddle/fluid/operators/math/sequence_scale.h index 202243985c125cd518a27477eb370bf1a325fe16..d84513e024d7f62195fc3153e1f6e446104d0359 100644 --- a/paddle/fluid/operators/math/sequence_scale.h +++ b/paddle/fluid/operators/math/sequence_scale.h @@ -17,6 +17,12 @@ limitations under the License. */ #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/platform/device_context.h" +namespace paddle { +namespace framework { +class LoDTensor; +} // namespace framework +} // namespace paddle + namespace paddle { namespace operators { namespace math { @@ -40,6 +46,7 @@ namespace math { * total_sequence_length is the sum of all sequences' * length. * \param scales Array. The i-th sequence will be scaled by scales[i]. + * \param num_seq Number of sequence * */ diff --git a/paddle/fluid/operators/math/vol2col.cc b/paddle/fluid/operators/math/vol2col.cc index 794fc647172b040d4e926144a87b84eb4e5216b0..42bf1f471deb5238fdb34dcd9284972930305f58 100644 --- a/paddle/fluid/operators/math/vol2col.cc +++ b/paddle/fluid/operators/math/vol2col.cc @@ -13,7 +13,12 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/math/vol2col.h" -#include + +namespace paddle { +namespace platform { +class CPUDeviceContext; +} // namespace platform +} // namespace paddle namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/math/vol2col_test.cc b/paddle/fluid/operators/math/vol2col_test.cc index aa979c4f10907e604758c3e2cfb776cb994c9ceb..6ed5a0943ebb329d15521f2610cecfba16a782d1 100644 --- a/paddle/fluid/operators/math/vol2col_test.cc +++ b/paddle/fluid/operators/math/vol2col_test.cc @@ -13,9 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/math/vol2col.h" + #include -#include -#include template void testVol2col() { diff --git a/paddle/fluid/operators/matmul_v2_op.h b/paddle/fluid/operators/matmul_v2_op.h index dc83e4d964815ec46452bb0086cf17437b3846a4..8cd4fa12be4065b3ece42e7525481f2f04f35bc8 100644 --- a/paddle/fluid/operators/matmul_v2_op.h +++ b/paddle/fluid/operators/matmul_v2_op.h @@ -65,7 +65,7 @@ static void GetBroadcastFromDims(const int x_ndim, const std::int64_t* x_dims, std::int64_t* x_bd_dims, std::int64_t* y_bd_dims, std::int64_t* out_bd_dims) { - const int ndim = std::max(x_ndim, y_ndim); + const int ndim = (std::max)(x_ndim, y_ndim); std::fill(x_bd_dims, x_bd_dims + ndim - x_ndim, 1); std::fill(y_bd_dims, y_bd_dims + ndim - y_ndim, 1); std::copy(x_dims, x_dims + x_ndim, x_bd_dims + ndim - x_ndim); @@ -79,7 +79,7 @@ static void GetBroadcastFromDims(const int x_ndim, const std::int64_t* x_dims, if (x_bd_dims[i] == 0 || y_bd_dims[i] == 0) { out_bd_dims[i] = 0; } else { - out_bd_dims[i] = std::max(x_bd_dims[i], y_bd_dims[i]); + out_bd_dims[i] = (std::max)(x_bd_dims[i], y_bd_dims[i]); } } } @@ -229,7 +229,7 @@ void MatMulFunction(const Tensor* X, const Tensor* Y, "Input(X) has error dim.")); } const int N = trans_y ? y_dims[y_ndim - 2] : y_dims[y_ndim - 1]; - const int ndim = std::max(x_ndim, y_ndim); + const int ndim = (std::max)(x_ndim, y_ndim); std::vector x_broadcast_dims(ndim); std::vector y_broadcast_dims(ndim); std::vector out_broadcast_dims(ndim); diff --git a/paddle/fluid/operators/max_sequence_len_op.cc b/paddle/fluid/operators/max_sequence_len_op.cc index b47ec8bc70a207c5f662e9a7ee0cdd944936e7a0..4f73de086f2a9f32ee07d644e8c470234cc947ba 100644 --- a/paddle/fluid/operators/max_sequence_len_op.cc +++ b/paddle/fluid/operators/max_sequence_len_op.cc @@ -12,10 +12,22 @@ 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 "paddle/fluid/framework/lod_rank_table.h" #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/framework/operator.h" +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +class Scope; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/merge_lod_tensor_op.cc b/paddle/fluid/operators/merge_lod_tensor_op.cc index 87d914aa79753fbdc9d859c43bbf749b3ddf95cf..584de34c5d329c184eb7d26c6efad82ed4978fb2 100644 --- a/paddle/fluid/operators/merge_lod_tensor_op.cc +++ b/paddle/fluid/operators/merge_lod_tensor_op.cc @@ -13,7 +13,18 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/op_registry.h" -#include "paddle/fluid/memory/memcpy.h" + +namespace paddle { +namespace framework { +class InferShapeContext; +class LoDTensor; +class OpDesc; +class Scope; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/mkldnn/activation_mkldnn_op.cc b/paddle/fluid/operators/mkldnn/activation_mkldnn_op.cc index 487deb11b48687a91174c8d9baf072a5ca929de8..aecf67fc3bb1d91c96ace38c8e7d83ea6af3a88b 100644 --- a/paddle/fluid/operators/mkldnn/activation_mkldnn_op.cc +++ b/paddle/fluid/operators/mkldnn/activation_mkldnn_op.cc @@ -15,6 +15,15 @@ #include "paddle/fluid/operators/activation_op.h" #include "paddle/fluid/platform/mkldnn_reuse.h" +namespace paddle { +namespace framework { +class Tensor; +} // namespace framework +namespace platform { +class MKLDNNDeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/mkldnn/batch_norm_mkldnn_op.cc b/paddle/fluid/operators/mkldnn/batch_norm_mkldnn_op.cc index 8a02a697cbb21b28e14f19c6202ae0777b5102de..98f368aa7a90859121a06e42705aee6355182b27 100644 --- a/paddle/fluid/operators/mkldnn/batch_norm_mkldnn_op.cc +++ b/paddle/fluid/operators/mkldnn/batch_norm_mkldnn_op.cc @@ -12,10 +12,18 @@ 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 "mkldnn.hpp" #include "paddle/fluid/operators/batch_norm_op.h" #include "paddle/fluid/platform/mkldnn_reuse.h" +namespace paddle { +namespace framework { +class Tensor; +} // namespace framework +namespace platform { +class MKLDNNDeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/mkldnn/conv_mkldnn_op.cc b/paddle/fluid/operators/mkldnn/conv_mkldnn_op.cc index 19ee8764e27b235a2fa8e0720c11bce601b030db..a6cda154e55b972fc653cffc4815f9e0f6e975de 100644 --- a/paddle/fluid/operators/mkldnn/conv_mkldnn_op.cc +++ b/paddle/fluid/operators/mkldnn/conv_mkldnn_op.cc @@ -12,12 +12,16 @@ See the License for the specific language governing permissions and limitations under the License. */ -#include #include "paddle/fluid/framework/data_layout_transform.h" -#include "paddle/fluid/memory/malloc.h" #include "paddle/fluid/operators/conv_op.h" #include "paddle/fluid/platform/mkldnn_reuse.h" +namespace paddle { +namespace platform { +class MKLDNNDeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/mkldnn/fc_mkldnn_op.cc b/paddle/fluid/operators/mkldnn/fc_mkldnn_op.cc index 40737f4cd029b47dbd03069a2e4d29ad33121eb9..0bec5619f5427adf9c38bbdd6480b6da28894b8a 100644 --- a/paddle/fluid/operators/mkldnn/fc_mkldnn_op.cc +++ b/paddle/fluid/operators/mkldnn/fc_mkldnn_op.cc @@ -12,13 +12,20 @@ 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 "paddle/fluid/framework/tensor.h" + #include "paddle/fluid/operators/fc_op.h" -#include "paddle/fluid/platform/device_context.h" #include "paddle/fluid/platform/mkldnn_helper.h" -#include "paddle/fluid/platform/variant.h" + +namespace paddle { +namespace framework { +class LoDTensor; +class Tensor; +} // namespace framework +namespace platform { +class MKLDNNDeviceContext; +} // namespace platform +} // namespace paddle namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/mkldnn/lrn_mkldnn_op.cc b/paddle/fluid/operators/mkldnn/lrn_mkldnn_op.cc index 00c10cecbf4828d2157505abca49763b6ded1b16..9ee653ec58912b326dc44f3f2289bd9dac6b3c62 100644 --- a/paddle/fluid/operators/mkldnn/lrn_mkldnn_op.cc +++ b/paddle/fluid/operators/mkldnn/lrn_mkldnn_op.cc @@ -12,10 +12,17 @@ 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 "paddle/fluid/framework/tensor.h" -#include "paddle/fluid/operators/lrn_op.h" #include "paddle/fluid/platform/mkldnn_reuse.h" +namespace paddle { +namespace framework { +class Tensor; +} // namespace framework +namespace platform { +class MKLDNNDeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/mkldnn/matmul_mkldnn_op.cc b/paddle/fluid/operators/mkldnn/matmul_mkldnn_op.cc index 5ca0ed1182e74e681e9e36e55b61f58b5da66170..3ae34fe0e9011940dabd85661e3c122e953d24c3 100644 --- a/paddle/fluid/operators/mkldnn/matmul_mkldnn_op.cc +++ b/paddle/fluid/operators/mkldnn/matmul_mkldnn_op.cc @@ -12,12 +12,18 @@ 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 "mkldnn.hpp" #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/framework/tensor.h" #include "paddle/fluid/operators/math/blas.h" #include "paddle/fluid/platform/mkldnn_helper.h" +namespace paddle { +namespace platform { +class MKLDNNDeviceContext; +struct CPUPlace; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/mkldnn/mul_mkldnn_op.cc b/paddle/fluid/operators/mkldnn/mul_mkldnn_op.cc index 1dd1ad117862d92aa8d358f04f8b03fec7abafff..4f0b7cab47efe33fbb297542975590b44f62c75a 100644 --- a/paddle/fluid/operators/mkldnn/mul_mkldnn_op.cc +++ b/paddle/fluid/operators/mkldnn/mul_mkldnn_op.cc @@ -13,12 +13,18 @@ See the License for the specific language governing permissions and limitations under the License. */ #include -#include -#include "paddle/fluid/framework/data_layout_transform.h" -#include "paddle/fluid/memory/malloc.h" + #include "paddle/fluid/operators/mul_op.h" #include "paddle/fluid/platform/mkldnn_helper.h" -#include "paddle/fluid/platform/mkldnn_reuse.h" + +namespace paddle { +namespace framework { +class Tensor; +} // namespace framework +namespace platform { +class MKLDNNDeviceContext; +} // namespace platform +} // namespace paddle namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/mkldnn/pool_mkldnn_op.cc b/paddle/fluid/operators/mkldnn/pool_mkldnn_op.cc index 9df30b3295c00e69a956ee84770dfeb19a83487c..bf12c61a4d9b16ffa41a44a1b53d6ec9daa3717d 100644 --- a/paddle/fluid/operators/mkldnn/pool_mkldnn_op.cc +++ b/paddle/fluid/operators/mkldnn/pool_mkldnn_op.cc @@ -12,7 +12,6 @@ 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 "paddle/fluid/framework/data_layout_transform.h" #include "paddle/fluid/operators/pool_op.h" #include "paddle/fluid/platform/mkldnn_helper.h" #include "paddle/fluid/platform/mkldnn_reuse.h" diff --git a/paddle/fluid/operators/mkldnn/softmax_mkldnn_op.cc b/paddle/fluid/operators/mkldnn/softmax_mkldnn_op.cc index 5014381a4e215917883f45288de4482db5cbf79c..0b159f9dcfaafde04dec862749d724ed02554978 100644 --- a/paddle/fluid/operators/mkldnn/softmax_mkldnn_op.cc +++ b/paddle/fluid/operators/mkldnn/softmax_mkldnn_op.cc @@ -12,12 +12,18 @@ 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 "mkldnn.hpp" #include "paddle/fluid/operators/softmax_op.h" #include "paddle/fluid/platform/mkldnn_reuse.h" +namespace paddle { +namespace framework { +class Tensor; +} // namespace framework +namespace platform { +class MKLDNNDeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/mkldnn/sum_mkldnn_op.cc b/paddle/fluid/operators/mkldnn/sum_mkldnn_op.cc index 1e0e13abb7c641d441b9c6188f7b9103c4ec7292..414312fe97ecb7d9ca1c53022e4340e8aed7b8a8 100644 --- a/paddle/fluid/operators/mkldnn/sum_mkldnn_op.cc +++ b/paddle/fluid/operators/mkldnn/sum_mkldnn_op.cc @@ -24,13 +24,19 @@ See the License for the specific language governing permissions and limitations under the License. */ -#include "mkldnn.hpp" -#include "paddle/fluid/framework/tensor.h" -#include "paddle/fluid/operators/math/selected_rows_functor.h" #include "paddle/fluid/operators/sum_op.h" -#include "paddle/fluid/platform/device_context.h" #include "paddle/fluid/platform/mkldnn_helper.h" +namespace paddle { +namespace framework { +class Tensor; +} // namespace framework +namespace platform { +class CPUDeviceContext; +class MKLDNNDeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/nccl/nccl_gpu_common.cc b/paddle/fluid/operators/nccl/nccl_gpu_common.cc index 70d80e26e5c6c51f4f0fbac304f48c5f4b3f62b2..169af47e95acdcc9450a892cd1dddc0d3ec9de1e 100644 --- a/paddle/fluid/operators/nccl/nccl_gpu_common.cc +++ b/paddle/fluid/operators/nccl/nccl_gpu_common.cc @@ -13,7 +13,6 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/nccl/nccl_gpu_common.h" -#include "paddle/fluid/platform/gpu_info.h" namespace paddle { namespace platform { diff --git a/paddle/fluid/operators/op_debug_string_test.cc b/paddle/fluid/operators/op_debug_string_test.cc index 67d71fe82ad0b52906312d3e214e73d56012824f..7c1cf9109c566625743f69de8cf3213855600c69 100644 --- a/paddle/fluid/operators/op_debug_string_test.cc +++ b/paddle/fluid/operators/op_debug_string_test.cc @@ -13,10 +13,10 @@ // limitations under the License. #include + #include "glog/logging.h" #include "gtest/gtest.h" #include "paddle/fluid/framework/op_registry.h" -#include "paddle/fluid/framework/operator.h" USE_OP(elementwise_add_grad); diff --git a/paddle/fluid/operators/print_op.cc b/paddle/fluid/operators/print_op.cc index 3fb18365e523d75f5c3e6107011d2aac5a152dea..80faf833be591d0f4e2e7ee365d0163869672c02 100644 --- a/paddle/fluid/operators/print_op.cc +++ b/paddle/fluid/operators/print_op.cc @@ -12,13 +12,21 @@ See the License for the specific language governing permissions and limitations under the License. */ -#include -#include "paddle/fluid/framework/data_layout.h" #include "paddle/fluid/framework/op_registry.h" -#include "paddle/fluid/framework/var_type.h" -#include "paddle/fluid/operators/assign_op.h" #include "paddle/fluid/operators/tensor_formatter.h" +namespace paddle { +namespace framework { +class InferShapeContext; +class LoDTensor; +class OpDesc; +class Scope; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle + namespace paddle { namespace operators { using framework::GradVarName; diff --git a/paddle/fluid/operators/rank_loss_op.cc b/paddle/fluid/operators/rank_loss_op.cc index 9b7a923fb4bbcfb6e525f8360cb692c003555260..ec9d1fde4533580f862e35d01fbdb6dd0143495a 100644 --- a/paddle/fluid/operators/rank_loss_op.cc +++ b/paddle/fluid/operators/rank_loss_op.cc @@ -13,9 +13,23 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/rank_loss_op.h" -#include + #include +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +class CPUDeviceContext; +struct CPUPlace; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/reader/buffered_reader.h b/paddle/fluid/operators/reader/buffered_reader.h index 42c087b9e47a9ec7e80d05a791af3e04c483ab08..041d36a93432e793a79e3d47df95c80e7a10b460 100644 --- a/paddle/fluid/operators/reader/buffered_reader.h +++ b/paddle/fluid/operators/reader/buffered_reader.h @@ -18,6 +18,7 @@ #include #include #include + #include "ThreadPool.h" #include "paddle/fluid/framework/reader.h" #ifdef PADDLE_WITH_CUDA diff --git a/paddle/fluid/operators/reader/py_reader.cc b/paddle/fluid/operators/reader/py_reader.cc index 2100aeb7cf4d5ca5ae0ae557c5d131ca831c39f9..ad79f6bbc4c4a82eff107e42fa60f139ccd5a818 100644 --- a/paddle/fluid/operators/reader/py_reader.cc +++ b/paddle/fluid/operators/reader/py_reader.cc @@ -13,7 +13,6 @@ // limitations under the License. #include "paddle/fluid/operators/reader/py_reader.h" -#include namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/reader/py_reader.h b/paddle/fluid/operators/reader/py_reader.h index d827cdd0b8764b1d6cfa0477dc85cd44525b0b29..3492d57804886309ebf1b63e8c161bc76d0c5abd 100644 --- a/paddle/fluid/operators/reader/py_reader.h +++ b/paddle/fluid/operators/reader/py_reader.h @@ -17,6 +17,7 @@ #include #include #include + #include "paddle/fluid/framework/reader.h" #include "paddle/fluid/operators/reader/lod_tensor_blocking_queue.h" @@ -24,6 +25,8 @@ namespace paddle { namespace operators { namespace reader { +class LoDTensorBlockingQueue; + class PyReader : public framework::FileReader { public: explicit PyReader( diff --git a/paddle/fluid/operators/reader/reader_blocking_queue_test.cc b/paddle/fluid/operators/reader/reader_blocking_queue_test.cc index dc0940ac0b78d295b5088cb6ae26300da1dc883d..86c9f38ad3f9793386d100218ea3854579b884df 100644 --- a/paddle/fluid/operators/reader/reader_blocking_queue_test.cc +++ b/paddle/fluid/operators/reader/reader_blocking_queue_test.cc @@ -12,12 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include // NOLINT -#include #include // NOLINT -#include -#include "gtest/gtest.h" +#include "gtest/gtest.h" #include "paddle/fluid/operators/reader/blocking_queue.h" using paddle::operators::reader::BlockingQueue; diff --git a/paddle/fluid/operators/reader/reader_op_registry.cc b/paddle/fluid/operators/reader/reader_op_registry.cc index 952ed4662880053833384799916fe5435d867ed0..bccaae70229b50446cc5743995cc655852529b68 100644 --- a/paddle/fluid/operators/reader/reader_op_registry.cc +++ b/paddle/fluid/operators/reader/reader_op_registry.cc @@ -13,8 +13,12 @@ // limitations under the License. #include "paddle/fluid/operators/reader/reader_op_registry.h" -#include -#include + +namespace paddle { +namespace framework { +class VarDesc; +} // namespace framework +} // namespace paddle namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/reader/reader_op_registry.h b/paddle/fluid/operators/reader/reader_op_registry.h index 35a0dacaec2376db67484bf934dc523cf105f363..fec496446ac01844f52eec55f9da666c76470489 100644 --- a/paddle/fluid/operators/reader/reader_op_registry.h +++ b/paddle/fluid/operators/reader/reader_op_registry.h @@ -18,9 +18,17 @@ #include #include #include + #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/framework/reader.h" +namespace paddle { +namespace framework { +class InferShapeContext; +class ReaderBase; +} // namespace framework +} // namespace paddle + namespace paddle { namespace operators { namespace reader { diff --git a/paddle/fluid/operators/recurrent_op.cc b/paddle/fluid/operators/recurrent_op.cc index c1adaf2037a34794218368ad46563efaca24e2ba..35f52ffa522f4c497a493b7e93736f9f522beb19 100644 --- a/paddle/fluid/operators/recurrent_op.cc +++ b/paddle/fluid/operators/recurrent_op.cc @@ -13,9 +13,15 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/recurrent_op.h" - #include -#include "paddle/fluid/string/string_helper.h" + +namespace paddle { +namespace framework { +class InferShapeContext; +class LoDTensor; +class OpDesc; +} // namespace framework +} // namespace paddle namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/recurrent_op.h b/paddle/fluid/operators/recurrent_op.h index 1ca66527e1b834a75f6edd1c23d7657fd52bbae7..e3f512d45c05516b0919d623b626e77f0c790a67 100644 --- a/paddle/fluid/operators/recurrent_op.h +++ b/paddle/fluid/operators/recurrent_op.h @@ -22,6 +22,12 @@ limitations under the License. */ #include "paddle/fluid/framework/executor.h" #include "paddle/fluid/framework/op_registry.h" +namespace paddle { +namespace platform { +class DeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/reduce_ops/frobenius_norm_op.cc b/paddle/fluid/operators/reduce_ops/frobenius_norm_op.cc index 57df2664824d478503fce04f09c5a7f1e02eb080..2d7cce68e81719f2187bb5ce030fd7ae2b0f5755 100644 --- a/paddle/fluid/operators/reduce_ops/frobenius_norm_op.cc +++ b/paddle/fluid/operators/reduce_ops/frobenius_norm_op.cc @@ -13,9 +13,22 @@ // limitations under the License. #include "paddle/fluid/operators/reduce_ops/frobenius_norm_op.h" -#include + #include +namespace paddle { +namespace framework { +class OpDesc; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +class CPUDeviceContext; +struct CPUPlace; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/reduce_ops/reduce_all_op.cc b/paddle/fluid/operators/reduce_ops/reduce_all_op.cc index 30265b3cc71fc6c587a7f4c716529962e1556f45..10095bc955047aa3f01cea38dbbfa87d0f842c5a 100644 --- a/paddle/fluid/operators/reduce_ops/reduce_all_op.cc +++ b/paddle/fluid/operators/reduce_ops/reduce_all_op.cc @@ -14,6 +14,21 @@ #include "paddle/fluid/operators/reduce_ops/reduce_all_op.h" +namespace paddle { +namespace framework { +class OpDesc; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +class CPUDeviceContext; +struct CPUPlace; +} // namespace platform +} // namespace paddle + // kernel's device type is decided by input tensor place, to be consistent with // compare and logical ops REGISTER_REDUCE_OP_WITHOUT_GRAD(reduce_all, UseInputPlace); diff --git a/paddle/fluid/operators/reduce_ops/reduce_any_op.cc b/paddle/fluid/operators/reduce_ops/reduce_any_op.cc index cbc18f18b8e5534b37294dbfb8630bac906e8066..f288fce753802a8c5c871f573680c99e461663d6 100644 --- a/paddle/fluid/operators/reduce_ops/reduce_any_op.cc +++ b/paddle/fluid/operators/reduce_ops/reduce_any_op.cc @@ -14,6 +14,21 @@ #include "paddle/fluid/operators/reduce_ops/reduce_any_op.h" +namespace paddle { +namespace framework { +class OpDesc; +template +class EmptyGradOpMaker; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +class CPUDeviceContext; +struct CPUPlace; +} // namespace platform +} // namespace paddle + // kernel's device type is decided by input tensor place, to be consistent with // compare and logical ops REGISTER_REDUCE_OP_WITHOUT_GRAD(reduce_any, UseInputPlace); diff --git a/paddle/fluid/operators/reduce_ops/reduce_prod_op.cc b/paddle/fluid/operators/reduce_ops/reduce_prod_op.cc index 88935107df187da731e5b77bb6c24cd692d2994f..f27cd6b125b3246b822ec4bef1e227ccff7dfc3e 100644 --- a/paddle/fluid/operators/reduce_ops/reduce_prod_op.cc +++ b/paddle/fluid/operators/reduce_ops/reduce_prod_op.cc @@ -14,6 +14,19 @@ #include "paddle/fluid/operators/reduce_ops/reduce_prod_op.h" +namespace paddle { +namespace framework { +class OpDesc; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +class CPUDeviceContext; +struct CPUPlace; +} // namespace platform +} // namespace paddle + REGISTER_REDUCE_OP(reduce_prod); REGISTER_OP_CPU_KERNEL(reduce_prod, ops::ReduceKernel + #include +namespace paddle { +namespace framework { +class OpDesc; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +class CPUDeviceContext; +struct CPUPlace; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/reorder_lod_tensor_by_rank_op.cc b/paddle/fluid/operators/reorder_lod_tensor_by_rank_op.cc index cb1a2962d9b1412086ad87e00131f0d4bdf9db71..d8d4e641aeb3ef660d092c404bf0edf91014b4bb 100644 --- a/paddle/fluid/operators/reorder_lod_tensor_by_rank_op.cc +++ b/paddle/fluid/operators/reorder_lod_tensor_by_rank_op.cc @@ -12,10 +12,21 @@ 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 "paddle/fluid/framework/lod_rank_table.h" #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/platform/device_context.h" +namespace paddle { +namespace framework { +class LoDRankTable; +class LoDTensor; +class OpDesc; +class Scope; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/reshape_op.cc b/paddle/fluid/operators/reshape_op.cc index 01a33a46521cd81d084f8971c47741b28a105d41..e03824ca8c3f428de3c89f0bc4f623379bb564f1 100644 --- a/paddle/fluid/operators/reshape_op.cc +++ b/paddle/fluid/operators/reshape_op.cc @@ -13,9 +13,24 @@ See the License for the specific language governing permissions and limitations under the License. */ #include -#include + #include "paddle/fluid/framework/op_registry.h" +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +struct CPUPlace; +struct CUDAPlace; +struct float16; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/rnn_memory_helper_op.cc b/paddle/fluid/operators/rnn_memory_helper_op.cc index eea2d2ac57ad3aba90aced8a3ff4816d3a64123f..95b23a0b8cceefaa82f2061e9b61b83a15cb6d07 100644 --- a/paddle/fluid/operators/rnn_memory_helper_op.cc +++ b/paddle/fluid/operators/rnn_memory_helper_op.cc @@ -15,6 +15,17 @@ limitations under the License. */ #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/framework/operator.h" +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +class Scope; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle + namespace paddle { namespace operators { class RNNMemoryHelperOp : public framework::OperatorBase { diff --git a/paddle/fluid/operators/scale_op.cc b/paddle/fluid/operators/scale_op.cc index 9d51f3e292fa2de114b971032c29f5e769ba617a..55e35e43eb9fc95b423f2d028242ff439e97c4c2 100644 --- a/paddle/fluid/operators/scale_op.cc +++ b/paddle/fluid/operators/scale_op.cc @@ -14,9 +14,21 @@ limitations under the License. */ #include "paddle/fluid/operators/scale_op.h" -#include #include +namespace paddle { +namespace framework { +class InferShapeContext; +class OpDesc; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +namespace platform { +class CPUDeviceContext; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/scatter_test.cc b/paddle/fluid/operators/scatter_test.cc index eb248e59b6ce6e5c9c04f94b21e4bc14207c39b1..c83726180baeae6f4b73adda3bd9d9127b0f3e26 100644 --- a/paddle/fluid/operators/scatter_test.cc +++ b/paddle/fluid/operators/scatter_test.cc @@ -13,10 +13,9 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/scatter.h" + #include -#include -#include -#include "paddle/fluid/framework/ddim.h" + #include "paddle/fluid/framework/tensor.h" #include "paddle/fluid/platform/place.h" diff --git a/paddle/fluid/operators/sequence_ops/sequence_concat_op.cu.cc b/paddle/fluid/operators/sequence_ops/sequence_concat_op.cu.cc index 43fd84a711ff7fbf999a66bfdfe320b4daceb1a7..6eda8595b1769b0891213124ac47a3b1cf27fb7c 100644 --- a/paddle/fluid/operators/sequence_ops/sequence_concat_op.cu.cc +++ b/paddle/fluid/operators/sequence_ops/sequence_concat_op.cu.cc @@ -13,6 +13,13 @@ // limitations under the License. #include "paddle/fluid/operators/sequence_ops/sequence_concat_op.h" +#include "paddle/fluid/framework/op_registry.h" + +namespace paddle { +namespace platform { +class CUDADeviceContext; +} // namespace platform +} // namespace paddle template using Kernel = diff --git a/paddle/fluid/operators/softmax_cudnn_op.cu.cc b/paddle/fluid/operators/softmax_cudnn_op.cu.cc index 94e54266f0f922efef5ea4a1b23338b6ce02d131..5b857960706f01c4636d2cb5f2b4b39c12465f99 100644 --- a/paddle/fluid/operators/softmax_cudnn_op.cu.cc +++ b/paddle/fluid/operators/softmax_cudnn_op.cu.cc @@ -14,9 +14,15 @@ limitations under the License. */ #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/operators/softmax_op.h" -#include "paddle/fluid/platform/cudnn_desc.h" #include "paddle/fluid/platform/cudnn_helper.h" +namespace paddle { +namespace platform { +struct CUDAPlace; +struct float16; +} // namespace platform +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/split_lod_tensor_op.cc b/paddle/fluid/operators/split_lod_tensor_op.cc index aa8c0b13dbb2e585e97cd47a0340336b01c2c408..4adbbacc844c64329c7c62f8969cdc3f42936beb 100644 --- a/paddle/fluid/operators/split_lod_tensor_op.cc +++ b/paddle/fluid/operators/split_lod_tensor_op.cc @@ -13,9 +13,20 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/op_registry.h" -#include "paddle/fluid/memory/memcpy.h" #include "paddle/fluid/platform/device_context.h" +namespace paddle { +namespace framework { +class InferShapeContext; +class LoDTensor; +class OpDesc; +class Scope; +} // namespace framework +namespace imperative { +class OpBase; +} // namespace imperative +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/strided_memcpy.h b/paddle/fluid/operators/strided_memcpy.h index 142b00b4de66caaedda5c4f0723d31e3a819b8a4..48d6cf8b3619a7e017319faa525ae1a3ab2f96d7 100644 --- a/paddle/fluid/operators/strided_memcpy.h +++ b/paddle/fluid/operators/strided_memcpy.h @@ -11,8 +11,10 @@ limitations under the License. */ #pragma once #include + #include "paddle/fluid/framework/tensor.h" #include "paddle/fluid/operators/detail/strided_memcpy.h" + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/strided_memcpy_test.cc b/paddle/fluid/operators/strided_memcpy_test.cc index 3a450773a9d749eb3f73baa46e681e588e1fbd0f..83480b44d5be08a2bb1c335f0a82be276a60a676 100644 --- a/paddle/fluid/operators/strided_memcpy_test.cc +++ b/paddle/fluid/operators/strided_memcpy_test.cc @@ -13,8 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/strided_memcpy.h" + #include "gtest/gtest.h" -#include "paddle/fluid/memory/memory.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/tensor_formatter.cc b/paddle/fluid/operators/tensor_formatter.cc index 7b8b484a11e010b7f003cb83ca171b907caadaea..e4fa4a96a5cf7fab122bd49b47719aea50a1da15 100644 --- a/paddle/fluid/operators/tensor_formatter.cc +++ b/paddle/fluid/operators/tensor_formatter.cc @@ -12,11 +12,10 @@ See the License for the specific language governing permissions and limitations under the License. */ +#include "paddle/fluid/operators/tensor_formatter.h" #include #include -#include "paddle/fluid/operators/tensor_formatter.h" - namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/tensor_formatter.h b/paddle/fluid/operators/tensor_formatter.h index 1731348479d5f5bcf5a3d3fbfe338d3ec76edaca..aee5eec0d1c29c5f5485182da24b9a53f7d27c78 100644 --- a/paddle/fluid/operators/tensor_formatter.h +++ b/paddle/fluid/operators/tensor_formatter.h @@ -18,6 +18,12 @@ #include "paddle/fluid/framework/data_layout.h" #include "paddle/fluid/framework/var_type.h" +namespace paddle { +namespace framework { +class LoDTensor; +} // namespace framework +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/tensorrt/tensorrt_engine_op.cc b/paddle/fluid/operators/tensorrt/tensorrt_engine_op.cc index 708fccf9715e41db9d56210e46a3d174c348ed63..d4eb79aa0f2fb44d41104e1dca3daec8116d02ce 100644 --- a/paddle/fluid/operators/tensorrt/tensorrt_engine_op.cc +++ b/paddle/fluid/operators/tensorrt/tensorrt_engine_op.cc @@ -14,9 +14,6 @@ #ifdef PADDLE_WITH_CUDA -#include -#include - #include "paddle/fluid/operators/tensorrt/tensorrt_engine_op.h" namespace paddle { diff --git a/paddle/fluid/operators/tensorrt/tensorrt_engine_op.h b/paddle/fluid/operators/tensorrt/tensorrt_engine_op.h index 9cfe47da5db7ba15c9b24a8d551606f805ad9b15..922340b08c63815e951155610c995c995c4bba9e 100644 --- a/paddle/fluid/operators/tensorrt/tensorrt_engine_op.h +++ b/paddle/fluid/operators/tensorrt/tensorrt_engine_op.h @@ -31,6 +31,18 @@ #include "paddle/fluid/inference/tensorrt/engine.h" #include "paddle/fluid/inference/tensorrt/helper.h" +namespace paddle { +namespace inference { +namespace tensorrt { +class TRTCalibratorEngine; +class TRTCalibratorEngineManager; +class TRTInt8Calibrator; +} // namespace tensorrt +template +struct Singleton; +} // namespace inference +} // namespace paddle + namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/test_leaky_relu_grad_grad_functor.h b/paddle/fluid/operators/test_leaky_relu_grad_grad_functor.h index cc2fe4cdbdb8faa69abad28fbdd31dc4e61bdc04..ce94ba1ce9e8c10e04cd3fe5fee214ef30ffb918 100644 --- a/paddle/fluid/operators/test_leaky_relu_grad_grad_functor.h +++ b/paddle/fluid/operators/test_leaky_relu_grad_grad_functor.h @@ -16,6 +16,7 @@ #include #include + #include "gtest/gtest.h" #include "paddle/fluid/operators/activation_op.h" #include "paddle/fluid/platform/for_range.h" diff --git a/paddle/fluid/platform/bfloat16.h b/paddle/fluid/platform/bfloat16.h index 742329abb2dae20437120c0d4ba5975d41b0a7c9..4460139219fb520d906b4a135d1b6f02d782ae2c 100644 --- a/paddle/fluid/platform/bfloat16.h +++ b/paddle/fluid/platform/bfloat16.h @@ -23,9 +23,15 @@ #endif #include + #include "paddle/fluid/platform/hostdevice.h" #include "unsupported/Eigen/CXX11/Tensor" +namespace Eigen { +template +struct NumTraits; +} // namespace Eigen + namespace paddle { namespace platform { diff --git a/paddle/fluid/platform/bfloat16_test.cc b/paddle/fluid/platform/bfloat16_test.cc index bdb508ee33630004daae132fcdcf71146a50e640..fc964d7df359a3a07bfd515a80175adbcd372e48 100644 --- a/paddle/fluid/platform/bfloat16_test.cc +++ b/paddle/fluid/platform/bfloat16_test.cc @@ -10,14 +10,12 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/platform/bfloat16.h" - #include #define GLOG_NO_ABBREVIATED_SEVERITIES // msvc conflict logging with windows.h #include "gtest/gtest.h" #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/platform/enforce.h" -#include "paddle/fluid/platform/init.h" namespace paddle { namespace platform { diff --git a/paddle/fluid/platform/collective_helper.cc b/paddle/fluid/platform/collective_helper.cc index 4cb6ee3143a862f59a3c224a012d380e629e738f..54dac976276904809003903324535824819e979f 100644 --- a/paddle/fluid/platform/collective_helper.cc +++ b/paddle/fluid/platform/collective_helper.cc @@ -14,12 +14,8 @@ #if defined(PADDLE_WITH_NCCL) #include "paddle/fluid/platform/collective_helper.h" - -#include #include -#include "paddle/fluid/platform/dynload/nccl.h" - namespace paddle { namespace platform { diff --git a/paddle/fluid/platform/cpu_info.cc b/paddle/fluid/platform/cpu_info.cc index b86fd70c9aecddca7c1ce23085a46c5332d2e698..e379832593c78c6ca2ad94bf72beaafded13a205 100644 --- a/paddle/fluid/platform/cpu_info.cc +++ b/paddle/fluid/platform/cpu_info.cc @@ -15,7 +15,6 @@ limitations under the License. */ #include "paddle/fluid/platform/cpu_info.h" #ifdef PADDLE_WITH_XBYAK -#include "xbyak/xbyak.h" #include "xbyak/xbyak_util.h" #endif diff --git a/paddle/fluid/platform/cuda_resource_pool.h b/paddle/fluid/platform/cuda_resource_pool.h index 22b53445d84c1f72481f559ff45c4864fb5c7263..570b68b08fc1e6fd0b9ff70dba244c355fc2618d 100644 --- a/paddle/fluid/platform/cuda_resource_pool.h +++ b/paddle/fluid/platform/cuda_resource_pool.h @@ -20,6 +20,7 @@ #include #include #include + #include "paddle/fluid/platform/resource_pool.h" namespace paddle { diff --git a/paddle/fluid/platform/cudnn_desc.h b/paddle/fluid/platform/cudnn_desc.h index e0ba1aaa6bd8b8b29b0d02259d91b9bb9470e35f..0e0218dcca3fc4d7ea661fbcfe89d260a4c93a2d 100644 --- a/paddle/fluid/platform/cudnn_desc.h +++ b/paddle/fluid/platform/cudnn_desc.h @@ -22,8 +22,15 @@ #include #include #include + #include "paddle/fluid/platform/cudnn_helper.h" +namespace paddle { +namespace framework { +class Tensor; +} // namespace framework +} // namespace paddle + namespace paddle { namespace platform { using framework::Tensor; diff --git a/paddle/fluid/platform/cudnn_helper.h b/paddle/fluid/platform/cudnn_helper.h index 4b9c5c429dabc32fad6f05e4f066ab063057e733..e983e36895353c215af19937980946a33c242b8c 100644 --- a/paddle/fluid/platform/cudnn_helper.h +++ b/paddle/fluid/platform/cudnn_helper.h @@ -23,6 +23,12 @@ limitations under the License. */ #include "paddle/fluid/platform/float16.h" #include "paddle/fluid/platform/macros.h" +namespace paddle { +namespace platform { +struct float16; +} // namespace platform +} // namespace paddle + DECLARE_bool(cudnn_deterministic); namespace paddle { diff --git a/paddle/fluid/platform/device_code.cc b/paddle/fluid/platform/device_code.cc index 9d5a0954b00b1755a86cbd5d654b9a06edff4879..2474903edf77c1d0d22845fa44a23f82be323417 100644 --- a/paddle/fluid/platform/device_code.cc +++ b/paddle/fluid/platform/device_code.cc @@ -13,10 +13,12 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/platform/device_code.h" + #include #include #include #include + #include "paddle/fluid/platform/enforce.h" DECLARE_string(cuda_dir); diff --git a/paddle/fluid/platform/device_code.h b/paddle/fluid/platform/device_code.h index 6128d8b78db05e6ba92ffae46ee4c9cc8895c105..4199317a8ceb03dddc5cc439dc455725b8863678 100644 --- a/paddle/fluid/platform/device_code.h +++ b/paddle/fluid/platform/device_code.h @@ -19,6 +19,7 @@ limitations under the License. */ #include #include #include + #include "paddle/fluid/platform/device_context.h" #ifdef PADDLE_WITH_CUDA #include "paddle/fluid/platform/dynload/cuda_driver.h" diff --git a/paddle/fluid/platform/device_context.h b/paddle/fluid/platform/device_context.h index 28d94627f9575573075beaa328a682314b5c3b71..e1438a1eefa62b238241c3185daf69d3418f2dc9 100644 --- a/paddle/fluid/platform/device_context.h +++ b/paddle/fluid/platform/device_context.h @@ -17,6 +17,7 @@ limitations under the License. */ #include #include #include + #include "paddle/fluid/memory/malloc.h" #ifdef PADDLE_WITH_CUDA #include "paddle/fluid/platform/cuda_helper.h" @@ -35,6 +36,7 @@ limitations under the License. */ #endif #include + #include "glog/logging.h" #include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/platform/place.h" @@ -44,6 +46,11 @@ limitations under the License. */ #define EIGEN_USE_THREADS #include "unsupported/Eigen/CXX11/Tensor" +namespace Eigen { +struct DefaultDevice; +struct GpuDevice; +} // namespace Eigen + #ifdef PADDLE_WITH_XPU #include "paddle/fluid/platform/xpu_header.h" #endif @@ -118,8 +125,8 @@ struct DefaultDeviceContextType { #ifdef PADDLE_WITH_CUDA -class EigenCudaStreamDevice; class CudnnWorkspaceHandle; +class EigenCudaStreamDevice; class CUDAContext { public: diff --git a/paddle/fluid/platform/device_memory_aligment.h b/paddle/fluid/platform/device_memory_aligment.h index 2c19a2b10626d0e312c267feba0104a23005909e..5cc33fd31f19cfc1512b1d41c5c9dc918f3c6491 100644 --- a/paddle/fluid/platform/device_memory_aligment.h +++ b/paddle/fluid/platform/device_memory_aligment.h @@ -14,6 +14,7 @@ limitations under the License. */ #pragma once #include + #include "paddle/fluid/platform/cpu_info.h" #include "paddle/fluid/platform/place.h" #ifdef PADDLE_WITH_CUDA diff --git a/paddle/fluid/platform/device_tracer.h b/paddle/fluid/platform/device_tracer.h index 85168a046fb3fa4317956737871cde56e15bedfb..9bae7a870522cd1019a8bf0facb2cfb6e6772118 100644 --- a/paddle/fluid/platform/device_tracer.h +++ b/paddle/fluid/platform/device_tracer.h @@ -28,6 +28,8 @@ namespace platform { /////////////////////// // WARN: Under Development. Don't depend on it yet. ////////////////////// +class Event; + inline uint64_t PosixInNsec() { struct timeval tv; gettimeofday(&tv, nullptr); diff --git a/paddle/fluid/platform/dynload/cublas.h b/paddle/fluid/platform/dynload/cublas.h index 562e7542012247c86add9e64f182d857ea969c60..045caab748811aac32f0ad3d20dfed1663a96f4a 100644 --- a/paddle/fluid/platform/dynload/cublas.h +++ b/paddle/fluid/platform/dynload/cublas.h @@ -19,6 +19,7 @@ limitations under the License. */ #include #include // NOLINT #include + #include "paddle/fluid/platform/dynload/dynamic_loader.h" #include "paddle/fluid/platform/port.h" diff --git a/paddle/fluid/platform/dynload/cuda_driver.h b/paddle/fluid/platform/dynload/cuda_driver.h index 056fcc069dba927fec0f04784f9edfd4e44ef3d2..5799b084f5f3157fda90583b128dcdce4485cc83 100644 --- a/paddle/fluid/platform/dynload/cuda_driver.h +++ b/paddle/fluid/platform/dynload/cuda_driver.h @@ -16,6 +16,7 @@ limitations under the License. */ #include #include // NOLINT + #include "paddle/fluid/platform/dynload/dynamic_loader.h" #include "paddle/fluid/platform/port.h" diff --git a/paddle/fluid/platform/dynload/cudnn.h b/paddle/fluid/platform/dynload/cudnn.h index dd0a2e1968501a3375ad5691b27fa0c922cf2ab4..88b545b48e5328883c1554c0efc75140006ce787 100644 --- a/paddle/fluid/platform/dynload/cudnn.h +++ b/paddle/fluid/platform/dynload/cudnn.h @@ -13,10 +13,10 @@ See the License for the specific language governing permissions and limitations under the License. */ #pragma once -#include - #include +#include #include // NOLINT + #include "paddle/fluid/platform/dynload/dynamic_loader.h" #include "paddle/fluid/platform/port.h" diff --git a/paddle/fluid/platform/dynload/cupti.cc b/paddle/fluid/platform/dynload/cupti.cc index a25660c6ed411bbe444ac8aa10a324cbed9c9d4f..d8381580c90d4ef9cd1bf5adbce7a733f81c91e0 100644 --- a/paddle/fluid/platform/dynload/cupti.cc +++ b/paddle/fluid/platform/dynload/cupti.cc @@ -15,7 +15,6 @@ limitations under the License. */ #ifdef PADDLE_WITH_CUPTI #include "paddle/fluid/platform/dynload/cupti.h" -#include "paddle/fluid/platform/enforce.h" namespace paddle { namespace platform { diff --git a/paddle/fluid/platform/dynload/curand.h b/paddle/fluid/platform/dynload/curand.h index 48076e5478a30d86802e10f35bfa7cabfc0deab9..7a160664bc2e8973951892c23981fdd746b2123f 100644 --- a/paddle/fluid/platform/dynload/curand.h +++ b/paddle/fluid/platform/dynload/curand.h @@ -14,11 +14,10 @@ limitations under the License. */ #pragma once #include - #include // NOLINT -#include "paddle/fluid/platform/port.h" #include "paddle/fluid/platform/dynload/dynamic_loader.h" +#include "paddle/fluid/platform/port.h" namespace paddle { namespace platform { diff --git a/paddle/fluid/platform/dynload/cusolver.h b/paddle/fluid/platform/dynload/cusolver.h index ba2d38729c12e2c5fc978a2768cf36c3af3b7c4c..561f20af45ab5c38f18ed161cb2135589b71a932 100644 --- a/paddle/fluid/platform/dynload/cusolver.h +++ b/paddle/fluid/platform/dynload/cusolver.h @@ -15,11 +15,10 @@ limitations under the License. */ #include #include - #include // NOLINT -#include "paddle/fluid/platform/port.h" #include "paddle/fluid/platform/dynload/dynamic_loader.h" +#include "paddle/fluid/platform/port.h" namespace paddle { namespace platform { diff --git a/paddle/fluid/platform/dynload/dynamic_loader.cc b/paddle/fluid/platform/dynload/dynamic_loader.cc index 82e4f6ac75ec1e3cc927a4018b83616298eefbff..0c8a64ccf6943aa4359ed6ae094e12e4d6bccf8d 100644 --- a/paddle/fluid/platform/dynload/dynamic_loader.cc +++ b/paddle/fluid/platform/dynload/dynamic_loader.cc @@ -13,8 +13,6 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/platform/dynload/dynamic_loader.h" -#include -#include // NOLINT #include #include @@ -22,7 +20,6 @@ limitations under the License. */ #include "glog/logging.h" #include "paddle/fluid/platform/dynload/cupti_lib_path.h" #include "paddle/fluid/platform/enforce.h" -#include "paddle/fluid/platform/port.h" DEFINE_string(cudnn_dir, "", "Specify path for loading libcudnn.so. For instance, " diff --git a/paddle/fluid/platform/dynload/mklml.h b/paddle/fluid/platform/dynload/mklml.h index 2be95b113b2f243b9813353877ddc61421b1a56c..9369cf131da9aba2f1c0e8b85441f4eba74996bc 100644 --- a/paddle/fluid/platform/dynload/mklml.h +++ b/paddle/fluid/platform/dynload/mklml.h @@ -16,6 +16,7 @@ limitations under the License. */ #include #include // NOLINT + #include "paddle/fluid/platform/dynload/dynamic_loader.h" #include "paddle/fluid/platform/port.h" diff --git a/paddle/fluid/platform/dynload/nccl.h b/paddle/fluid/platform/dynload/nccl.h index 1d5fa45ecf684597be5a3d5234456a871221d329..407f34f0ac3e0e1d5244552834207b3ca28cbe89 100644 --- a/paddle/fluid/platform/dynload/nccl.h +++ b/paddle/fluid/platform/dynload/nccl.h @@ -14,8 +14,8 @@ limitations under the License. */ #pragma once #include - #include // NOLINT + #include "paddle/fluid/platform/dynload/dynamic_loader.h" #include "paddle/fluid/platform/port.h" diff --git a/paddle/fluid/platform/dynload/nvrtc.h b/paddle/fluid/platform/dynload/nvrtc.h index 9464a23ba1ef9f0b24c4ef727c2de8176149f166..720450d28b16f204cfc54b4e617adbe66997f539 100644 --- a/paddle/fluid/platform/dynload/nvrtc.h +++ b/paddle/fluid/platform/dynload/nvrtc.h @@ -16,6 +16,7 @@ limitations under the License. */ #include #include // NOLINT + #include "paddle/fluid/platform/dynload/dynamic_loader.h" #include "paddle/fluid/platform/port.h" diff --git a/paddle/fluid/platform/dynload/warpctc.h b/paddle/fluid/platform/dynload/warpctc.h index bc1977b05de5da062fae5662dfb51d4a74868c8a..e10a7233b6248705492f641044771e6531fb00a4 100644 --- a/paddle/fluid/platform/dynload/warpctc.h +++ b/paddle/fluid/platform/dynload/warpctc.h @@ -15,6 +15,7 @@ limitations under the License. */ #pragma once #include // NOLINT + #include "paddle/fluid/platform/dynload/dynamic_loader.h" #include "paddle/fluid/platform/port.h" #include "warpctc/include/ctc.h" diff --git a/paddle/fluid/platform/enforce.h b/paddle/fluid/platform/enforce.h index ce1ec507307a2721e641ac15425c6a2321e514c7..a3ae9e48eea30616770b6e6babcefc5026f22905 100644 --- a/paddle/fluid/platform/enforce.h +++ b/paddle/fluid/platform/enforce.h @@ -70,6 +70,12 @@ limitations under the License. */ #include "paddle/fluid/framework/type_defs.h" #include "paddle/fluid/imperative/type_defs.h" +namespace paddle { +namespace platform { +class ErrorSummary; +} // namespace platform +} // namespace paddle + DECLARE_int32(call_stack_level); namespace paddle { diff --git a/paddle/fluid/platform/errors_test.cc b/paddle/fluid/platform/errors_test.cc index 3c84215b5e5900897a1c49a0f81428dd7beae5e7..a73c1ba3d34379df2e3999dd1a8519a5a9c792f9 100644 --- a/paddle/fluid/platform/errors_test.cc +++ b/paddle/fluid/platform/errors_test.cc @@ -12,7 +12,6 @@ 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 "gtest/gtest.h" diff --git a/paddle/fluid/platform/float16_test.cc b/paddle/fluid/platform/float16_test.cc index 261ec68483faf6ca7a34a641cd53cd2113381e9c..ec8a98eeb1a14d88a5aecea49140a3c2dd177b78 100644 --- a/paddle/fluid/platform/float16_test.cc +++ b/paddle/fluid/platform/float16_test.cc @@ -10,13 +10,11 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/platform/float16.h" -#include - #define GLOG_NO_ABBREVIATED_SEVERITIES // msvc conflict logging with windows.h +#include #include "gtest/gtest.h" #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/platform/enforce.h" -#include "paddle/fluid/platform/init.h" namespace paddle { namespace platform { diff --git a/paddle/fluid/platform/lodtensor_printer.cc b/paddle/fluid/platform/lodtensor_printer.cc index 33d0fe6268046b3bcbd4addc75fcf34c03d70bf9..0be4233269e0f4f732c6b6a2622e7db3cb8e37e3 100644 --- a/paddle/fluid/platform/lodtensor_printer.cc +++ b/paddle/fluid/platform/lodtensor_printer.cc @@ -13,9 +13,15 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/platform/lodtensor_printer.h" -#include "paddle/fluid/framework/lod_tensor_array.h" + #include "paddle/fluid/framework/scope.h" -#include "paddle/fluid/framework/variable.h" + +namespace paddle { +namespace framework { +class LoDTensor; +class Variable; +} // namespace framework +} // namespace paddle namespace paddle { namespace platform { diff --git a/paddle/fluid/platform/lodtensor_printer.h b/paddle/fluid/platform/lodtensor_printer.h index e070e3540c996a0fe248a3b9312c18d948395426..e0bd1fff197f700303e3e7d9c9afe18937a1b9e6 100644 --- a/paddle/fluid/platform/lodtensor_printer.h +++ b/paddle/fluid/platform/lodtensor_printer.h @@ -14,8 +14,15 @@ limitations under the License. */ #pragma once #include + #include "paddle/fluid/framework/scope.h" +namespace paddle { +namespace framework { +class Scope; +} // namespace framework +} // namespace paddle + namespace paddle { namespace platform { void PrintVar(framework::Scope* scope, const std::string& var_name, diff --git a/paddle/fluid/platform/lodtensor_printer_test.cc b/paddle/fluid/platform/lodtensor_printer_test.cc index 19e85284b8fc8842b2e5662343c74fc451b08d9e..5b2af270740766307990c5cd53585a9c62606da3 100644 --- a/paddle/fluid/platform/lodtensor_printer_test.cc +++ b/paddle/fluid/platform/lodtensor_printer_test.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. #include "paddle/fluid/platform/lodtensor_printer.h" + #include "gtest/gtest.h" #include "paddle/fluid/framework/scope.h" -#include "paddle/fluid/framework/variable.h" TEST(LodTensorPrinter, PrintVar) { paddle::framework::Scope scope; diff --git a/paddle/fluid/platform/monitor.cc b/paddle/fluid/platform/monitor.cc index e65e09f45c0c809f126309ebc16915ab42e1ff0a..76554012bf51e34fc99db7759404f0e8d6f96cd6 100644 --- a/paddle/fluid/platform/monitor.cc +++ b/paddle/fluid/platform/monitor.cc @@ -13,7 +13,6 @@ // limitations under the License. #include "paddle/fluid/platform/monitor.h" -#include namespace paddle { namespace platform {} // namespace platform diff --git a/paddle/fluid/platform/monitor.h b/paddle/fluid/platform/monitor.h index 2f186420b414280c40ece763307e8e90c9a6d505..b57fae9daac41f37829309c4bc5f58fb2606ca02 100644 --- a/paddle/fluid/platform/monitor.h +++ b/paddle/fluid/platform/monitor.h @@ -22,6 +22,7 @@ #include #include #include + #include "glog/logging.h" namespace paddle { diff --git a/paddle/fluid/platform/place_test.cc b/paddle/fluid/platform/place_test.cc index 13f28c73f4504aea85d6155a3daa8f8f01b26385..41e084efa57004c3935e8a9f4200c1e5a4e8f664 100644 --- a/paddle/fluid/platform/place_test.cc +++ b/paddle/fluid/platform/place_test.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. #include "paddle/fluid/platform/place.h" -#include + #include "gtest/gtest.h" TEST(Place, Equality) { diff --git a/paddle/fluid/platform/profiler.cc b/paddle/fluid/platform/profiler.cc index 85759bc6e2ea3700df6a17f885385b85dfbcb6a3..56a6275b582d753c0fa579d624b7f50c16f579b8 100644 --- a/paddle/fluid/platform/profiler.cc +++ b/paddle/fluid/platform/profiler.cc @@ -12,28 +12,15 @@ 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 // NOLINT #include -#include #include -#include -#ifdef PADDLE_WITH_CUDA -#include -#endif // PADDLE_WITH_CUDA -#include "glog/logging.h" -#include "paddle/fluid/framework/block_desc.h" #include "paddle/fluid/platform/device_tracer.h" #include "paddle/fluid/platform/enforce.h" -#include "paddle/fluid/platform/errors.h" -#include "paddle/fluid/platform/port.h" #include "paddle/fluid/platform/profiler.h" #include "paddle/fluid/platform/profiler_helper.h" -#include "paddle/fluid/string/printf.h" DEFINE_bool(enable_rpc_profiler, false, "Enable rpc profiler or not."); diff --git a/paddle/fluid/platform/profiler.h b/paddle/fluid/platform/profiler.h index 12049d815cf85dbd54d9188240dbfa5213e94447..0185328ff32004a35283c1d2883c2834b49b473b 100644 --- a/paddle/fluid/platform/profiler.h +++ b/paddle/fluid/platform/profiler.h @@ -23,6 +23,7 @@ limitations under the License. */ #include #include #include + #include "paddle/fluid/framework/type_defs.h" #include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/platform/event.h" diff --git a/paddle/fluid/platform/profiler_test.cc b/paddle/fluid/platform/profiler_test.cc index 4d340a06342822ffd44bac7ebc6114424d9bab60..2ce898d46171e190f546d8715a1f02845d62a848 100644 --- a/paddle/fluid/platform/profiler_test.cc +++ b/paddle/fluid/platform/profiler_test.cc @@ -13,10 +13,9 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/platform/profiler.h" + #include -#ifdef PADDLE_WITH_CUDA -#include -#endif + #include "gtest/gtest.h" TEST(Event, CpuElapsedTime) { diff --git a/paddle/fluid/platform/stream/cuda_stream.h b/paddle/fluid/platform/stream/cuda_stream.h index 4272d5fd0b14c5d705d4af84691b3b8d24d1c7f5..c65d107cf454676777ef85bf557299ab3f07483c 100644 --- a/paddle/fluid/platform/stream/cuda_stream.h +++ b/paddle/fluid/platform/stream/cuda_stream.h @@ -16,6 +16,7 @@ limitations under the License. */ #include #include + #include "paddle/fluid/platform/gpu_info.h" #include "paddle/fluid/platform/macros.h" #include "paddle/fluid/platform/place.h" diff --git a/paddle/fluid/platform/timer.h b/paddle/fluid/platform/timer.h index ff0e1d95c2946b6db3ac0c05acba64ff5d3c59ef..09dcc4369beb06f11a429e4b9ffbae454a34f441 100644 --- a/paddle/fluid/platform/timer.h +++ b/paddle/fluid/platform/timer.h @@ -14,6 +14,7 @@ limitations under the License. */ #pragma once #include + #include "paddle/fluid/platform/port.h" #ifdef _WIN32 diff --git a/paddle/fluid/string/piece_test.cc b/paddle/fluid/string/piece_test.cc index 80b712b08ccbcc3fc33e26f8c8c5b0531a71d974..544b5985ed21432488200768a28a3bae69f00a7f 100644 --- a/paddle/fluid/string/piece_test.cc +++ b/paddle/fluid/string/piece_test.cc @@ -14,8 +14,6 @@ #include "paddle/fluid/string/piece.h" -#include - #include "gtest/gtest.h" TEST(StringPiece, Construct) { diff --git a/paddle/fluid/string/pretty_log.h b/paddle/fluid/string/pretty_log.h index da4c1f326fbc2703e639279d79acb52dc748266a..5e2aedb22ad6899d046ffc8d11b0a2df2fca5ae3 100644 --- a/paddle/fluid/string/pretty_log.h +++ b/paddle/fluid/string/pretty_log.h @@ -18,6 +18,7 @@ #include #include #include + #include "paddle/fluid/string/printf.h" DECLARE_bool(color); diff --git a/paddle/fluid/string/string_helper.cc b/paddle/fluid/string/string_helper.cc index 712db90d2f4ba62abdb0747827d78266503efcc5..8731e8fca8a5c4d8b13cf5fb6b38c5cf710225aa 100644 --- a/paddle/fluid/string/string_helper.cc +++ b/paddle/fluid/string/string_helper.cc @@ -13,12 +13,12 @@ // limitations under the License. #include "paddle/fluid/string/string_helper.h" + #include #include #include #include -#include -#include "boost/lexical_cast.hpp" + #include "glog/logging.h" namespace paddle { diff --git a/paddle/fluid/string/string_helper.h b/paddle/fluid/string/string_helper.h index 8bf379a6b3423fed07d3ab670e0492a9316e8e19..499539226bd318d5ee297eccc81c13c7997bb5b9 100644 --- a/paddle/fluid/string/string_helper.h +++ b/paddle/fluid/string/string_helper.h @@ -20,6 +20,7 @@ #include #include #include + #include "boost/lexical_cast.hpp" #include "glog/logging.h" diff --git a/paddle/testing/paddle_gtest_main.cc b/paddle/testing/paddle_gtest_main.cc index c19bd56fbbf4de343abea198674eaf8b545321f5..5400c55a0b150ecc0f534ed1bbb83aba236ec24b 100644 --- a/paddle/testing/paddle_gtest_main.cc +++ b/paddle/testing/paddle_gtest_main.cc @@ -12,12 +12,9 @@ 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 "gflags/gflags.h" #include "gtest/gtest.h" #include "paddle/fluid/memory/allocation/allocator_strategy.h" -#include "paddle/fluid/memory/memory.h" #include "paddle/fluid/platform/init.h" int main(int argc, char** argv) {