diff --git a/.clang-format b/.clang-format index a10c270ac0a..4c5d0907047 100644 --- a/.clang-format +++ b/.clang-format @@ -102,6 +102,10 @@ IncludeBlocks: Regroup IncludeCategories: - Regex: '^' Priority: 3 + - Regex: '^' + Priority: 3 + - Regex: '^' + Priority: 3 - Regex: '^<.*\.h>' Priority: 1 - Regex: '^<.*' diff --git a/test/cpp/test_replication.cpp b/test/cpp/test_replication.cpp index b59f4805a15..3d3d44119da 100644 --- a/test/cpp/test_replication.cpp +++ b/test/cpp/test_replication.cpp @@ -1,8 +1,9 @@ -#include #include #include +#include + #include "absl/synchronization/blocking_counter.h" #include "xla/hlo/builder/xla_builder.h" #include "xla/shape_util.h" diff --git a/test/cpp/test_status_common.h b/test/cpp/test_status_common.h index 1c1a09b3c97..4b00d7dc5b6 100644 --- a/test/cpp/test_status_common.h +++ b/test/cpp/test_status_common.h @@ -18,7 +18,6 @@ #ifndef XLA_TEST_CPP_TEST_STATUS_COMMON_H_ #define XLA_TEST_CPP_TEST_STATUS_COMMON_H_ -#include #include #include @@ -27,6 +26,8 @@ #include #include +#include + #include "absl/status/status.h" #include "absl/status/statusor.h" diff --git a/test/cpp/test_tensor.cpp b/test/cpp/test_tensor.cpp index 1328f5fc528..f2a74b26d23 100644 --- a/test/cpp/test_tensor.cpp +++ b/test/cpp/test_tensor.cpp @@ -1,9 +1,9 @@ -#include #include #include #include +#include #include #include "absl/base/nullability.h" diff --git a/test/cpp/test_xla_sharding.cpp b/test/cpp/test_xla_sharding.cpp index f544292301d..57ab2de44e2 100644 --- a/test/cpp/test_xla_sharding.cpp +++ b/test/cpp/test_xla_sharding.cpp @@ -1,10 +1,10 @@ -#include #include #include #include #include +#include #include #include "xla/protobuf_util.h" diff --git a/torch_xla/csrc/aten_fallback.cpp b/torch_xla/csrc/aten_fallback.cpp index 9feb75e22ce..b610f040bb5 100644 --- a/torch_xla/csrc/aten_fallback.cpp +++ b/torch_xla/csrc/aten_fallback.cpp @@ -1,13 +1,12 @@ #include "torch_xla/csrc/aten_fallback.h" +#include +#include + #include #include #include #include - -#include -#include - #include #include "torch_xla/csrc/function_call_tracker.h" diff --git a/torch_xla/csrc/aten_xla_bridge.cpp b/torch_xla/csrc/aten_xla_bridge.cpp index a9a9204342d..9fd9634fd76 100644 --- a/torch_xla/csrc/aten_xla_bridge.cpp +++ b/torch_xla/csrc/aten_xla_bridge.cpp @@ -1,11 +1,10 @@ #include "torch_xla/csrc/aten_xla_bridge.h" -#include - #include #include #include +#include #include #include "absl/log/absl_check.h" diff --git a/torch_xla/csrc/aten_xla_bridge.h b/torch_xla/csrc/aten_xla_bridge.h index 440bdf59d92..f22a68ca49b 100644 --- a/torch_xla/csrc/aten_xla_bridge.h +++ b/torch_xla/csrc/aten_xla_bridge.h @@ -1,12 +1,12 @@ #ifndef XLA_TORCH_XLA_CSRC_ATEN_XLA_BRIDGE_H_ #define XLA_TORCH_XLA_CSRC_ATEN_XLA_BRIDGE_H_ +#include + #include #include #include -#include - #include "absl/base/nullability.h" #include "absl/status/statusor.h" #include "absl/types/span.h" diff --git a/torch_xla/csrc/aten_xla_type.cpp b/torch_xla/csrc/aten_xla_type.cpp index bf7a4003acc..80e30a70072 100644 --- a/torch_xla/csrc/aten_xla_type.cpp +++ b/torch_xla/csrc/aten_xla_type.cpp @@ -1,3 +1,7 @@ +#include +#include +#include + #include #include #include @@ -10,11 +14,6 @@ #include #include #include - -#include -#include -#include - #include #include #include diff --git a/torch_xla/csrc/autocast_mode.cpp b/torch_xla/csrc/autocast_mode.cpp index 0baef83f20a..4db31feb6ba 100644 --- a/torch_xla/csrc/autocast_mode.cpp +++ b/torch_xla/csrc/autocast_mode.cpp @@ -4,7 +4,6 @@ #include #include #include - #include namespace at { diff --git a/torch_xla/csrc/convert_ops.h b/torch_xla/csrc/convert_ops.h index 3ad627d559c..4247de3b16a 100644 --- a/torch_xla/csrc/convert_ops.h +++ b/torch_xla/csrc/convert_ops.h @@ -1,10 +1,10 @@ #ifndef XLA_TORCH_XLA_CSRC_CONVERT_OPS_H_ #define XLA_TORCH_XLA_CSRC_CONVERT_OPS_H_ -#include - #include +#include + #include "xla/hlo/builder/xla_builder.h" #include "xla/types.h" diff --git a/torch_xla/csrc/data_ops.h b/torch_xla/csrc/data_ops.h index c068d578842..8af661415fd 100644 --- a/torch_xla/csrc/data_ops.h +++ b/torch_xla/csrc/data_ops.h @@ -1,10 +1,10 @@ #ifndef XLA_TORCH_XLA_CSRC_DATA_OPS_H_ #define XLA_TORCH_XLA_CSRC_DATA_OPS_H_ -#include - #include +#include + #include "absl/types/optional.h" #include "absl/types/span.h" #include "xla/hlo/builder/xla_builder.h" diff --git a/torch_xla/csrc/dl_convertor.cpp b/torch_xla/csrc/dl_convertor.cpp index 845c15696e8..c978bb848c5 100644 --- a/torch_xla/csrc/dl_convertor.cpp +++ b/torch_xla/csrc/dl_convertor.cpp @@ -1,11 +1,11 @@ #include "torch_xla/csrc/dl_convertor.h" -#include - #include #include #include +#include + #include "absl/log/absl_check.h" #include "absl/status/status.h" #include "absl/types/span.h" diff --git a/torch_xla/csrc/helpers.h b/torch_xla/csrc/helpers.h index 55a03447851..c01820dc27a 100644 --- a/torch_xla/csrc/helpers.h +++ b/torch_xla/csrc/helpers.h @@ -1,13 +1,12 @@ #ifndef XLA_TORCH_XLA_CSRC_HELPERS_H_ #define XLA_TORCH_XLA_CSRC_HELPERS_H_ -#include - #include #include #include #include +#include #include #include diff --git a/torch_xla/csrc/init_python_bindings.cpp b/torch_xla/csrc/init_python_bindings.cpp index ce6012c1073..253c569e3a2 100644 --- a/torch_xla/csrc/init_python_bindings.cpp +++ b/torch_xla/csrc/init_python_bindings.cpp @@ -1,7 +1,4 @@ -#include #include -#include -#include #include #include @@ -17,6 +14,9 @@ #include #include +#include +#include +#include #include #include #include diff --git a/torch_xla/csrc/ir.h b/torch_xla/csrc/ir.h index 17944b3c73d..eea82a8fe2b 100644 --- a/torch_xla/csrc/ir.h +++ b/torch_xla/csrc/ir.h @@ -1,8 +1,6 @@ #ifndef XLA_TORCH_XLA_CSRC_IR_H_ #define XLA_TORCH_XLA_CSRC_IR_H_ -#include - #include #include #include @@ -12,6 +10,7 @@ #include #include +#include #include #include #include diff --git a/torch_xla/csrc/ops/cast.h b/torch_xla/csrc/ops/cast.h index 73490cdf1da..4785cfd03f7 100644 --- a/torch_xla/csrc/ops/cast.h +++ b/torch_xla/csrc/ops/cast.h @@ -1,10 +1,10 @@ #ifndef XLA_TORCH_XLA_CSRC_OPS_CAST_H_ #define XLA_TORCH_XLA_CSRC_OPS_CAST_H_ -#include - #include +#include + #include "torch_xla/csrc/ir.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/cumprod.h b/torch_xla/csrc/ops/cumprod.h index c650505e2f5..b948781c465 100644 --- a/torch_xla/csrc/ops/cumprod.h +++ b/torch_xla/csrc/ops/cumprod.h @@ -1,10 +1,10 @@ #ifndef XLA_TORCH_XLA_CSRC_OPS_CUMPROD_H_ #define XLA_TORCH_XLA_CSRC_OPS_CUMPROD_H_ -#include - #include +#include + #include "torch_xla/csrc/ir.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/cumsum.h b/torch_xla/csrc/ops/cumsum.h index 76832378f61..682d4e6db12 100644 --- a/torch_xla/csrc/ops/cumsum.h +++ b/torch_xla/csrc/ops/cumsum.h @@ -1,10 +1,10 @@ #ifndef XLA_TORCH_XLA_CSRC_OPS_CUMSUM_H_ #define XLA_TORCH_XLA_CSRC_OPS_CUMSUM_H_ -#include - #include +#include + #include "torch_xla/csrc/ir.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/dot_general.cpp b/torch_xla/csrc/ops/dot_general.cpp index 7a54418fda1..345bfc3a08f 100644 --- a/torch_xla/csrc/ops/dot_general.cpp +++ b/torch_xla/csrc/ops/dot_general.cpp @@ -1,7 +1,6 @@ #include "torch_xla/csrc/ops/dot_general.h" #include - #include #include "torch_xla/csrc/dtype.h" diff --git a/torch_xla/csrc/ops/index_ops.cpp b/torch_xla/csrc/ops/index_ops.cpp index ba306c373d7..ccca4ba9715 100644 --- a/torch_xla/csrc/ops/index_ops.cpp +++ b/torch_xla/csrc/ops/index_ops.cpp @@ -3,7 +3,6 @@ #include #include #include - #include #include "xla/permutation_util.h" diff --git a/torch_xla/csrc/ops/log_softmax.h b/torch_xla/csrc/ops/log_softmax.h index 068080721ba..c8abd0363ce 100644 --- a/torch_xla/csrc/ops/log_softmax.h +++ b/torch_xla/csrc/ops/log_softmax.h @@ -1,10 +1,10 @@ #ifndef XLA_TORCH_XLA_CSRC_OPS_LOG_SOFTMAX_H_ #define XLA_TORCH_XLA_CSRC_OPS_LOG_SOFTMAX_H_ -#include - #include +#include + #include "torch_xla/csrc/ir.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/mean.h b/torch_xla/csrc/ops/mean.h index 380ba9eef70..244acdbd951 100644 --- a/torch_xla/csrc/ops/mean.h +++ b/torch_xla/csrc/ops/mean.h @@ -1,11 +1,11 @@ #ifndef XLA_TORCH_XLA_CSRC_OPS_MEAN_H_ #define XLA_TORCH_XLA_CSRC_OPS_MEAN_H_ -#include - #include #include +#include + #include "xla/types.h" #include "torch_xla/csrc/ir.h" diff --git a/torch_xla/csrc/ops/mse_loss.cpp b/torch_xla/csrc/ops/mse_loss.cpp index 196865423a9..c816c32e4f5 100644 --- a/torch_xla/csrc/ops/mse_loss.cpp +++ b/torch_xla/csrc/ops/mse_loss.cpp @@ -1,7 +1,6 @@ #include "torch_xla/csrc/ops/mse_loss.h" #include - #include #include "torch_xla/csrc/lowering_context.h" diff --git a/torch_xla/csrc/ops/prod.h b/torch_xla/csrc/ops/prod.h index a2153aba2b2..0da69b58790 100644 --- a/torch_xla/csrc/ops/prod.h +++ b/torch_xla/csrc/ops/prod.h @@ -1,10 +1,10 @@ #ifndef XLA_TORCH_XLA_CSRC_OPS_PROD_H_ #define XLA_TORCH_XLA_CSRC_OPS_PROD_H_ -#include - #include +#include + #include "absl/types/span.h" #include "torch_xla/csrc/ir.h" diff --git a/torch_xla/csrc/ops/scalar.h b/torch_xla/csrc/ops/scalar.h index deae74a4c6f..183edd27981 100644 --- a/torch_xla/csrc/ops/scalar.h +++ b/torch_xla/csrc/ops/scalar.h @@ -1,11 +1,11 @@ #ifndef XLA_TORCH_XLA_CSRC_OPS_SCALAR_H_ #define XLA_TORCH_XLA_CSRC_OPS_SCALAR_H_ +#include + #include #include -#include - #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/runtime/types.h" diff --git a/torch_xla/csrc/ops/softmax.h b/torch_xla/csrc/ops/softmax.h index 10fea7be9dc..36c9d7b2174 100644 --- a/torch_xla/csrc/ops/softmax.h +++ b/torch_xla/csrc/ops/softmax.h @@ -1,10 +1,10 @@ #ifndef XLA_TORCH_XLA_CSRC_OPS_SOFTMAX_H_ #define XLA_TORCH_XLA_CSRC_OPS_SOFTMAX_H_ -#include - #include +#include + #include "torch_xla/csrc/ir.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/sum.h b/torch_xla/csrc/ops/sum.h index 67ecfdc0542..2eb890592fc 100644 --- a/torch_xla/csrc/ops/sum.h +++ b/torch_xla/csrc/ops/sum.h @@ -1,10 +1,10 @@ #ifndef XLA_TORCH_XLA_CSRC_OPS_SUM_H_ #define XLA_TORCH_XLA_CSRC_OPS_SUM_H_ -#include - #include +#include + #include "absl/types/span.h" #include "torch_xla/csrc/ir.h" diff --git a/torch_xla/csrc/reduction.cpp b/torch_xla/csrc/reduction.cpp index 9e759aef700..71cdb606c6a 100644 --- a/torch_xla/csrc/reduction.cpp +++ b/torch_xla/csrc/reduction.cpp @@ -1,10 +1,9 @@ #include "torch_xla/csrc/reduction.h" -#include - #include #include +#include #include #include diff --git a/torch_xla/csrc/runtime/computation_client.h b/torch_xla/csrc/runtime/computation_client.h index a045a01e548..66466997958 100644 --- a/torch_xla/csrc/runtime/computation_client.h +++ b/torch_xla/csrc/runtime/computation_client.h @@ -1,8 +1,6 @@ #ifndef XLA_CLIENT_COMPUTATION_CLIENT_H_ #define XLA_CLIENT_COMPUTATION_CLIENT_H_ -#include - #include #include #include @@ -10,6 +8,7 @@ #include #include +#include #include #include #include diff --git a/torch_xla/csrc/runtime/tensor_source.h b/torch_xla/csrc/runtime/tensor_source.h index 20c9f674c9e..206215ee798 100644 --- a/torch_xla/csrc/runtime/tensor_source.h +++ b/torch_xla/csrc/runtime/tensor_source.h @@ -1,12 +1,11 @@ #ifndef XLA_CLIENT_TENSOR_SOURCE_H_ #define XLA_CLIENT_TENSOR_SOURCE_H_ -#include - #include #include #include +#include #include #include "xla/literal.h" diff --git a/torch_xla/csrc/runtime/tf_logging.cpp b/torch_xla/csrc/runtime/tf_logging.cpp index a8c2d7644aa..2d2d84d5a68 100644 --- a/torch_xla/csrc/runtime/tf_logging.cpp +++ b/torch_xla/csrc/runtime/tf_logging.cpp @@ -1,9 +1,8 @@ #include "torch_xla/csrc/runtime/tf_logging.h" -#include - #include +#include #include #include "tsl/platform/stacktrace.h" diff --git a/torch_xla/csrc/status.cpp b/torch_xla/csrc/status.cpp index e9145a79aea..2666d2c8bbd 100644 --- a/torch_xla/csrc/status.cpp +++ b/torch_xla/csrc/status.cpp @@ -1,11 +1,10 @@ #include "torch_xla/csrc/status.h" -#include - #include #include #include +#include #include #include "absl/log/absl_check.h" diff --git a/torch_xla/csrc/tensor.h b/torch_xla/csrc/tensor.h index 66a8e14e913..e26bb266cf8 100644 --- a/torch_xla/csrc/tensor.h +++ b/torch_xla/csrc/tensor.h @@ -1,11 +1,10 @@ #ifndef XLA_TORCH_XLA_CSRC_TENSOR_H_ #define XLA_TORCH_XLA_CSRC_TENSOR_H_ -#include - #include #include +#include #include #include #include diff --git a/torch_xla/csrc/tensor_impl.cpp b/torch_xla/csrc/tensor_impl.cpp index 2c79eff110f..5293d5de6d0 100644 --- a/torch_xla/csrc/tensor_impl.cpp +++ b/torch_xla/csrc/tensor_impl.cpp @@ -4,7 +4,6 @@ #include #include #include - #include #include #include diff --git a/torch_xla/csrc/tensor_methods.cpp b/torch_xla/csrc/tensor_methods.cpp index 65d4e1b4ac8..7b448591955 100644 --- a/torch_xla/csrc/tensor_methods.cpp +++ b/torch_xla/csrc/tensor_methods.cpp @@ -1,12 +1,11 @@ #include "torch_xla/csrc/tensor_methods.h" -#include -#include - #include #include #include +#include +#include #include #include #include diff --git a/torch_xla/csrc/tensor_util.cpp b/torch_xla/csrc/tensor_util.cpp index cef072f4c53..078e8a593c5 100644 --- a/torch_xla/csrc/tensor_util.cpp +++ b/torch_xla/csrc/tensor_util.cpp @@ -1,8 +1,5 @@ #include "torch_xla/csrc/tensor_util.h" -#include -#include - #include #include #include @@ -10,6 +7,8 @@ #include #include +#include +#include #include #include diff --git a/torch_xla/csrc/tensor_util.h b/torch_xla/csrc/tensor_util.h index 4a6f73bd3bd..fc840054bcc 100644 --- a/torch_xla/csrc/tensor_util.h +++ b/torch_xla/csrc/tensor_util.h @@ -1,11 +1,10 @@ #ifndef XLA_TORCH_XLA_CSRC_TENSOR_UTIL_H_ #define XLA_TORCH_XLA_CSRC_TENSOR_UTIL_H_ -#include - #include #include +#include #include #include diff --git a/torch_xla/csrc/torch_util.h b/torch_xla/csrc/torch_util.h index b45695ad6d6..1422c38fd4a 100644 --- a/torch_xla/csrc/torch_util.h +++ b/torch_xla/csrc/torch_util.h @@ -1,12 +1,11 @@ #ifndef XLA_TORCH_XLA_CSRC_TORCH_UTIL_H_ #define XLA_TORCH_XLA_CSRC_TORCH_UTIL_H_ +#include + #include #include #include - -#include - #include #include #include diff --git a/torch_xla/csrc/xla_generator.cpp b/torch_xla/csrc/xla_generator.cpp index cb334b1ba95..a04625cce6d 100644 --- a/torch_xla/csrc/xla_generator.cpp +++ b/torch_xla/csrc/xla_generator.cpp @@ -1,5 +1,9 @@ #include "xla_generator.h" +#include +#include +#include + #include #include #include @@ -10,10 +14,6 @@ #include #include -#include -#include -#include - #include "absl/status/status.h" #include "torch_xla/csrc/aten_xla_bridge.h" diff --git a/torch_xla/csrc/xla_generator.h b/torch_xla/csrc/xla_generator.h index 8001737e795..868ed7bee98 100644 --- a/torch_xla/csrc/xla_generator.h +++ b/torch_xla/csrc/xla_generator.h @@ -1,5 +1,7 @@ #pragma once +#include + #include #include #include @@ -8,8 +10,6 @@ #include #include -#include - #include "absl/status/status.h" #include "absl/status/statusor.h" diff --git a/torch_xla/csrc/xla_graph_executor.h b/torch_xla/csrc/xla_graph_executor.h index e4dcedce826..96219551394 100644 --- a/torch_xla/csrc/xla_graph_executor.h +++ b/torch_xla/csrc/xla_graph_executor.h @@ -1,13 +1,12 @@ #ifndef XLA_TORCH_XLA_CSRC_XLA_GRAPH_EXECUTOR_H_ #define XLA_TORCH_XLA_CSRC_XLA_GRAPH_EXECUTOR_H_ -#include - #include #include #include #include +#include #include #include diff --git a/torch_xla/csrc/xla_manual_registration.cpp b/torch_xla/csrc/xla_manual_registration.cpp index 6aad7994040..f5e5f74f380 100644 --- a/torch_xla/csrc/xla_manual_registration.cpp +++ b/torch_xla/csrc/xla_manual_registration.cpp @@ -1,6 +1,5 @@ #include #include - #include #include "torch_xla/csrc/XLANativeFunctions.h" diff --git a/torch_xla/csrc/xla_sharding_util.cpp b/torch_xla/csrc/xla_sharding_util.cpp index 2f90a6a0bca..6ecf6c65bf1 100644 --- a/torch_xla/csrc/xla_sharding_util.cpp +++ b/torch_xla/csrc/xla_sharding_util.cpp @@ -1,10 +1,9 @@ #include "torch_xla/csrc/xla_sharding_util.h" -#include - #include #include +#include #include #include "absl/synchronization/blocking_counter.h"