From 403b127b8b5caeda5266bbb46ec3849696f97be9 Mon Sep 17 00:00:00 2001 From: Sing_chan <51314274+betterpig@users.noreply.github.com> Date: Tue, 14 Jun 2022 13:39:02 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90code=20format=20check=20upgrade?= =?UTF-8?q?=E3=80=91=20step3=EF=BC=9Aenable=20clang-format=20sort=20these?= =?UTF-8?q?=20infrt=20files's=20headers=20(#43333)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operators/fused/fused_multi_transformer_op.cu | 14 +++++--------- paddle/infrt/api/infrt_api.cc | 8 ++------ paddle/infrt/dialect/dense_tensor.h | 5 +---- paddle/infrt/dialect/phi/ir/infrt_phi_tensor.h | 5 +---- .../infrt/dialect/phi/pass/kernel_op_desc_test.cc | 6 +++--- paddle/infrt/dialect/tensorrt/trt_exec.cc | 7 +------ paddle/infrt/dialect/tensorrt/trt_ops.cc | 7 +++---- paddle/infrt/kernel/tensorrt/trt_kernels.cc | 10 ++++------ 8 files changed, 20 insertions(+), 42 deletions(-) diff --git a/paddle/fluid/operators/fused/fused_multi_transformer_op.cu b/paddle/fluid/operators/fused/fused_multi_transformer_op.cu index 814827d95b..01c5b79fff 100644 --- a/paddle/fluid/operators/fused/fused_multi_transformer_op.cu +++ b/paddle/fluid/operators/fused/fused_multi_transformer_op.cu @@ -16,29 +16,25 @@ limitations under the License. */ // https://github.com/NVIDIA/FasterTransformer/blob/v4.0/fastertransformer/cuda/masked_multihead_attention.cu // We add License in the head. -// headers sort by clang-format may cause compiling error or test faiure, -// see https://github.com/PaddlePaddle/Paddle/pull/42840/ -// clang-format off #include #include + #include + #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/framework/operator.h" -#include "paddle/fluid/platform/device/gpu/gpu_device_function.h" -#include "paddle/fluid/platform/device/gpu/gpu_dnn.h" - -#include "paddle/phi/kernels/funcs/math_function.h" - #include "paddle/fluid/operators/fused/attention_layer_norm.h" #include "paddle/fluid/operators/fused/attn_gemm.h" #include "paddle/fluid/operators/fused/fmha_ref.h" #include "paddle/fluid/operators/fused/fused_dropout_helper.h" +#include "paddle/fluid/platform/device/gpu/gpu_device_function.h" +#include "paddle/fluid/platform/device/gpu/gpu_dnn.h" +#include "paddle/phi/kernels/funcs/math_function.h" #if defined(PADDLE_WITH_NCCL) || defined(PADDLE_WITH_RCCL) #include "paddle/fluid/platform/collective_helper.h" #include "paddle/fluid/platform/device/gpu/nccl_helper.h" #endif -// clang-format on namespace paddle { namespace operators { diff --git a/paddle/infrt/api/infrt_api.cc b/paddle/infrt/api/infrt_api.cc index 2f4bbd5df3..a58c6cc5b8 100644 --- a/paddle/infrt/api/infrt_api.cc +++ b/paddle/infrt/api/infrt_api.cc @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -// clang-format off #include "paddle/infrt/api/infrt_api.h" #include @@ -31,6 +30,7 @@ #include "paddle/infrt/dialect/dense_tensor.h" #include "paddle/infrt/dialect/infrt/ir/infrt_dialect.h" #include "paddle/infrt/dialect/infrt/pass/infrt_op_fuse_pass.h" +#include "paddle/infrt/dialect/infrt/pass/infrt_weights_unfold_pass.h" #include "paddle/infrt/dialect/mlir_loader.h" #include "paddle/infrt/dialect/phi/ir/phi_base.h" #include "paddle/infrt/dialect/phi/pass/phi_op_convert_pass.h" @@ -51,18 +51,14 @@ #include "paddle/infrt/kernel/test_kernels.h" #include "paddle/infrt/tensor/tensor_map.h" -#include "paddle/infrt/dialect/infrt/pass/infrt_weights_unfold_pass.h" - #if defined(INFRT_WITH_GPU) && defined(INFRT_WITH_TRT) -#include "paddle/infrt/kernel/tensorrt/registry.h" - #include "paddle/infrt/dialect/tensorrt/trt_graph_fuse_pass.h" #include "paddle/infrt/dialect/tensorrt/trt_graph_split_pass.h" #include "paddle/infrt/dialect/tensorrt/trt_op_converter_pass.h" #include "paddle/infrt/dialect/tensorrt/trt_op_teller_pass.h" #include "paddle/infrt/dialect/tensorrt/trt_type_convert_pass.h" +#include "paddle/infrt/kernel/tensorrt/registry.h" #endif -// clang-format on using namespace infrt::host_context; // NOLINT using namespace infrt::tensor; // NOLINT diff --git a/paddle/infrt/dialect/dense_tensor.h b/paddle/infrt/dialect/dense_tensor.h index 8dec818a80..eebcbbbcbc 100644 --- a/paddle/infrt/dialect/dense_tensor.h +++ b/paddle/infrt/dialect/dense_tensor.h @@ -14,17 +14,14 @@ #pragma once -// clang-format off #include #include #include #include -#include "paddle/infrt/dialect/infrt/ir/infrt_dialect.h" - #include "paddle/infrt/dialect/dense_tensor_dialect.hpp.inc" +#include "paddle/infrt/dialect/infrt/ir/infrt_dialect.h" #define GET_OP_CLASSES #include "paddle/infrt/dialect/dense_tensor.hpp.inc" -// clang-format on diff --git a/paddle/infrt/dialect/phi/ir/infrt_phi_tensor.h b/paddle/infrt/dialect/phi/ir/infrt_phi_tensor.h index f7358db5bf..9e09cdde50 100644 --- a/paddle/infrt/dialect/phi/ir/infrt_phi_tensor.h +++ b/paddle/infrt/dialect/phi/ir/infrt_phi_tensor.h @@ -14,7 +14,6 @@ #pragma once -// clang-format off #include #include #include @@ -30,12 +29,10 @@ #include #include +#include "paddle/infrt/dialect/dense_tensor.h" #include "paddle/infrt/dialect/phi/ir/infrt_phi_tensorDialect.h.inc" #include "paddle/infrt/dialect/phi/ir/infrt_phi_tensorTypes.h.inc" - -#include "paddle/infrt/dialect/dense_tensor.h" #include "paddle/infrt/dialect/phi/ir/phi_base.h" // NOLINT #define GET_OP_CLASSES #include "paddle/infrt/dialect/phi/ir/infrt_phi_tensor.h.inc" -// clang-format on diff --git a/paddle/infrt/dialect/phi/pass/kernel_op_desc_test.cc b/paddle/infrt/dialect/phi/pass/kernel_op_desc_test.cc index 24af0ea437..530d0981f1 100644 --- a/paddle/infrt/dialect/phi/pass/kernel_op_desc_test.cc +++ b/paddle/infrt/dialect/phi/pass/kernel_op_desc_test.cc @@ -12,14 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -// clang-format off +#include "paddle/infrt/dialect/phi/pass/kernel_op_desc.h" + #include #include + #include -#include "paddle/infrt/dialect/phi/pass/kernel_op_desc.h" #include "paddle/phi/kernels/declarations.h" -// clang-format on namespace infrt { diff --git a/paddle/infrt/dialect/tensorrt/trt_exec.cc b/paddle/infrt/dialect/tensorrt/trt_exec.cc index 899e71f1c9..d1ce1c1b56 100644 --- a/paddle/infrt/dialect/tensorrt/trt_exec.cc +++ b/paddle/infrt/dialect/tensorrt/trt_exec.cc @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -// clang-format off #include #include @@ -27,18 +26,15 @@ #include "paddle/infrt/dialect/tensorrt/trt_op_converter_pass.h" #include "paddle/infrt/dialect/tensorrt/trt_op_teller_pass.h" #include "paddle/infrt/dialect/tensorrt/trt_type_convert_pass.h" - #include "paddle/infrt/host_context/core_runtime.h" #include "paddle/infrt/host_context/kernel_registry.h" #include "paddle/infrt/host_context/mlir_to_runtime_translate.h" - #include "paddle/infrt/kernel/basic_kernels.h" #include "paddle/infrt/kernel/control_flow_kernels.h" #include "paddle/infrt/kernel/tensor_kernels.h" #include "paddle/infrt/kernel/tensor_shape_kernels.h" -#include "paddle/infrt/kernel/test_kernels.h" - #include "paddle/infrt/kernel/tensorrt/registry.h" +#include "paddle/infrt/kernel/test_kernels.h" #ifdef INFRT_WITH_PHI #include "paddle/infrt/dialect/infrt/pass/infrt_op_fuse_pass.h" @@ -48,7 +44,6 @@ #endif #include -// clang-format on int main(int argc, char** argv) { static llvm::cl::opt input_file( diff --git a/paddle/infrt/dialect/tensorrt/trt_ops.cc b/paddle/infrt/dialect/tensorrt/trt_ops.cc index 161fbbbcc6..8e39fea4cd 100644 --- a/paddle/infrt/dialect/tensorrt/trt_ops.cc +++ b/paddle/infrt/dialect/tensorrt/trt_ops.cc @@ -12,21 +12,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -// clang-format off #include "paddle/infrt/dialect/tensorrt/trt_ops.h" + #include #include #include #include #include #include -#include "paddle/infrt/common/global.h" -#include "paddle/infrt/dialect/tensorrt/trt_dialect_types.h" +#include "paddle/infrt/common/global.h" #include "paddle/infrt/dialect/dense_tensor.h" #include "paddle/infrt/dialect/infrt/ir/infrt_dialect.h" #include "paddle/infrt/dialect/phi/ir/phi_base.h" -// clang-format on +#include "paddle/infrt/dialect/tensorrt/trt_dialect_types.h" namespace infrt { namespace trt { diff --git a/paddle/infrt/kernel/tensorrt/trt_kernels.cc b/paddle/infrt/kernel/tensorrt/trt_kernels.cc index 0ea68f2e83..931fe21b2c 100644 --- a/paddle/infrt/kernel/tensorrt/trt_kernels.cc +++ b/paddle/infrt/kernel/tensorrt/trt_kernels.cc @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// clang-format off #include "paddle/infrt/kernel/tensorrt/trt_kernels.h" + #include #include + #include "NvInfer.h" #include "NvInferRuntime.h" #include "NvInferRuntimeCommon.h" @@ -27,17 +28,14 @@ #include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Operation.h" #include "mlir/IR/Value.h" - -#include "paddle/infrt/kernel/tensorrt/trt_helper.h" -#include "paddle/infrt/kernel/tensorrt/trt_layers.h" - #include "paddle/infrt/backends/tensorrt/trt_engine.h" #include "paddle/infrt/backends/tensorrt/trt_options.h" #include "paddle/infrt/dialect/tensorrt/trt_ops.h" #include "paddle/infrt/host_context/symbol_table.h" +#include "paddle/infrt/kernel/tensorrt/trt_helper.h" +#include "paddle/infrt/kernel/tensorrt/trt_layers.h" #include "paddle/phi/common/place.h" #include "paddle/phi/core/dense_tensor.h" -// clang-format on namespace infrt { namespace kernel { -- GitLab