From df43905f1295f76f08d98aab5b6cc6875b4597f0 Mon Sep 17 00:00:00 2001 From: wanghuancoder Date: Thu, 24 Sep 2020 13:27:13 +0800 Subject: [PATCH] use iwyu clean include (#27267) * use iwyu clean include, test=develop, test=win * compilation error, test=develop * fix compilation error2, test=develop * fix compilation error3, test=develop * fix compilation error4, test=develop * fix compilation error5, test=develop * fix compilation error6, test=develop * fix compilation error7, test=develop * fix compilation error8, test=develop * fix compilation error8, test=develop * fix compilation error10, test=develop * fix compilation error11, test=develop --- paddle/fluid/framework/attribute.cc | 2 -- paddle/fluid/framework/block_desc.h | 2 ++ paddle/fluid/framework/c/c_api.cc | 10 ------- paddle/fluid/framework/c/c_api.h | 9 ++++++ paddle/fluid/framework/channel.h | 2 +- .../fluid/framework/copy_same_tensor_test.cc | 2 +- .../fluid/framework/data_device_transform.h | 2 ++ paddle/fluid/framework/data_feed.h | 10 +++++++ paddle/fluid/framework/data_feed_factory.cc | 4 +-- paddle/fluid/framework/data_feed_factory.h | 3 ++ .../fluid/framework/data_layout_transform.cc | 2 +- .../fluid/framework/data_layout_transform.h | 8 ++++++ .../framework/data_layout_transform_test.cc | 1 - paddle/fluid/framework/data_transform.cc | 7 ++++- paddle/fluid/framework/data_transform.h | 4 +++ paddle/fluid/framework/data_type.cc | 1 - paddle/fluid/framework/data_type.h | 11 ++++++-- paddle/fluid/framework/data_type_test.cc | 8 ++++++ paddle/fluid/framework/data_type_transform.h | 4 +++ paddle/fluid/framework/dataset_factory.cc | 3 -- paddle/fluid/framework/dataset_factory.h | 1 + paddle/fluid/framework/ddim.h | 1 + paddle/fluid/framework/ddim_test.cc | 1 - .../framework/details/all_reduce_op_handle.h | 11 ++++++++ .../framework/details/broadcast_op_handle.h | 14 ++++++++++ .../details/broadcast_op_handle_test.h | 4 ++- .../fluid/framework/details/build_strategy.h | 12 ++++++++ .../details/computation_op_handle.cc | 2 ++ .../framework/details/computation_op_handle.h | 12 ++++++++ .../details/eager_deletion_op_handle.h | 11 ++++++++ .../details/exception_holder_test.cc | 3 +- .../details/fetch_async_op_handle.cc | 7 ++++- .../framework/details/fetch_async_op_handle.h | 12 ++++++++ .../details/fetch_barrier_op_handle.cc | 2 ++ .../details/fetch_barrier_op_handle.h | 11 ++++++++ .../fluid/framework/details/fetch_op_handle.h | 11 ++++++++ .../details/fused_all_reduce_op_handle.h | 12 ++++++++ .../details/fused_broadcast_op_handle.h | 11 ++++++++ .../details/fused_broadcast_op_handle_test.cc | 9 ++++++ .../framework/details/gather_op_handle.h | 8 ++++++ .../details/gather_op_handle_test.cc | 4 +-- .../framework/details/multi_devices_helper.h | 11 ++++++-- .../framework/details/nan_inf_utils_detail.h | 6 ++++ .../fluid/framework/details/op_handle_base.h | 12 ++++++++ .../framework/details/reduce_op_handle.h | 15 ++++++++++ .../fluid/framework/details/rpc_op_handle.h | 10 +++++++ .../details/scale_loss_grad_op_handle.cc | 8 ++++++ .../details/scale_loss_grad_op_handle.h | 12 ++++++++ .../details/scope_buffered_monitor.h | 2 ++ .../details/share_tensor_buffer_functor.cc | 11 ++++++++ .../details/share_tensor_buffer_functor.h | 9 ++++++ .../details/share_tensor_buffer_op_handle.cc | 10 +++++++ .../details/share_tensor_buffer_op_handle.h | 12 ++++++++ .../details/sparse_all_reduce_op_handle.h | 11 ++++++++ paddle/fluid/framework/details/var_handle.h | 8 ++++++ .../framework/details/variable_visitor.cc | 8 ++++++ .../framework/details/variable_visitor.h | 7 +++++ paddle/fluid/framework/device_worker.cc | 4 ++- paddle/fluid/framework/device_worker.h | 12 ++++++++ .../fluid/framework/device_worker_factory.cc | 2 ++ .../fluid/framework/device_worker_factory.h | 3 ++ paddle/fluid/framework/device_worker_test.cc | 3 +- paddle/fluid/framework/dlpack_tensor.cc | 11 ++++++-- paddle/fluid/framework/dlpack_tensor.h | 3 ++ paddle/fluid/framework/dlpack_tensor_test.cc | 6 ++++ paddle/fluid/framework/downpour_worker.cc | 10 +++++-- paddle/fluid/framework/downpour_worker_opt.cc | 10 +++---- paddle/fluid/framework/eigen.h | 2 ++ paddle/fluid/framework/executor.h | 6 ++++ paddle/fluid/framework/executor_gc_helper.cc | 13 +++++---- paddle/fluid/framework/executor_gc_helper.h | 5 ++++ paddle/fluid/framework/feed_fetch_method.cc | 9 +++--- paddle/fluid/framework/feed_fetch_method.h | 4 +++ paddle/fluid/framework/fleet/fleet_wrapper.cc | 6 ---- paddle/fluid/framework/fleet/fleet_wrapper.h | 6 ++++ paddle/fluid/framework/fleet/gloo_wrapper.cc | 3 -- paddle/fluid/framework/fleet/heter_wrapper.cc | 16 +++-------- paddle/fluid/framework/fleet/nccl_wrapper.cc | 3 -- paddle/fluid/framework/fleet/nccl_wrapper.h | 7 +++++ paddle/fluid/framework/garbage_collector.h | 7 +++++ paddle/fluid/framework/generator.h | 1 - paddle/fluid/framework/hetercpu_worker.cc | 7 ----- paddle/fluid/framework/heterxpu_trainer.cc | 12 +------- paddle/fluid/framework/inlined_vector.h | 1 + paddle/fluid/framework/inlined_vector_test.cc | 4 +-- .../fluid/framework/io/crypto/cipher_utils.cc | 2 -- .../fluid/framework/io/crypto/cipher_utils.h | 1 + paddle/fluid/framework/io/fs.h | 1 + paddle/fluid/framework/io/shell.h | 1 + .../framework/ir/attention_lstm_fuse_pass.h | 2 ++ .../ir/conv_affine_channel_fuse_pass.cc | 13 +++++++-- .../ir/conv_affine_channel_fuse_pass.h | 3 ++ .../fluid/framework/ir/conv_bn_fuse_pass.cc | 11 ++++++-- paddle/fluid/framework/ir/conv_bn_fuse_pass.h | 3 ++ .../ir/conv_elementwise_add2_act_fuse_pass.h | 2 ++ .../ir/conv_elementwise_add_act_fuse_pass.cc | 1 + .../ir/conv_elementwise_add_act_fuse_pass.h | 2 ++ .../ir/conv_elementwise_add_fuse_pass.cc | 1 + .../ir/conv_elementwise_add_fuse_pass.h | 2 ++ .../fluid/framework/ir/cudnn_placement_pass.h | 1 + .../ir/delete_quant_dequant_op_pass.cc | 4 +-- .../ir/delete_quant_dequant_op_pass.h | 3 ++ .../embedding_eltwise_layernorm_fuse_pass.cc | 2 +- .../embedding_eltwise_layernorm_fuse_pass.h | 9 ++++++ .../ir/embedding_fc_lstm_fuse_pass.h | 2 ++ .../ir/fc_elementwise_layernorm_fuse_pass.cc | 2 ++ .../ir/fc_elementwise_layernorm_fuse_pass.h | 2 ++ paddle/fluid/framework/ir/fc_fuse_pass.cc | 4 +-- paddle/fluid/framework/ir/fc_fuse_pass.h | 2 ++ paddle/fluid/framework/ir/fc_gru_fuse_pass.cc | 3 ++ paddle/fluid/framework/ir/fc_gru_fuse_pass.h | 3 ++ .../fluid/framework/ir/fc_lstm_fuse_pass.cc | 3 ++ paddle/fluid/framework/ir/fc_lstm_fuse_pass.h | 2 ++ paddle/fluid/framework/ir/fuse_bn_act_pass.cc | 11 ++++++-- paddle/fluid/framework/ir/fuse_bn_act_pass.h | 4 +++ .../framework/ir/fuse_elewise_add_act_pass.h | 4 +++ .../fuse_adam_op_pass.cc | 13 +++++---- .../fuse_momentum_op_pass.cc | 11 +++++--- .../fuse_optimizer_op_pass.h | 11 ++++++++ .../fuse_sgd_op_pass.cc | 12 +++++--- paddle/fluid/framework/ir/fuse_pass_base.cc | 8 ++++++ paddle/fluid/framework/ir/fuse_pass_base.h | 10 +++++++ .../ir/fuse_relu_depthwise_conv_pass.h | 3 ++ .../ir/fusion_group/code_generator.h | 3 ++ .../ir/fusion_group/code_generator_tester.cc | 12 +++++--- .../fusion_group/elementwise_group_detector.h | 9 ++++++ .../ir/fusion_group/fusion_group_pass.h | 6 ++++ .../framework/ir/fusion_group/operation.h | 1 + paddle/fluid/framework/ir/graph.h | 7 +++++ paddle/fluid/framework/ir/graph_helper.h | 2 ++ .../fluid/framework/ir/graph_helper_test.cc | 1 - .../framework/ir/graph_pattern_detector.h | 10 +++++++ .../ir/graph_pattern_detector_tester.cc | 6 ++-- .../framework/ir/graph_to_program_pass.h | 2 ++ .../ir/graph_to_program_pass_test.cc | 3 +- paddle/fluid/framework/ir/graph_traits.cc | 5 ++-- paddle/fluid/framework/ir/graph_traits.h | 3 ++ paddle/fluid/framework/ir/graph_viz_pass.h | 2 ++ .../ir/identity_scale_op_clean_pass.cc | 2 ++ .../ir/identity_scale_op_clean_pass.h | 2 ++ paddle/fluid/framework/ir/is_test_pass.cc | 2 ++ paddle/fluid/framework/ir/is_test_pass.h | 2 ++ .../framework/ir/lock_free_optimize_pass.h | 1 + ...uffer_shared_cross_op_memory_reuse_pass.cc | 15 +++++----- .../buffer_shared_inplace_op_pass.cc | 5 +++- .../memory_optimize_pass/memory_reuse_pass.cc | 13 ++++++--- .../memory_optimize_pass/memory_reuse_pass.h | 13 +++++++++ .../ir/memory_optimize_pass/op_graph_view.cc | 10 +++++-- .../ir/memory_optimize_pass/op_graph_view.h | 9 ++++++ .../reference_count_pass_helper.cc | 2 -- .../reference_count_pass_helper.h | 3 ++ .../conv_activation_mkldnn_fuse_pass.cc | 9 +++++- .../mkldnn/conv_activation_mkldnn_fuse_pass.h | 3 ++ .../ir/mkldnn/conv_bias_mkldnn_fuse_pass.cc | 1 - .../ir/mkldnn/conv_bias_mkldnn_fuse_pass.h | 4 +++ .../conv_concat_relu_mkldnn_fuse_pass.cc | 2 ++ .../conv_concat_relu_mkldnn_fuse_pass.h | 3 ++ .../conv_elementwise_add_mkldnn_fuse_pass.h | 7 +++++ .../framework/ir/mkldnn/cpu_quantize_pass.cc | 5 ++-- .../framework/ir/mkldnn/cpu_quantize_pass.h | 4 +++ .../ir/mkldnn/cpu_quantize_placement_pass.cc | 3 +- .../ir/mkldnn/cpu_quantize_placement_pass.h | 3 ++ .../ir/mkldnn/cpu_quantize_squash_pass.cc | 5 +++- .../ir/mkldnn/cpu_quantize_squash_pass.h | 3 ++ .../ir/mkldnn/depthwise_conv_mkldnn_pass.cc | 3 ++ .../ir/mkldnn/depthwise_conv_mkldnn_pass.h | 2 ++ .../framework/ir/mkldnn/fc_mkldnn_pass.cc | 15 ++++++---- .../framework/ir/mkldnn/fc_mkldnn_pass.h | 3 ++ .../matmul_transpose_reshape_fuse_pass.h | 5 +++- .../ir/mkldnn/mkldnn_placement_pass.h | 1 + ...eshape_transpose_matmul_mkldnn_fuse_pass.h | 3 ++ .../ir/mkldnn/scale_matmul_fuse_pass.cc | 4 +++ .../ir/mkldnn/scale_matmul_fuse_pass.h | 2 ++ .../framework/ir/multi_batch_merge_pass.h | 2 ++ .../multi_devices_graph_pass.h | 15 ++++++++++ .../sequential_execution_pass.cc | 11 ++++---- .../set_reader_device_info_utils.h | 8 ++++++ .../ir/multihead_matmul_fuse_pass.cc | 4 +-- .../framework/ir/multihead_matmul_fuse_pass.h | 9 ++++++ paddle/fluid/framework/ir/node.cc | 1 - paddle/fluid/framework/ir/node.h | 8 ++++++ paddle/fluid/framework/ir/pass.cc | 12 +++++--- paddle/fluid/framework/ir/pass.h | 2 ++ paddle/fluid/framework/ir/pass_builder.cc | 2 ++ paddle/fluid/framework/ir/pass_builder.h | 3 ++ paddle/fluid/framework/ir/pass_test.cc | 8 ++++-- .../fluid/framework/ir/placement_pass_base.h | 3 ++ .../ir/repeated_fc_relu_fuse_pass.cc | 3 +- .../framework/ir/repeated_fc_relu_fuse_pass.h | 3 ++ .../framework/ir/runtime_context_cache_pass.h | 3 ++ .../framework/ir/seq_concat_fc_fuse_pass.cc | 3 -- .../framework/ir/seq_concat_fc_fuse_pass.h | 2 ++ .../ir/seqconv_eltadd_relu_fuse_pass.cc | 3 ++ .../ir/seqconv_eltadd_relu_fuse_pass.h | 3 ++ .../framework/ir/seqpool_concat_fuse_pass.cc | 9 +++++- .../framework/ir/seqpool_concat_fuse_pass.h | 3 ++ .../ir/seqpool_cvm_concat_fuse_pass.cc | 5 ++-- .../ir/seqpool_cvm_concat_fuse_pass.h | 3 ++ .../ir/shuffle_channel_detect_pass.cc | 3 -- .../ir/shuffle_channel_detect_pass.h | 1 + .../ir/simplify_with_basic_ops_pass.cc | 3 +- .../ir/simplify_with_basic_ops_pass.h | 4 +++ .../framework/ir/skip_layernorm_fuse_pass.cc | 3 +- .../framework/ir/skip_layernorm_fuse_pass.h | 2 ++ .../framework/ir/squared_mat_sub_fuse_pass.h | 3 ++ .../fluid/framework/ir/subgraph_detector.cc | 7 ++--- paddle/fluid/framework/ir/subgraph_detector.h | 4 +++ .../framework/ir/sync_batch_norm_pass.cc | 5 ++-- .../ir/transpose_flatten_concat_fuse_pass.cc | 1 - paddle/fluid/framework/lod_rank_table.h | 1 + paddle/fluid/framework/lod_tensor.cc | 15 ++++------ paddle/fluid/framework/lod_tensor.h | 10 +++++++ paddle/fluid/framework/lod_tensor_test.cc | 3 -- paddle/fluid/framework/mixed_vector.h | 4 +-- paddle/fluid/framework/mixed_vector_test.cc | 4 +-- paddle/fluid/framework/naive_executor.h | 6 ++++ .../framework/no_need_buffer_vars_inference.h | 1 + paddle/fluid/framework/op_call_stack.h | 7 +++++ paddle/fluid/framework/op_compatible_info.h | 5 ++++ .../framework/op_compatible_info_test.cc | 7 +++-- paddle/fluid/framework/op_desc.h | 2 ++ paddle/fluid/framework/op_info.cc | 2 -- paddle/fluid/framework/op_info.h | 5 ++++ paddle/fluid/framework/op_kernel_type.h | 1 + paddle/fluid/framework/op_kernel_type_test.cc | 2 +- paddle/fluid/framework/op_proto_maker_test.cc | 6 ++++ paddle/fluid/framework/op_registry.cc | 2 -- paddle/fluid/framework/op_registry.h | 6 ++++ .../framework/op_version_registry_test.cc | 1 - paddle/fluid/framework/operator.h | 11 +++++++- paddle/fluid/framework/program_desc.h | 1 + paddle/fluid/framework/program_desc_test.cc | 4 ++- paddle/fluid/framework/prune.h | 1 + paddle/fluid/framework/prune_test.cc | 4 --- paddle/fluid/framework/pull_dense_worker.cc | 6 +++- paddle/fluid/framework/rw_lock_test.cc | 1 - paddle/fluid/framework/save_load_util.h | 2 ++ paddle/fluid/framework/save_load_util_test.cc | 3 -- paddle/fluid/framework/scope.h | 6 ++++ paddle/fluid/framework/scope_pool.cc | 4 +-- paddle/fluid/framework/scope_pool.h | 3 ++ paddle/fluid/framework/scope_test.cc | 8 +++++- paddle/fluid/framework/selected_rows.cc | 6 ++++ paddle/fluid/framework/selected_rows.h | 9 ++++++ paddle/fluid/framework/shape_inference.cc | 5 ---- paddle/fluid/framework/tensor.cc | 9 +++++- paddle/fluid/framework/tensor.h | 9 ++++++ paddle/fluid/framework/tensor_test.cc | 8 +++++- paddle/fluid/framework/tensor_util.cc | 2 +- paddle/fluid/framework/tensor_util.h | 3 ++ paddle/fluid/framework/tensor_util_test.cc | 2 +- paddle/fluid/framework/threadpool.cc | 2 -- paddle/fluid/framework/threadpool.h | 1 + paddle/fluid/framework/trainer.h | 12 +++++++- paddle/fluid/framework/trainer_factory.cc | 4 +-- paddle/fluid/framework/trainer_factory.h | 3 ++ paddle/fluid/framework/transfer_scope_cache.h | 4 +++ paddle/fluid/framework/tuple.h | 1 + paddle/fluid/framework/tuple_test.cc | 5 +--- paddle/fluid/framework/unroll_array_ops.h | 1 + .../fluid/framework/unroll_array_ops_test.cc | 3 +- paddle/fluid/framework/unused_var_check.cc | 4 +-- paddle/fluid/framework/unused_var_check.h | 1 - paddle/fluid/framework/var_desc.cc | 2 -- paddle/fluid/framework/var_desc.h | 1 + paddle/fluid/framework/var_type_inference.h | 3 +- .../framework/var_type_inference_test.cc | 4 +++ paddle/fluid/framework/var_type_traits.h | 7 +++-- paddle/fluid/framework/variable_helper.h | 2 ++ paddle/fluid/framework/variable_test.cc | 6 +--- paddle/fluid/framework/version.cc | 2 +- paddle/fluid/imperative/all_reduce.h | 8 ++++++ paddle/fluid/imperative/amp_auto_cast.cc | 7 ++--- paddle/fluid/imperative/amp_auto_cast.h | 2 ++ paddle/fluid/imperative/data_loader.cc | 4 --- paddle/fluid/imperative/jit/op_desc_meta.cc | 1 - paddle/fluid/imperative/jit/op_desc_meta.h | 1 + .../imperative/jit/program_desc_tracer.cc | 7 ++++- .../imperative/jit/program_desc_tracer.h | 7 +++++ paddle/fluid/imperative/layer.h | 9 ++++++ paddle/fluid/imperative/prepared_operator.h | 11 ++++++++ paddle/fluid/imperative/profiler.cc | 3 +- .../imperative/tests/nccl_context_test.cc | 2 +- .../analysis/ir_passes/subgraph_util.cc | 9 +++++- .../analysis/ir_passes/subgraph_util.h | 6 ++++ .../ir_passes/tensorrt_subgraph_pass.h | 10 +++++++ .../passes/adjust_cudnn_workspace_size_pass.h | 2 ++ .../passes/inference_op_replace_pass.h | 2 ++ .../analysis/passes/ir_graph_clean_pass.h | 3 ++ .../passes/ir_graph_to_program_pass.h | 3 ++ .../analysis/passes/memory_optimize_pass.cc | 21 +++++++------- .../analysis/passes/memory_optimize_pass.h | 9 ++++++ paddle/fluid/inference/api/analysis_config.cc | 4 +-- paddle/fluid/inference/api/api_impl.h | 8 ++++++ .../api/details/reset_tensor_array.cc | 6 ++++ .../api/details/reset_tensor_array.h | 8 ++++++ paddle/fluid/inference/api/helper.h | 1 + .../inference/api/mkldnn_quantizer_config.cc | 2 ++ .../fluid/inference/api/paddle_pass_builder.h | 1 + .../tensorrt/convert/activation_op.cc | 21 +++++++++++++- .../tensorrt/convert/batch_norm_op.cc | 13 ++++++++- .../inference/tensorrt/convert/concat_op.cc | 9 ++++++ .../inference/tensorrt/convert/conv2d_op.cc | 9 ++++++ .../inference/tensorrt/convert/dropout_op.cc | 9 ++++++ .../tensorrt/convert/emb_eltwise_layernorm.cc | 9 ++++++ .../fluid/inference/tensorrt/convert/fc_op.cc | 9 ++++++ .../inference/tensorrt/convert/gelu_op.cc | 12 ++++++++ .../tensorrt/convert/hard_sigmoid_op.cc | 9 ++++++ .../tensorrt/convert/hard_swish_op.cc | 12 ++++++++ .../tensorrt/convert/instance_norm_op.cc | 12 ++++++++ .../tensorrt/convert/leaky_relu_op.cc | 12 ++++++++ .../inference/tensorrt/convert/mul_op.cc | 9 ++++++ .../inference/tensorrt/convert/pad_op.cc | 9 ++++++ .../inference/tensorrt/convert/pool2d_op.cc | 9 ++++++ .../inference/tensorrt/convert/scale_op.cc | 9 ++++++ .../tensorrt/convert/shuffle_channel_op.cc | 9 ++++++ .../inference/tensorrt/convert/softmax_op.cc | 9 ++++++ .../inference/tensorrt/convert/swish_op.cc | 12 ++++++++ paddle/fluid/inference/tensorrt/engine.cc | 7 +++-- paddle/fluid/inference/tensorrt/engine.h | 12 ++++++++ paddle/fluid/inference/tensorrt/op_teller.cc | 6 ++++ paddle/fluid/inference/tensorrt/op_teller.h | 7 +++++ .../tensorrt/plugin/trt_plugin_factory.h | 1 + .../fluid/inference/tensorrt/test_engine.cc | 3 -- .../inference/tensorrt/trt_int8_calibrator.h | 1 + paddle/fluid/inference/utils/benchmark.cc | 2 +- paddle/fluid/inference/utils/io_utils.h | 5 ++++ .../memory/allocation/aligned_allocator.h | 1 + paddle/fluid/memory/allocation/allocator.h | 1 + .../allocator_facade_abs_flags_test.cc | 4 +-- .../allocator_facade_frac_flags_test.cc | 4 +-- .../memory/allocation/allocator_strategy.cc | 2 +- .../auto_growth_best_fit_allocator.h | 1 + .../auto_growth_best_fit_allocator_test.cc | 2 ++ .../memory/allocation/best_fit_allocator.cc | 6 +--- .../memory/allocation/best_fit_allocator.h | 7 +++++ .../memory/allocation/buffered_allocator.cc | 3 -- .../memory/allocation/buffered_allocator.h | 1 + .../fluid/memory/allocation/cpu_allocator.cc | 2 -- .../memory/allocation/locked_allocator.h | 1 + .../fluid/memory/allocation/mmap_allocator.cc | 5 ---- .../memory/allocation/mmap_allocator_test.cc | 2 -- .../allocation/naive_best_fit_allocator.h | 2 ++ .../memory/allocation/pinned_allocator.cc | 3 -- .../allocation/thread_local_allocator.h | 1 + paddle/fluid/memory/detail/buddy_allocator.cc | 2 -- .../memory/detail/buddy_allocator_test.cc | 3 -- .../memory/detail/system_allocator_test.cc | 1 - paddle/fluid/memory/malloc.h | 2 ++ .../fluid/operators/activation_cudnn_op.cu.cc | 9 ++++-- .../fluid/operators/array_to_lod_tensor_op.cc | 15 +++++++--- paddle/fluid/operators/assert_op.cc | 16 ++++++++++- paddle/fluid/operators/assign_op.cc | 16 ++++++++++- paddle/fluid/operators/assign_op.h | 7 +++++ paddle/fluid/operators/assign_op_test.cc | 2 -- paddle/fluid/operators/assign_value_op.cc | 17 ++++++++++- paddle/fluid/operators/assign_value_op.h | 1 + .../fluid/operators/beam_search_decode_op.cc | 14 +++++++++- .../collective/c_allreduce_max_op.cc | 15 ++++++++++ .../collective/c_allreduce_max_op.cu.cc | 7 +++++ .../collective/c_allreduce_min_op.cc | 15 ++++++++++ .../collective/c_allreduce_min_op.cu.cc | 7 +++++ .../collective/c_allreduce_prod_op.cc | 15 ++++++++++ .../collective/c_allreduce_prod_op.cu.cc | 7 +++++ .../collective/c_allreduce_sum_op.cc | 13 +++++++++ .../collective/c_allreduce_sum_op.cu.cc | 7 +++++ .../operators/collective/c_comm_init_op.cc | 14 ++++------ .../operators/collective/c_gen_nccl_id_op.cc | 24 ++++++++-------- .../operators/collective/c_reduce_max_op.cc | 15 ++++++++++ .../collective/c_reduce_max_op.cu.cc | 7 +++++ .../operators/collective/c_reduce_min_op.cc | 15 ++++++++++ .../collective/c_reduce_min_op.cu.cc | 7 +++++ .../operators/collective/c_reduce_prod_op.cc | 15 ++++++++++ .../collective/c_reduce_prod_op.cu.cc | 7 +++++ .../operators/collective/c_reduce_sum_op.cc | 15 ++++++++++ .../collective/c_reduce_sum_op.cu.cc | 7 +++++ .../collective/c_sync_calc_stream_op.cc | 14 ++++------ .../collective/c_sync_comm_stream_op.cc | 13 ++++----- .../operators/common_infer_shape_functions.cc | 7 ++++- .../operators/common_infer_shape_functions.h | 6 ++++ .../controlflow/conditional_block_infer_op.cc | 12 ++++++++ .../controlflow/conditional_block_op.h | 1 + .../conditional_block_op_helper.cc | 9 +++++- .../controlflow/conditional_block_op_helper.h | 7 +++++ .../controlflow/conditional_block_op_test.cc | 6 +--- paddle/fluid/operators/controlflow/feed_op.cc | 13 ++++++++- .../operators/controlflow/get_places_op.cc | 14 +++++++++- .../fluid/operators/controlflow/op_variant.h | 7 +++++ .../controlflow/recurrent_op_helper.cc | 11 ++++---- .../controlflow/recurrent_op_helper.h | 6 ++++ .../controlflow/tensor_array_read_write_op.cc | 11 +++++++- .../fluid/operators/controlflow/while_op.cc | 11 ++++++-- .../operators/controlflow/while_op_helper.h | 8 ++++++ paddle/fluid/operators/cudnn_lstm_op.cu.cc | 9 ++++-- paddle/fluid/operators/delete_var_op.cc | 13 +++++++++ .../fluid/operators/dequantize_abs_max_op.cc | 17 ++++++++++- .../fluid/operators/dequantize_abs_max_op.h | 8 ++++++ paddle/fluid/operators/dequantize_log_op.cc | 18 ++++++++++-- paddle/fluid/operators/dequantize_log_op.h | 7 +++++ .../async_sparse_param_update_recorder.h | 3 +- ...async_sparse_param_update_recorder_test.cc | 2 -- .../distributed/collective_client.cc | 6 ++-- .../operators/distributed/collective_client.h | 13 ++++++++- .../distributed/collective_server.cc | 8 +----- .../operators/distributed/collective_server.h | 8 +++++- .../distributed/collective_server_test.cc | 16 ++++------- .../operators/distributed/communicator.h | 3 +- .../distributed/communicator_test.cc | 4 --- .../grpc/grpc_bytebuffer_stream.cc | 4 +++ .../distributed/grpc/grpc_bytebuffer_stream.h | 4 +++ .../operators/distributed/grpc/grpc_client.h | 13 ++++++++- .../operators/distributed/grpc/grpc_serde.cc | 21 +++++++++----- .../operators/distributed/grpc/grpc_serde.h | 14 +++++++++- .../operators/distributed/grpc/grpc_server.cc | 14 ++++++++++ .../operators/distributed/grpc/grpc_server.h | 4 +++ .../grpc/grpc_variable_response.cc | 19 +++++++++++-- .../distributed/grpc/grpc_variable_response.h | 19 ++++++++++--- .../distributed/heart_beat_monitor.cc | 2 +- .../distributed/heart_beat_monitor.h | 7 ++--- .../distributed/heart_beat_monitor_test.cc | 3 -- .../operators/distributed/large_scale_kv.h | 1 - .../distributed/parameter_prefetch.cc | 22 +++++++-------- .../distributed/parameter_prefetch.h | 7 +++++ .../operators/distributed/parameter_recv.cc | 21 +++++++------- .../operators/distributed/parameter_send.cc | 27 ++++++++++-------- .../distributed/request_handler_impl.h | 8 +++++- .../fluid/operators/distributed/rpc_client.h | 11 +++++++- .../fluid/operators/distributed/rpc_server.cc | 14 ++++++++-- .../fluid/operators/distributed/rpc_server.h | 12 ++++++++ .../operators/distributed/sendrecvop_utils.cc | 19 +++++++------ .../operators/distributed/sendrecvop_utils.h | 16 +++++++++++ .../operators/distributed/varhandle_test.cc | 5 ---- .../operators/distributed/variable_response.h | 24 +++++++++++++--- .../distributed_ops/checkpoint_notify_op.cc | 20 ++++++++----- .../distributed_ops/fetch_barrier_op.cc | 24 +++++++++++----- .../distributed_ops/fl_listen_and_serv_op.h | 16 +++++++++++ .../distributed_ops/gen_nccl_id_op.cc | 16 +++++++---- .../distributed_ops/listen_and_serv_op.h | 16 +++++++++++ .../operators/distributed_ops/prefetch_op.cc | 23 +++++++++++---- .../operators/distributed_ops/recv_op.cc | 26 +++++++++++------ .../distributed_ops/ref_by_trainer_id_op.cc | 13 +++++++++ .../distributed_ops/ref_by_trainer_id_op.h | 1 + .../distributed_ops/send_barrier_op.cc | 23 ++++++++++----- .../operators/distributed_ops/send_op.cc | 28 +++++++++++-------- .../elementwise/elementwise_add_op.cc | 13 +++++++++ .../elementwise/elementwise_add_op.h | 1 + .../elementwise/elementwise_floordiv_op.cc | 17 +++++++++++ .../elementwise/elementwise_max_op.cc | 16 ++++++++++- .../elementwise/elementwise_min_op.cc | 16 ++++++++++- .../elementwise/elementwise_min_op.h | 1 + .../elementwise/elementwise_mod_op.cc | 17 +++++++++++ .../elementwise/elementwise_pow_op.cc | 16 ++++++++++- .../elementwise/elementwise_pow_op.h | 1 + .../elementwise/elementwise_sub_op.cc | 16 ++++++++++- .../mkldnn/elementwise_add_mkldnn_op.cc | 10 +++++++ .../test_elementwise_add_grad_grad.cc | 12 +------- .../test_elementwise_add_op_inplace.cc | 5 +--- paddle/fluid/operators/enqueue_op.cc | 15 ++++++++-- paddle/fluid/operators/eye_op.h | 2 +- .../fusion_transpose_flatten_concat_op.cu.cc | 7 ++++- paddle/fluid/operators/gather_test.cc | 3 -- .../operators/grid_sampler_cudnn_op.cu.cc | 6 ++++ paddle/fluid/operators/gru_op.cu.cc | 7 +++++ paddle/fluid/operators/hash_op.cc | 16 +++++++++++ paddle/fluid/operators/hash_op.h | 1 + paddle/fluid/operators/increment_op.cc | 16 ++++++++++- paddle/fluid/operators/isfinite_op.cc | 18 +++++++++++- paddle/fluid/operators/isfinite_op.h | 7 +++++ paddle/fluid/operators/isfinite_v2_op.cc | 25 +++++++++++++++-- paddle/fluid/operators/isfinite_v2_op.h | 7 +++++ paddle/fluid/operators/jit/gen/act.h | 1 + paddle/fluid/operators/jit/gen/blas.h | 1 + paddle/fluid/operators/jit/gen/embseqpool.cc | 3 +- paddle/fluid/operators/jit/gen/embseqpool.h | 1 + paddle/fluid/operators/jit/gen/gru.cc | 2 ++ paddle/fluid/operators/jit/gen/gru.h | 1 + paddle/fluid/operators/jit/gen/hopv.h | 1 + paddle/fluid/operators/jit/gen/lstm.cc | 2 ++ paddle/fluid/operators/jit/gen/lstm.h | 1 + paddle/fluid/operators/jit/gen/matmul.cc | 3 +- paddle/fluid/operators/jit/gen/matmul.h | 1 + paddle/fluid/operators/jit/gen/seqpool.h | 1 + paddle/fluid/operators/jit/gen/sgd.cc | 3 +- paddle/fluid/operators/jit/gen/sgd.h | 1 + paddle/fluid/operators/jit/gen/vbroadcast.h | 1 + paddle/fluid/operators/jit/gen_base.h | 1 + paddle/fluid/operators/jit/helper.h | 3 ++ paddle/fluid/operators/jit/kernel_pool.cc | 3 -- paddle/fluid/operators/jit/kernel_pool.h | 3 ++ .../jit/more/intrinsic/crf_decoding.h | 1 + .../operators/jit/more/intrinsic/layer_norm.h | 1 + paddle/fluid/operators/jit/more/mix/mix.h | 1 + paddle/fluid/operators/jit/more/mkl/mkl.h | 1 + paddle/fluid/operators/jit/refer/refer.h | 1 + paddle/fluid/operators/label_smooth_op.cc | 16 ++++++++++- paddle/fluid/operators/layer_norm_op.h | 9 ++++++ paddle/fluid/operators/lod_array_length_op.cc | 14 +++++++++- paddle/fluid/operators/lod_rank_table_op.cc | 15 +++++++++- .../fluid/operators/lod_tensor_to_array_op.cc | 15 ++++++---- paddle/fluid/operators/math/beam_search.cc | 12 ++++++-- .../fluid/operators/math/beam_search_test.cc | 2 +- paddle/fluid/operators/math/blas.cc | 2 +- paddle/fluid/operators/math/blas.h | 7 +++++ paddle/fluid/operators/math/blas_impl.h | 6 ++-- .../fluid/operators/math/concat_and_split.cc | 12 +++++++- paddle/fluid/operators/math/concat_test.cc | 2 +- .../fluid/operators/math/context_project.cc | 6 ++++ paddle/fluid/operators/math/context_project.h | 2 ++ .../fluid/operators/math/cos_sim_functor.cc | 6 ++++ paddle/fluid/operators/math/cos_sim_functor.h | 2 ++ paddle/fluid/operators/math/cpu_vec.h | 1 + paddle/fluid/operators/math/cpu_vec_test.cc | 4 +-- paddle/fluid/operators/math/cross_entropy.cc | 6 ++++ paddle/fluid/operators/math/gru_compute.cc | 7 +++++ paddle/fluid/operators/math/im2col.cc | 8 +++++- paddle/fluid/operators/math/lstm_compute.cc | 7 +++++ .../fluid/operators/math/matrix_bit_code.cc | 2 -- .../fluid/operators/math/matrix_inverse.cu.cc | 11 ++++++-- paddle/fluid/operators/math/pooling.cc | 3 -- paddle/fluid/operators/math/sample_prob.cc | 6 ++++ paddle/fluid/operators/math/sample_prob.h | 7 +++++ .../math/selected_rows_functor_test.cu.cc | 1 - paddle/fluid/operators/math/sequence2batch.cc | 6 ++++ .../fluid/operators/math/sequence_padding.cc | 10 +++++++ .../operators/math/sequence_padding_test.cc | 2 +- paddle/fluid/operators/math/sequence_scale.cc | 6 ++++ paddle/fluid/operators/math/sequence_scale.h | 7 +++++ paddle/fluid/operators/math/vol2col.cc | 7 ++++- paddle/fluid/operators/math/vol2col_test.cc | 3 +- paddle/fluid/operators/matmul_v2_op.h | 6 ++-- paddle/fluid/operators/max_sequence_len_op.cc | 14 +++++++++- paddle/fluid/operators/merge_lod_tensor_op.cc | 13 ++++++++- .../operators/mkldnn/activation_mkldnn_op.cc | 9 ++++++ .../operators/mkldnn/batch_norm_mkldnn_op.cc | 10 ++++++- .../fluid/operators/mkldnn/conv_mkldnn_op.cc | 8 ++++-- paddle/fluid/operators/mkldnn/fc_mkldnn_op.cc | 15 +++++++--- .../fluid/operators/mkldnn/lrn_mkldnn_op.cc | 11 ++++++-- .../operators/mkldnn/matmul_mkldnn_op.cc | 8 +++++- .../fluid/operators/mkldnn/mul_mkldnn_op.cc | 14 +++++++--- .../fluid/operators/mkldnn/pool_mkldnn_op.cc | 1 - .../operators/mkldnn/softmax_mkldnn_op.cc | 12 ++++++-- .../fluid/operators/mkldnn/sum_mkldnn_op.cc | 14 +++++++--- .../fluid/operators/nccl/nccl_gpu_common.cc | 1 - .../fluid/operators/op_debug_string_test.cc | 2 +- paddle/fluid/operators/print_op.cc | 16 ++++++++--- paddle/fluid/operators/rank_loss_op.cc | 16 ++++++++++- .../fluid/operators/reader/buffered_reader.h | 1 + paddle/fluid/operators/reader/py_reader.cc | 1 - paddle/fluid/operators/reader/py_reader.h | 3 ++ .../reader/reader_blocking_queue_test.cc | 5 +--- .../operators/reader/reader_op_registry.cc | 8 ++++-- .../operators/reader/reader_op_registry.h | 8 ++++++ paddle/fluid/operators/recurrent_op.cc | 10 +++++-- paddle/fluid/operators/recurrent_op.h | 6 ++++ .../operators/reduce_ops/frobenius_norm_op.cc | 15 +++++++++- .../operators/reduce_ops/reduce_all_op.cc | 15 ++++++++++ .../operators/reduce_ops/reduce_any_op.cc | 15 ++++++++++ .../operators/reduce_ops/reduce_prod_op.cc | 13 +++++++++ .../operators/reduce_ops/reduce_sum_op.cc | 15 +++++++++- .../reorder_lod_tensor_by_rank_op.cc | 13 ++++++++- paddle/fluid/operators/reshape_op.cc | 17 ++++++++++- .../fluid/operators/rnn_memory_helper_op.cc | 11 ++++++++ paddle/fluid/operators/scale_op.cc | 14 +++++++++- paddle/fluid/operators/scatter_test.cc | 5 ++-- .../sequence_ops/sequence_concat_op.cu.cc | 7 +++++ paddle/fluid/operators/softmax_cudnn_op.cu.cc | 8 +++++- paddle/fluid/operators/split_lod_tensor_op.cc | 13 ++++++++- paddle/fluid/operators/strided_memcpy.h | 2 ++ paddle/fluid/operators/strided_memcpy_test.cc | 2 +- paddle/fluid/operators/tensor_formatter.cc | 3 +- paddle/fluid/operators/tensor_formatter.h | 6 ++++ .../operators/tensorrt/tensorrt_engine_op.cc | 3 -- .../operators/tensorrt/tensorrt_engine_op.h | 12 ++++++++ .../test_leaky_relu_grad_grad_functor.h | 1 + paddle/fluid/platform/bfloat16.h | 6 ++++ paddle/fluid/platform/bfloat16_test.cc | 2 -- paddle/fluid/platform/collective_helper.cc | 4 --- paddle/fluid/platform/cpu_info.cc | 1 - paddle/fluid/platform/cuda_resource_pool.h | 1 + paddle/fluid/platform/cudnn_desc.h | 7 +++++ paddle/fluid/platform/cudnn_helper.h | 6 ++++ paddle/fluid/platform/device_code.cc | 2 ++ paddle/fluid/platform/device_code.h | 1 + paddle/fluid/platform/device_context.h | 9 +++++- .../fluid/platform/device_memory_aligment.h | 1 + paddle/fluid/platform/device_tracer.h | 2 ++ paddle/fluid/platform/dynload/cublas.h | 1 + paddle/fluid/platform/dynload/cuda_driver.h | 1 + paddle/fluid/platform/dynload/cudnn.h | 4 +-- paddle/fluid/platform/dynload/cupti.cc | 1 - paddle/fluid/platform/dynload/curand.h | 3 +- paddle/fluid/platform/dynload/cusolver.h | 3 +- .../fluid/platform/dynload/dynamic_loader.cc | 3 -- paddle/fluid/platform/dynload/mklml.h | 1 + paddle/fluid/platform/dynload/nccl.h | 2 +- paddle/fluid/platform/dynload/nvrtc.h | 1 + paddle/fluid/platform/dynload/warpctc.h | 1 + paddle/fluid/platform/enforce.h | 6 ++++ paddle/fluid/platform/errors_test.cc | 1 - paddle/fluid/platform/float16_test.cc | 4 +-- paddle/fluid/platform/lodtensor_printer.cc | 10 +++++-- paddle/fluid/platform/lodtensor_printer.h | 7 +++++ .../fluid/platform/lodtensor_printer_test.cc | 2 +- paddle/fluid/platform/monitor.cc | 1 - paddle/fluid/platform/monitor.h | 1 + paddle/fluid/platform/place_test.cc | 2 +- paddle/fluid/platform/profiler.cc | 13 --------- paddle/fluid/platform/profiler.h | 1 + paddle/fluid/platform/profiler_test.cc | 5 ++-- paddle/fluid/platform/stream/cuda_stream.h | 1 + paddle/fluid/platform/timer.h | 1 + paddle/fluid/string/piece_test.cc | 2 -- paddle/fluid/string/pretty_log.h | 1 + paddle/fluid/string/string_helper.cc | 4 +-- paddle/fluid/string/string_helper.h | 1 + paddle/testing/paddle_gtest_main.cc | 3 -- 616 files changed, 3308 insertions(+), 766 deletions(-) diff --git a/paddle/fluid/framework/attribute.cc b/paddle/fluid/framework/attribute.cc index 9ca3fe31a33..7460686c1a3 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 5c6e4215162..8c8fcadb05b 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 0dd2768ccb9..48181dac662 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 04dbfbebe5d..a9ec402f381 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 64a645bf8b2..503f1513aad 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 9350c387a6e..5b89166e2f4 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 8ff97646cfc..60b52a5e706 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 b48d152fe35..da156bfc5c7 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 1d8aec76240..048d539f9b9 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 13678edb0b8..49381a98706 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 f757e244e38..108cd9ac6d1 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 b92c47c2eb0..238f2d2e679 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 8dfad23db65..20443e9a3dc 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 f54311eebfa..3a40de6988f 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 ef2271d530d..2bbdac52ee4 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 8188d5cde1b..e4be866dca1 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 720e422e114..4477a9cac09 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 331596da33a..5599edcd222 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 1c281b03ed6..b42b2f594aa 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 3a28c101d48..cdb513f70ad 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 d4a36cec22f..425c488daa8 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 29c4732f991..e69fb4e7619 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 b7b42fa019f..e89f77ae496 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 36f5d3adfad..e0064ec2642 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 588248d6454..1412e2cd9db 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 6d14c7e4e7b..e455879a68f 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 01d496d4ea7..87b27eaa440 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 0b653e57f6d..2256b826ed5 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 41c51b95800..3c219ee27d3 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 a048799a280..8edce6782de 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 c20563a0860..3db358667eb 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 6aae523365e..09aedafc6bb 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 691a3286c27..ff9271942da 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 127183a32e9..fc836ade786 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 d1f7e08b28e..7ce790f38e8 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 31ffd1211d2..41deeb0af27 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 16c13ac1c03..9bed792a42f 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 8a59d2bfa9a..8fd3ec56d18 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 cbded074f20..761a5b5a30a 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 ac87b246b50..9cbd94cd6b8 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 5d8562e7046..f3fcc1a436d 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 21e781877a4..c3a18433cf8 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 15d00932f1c..b4459e5a7c1 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 097f54d5d58..eb3d9c32ffc 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 8b92bdef475..e76a48d207d 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 d86d33dd676..909f565f2c0 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 6e2f2327abd..287667d5ee9 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 d4f28dbe2b2..02e5aa88443 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 1246c35af6a..3a94534eff4 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 5fbaf3cbfe0..bf93d8f85b1 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 be49d1c432b..0db69d07bf6 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 be3f5515a97..3d53bb62855 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 a02c346485e..d14cbc31d82 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 b24b457d21d..8bfea0f1ae8 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 bb38424d3ae..a35ac0bd732 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 fba0c1bf463..71e5dd28ede 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 ca9a19bdcf1..a882d5120bc 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 aeec6161714..fbaae5a21c2 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 efe6fa1b2da..ee2ef9a0c3d 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 67be8db6e80..3b60cb65e34 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 9d0613385e7..6a31c3ea7a4 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 b488e4cfe7a..461d329a371 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 915589b3242..ac1e39ad2c1 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 5346ba62894..e342523718b 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 4dead063b47..4a1f151f69b 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 1c64bf1d3f7..00f721701a4 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 b40a00ef9cb..afe6ddfa3d9 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 0e3edfb95cb..a6abda8a83b 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 fa6a65d5892..7593b60abff 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 706248229bc..c80eedb1b86 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 a4c71c5304e..e44edc5aa1c 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 fd857f7735c..3bd85b2b24b 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 65c8b255ffb..a52ef517c8b 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 34fff042770..3c076805932 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 cc13a50160a..be87bdf1e75 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 f195dde4084..f4b2d2d7d18 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 b70d5e5fc1a..7a27b6a9d7a 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 33a91388fd8..ed92e2e9aad 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 a55921f1ac2..3725a225dbe 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 4f773965282..884d230816b 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 a279c2e4e14..862e63c4c6a 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 83838f4df67..747fd434ae7 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 5ca1aa66319..fbed74800b4 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 2a7f26b9f96..f8e937fa107 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 003c0d7bbea..581e7d8934d 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 e0c653e0016..ee9f06b2f3e 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 936f62f6ba6..52db03f530c 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 c88636e2674..bb6d720ca58 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 dc486275d6f..7db5cd7661c 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 47ed9f0393f..48e3989a531 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 fd8b55a6b7d..9c984a23e37 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 d607020a47b..916384ec447 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 fb787e08814..a915015bf55 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 57a9f69ca15..342cd8dad5f 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 ea9e465d8d7..e68f57d4ae9 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 c5fa47ec55f..93e6e13ff70 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 8b34c3551d8..933092c7db7 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 38c0b773dde..e4396f227f7 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 66a562cdd19..7198a7488e0 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 99dd3a175d3..8d84c2bf707 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 4dfbd5e00c1..886b080c662 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 938ada6453e..fea0498fdec 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 3f88a460d14..51861b402d5 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 644eb1cf892..25049d7468b 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 65cb4439727..a9cde13758b 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 5c18a0d6c7f..bedb9689641 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 ac4d0b39ee2..12e4c44b84e 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 d60510a4074..0248aeedd0a 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 ef6636d109a..f564bbb1518 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 f5fea90ac2f..c4515bbc455 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 e11cdac7ea9..73f00504d34 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 a3c57e14e1a..2b451da7bfa 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 5dea7c91a86..d37f53b15f0 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 54c05046a2c..db3c711201d 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 427ff03a803..7e5f046ecaa 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 dc73f1fda03..d9356b7bd72 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 c284c1f4587..0094b674c2a 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 43ec8bff5ed..f87d31cbc40 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 0b5bf8a3a4b..5b7e1b7d384 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 70d4d2b8652..720d252c9a6 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 e6fb1302e27..f3db4f02b1c 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 3a1022bbcbd..ce7635bb35c 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 d37c153dd2a..0b1dfaa6928 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 21773f239b9..15d21cf6829 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 ebc89b14c26..2a7a0748cf0 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 0861c2f7e96..96b38f65013 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 3438783c180..5ca785846a5 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 74abbdaad0b..d99fe737504 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 137ab7a56d7..593ac214e56 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 074ad320fb1..0c43febca70 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 d8973d5aeda..0a2dcfed000 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 053c1fe832b..7116b8a2a6f 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 6c466fb21fb..5ac5a5d9839 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 52c8f4e0fca..6b17c0076f6 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 5ee6b8a5f1e..80d7839d700 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 4b403c46260..3fa84554d99 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 bb4212bcd33..a54cc61a63f 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 7091aa6a95b..118c1bc6f3c 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 c8dfa02f469..08d09fce5de 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 d66b411257e..7e3d4e19fa8 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 bf6fe999c1e..9c1640efcd8 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 80cedbf9f85..abf48480d71 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 f38f48fcd92..26ec61fd36e 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 b1afa47910f..b12b84d4a49 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 ce7f27d2755..0cdde5c757a 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 3e3b9864a7b..72e29dfe156 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 1c0c6ae6020..4a77d116f1e 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 11c2508afb5..7de62d6e482 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 5fb2caedba8..d6f286afc55 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 ed87f73adf1..e85be0272de 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 0e8f4e78d22..d00e4f53022 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 45ff275d530..a5beec87c39 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 ac15fc04512..be6b1e07c02 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 f7a8e3e3f6c..63524294b68 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 833fbc748eb..9a83310ebfb 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 af64cb22054..5fadd9607e9 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 91ff0760f04..f1faa84f3d5 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 b95aec34d30..2ba4c80678f 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 aa0979b4be6..0254b5e7573 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 21219e7dca8..bd87b31b781 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 bc268a83478..2146d833ddf 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 f3229e59d6f..474fa63f60e 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 bc24c10d9d0..54ab244a99b 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 98a518e4e53..d1465f9da5c 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 df5ba3314e6..b2c0afdc754 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 ca314afde57..0f4ecc71ad7 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 95afc548376..6efa9f6b749 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 97c6b242989..df02250394a 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 77e30b35346..ef469bac40c 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 de699430189..ca56a8900ca 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 eab9f095623..7a53b3c4984 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 6c87e437caa..790821e3fa4 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 fe97b9681ce..32ff78d9a73 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 a89616683d9..ae2e68c6003 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 bb6c8079074..bb3586ba804 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 bcbd1e066cc..78e90f82bfb 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 0038790cae2..d37b21f0584 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 9d2b4ebaf8c..d1fbc8396ba 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 0afa00fc62a..f5327dc7108 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 45d81b93739..7143c9a7a3e 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 87e7e64acb7..d0db3bd36e1 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 a5ca13f1ce2..0e5f5867f47 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 0f5ef551f04..668dc74eab2 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 6457bd230c5..4e99271a2ec 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 733d3a3ad1a..0e68767db3f 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 0c5286b3f77..65b9c427869 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 5cdd7963e54..ef1a920db3f 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 9f6032ffa5b..af4a2f40605 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 ae777bccebe..0be217cc748 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 e4783166e0c..741adcce8d7 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 19ec2d818a3..7daa9b5eff7 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 d68840a5547..a7041153645 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 75ab04f1b91..d9a1348e05a 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 fde9b586c85..6f623625f51 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 1c220ee4d57..b6badf745c6 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 40a9edc5e64..482fd5cb580 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 8261bfc1534..d639d410466 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 88a41983c6b..b0a3573fb59 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 8bdf3940928..92e995579fa 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 008f8013efd..dc375988cdd 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 2e5c18d3352..5cc6b6171ac 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 f5185622468..6a245c444a7 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 2e3cd16d5ce..e5f348dfeb1 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 2de8d376221..3a3e5005239 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 56b7ec9b843..90def957df4 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 7979953d7be..6ebe900e26b 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 3d279e27e6a..6bd73c758b3 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 222c73761b4..3fa008c300c 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 405cefa99eb..2db6d0230e3 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 8c6e8b0c66e..9a7c1285e30 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 40615d772e5..a044812dd31 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 da97efb6168..e09a628f491 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 c93c3f2673b..e3223e67fc9 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 280996d34dd..3a6e80f718d 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 0599c8d3846..a40a3ff33fe 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 81402a650a3..75677ef5243 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 5d30f34090e..21ba0381fe6 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 d48cf27285a..f633538e700 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 08b5734b5bf..01fbdef99cb 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 43959c8b2ab..98f3f5071ad 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 e15f0012fdc..95c33bca6c7 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 c815e194d43..820a83586b3 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 89b49997579..af657232e91 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 9edc1a3e150..f4e60bb9b78 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 40db85400d2..2979750fba7 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 a8030d377fd..56f940e3997 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 81cfaf92e39..72dd6fa6bbd 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 6408fadf90a..77383386fa1 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 239dbc43578..d6b18751cef 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 bd52d7ffef5..d493f350e69 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 d5e9c755f12..5cafc9111da 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 48bde2785e6..0ba1099b032 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 63e8aaad735..57f282536bf 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 12fa0c61f81..618eaba3c5b 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 9f4c817db7d..c399c5d02eb 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 16f9cbb6522..601b10787be 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 6b50c93ddbd..0b96e002e30 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 4a54e2d4668..10a34d7ce91 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 db7010ecceb..922e9a9b272 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 4bb077a2c52..cf0b3ebcddd 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 a8b468699ab..19faa9aa6a4 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 26817fc558d..a61e68279a2 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 1f402ea9dd3..4c30c40ad58 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 285af1d5530..48353b43f56 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 f5bb3f68007..02e4ce914b8 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 0b22bab2678..9f5d8d30c9c 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 f2ccff2c133..faecba6295d 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 cc972dd93d0..92a29d5165c 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 0e3d11b9f02..a073dbd733f 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 a0408dbc3db..1e811a41e90 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 ef9964b3ae7..e389cb34679 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 4682bfc264b..3db8f3e36b7 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 09528b6fc35..7fecf07475b 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 077fe751720..d041ef48e2c 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 31ac11e78cf..15584620d86 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 9c772a4f19e..3ef61c03817 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 9a5d4526321..7ff6020ff2a 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 508ee931c6e..35b8220d453 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 cfdd4dc56e4..9060bd3fc89 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 ab176410805..a9c047cc6c6 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 be811478eec..c4fdfdb425f 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 e7e964b4181..ac455b9ffd7 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 2f44a3bcde0..d78b4d928f3 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 2ee0b17b64b..457c0c77b3c 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 6e8be0fdd42..b37a09a17a9 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 9312ac075de..f649c9388f0 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 dc86d58f600..5483ef01c08 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 4875956096a..07387f87411 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 01a5d09e072..6e65bc2c932 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 511c9c52146..98a8ff9cf3e 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 7ba00f52e67..92042e47259 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 81880d0fb89..249fb4e11f1 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 c980b014b82..d4a1519b07e 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 d1da97e5a39..7ab876c1ce8 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 3b8239e566d..a2fccf7901f 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 f5c00985900..d256dafb891 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 506afee6a99..c59b2c885d2 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 be93a787d46..9f4cf713f7c 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 d07acec2230..8e2e59a49ed 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 03e83301d44..d4df052a40d 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 bf02eebdbb6..3bf032e642b 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 34570b3a60e..85063a68216 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 8ce257a6c37..93ea988d638 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 ebb19fd486c..ee109310483 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 1257562972e..621c631b853 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 b6b67ce8ece..bb0248008e0 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 65d1c545313..66d5667a37c 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 7fbdd88e014..bbdf8b1009a 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 a9d58aa2f4c..a4d60e91e84 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 838ebdbc9d7..613eb04497e 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 f432188131e..defa0a525f6 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 77da5d40d8d..6d20aee295b 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 2184574aa1f..4abe293c930 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 96b94777304..be771ac48fc 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 03c2aa3fb80..ee5c10b7bf6 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 213c6891d0e..be5fe1d64f9 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 014985661fd..061b83e1d1e 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 76cf1661f30..30c6c21ec87 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 90732535204..b10c290b226 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 1a428e205cb..57aeee99ba2 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 f67370b3382..2f4f9320607 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 5d63aa2ace8..5ecf1923388 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 aa03bc44bd6..f582d7e0705 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 0541d891705..d11dbc16e87 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 9fff558c583..b846b3033f6 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 0dccd3cc639..cd16ed73965 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 7927b6cd1bb..aad822b3354 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 3b6e464a117..f2c1bafb4ae 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 39820068ca8..967f79a1643 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 8a0b50f4744..d746c51c5c5 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 29826909c3c..e348de9877f 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 5b6aaad4983..c99528b207b 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 dd594404d33..7ddedf969fd 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 864e440920e..c031630f36d 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 f9a1fe41ddc..18c97890d72 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 326915dfff5..7090e298ddc 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 9f4a048961f..0388154427e 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 e220d80f0d7..ab82a6578fb 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 754979f77ac..1f7ea7ea044 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 a85ed483c1d..71625210054 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 31128ba8c5d..23aacedd693 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 76784c7445e..9113525a5c9 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 ed825801fc4..076dfbcf8f0 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 72962c733ec..7c763858bb2 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 5815bc9a146..b4b7ee50dc3 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 074a397e323..8c76a03d298 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 853aba168b5..de2c7b26d33 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 71250766034..6fef5cae8d6 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 379c8d00960..e54748a5367 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 3e10be037bd..00299911162 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 3748805b1ce..1e793d1617a 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 e1c7b243bec..518b31e9430 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 27257883d55..cbc126264ac 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 8865bf0b0db..685248a88f7 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 957dac4d03e..2b8d2164f68 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 64a552e4fd2..a6015417b12 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 7eed81a712a..d463ad1f5eb 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 fd0996f7748..5e1733bd839 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 b096fbc112c..407f0f25935 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 4af77e6e057..1b8418bc849 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 0ef084bafd0..77e8d9943d0 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 5b66920be2a..bcb02e04792 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 913d583099c..4cf1bd6123e 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 3ea2ecf3538..42dd50af729 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 bc07ad0c4dc..10ca4b828a4 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 faa87f1f01a..6ac99744d79 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 780126f57c5..1722acd10aa 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 34bb40d549d..ea4897494f7 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 9ba572acaca..73487795f75 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 33d8fb828f8..1903b9e30d8 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 ea1a93b5826..89475e3a2ec 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 da0e5fda636..3e4250389fc 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 f8c1216e972..e5bceae1c95 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 c2154f78bbe..ed4ba24a74b 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 58f360ad605..f0ec04a1f20 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 a35e5a80a9e..1589f9e8911 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 1418d96b67b..6c2e5b9ad68 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 c177dad8028..3cb3f1d48bf 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 bcb529f1570..835b49e57bc 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 34054103aa0..ec8d6518195 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 9d27a9ceb30..efc19659c83 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 4e8b6f9d0a9..7935a1f722e 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 3cfb1723f18..5ab07ef026b 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 61f76c178d0..1a78427cd19 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 c9ed8b67647..68061e6ae6b 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 8fe7fce21e4..06e90cdff80 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 a3bf1f4dfb1..ccad96320a7 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 e2b09be5a9d..2822129b198 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 42535187768..41a07f94399 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 7e260346b4b..e03da37360f 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 8e849641e63..77bb96347f9 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 77a75ed0b7a..83f7fce1ec6 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 64935df856e..f6c1c5d50e8 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 07e431f7bc8..83db107b36f 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 3e20cee7e18..e59ec85fefd 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 d9826422c16..39c8716a92a 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 64b60165722..00f366e6212 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 5405ea70ef6..d8617492fb1 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 22b212fc1b9..ce622d7501f 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 2cb9eab2865..922d5262abc 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 aa31b887562..62019be26cd 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 659e098c6dd..c8ab2c91e91 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 155a5dbfec3..00b86121c0d 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 f7dfba6f364..abaaa897606 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 a5ca4a289de..068d853f1cc 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 088413ce223..9597dd25ec5 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 4ab9f9fc863..e8829e1e1fa 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 9af993f1006..28c27437de1 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 f2973add84e..c96b7c6a08c 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 aacca0762ca..3d9404e57aa 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 9f7702a5d6b..c4451c3b583 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 e4a1397f5c4..b85e740ada9 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 4f9d93c91f6..d2e9953e647 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 6457d9295dc..6ac75b78d70 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 ec60569be20..aa5649e4e9c 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 0d4d68d9f62..c8bca25b6b0 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 796ca93b000..0d9d20fc120 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 2ecd54f7edd..c12dd9e6d21 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 f6590ecf61f..67ce9cc84d3 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 eadd842c7f6..cef6590ae21 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 17d8973303b..2d78559625c 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 6d3f5343111..fcd3e6abead 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 6a3a450a1fd..e7d8bb8df98 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 c95652400c2..cdd37742d2d 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 03c688a78e1..1015007ba0c 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 be8c7a7dd40..92b2eb4b51e 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 4a9a9eb1701..07fd4ed4960 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 b9a6afa4cc3..38b7c8b0031 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 c2cb0d7f04e..7d6756b4136 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 e9074574cdd..486870de7a5 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 6b6249540c6..22ca74a67e7 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 eddd89cf20c..0372846ce0d 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 30e6907656e..932f3e2f069 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 5c0232a50a9..47e114ff4b2 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 ee6950205b3..3d68b7e8ceb 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 e46d2fbe01c..7d7723f1945 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 3ca1d89f750..4d12b4a4bac 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 6736ea4336b..84ba9793c4e 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 211e40757fc..cfef492de0e 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 699c03f6f28..7c2c0fbff11 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 9e39e68cba7..b4388c0002a 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 a9378d61c3c..6b33c1f5fcd 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 8605bcdcd86..6fd3a998813 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 3b8479c91b0..a91df5b3c47 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 545b1f5e803..99af06bc7cc 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 42621724e68..6d239673f91 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 69a5e327431..6a6a795a46b 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 691c2c1048f..52b4456f7b1 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 8c7b7f1d7ee..f83144f6268 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 b52fb93e5bf..2e9d958ebfb 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 5457101a5c9..8a382baa5be 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 a0fcaf88647..7c52ef74b4c 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 d979cd8a881..be67a2396f7 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 2ed2acb96dc..abc8d912840 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 c9f9daf3b3c..755cbf017d9 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 1199a63d16a..25ad16e3fce 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 e63f8824783..db8c2f3f2d8 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 b41e4e87722..bacfd32cc73 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 6037ab1523e..007dbbbfbf5 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 2547ba3acb1..9729d0dadd7 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 befdf4e9388..4727b3bb249 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 43dd9c3c98a..d8639627c3e 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 a8e9379d214..5aa2ba26aa4 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 53e3d70f960..a4192c18afa 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 97624944ca1..68a98e7c6bc 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 152f20273a1..c4efc4ab72d 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 5a398fa50fe..ddd69203fd3 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 692bc015c5b..be6a6330547 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 1b2364a5a53..bd40763e05a 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 1a49a601398..5a3e7f90f3c 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 8c2e62bed19..d8ad0a353c9 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 1321eee8457..ea0e8e7c013 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 a910c326196..535d838209d 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 9603b022d5d..90f4ebb99ec 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 caaaf2c931d..3dcf5bf6a32 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 be8b8d6c2f7..15c31a4cece 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 6ec8f2c2355..cf9e9dbb04b 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 9b367a72fb5..a7920488f2e 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 0eefe7d2163..d5ad27596d6 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 17cb4556d45..37a442a7815 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 f6b156eb30d..ea1fa813928 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 93f9e108723..f0903bdfce9 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 ba918b3def2..bdc5debaea7 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 b6017a6eafc..47b480c11c2 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 c2d53000491..b5b3f3de70c 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 b4f33dad927..e8edfb99f9f 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 9b92ce3e538..1ac1c26796c 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 2fc0d58669b..a54134910d0 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 72da43e3bc6..fcbb4c5bf6a 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 9f0aa63ce80..332c50d7551 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 585196e939c..cd360caa39b 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 ff4a13a3679..d3d9eddd2ee 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 331a4b0d075..b4e63d87eac 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 67a39350952..8353e5846f7 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 b5b0cffa806..fbdf49d5d58 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 e047a65cb4b..588d11820b2 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 575dec68a58..113c66a2558 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 2c3bc985e9a..211dfc5ecad 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 6f232906569..c980670d482 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 3a455334f58..047d0d3e1ca 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 881cea581ac..4f04f7606d2 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 a0f1bb8299a..cb562c4c9a6 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 40f8298af39..1452d4139b0 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 80b1809bbbf..403d97b8fec 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 27c75f6f710..7d30fe5751b 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 033c603c07c..27b85763415 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 39e5ee2be15..b6dd49b7772 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 f1719be9873..7b6b13c3d98 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 48435cf6ef2..763be7d3cf5 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 49b1a1fea4b..6e0c972e27a 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 7b9f676050d..6a44bb25612 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 035425317ed..240cbbcda4f 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 b38cc107b8e..ee31c8df2f8 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 136b99e0aef..b8d5e2c2407 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 ac0405b9a6e..231ff941278 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 6968c1a5b13..931cd6d1794 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 49e8cbbbaab..70da0149cad 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 7cbfbd03e1d..a9128b15bdb 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 b130e84933b..db07a104a89 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 550de1aadde..5271da91b8c 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 7ea8eb8b00d..97ce3d3f878 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 2a7ce83967f..3bc1b4f4048 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 42a60e9220c..562e2de3bd3 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 515d6a2435e..c53c453897f 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 b6bd58d118e..3b0c3c1686a 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 270a9d3f80a..094e2059c4d 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 537d0b47868..927d610e2ce 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 051c6019d74..08bb555c593 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 cbe16999124..f7770050bee 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 d74662e68e7..9a24bfc3312 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 925f3b6161a..eb7c622e596 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 6490d81cec7..07fe9c30f39 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 7a1ed47d182..23840143a44 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 07c5cbf3337..4b8a6274cce 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 6fb393d791c..8efd35ca108 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 94bbcbb5067..7e74f688019 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 d6f51c6e5c6..7c50ba630db 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 614f89a048c..950aed0aa49 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 1e86c2e7a32..40cea7483f3 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 99aa318453e..16342493e45 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 e5a6d84cb2b..7b08df660a0 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 81ad620466e..5cb1cc5dc03 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 300a3692012..852700fa7ff 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 076df017642..e29313e9f74 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 eab4553ae8b..8892a17886a 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 ee5b22ca855..78cbdf311ad 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 202243985c1..d84513e024d 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 794fc647172..42bf1f471de 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 aa979c4f109..6ed5a0943eb 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 dc83e4d9648..8cd4fa12be4 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 b47ec8bc70a..4f73de086f2 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 87d914aa797..584de34c5d3 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 487deb11b48..aecf67fc3bb 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 8a02a697cbb..98f368aa7a9 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 19ee8764e27..a6cda154e55 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 40737f4cd02..0bec5619f54 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 00c10cecbf4..9ee653ec589 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 5ca0ed1182e..3ae34fe0e90 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 1dd1ad11786..4f0b7cab47e 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 9df30b3295c..bf12c61a4d9 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 5014381a4e2..0b159f9dcfa 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 1e0e13abb7c..414312fe97e 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 70d80e26e5c..169af47e95a 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 67d71fe82ad..7c1cf9109c5 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 3fb18365e52..80faf833be5 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 9b7a923fb4b..ec9d1fde453 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 42c087b9e47..041d36a9343 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 2100aeb7cf4..ad79f6bbc4c 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 d827cdd0b87..3492d578048 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 dc0940ac0b7..86c9f38ad3f 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 952ed466288..bccaae70229 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 35a0dacaec2..fec496446ac 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 c1adaf2037a..35f52ffa522 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 1ca66527e1b..e3f512d45c0 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 57df2664824..2d7cce68e81 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 30265b3cc71..10095bc9550 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 cbc18f18b8e..f288fce7538 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 88935107df1..f27cd6b125b 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 cb1a2962d9b..d8d4e641aeb 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 01a33a46521..e03824ca8c3 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 eea2d2ac57a..95b23a0b8cc 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 9d51f3e292f..55e35e43eb9 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 eb248e59b6c..c83726180ba 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 43fd84a711f..6eda8595b17 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 94e54266f0f..5b857960706 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 aa8c0b13dbb..4adbbacc844 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 142b00b4de6..48d6cf8b361 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 3a450773a9d..83480b44d5b 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 7b8b484a11e..e4fa4a96a5c 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 1731348479d..aee5eec0d1c 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 708fccf9715..d4eb79aa0f2 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 9cfe47da5db..922340b08c6 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 cc2fe4cdbdb..ce94ba1ce9e 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 742329abb2d..4460139219f 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 bdb508ee336..fc964d7df35 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 4cb6ee3143a..54dac976276 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 b86fd70c9ae..e379832593c 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 22b53445d84..570b68b08fc 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 e0ba1aaa6bd..0e0218dcca3 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 4b9c5c429da..e983e368953 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 9d5a0954b00..2474903edf7 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 6128d8b78db..4199317a8ce 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 28d94627f95..e1438a1eefa 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 2c19a2b1062..5cc33fd31f1 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 85168a046fb..9bae7a87052 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 562e7542012..045caab7488 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 056fcc069db..5799b084f5f 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 dd0a2e19685..88b545b48e5 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 a25660c6ed4..d8381580c90 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 48076e5478a..7a160664bc2 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 ba2d38729c1..561f20af45a 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 82e4f6ac75e..0c8a64ccf69 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 2be95b113b2..9369cf131da 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 1d5fa45ecf6..407f34f0ac3 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 9464a23ba1e..720450d28b1 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 bc1977b05de..e10a7233b62 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 ce1ec507307..a3ae9e48eea 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 3c84215b5e5..a73c1ba3d34 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 261ec68483f..ec8a98eeb1a 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 33d0fe62680..0be4233269e 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 e070e3540c9..e0bd1fff197 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 19e85284b8f..5b2af270740 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 e65e09f45c0..76554012bf5 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 2f186420b41..b57fae9daac 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 13f28c73f45..41e084efa57 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 85759bc6e2e..56a6275b582 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 12049d815cf..0185328ff32 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 4d340a06342..2ce898d4617 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 4272d5fd0b1..c65d107cf45 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 ff0e1d95c29..09dcc4369be 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 80b712b08cc..544b5985ed2 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 da4c1f326fb..5e2aedb22ad 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 712db90d2f4..8731e8fca8a 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 8bf379a6b34..499539226bd 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 c19bd56fbbf..5400c55a0b1 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) { -- GitLab