From 65c195234f87557291330d58da1bd45bebaf2acf Mon Sep 17 00:00:00 2001 From: Yukio Siraichi Date: Mon, 17 Nov 2025 14:42:49 -0300 Subject: [PATCH 1/4] Customize include groups for this project. --- .clang-format | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.clang-format b/.clang-format index 639774ec335c..e04798c31d54 100644 --- a/.clang-format +++ b/.clang-format @@ -66,15 +66,30 @@ ForEachMacros: - Q_FOREACH - BOOST_FOREACH IncludeBlocks: Regroup +# Include Groups (by priority): +# 1. C system headers: `#include <*.h>` +# 2. C++ system headers: `#include <*>` +# 3. PyTorch API headers: `#include ` +# - All PyTorch source files under `torch/csrc` already include PyTorch +# headers with angle-brackets +# - Make this into its own group (insted of, say, (4)), since it's the only +# external dependency using angle-brackets +# 4. Anything that's not (5) or (6) +# 5. Project headers: `#include "torch_xla/*.h"` +# 6. Test headers: `#include "test/*.h"` IncludeCategories: - - Regex: '^' - Priority: 2 + - Regex: '^' + Priority: 3 - Regex: '^<.*\.h>' Priority: 1 - Regex: '^<.*' Priority: 2 + - Regex: '"torch_xla/.*"' + Priority: 5 + - Regex: '"test/.*"' + Priority: 6 - Regex: '.*' - Priority: 3 + Priority: 4 IncludeIsMainRegex: '([-_](test|unittest))?$' IndentCaseLabels: true IndentPPDirectives: None From 604e49725521de98cec1e3ed65795cd6f6445a70 Mon Sep 17 00:00:00 2001 From: Yukio Siraichi Date: Mon, 17 Nov 2025 14:43:03 -0300 Subject: [PATCH 2/4] Format all C++ files. --- test/cpp/cpp_test_util.h | 4 ++- test/cpp/metrics_snapshot.cpp | 1 + test/cpp/metrics_snapshot.h | 3 +- test/cpp/test_aten_xla_tensor_1.cpp | 13 +++++---- test/cpp/test_aten_xla_tensor_2.cpp | 13 +++++---- test/cpp/test_aten_xla_tensor_3.cpp | 13 +++++---- test/cpp/test_aten_xla_tensor_4.cpp | 13 +++++---- test/cpp/test_aten_xla_tensor_5.cpp | 13 +++++---- test/cpp/test_aten_xla_tensor_6.cpp | 13 +++++---- test/cpp/test_debug_macros.cpp | 3 +- test/cpp/test_device.cpp | 1 + test/cpp/test_ir.cpp | 5 ++-- test/cpp/test_lazy.cpp | 6 ++-- test/cpp/test_replication.cpp | 10 ++++--- test/cpp/test_status_common.h | 4 ++- test/cpp/test_symint.cpp | 3 +- test/cpp/test_tensor.cpp | 6 ++-- test/cpp/test_xla_backend_intf.cpp | 3 +- test/cpp/test_xla_generator.cpp | 6 ++-- test/cpp/test_xla_sharding.cpp | 13 +++++---- test/cpp/torch_xla_test.cpp | 1 + torch_xla/csrc/aten_fallback.cpp | 3 +- torch_xla/csrc/aten_xla_bridge.cpp | 4 ++- torch_xla/csrc/aten_xla_bridge.h | 1 + torch_xla/csrc/aten_xla_type.cpp | 8 ++++-- torch_xla/csrc/autocast_mode.cpp | 1 + torch_xla/csrc/batch_norm.cpp | 5 ++-- torch_xla/csrc/convert_ops.cpp | 9 +++--- torch_xla/csrc/convert_ops.h | 3 +- torch_xla/csrc/convolution.cpp | 3 +- torch_xla/csrc/convolution.h | 3 +- torch_xla/csrc/cross_replica_reduces.cpp | 7 +++-- torch_xla/csrc/cross_replica_reduces.h | 3 +- torch_xla/csrc/data_ops.cpp | 15 +++++----- torch_xla/csrc/debug_util.cpp | 9 +++--- torch_xla/csrc/debug_util.h | 1 + torch_xla/csrc/device.cpp | 1 + torch_xla/csrc/device.h | 6 ++-- torch_xla/csrc/dl_convertor.cpp | 7 +++-- torch_xla/csrc/dtype.cpp | 3 +- torch_xla/csrc/dtype.h | 3 +- torch_xla/csrc/dynamic_shape_detector.h | 4 +-- torch_xla/csrc/elementwise.cpp | 5 ++-- torch_xla/csrc/function_call_tracker.cpp | 7 +++-- torch_xla/csrc/hash_util.h | 4 +-- torch_xla/csrc/helpers.cpp | 13 +++++---- torch_xla/csrc/helpers.h | 12 ++++---- torch_xla/csrc/init_python_bindings.cpp | 28 ++++++++++--------- torch_xla/csrc/ir.cpp | 9 +++--- torch_xla/csrc/ir.h | 12 ++++---- torch_xla/csrc/ir_dump_util.cpp | 5 ++-- torch_xla/csrc/ir_dump_util.h | 1 + torch_xla/csrc/layout_manager.cpp | 7 +++-- torch_xla/csrc/layout_manager.h | 3 +- torch_xla/csrc/lowering_context.cpp | 5 ++-- torch_xla/csrc/lowering_context.h | 15 +++++----- torch_xla/csrc/matrix.cpp | 7 +++-- torch_xla/csrc/nll_loss.cpp | 5 ++-- torch_xla/csrc/nll_loss.h | 3 +- torch_xla/csrc/ops/all_gather.cpp | 3 +- torch_xla/csrc/ops/all_reduce.cpp | 3 +- torch_xla/csrc/ops/all_to_all.cpp | 3 +- ...p_foreach_non_finite_check_and_unscale.cpp | 3 +- torch_xla/csrc/ops/amp_update_scale.cpp | 3 +- torch_xla/csrc/ops/as_strided.cpp | 7 +++-- torch_xla/csrc/ops/as_strided.h | 3 +- torch_xla/csrc/ops/as_strided_view_update.cpp | 3 +- torch_xla/csrc/ops/as_strided_view_update.h | 3 +- torch_xla/csrc/ops/avg_pool_nd.cpp | 1 + torch_xla/csrc/ops/cast.cpp | 3 +- torch_xla/csrc/ops/cast_int4.cpp | 3 +- torch_xla/csrc/ops/cat.h | 1 + torch_xla/csrc/ops/collective_permute.cpp | 3 +- torch_xla/csrc/ops/constant.cpp | 5 ++-- torch_xla/csrc/ops/constant_pad_nd.cpp | 3 +- .../ops/convolution_backward_overrideable.cpp | 1 + .../ops/convolution_backward_overrideable.h | 3 +- .../csrc/ops/convolution_overrideable.cpp | 1 + torch_xla/csrc/ops/convolution_overrideable.h | 3 +- torch_xla/csrc/ops/cumprod.cpp | 3 +- torch_xla/csrc/ops/diagonal.cpp | 3 +- torch_xla/csrc/ops/dot_general.cpp | 1 + torch_xla/csrc/ops/dynamic_ir.cpp | 1 + torch_xla/csrc/ops/dynamic_ir.h | 5 ++-- torch_xla/csrc/ops/eigh.cpp | 3 +- torch_xla/csrc/ops/eigh.h | 3 +- torch_xla/csrc/ops/embedding_bag.cpp | 11 ++++---- torch_xla/csrc/ops/expand.cpp | 1 + torch_xla/csrc/ops/expand_symint.cpp | 3 +- torch_xla/csrc/ops/flip.cpp | 3 +- torch_xla/csrc/ops/flip.h | 1 + torch_xla/csrc/ops/gather.cpp | 3 +- torch_xla/csrc/ops/generic_slice.cpp | 1 + torch_xla/csrc/ops/generic_slice.h | 1 + torch_xla/csrc/ops/get_dimensions_size.cpp | 3 +- torch_xla/csrc/ops/index_ops.cpp | 4 ++- torch_xla/csrc/ops/index_select.cpp | 3 +- torch_xla/csrc/ops/logsumexp.cpp | 1 + torch_xla/csrc/ops/masked_select.cpp | 3 +- torch_xla/csrc/ops/mean.cpp | 1 + torch_xla/csrc/ops/mean.h | 3 +- torch_xla/csrc/ops/mse_loss.cpp | 1 + torch_xla/csrc/ops/mse_loss.h | 3 +- torch_xla/csrc/ops/mse_loss_backward.h | 3 +- torch_xla/csrc/ops/nll_loss.cpp | 1 + torch_xla/csrc/ops/nll_loss.h | 1 + torch_xla/csrc/ops/nll_loss2d.cpp | 1 + torch_xla/csrc/ops/nll_loss2d.h | 1 + torch_xla/csrc/ops/nll_loss2d_backward.h | 1 + torch_xla/csrc/ops/nll_loss_backward.h | 1 + torch_xla/csrc/ops/nonzero.cpp | 3 +- torch_xla/csrc/ops/ops.cpp | 15 +++++----- torch_xla/csrc/ops/ops_lower_fn.cpp | 9 +++--- torch_xla/csrc/ops/ops_xla_shape_fn.cpp | 5 ++-- torch_xla/csrc/ops/optimization_barrier.cpp | 3 +- torch_xla/csrc/ops/permute.h | 1 + torch_xla/csrc/ops/prod.cpp | 1 + torch_xla/csrc/ops/prod.h | 1 + torch_xla/csrc/ops/qr.cpp | 7 +++-- torch_xla/csrc/ops/randperm.cpp | 7 +++-- torch_xla/csrc/ops/reduce_scatter.cpp | 3 +- torch_xla/csrc/ops/reflection_pad2d.cpp | 1 + .../csrc/ops/reflection_pad2d_backward.cpp | 1 + torch_xla/csrc/ops/replication_pad.h | 1 + .../csrc/ops/replication_pad_backward.cpp | 1 + torch_xla/csrc/ops/resize.cpp | 3 +- torch_xla/csrc/ops/rrelu_with_noise.h | 3 +- torch_xla/csrc/ops/scalar.cpp | 3 +- torch_xla/csrc/ops/split.cpp | 1 + torch_xla/csrc/ops/stack.h | 1 + torch_xla/csrc/ops/std.cpp | 1 + torch_xla/csrc/ops/std.h | 3 +- torch_xla/csrc/ops/std_mean.cpp | 1 + torch_xla/csrc/ops/std_mean.h | 3 +- torch_xla/csrc/ops/sum.cpp | 1 + torch_xla/csrc/ops/sum.h | 1 + torch_xla/csrc/ops/svd.cpp | 7 +++-- torch_xla/csrc/ops/symeig.cpp | 5 ++-- torch_xla/csrc/ops/triangular_solve.cpp | 5 ++-- torch_xla/csrc/ops/update_slice.cpp | 1 + torch_xla/csrc/ops/update_slice.h | 1 + torch_xla/csrc/ops/upsample_bilinear2d.cpp | 3 +- .../csrc/ops/upsample_bilinear2d_backward.cpp | 1 + torch_xla/csrc/ops/upsample_nearest2d.cpp | 3 +- .../csrc/ops/upsample_nearest2d_backward.cpp | 1 + torch_xla/csrc/ops/var.cpp | 1 + torch_xla/csrc/ops/var.h | 3 +- torch_xla/csrc/ops/var_mean.cpp | 1 + torch_xla/csrc/ops/var_mean.h | 3 +- torch_xla/csrc/ops/view.cpp | 3 +- torch_xla/csrc/pooling.cpp | 11 ++++---- torch_xla/csrc/pooling.h | 3 +- torch_xla/csrc/random.cpp | 5 ++-- torch_xla/csrc/reduction.cpp | 14 ++++++---- torch_xla/csrc/resize_ops.cpp | 7 +++-- torch_xla/csrc/runtime/cache.h | 3 +- torch_xla/csrc/runtime/computation_client.cpp | 5 ++-- torch_xla/csrc/runtime/computation_client.h | 24 ++++++++-------- torch_xla/csrc/runtime/debug_macros.h | 3 +- .../csrc/runtime/ifrt_computation_client.cpp | 19 +++++++------ .../csrc/runtime/ifrt_computation_client.h | 13 +++++---- .../runtime/ifrt_computation_client_test.cpp | 7 +++-- torch_xla/csrc/runtime/metrics.cpp | 3 +- torch_xla/csrc/runtime/metrics.h | 3 +- torch_xla/csrc/runtime/metrics_analysis.cpp | 1 + torch_xla/csrc/runtime/operation_manager.cpp | 1 + .../csrc/runtime/pjrt_computation_client.cpp | 23 +++++++-------- .../csrc/runtime/pjrt_computation_client.h | 13 +++++---- .../runtime/pjrt_computation_client_test.cpp | 7 +++-- torch_xla/csrc/runtime/pjrt_registry.cpp | 15 +++++----- torch_xla/csrc/runtime/pjrt_registry.h | 3 +- torch_xla/csrc/runtime/profiler.cpp | 3 +- torch_xla/csrc/runtime/runtime.cpp | 3 +- torch_xla/csrc/runtime/runtime.h | 1 + torch_xla/csrc/runtime/stablehlo_helper.cpp | 9 +++--- torch_xla/csrc/runtime/tensor_source.h | 10 ++++--- torch_xla/csrc/runtime/tf_logging.cpp | 6 ++-- torch_xla/csrc/runtime/tf_logging.h | 1 + torch_xla/csrc/runtime/util.h | 3 +- torch_xla/csrc/runtime/xla_coordinator.cpp | 3 +- torch_xla/csrc/runtime/xla_util.cpp | 11 ++++---- torch_xla/csrc/runtime/xla_util.h | 7 +++-- torch_xla/csrc/runtime/xla_util_test.cpp | 3 +- torch_xla/csrc/shape_helper.cpp | 3 +- torch_xla/csrc/softmax_builder.cpp | 3 +- torch_xla/csrc/stack_frame_index_builder.h | 4 +-- torch_xla/csrc/status.cpp | 3 +- torch_xla/csrc/tensor.cpp | 25 +++++++++-------- torch_xla/csrc/tensor.h | 8 ++++-- torch_xla/csrc/tensor_impl.cpp | 2 ++ torch_xla/csrc/tensor_methods.cpp | 10 ++++--- torch_xla/csrc/tensor_methods.h | 1 + torch_xla/csrc/tensor_ops.cpp | 1 + torch_xla/csrc/tensor_util.cpp | 12 ++++---- torch_xla/csrc/tensor_util.h | 12 ++++---- torch_xla/csrc/thread_pool.cpp | 3 +- torch_xla/csrc/token_handler.cpp | 5 ++-- torch_xla/csrc/torch_util.h | 6 ++-- torch_xla/csrc/unwrap_data.cpp | 7 +++-- torch_xla/csrc/unwrap_data.h | 5 ++-- torch_xla/csrc/view.cpp | 9 +++--- torch_xla/csrc/view.h | 3 +- torch_xla/csrc/xla_backend_impl.h | 4 +-- torch_xla/csrc/xla_generator.cpp | 1 + torch_xla/csrc/xla_graph_executor.cpp | 28 ++++++++++--------- torch_xla/csrc/xla_graph_executor.h | 10 ++++--- torch_xla/csrc/xla_lower_util.cpp | 25 +++++++++-------- torch_xla/csrc/xla_lower_util.h | 3 +- torch_xla/csrc/xla_manual_registration.cpp | 1 + torch_xla/csrc/xla_op_builder.cpp | 13 +++++---- torch_xla/csrc/xla_op_builder.h | 4 +-- torch_xla/csrc/xla_sharding_util.cpp | 23 +++++++-------- torch_xla/csrc/xla_sharding_util.h | 9 +++--- 213 files changed, 684 insertions(+), 439 deletions(-) diff --git a/test/cpp/cpp_test_util.h b/test/cpp/cpp_test_util.h index e3a5081e3dae..a41620083dbe 100644 --- a/test/cpp/cpp_test_util.h +++ b/test/cpp/cpp_test_util.h @@ -2,14 +2,16 @@ #define XLA_TEST_CPP_CPP_TEST_UTIL_H_ #include -#include #include #include #include #include +#include + #include "absl/types/span.h" + #include "torch_xla/csrc/debug_util.h" #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/dtype.h" diff --git a/test/cpp/metrics_snapshot.cpp b/test/cpp/metrics_snapshot.cpp index 1324089a8073..1d38fd543d61 100644 --- a/test/cpp/metrics_snapshot.cpp +++ b/test/cpp/metrics_snapshot.cpp @@ -3,6 +3,7 @@ #include #include "torch/csrc/lazy/core/metrics.h" + #include "torch_xla/csrc/runtime/tf_logging.h" #include "torch_xla/csrc/runtime/util.h" diff --git a/test/cpp/metrics_snapshot.h b/test/cpp/metrics_snapshot.h index 5cd5ebf92819..c6d5b3b5da68 100644 --- a/test/cpp/metrics_snapshot.h +++ b/test/cpp/metrics_snapshot.h @@ -7,9 +7,10 @@ #include #include -#include "torch_xla/csrc/runtime/metrics.h" #include "xla/types.h" +#include "torch_xla/csrc/runtime/metrics.h" + namespace torch_xla { namespace cpp_test { diff --git a/test/cpp/test_aten_xla_tensor_1.cpp b/test/cpp/test_aten_xla_tensor_1.cpp index bac303be96b4..f24104298985 100644 --- a/test/cpp/test_aten_xla_tensor_1.cpp +++ b/test/cpp/test_aten_xla_tensor_1.cpp @@ -1,10 +1,12 @@ #include -#include #include -#include "test/cpp/cpp_test_util.h" -#include "test/cpp/torch_xla_test.h" +#include + +#include "xla/permutation_util.h" +#include "xla/util.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/ops/dynamic_ir.h" @@ -12,8 +14,9 @@ #include "torch_xla/csrc/ops/ops.h" #include "torch_xla/csrc/runtime/metrics.h" #include "torch_xla/csrc/torch_util.h" -#include "xla/permutation_util.h" -#include "xla/util.h" + +#include "test/cpp/cpp_test_util.h" +#include "test/cpp/torch_xla_test.h" namespace torch_xla { namespace cpp_test { diff --git a/test/cpp/test_aten_xla_tensor_2.cpp b/test/cpp/test_aten_xla_tensor_2.cpp index 013abee5563d..aa3b3a7db4d7 100644 --- a/test/cpp/test_aten_xla_tensor_2.cpp +++ b/test/cpp/test_aten_xla_tensor_2.cpp @@ -1,11 +1,13 @@ #include -#include #include #include -#include "test/cpp/cpp_test_util.h" -#include "test/cpp/torch_xla_test.h" +#include + +#include "xla/permutation_util.h" +#include "xla/util.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/ops/dynamic_ir.h" @@ -13,8 +15,9 @@ #include "torch_xla/csrc/ops/ops.h" #include "torch_xla/csrc/runtime/metrics.h" #include "torch_xla/csrc/torch_util.h" -#include "xla/permutation_util.h" -#include "xla/util.h" + +#include "test/cpp/cpp_test_util.h" +#include "test/cpp/torch_xla_test.h" namespace torch_xla { namespace cpp_test { diff --git a/test/cpp/test_aten_xla_tensor_3.cpp b/test/cpp/test_aten_xla_tensor_3.cpp index 1bdb16c818b6..b8bd444ddcd8 100644 --- a/test/cpp/test_aten_xla_tensor_3.cpp +++ b/test/cpp/test_aten_xla_tensor_3.cpp @@ -1,10 +1,12 @@ #include -#include #include -#include "test/cpp/cpp_test_util.h" -#include "test/cpp/torch_xla_test.h" +#include + +#include "xla/permutation_util.h" +#include "xla/util.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/ops/dynamic_ir.h" @@ -12,8 +14,9 @@ #include "torch_xla/csrc/ops/ops.h" #include "torch_xla/csrc/runtime/metrics.h" #include "torch_xla/csrc/torch_util.h" -#include "xla/permutation_util.h" -#include "xla/util.h" + +#include "test/cpp/cpp_test_util.h" +#include "test/cpp/torch_xla_test.h" namespace torch_xla { namespace cpp_test { diff --git a/test/cpp/test_aten_xla_tensor_4.cpp b/test/cpp/test_aten_xla_tensor_4.cpp index 1283cec89967..eb0fadd14d48 100644 --- a/test/cpp/test_aten_xla_tensor_4.cpp +++ b/test/cpp/test_aten_xla_tensor_4.cpp @@ -1,10 +1,12 @@ #include -#include #include -#include "test/cpp/cpp_test_util.h" -#include "test/cpp/torch_xla_test.h" +#include + +#include "xla/permutation_util.h" +#include "xla/util.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/ops/dynamic_ir.h" @@ -12,8 +14,9 @@ #include "torch_xla/csrc/ops/ops.h" #include "torch_xla/csrc/runtime/metrics.h" #include "torch_xla/csrc/torch_util.h" -#include "xla/permutation_util.h" -#include "xla/util.h" + +#include "test/cpp/cpp_test_util.h" +#include "test/cpp/torch_xla_test.h" namespace torch_xla { namespace cpp_test { diff --git a/test/cpp/test_aten_xla_tensor_5.cpp b/test/cpp/test_aten_xla_tensor_5.cpp index 19beae5789b2..5f512b0ff7f8 100644 --- a/test/cpp/test_aten_xla_tensor_5.cpp +++ b/test/cpp/test_aten_xla_tensor_5.cpp @@ -1,10 +1,12 @@ #include -#include #include -#include "test/cpp/cpp_test_util.h" -#include "test/cpp/torch_xla_test.h" +#include + +#include "xla/permutation_util.h" +#include "xla/util.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/ops/dynamic_ir.h" @@ -12,8 +14,9 @@ #include "torch_xla/csrc/ops/ops.h" #include "torch_xla/csrc/runtime/metrics.h" #include "torch_xla/csrc/torch_util.h" -#include "xla/permutation_util.h" -#include "xla/util.h" + +#include "test/cpp/cpp_test_util.h" +#include "test/cpp/torch_xla_test.h" namespace torch_xla { namespace cpp_test { diff --git a/test/cpp/test_aten_xla_tensor_6.cpp b/test/cpp/test_aten_xla_tensor_6.cpp index ca2ad6498ca3..32e9d53acb0e 100644 --- a/test/cpp/test_aten_xla_tensor_6.cpp +++ b/test/cpp/test_aten_xla_tensor_6.cpp @@ -1,10 +1,12 @@ #include -#include #include -#include "test/cpp/cpp_test_util.h" -#include "test/cpp/torch_xla_test.h" +#include + +#include "xla/permutation_util.h" +#include "xla/util.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/ops/dynamic_ir.h" @@ -12,8 +14,9 @@ #include "torch_xla/csrc/ops/ops.h" #include "torch_xla/csrc/runtime/metrics.h" #include "torch_xla/csrc/torch_util.h" -#include "xla/permutation_util.h" -#include "xla/util.h" + +#include "test/cpp/cpp_test_util.h" +#include "test/cpp/torch_xla_test.h" namespace torch_xla { namespace cpp_test { diff --git a/test/cpp/test_debug_macros.cpp b/test/cpp/test_debug_macros.cpp index e62e40484fe6..55af1c032efe 100644 --- a/test/cpp/test_debug_macros.cpp +++ b/test/cpp/test_debug_macros.cpp @@ -1,10 +1,11 @@ #include #include -#include "test/cpp/cpp_test_util.h" #include "torch_xla/csrc/runtime/debug_macros.h" #include "torch_xla/csrc/runtime/env_vars.h" +#include "test/cpp/cpp_test_util.h" + namespace torch_xla::cpp_test { namespace { diff --git a/test/cpp/test_device.cpp b/test/cpp/test_device.cpp index cde2277336d9..d63b81643498 100644 --- a/test/cpp/test_device.cpp +++ b/test/cpp/test_device.cpp @@ -1,6 +1,7 @@ #include #include "absl/strings/str_cat.h" + #include "torch_xla/csrc/device.h" static void CheckFormatError(const std::string& spec) { diff --git a/test/cpp/test_ir.cpp b/test/cpp/test_ir.cpp index 39b155a564ff..da654bdc1a71 100644 --- a/test/cpp/test_ir.cpp +++ b/test/cpp/test_ir.cpp @@ -2,8 +2,6 @@ #include -#include "test/cpp/cpp_test_util.h" -#include "test/cpp/torch_xla_test.h" #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/arithmetic_ir_ops.h" @@ -16,6 +14,9 @@ #include "torch_xla/csrc/ops/unselect.h" #include "torch_xla/csrc/ops/update_slice.h" +#include "test/cpp/cpp_test_util.h" +#include "test/cpp/torch_xla_test.h" + namespace torch_xla { namespace cpp_test { diff --git a/test/cpp/test_lazy.cpp b/test/cpp/test_lazy.cpp index b16cdafbf24d..90082a3b9d7d 100644 --- a/test/cpp/test_lazy.cpp +++ b/test/cpp/test_lazy.cpp @@ -1,10 +1,12 @@ #include -#include "test/cpp/torch_xla_test.h" #include "torch/csrc/lazy/core/shape.h" -#include "torch_xla/csrc/helpers.h" #include "xla/shape.h" +#include "torch_xla/csrc/helpers.h" + +#include "test/cpp/torch_xla_test.h" + namespace torch_xla { namespace cpp_test { diff --git a/test/cpp/test_replication.cpp b/test/cpp/test_replication.cpp index 8ac622c6eace..2cb9f05ba1af 100644 --- a/test/cpp/test_replication.cpp +++ b/test/cpp/test_replication.cpp @@ -4,8 +4,9 @@ #include #include "absl/synchronization/blocking_counter.h" -#include "test/cpp/cpp_test_util.h" -#include "test/cpp/torch_xla_test.h" +#include "xla/hlo/builder/xla_builder.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/runtime/debug_macros.h" @@ -14,8 +15,9 @@ #include "torch_xla/csrc/tensor_util.h" #include "torch_xla/csrc/thread_pool.h" #include "torch_xla/csrc/torch_util.h" -#include "xla/hlo/builder/xla_builder.h" -#include "xla/shape_util.h" + +#include "test/cpp/cpp_test_util.h" +#include "test/cpp/torch_xla_test.h" namespace torch_xla { namespace cpp_test { diff --git a/test/cpp/test_status_common.h b/test/cpp/test_status_common.h index e09d2e58d28f..c7adbb5c369c 100644 --- a/test/cpp/test_status_common.h +++ b/test/cpp/test_status_common.h @@ -29,10 +29,12 @@ #include "absl/status/status.h" #include "absl/status/statusor.h" -#include "test/cpp/cpp_test_util.h" + #include "torch_xla/csrc/runtime/env_vars.h" #include "torch_xla/csrc/status.h" +#include "test/cpp/cpp_test_util.h" + namespace torch_xla { // Enum to control whether C++ error context is shown in status messages. diff --git a/test/cpp/test_symint.cpp b/test/cpp/test_symint.cpp index ed0659f46824..c8bead772480 100644 --- a/test/cpp/test_symint.cpp +++ b/test/cpp/test_symint.cpp @@ -2,7 +2,6 @@ #include -#include "test/cpp/cpp_test_util.h" #include "torch_xla/csrc/LazyIr.h" #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/ops/dynamic_ir.h" @@ -10,6 +9,8 @@ #include "torch_xla/csrc/ops/ops.h" #include "torch_xla/csrc/torch_util.h" +#include "test/cpp/cpp_test_util.h" + namespace torch_xla { namespace cpp_test { diff --git a/test/cpp/test_tensor.cpp b/test/cpp/test_tensor.cpp index a75580d22f41..69abc54d6977 100644 --- a/test/cpp/test_tensor.cpp +++ b/test/cpp/test_tensor.cpp @@ -5,14 +5,16 @@ #include #include "absl/base/nullability.h" -#include "test/cpp/cpp_test_util.h" -#include "test/cpp/torch_xla_test.h" #include "torch/csrc/autograd/variable.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/tensor.h" #include "torch_xla/csrc/tensor_methods.h" #include "torch_xla/csrc/tensor_util.h" +#include "test/cpp/cpp_test_util.h" +#include "test/cpp/torch_xla_test.h" + namespace torch_xla { namespace cpp_test { namespace { diff --git a/test/cpp/test_xla_backend_intf.cpp b/test/cpp/test_xla_backend_intf.cpp index 25a39e57abb8..b175948152ff 100644 --- a/test/cpp/test_xla_backend_intf.cpp +++ b/test/cpp/test_xla_backend_intf.cpp @@ -1,11 +1,12 @@ #include -#include "test/cpp/cpp_test_util.h" #include "torch_xla/csrc/runtime/computation_client.h" #include "torch_xla/csrc/status.h" #include "torch_xla/csrc/tensor_util.h" #include "torch_xla/csrc/xla_backend_impl.h" +#include "test/cpp/cpp_test_util.h" + namespace torch_xla { namespace cpp_test { diff --git a/test/cpp/test_xla_generator.cpp b/test/cpp/test_xla_generator.cpp index ebf90e93b457..e331df2e3052 100644 --- a/test/cpp/test_xla_generator.cpp +++ b/test/cpp/test_xla_generator.cpp @@ -1,12 +1,14 @@ #include #include -#include #include -#include "test/cpp/torch_xla_test.h" +#include + #include "torch_xla/csrc/xla_generator.h" +#include "test/cpp/torch_xla_test.h" + namespace torch_xla { namespace cpp_test { diff --git a/test/cpp/test_xla_sharding.cpp b/test/cpp/test_xla_sharding.cpp index 4dd5e965720b..fb0ae2e7f91f 100644 --- a/test/cpp/test_xla_sharding.cpp +++ b/test/cpp/test_xla_sharding.cpp @@ -2,12 +2,14 @@ #include #include #include -#include #include -#include "test/cpp/cpp_test_util.h" -#include "test/cpp/torch_xla_test.h" +#include + +#include "xla/protobuf_util.h" +#include "xla/xla_data.pb.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/runtime/computation_client.h" @@ -19,8 +21,9 @@ #include "torch_xla/csrc/tensor_methods.h" #include "torch_xla/csrc/tensor_util.h" #include "torch_xla/csrc/xla_sharding_util.h" -#include "xla/protobuf_util.h" -#include "xla/xla_data.pb.h" + +#include "test/cpp/cpp_test_util.h" +#include "test/cpp/torch_xla_test.h" namespace torch_xla { namespace cpp_test { diff --git a/test/cpp/torch_xla_test.cpp b/test/cpp/torch_xla_test.cpp index 781640268a35..804cd000ed8a 100644 --- a/test/cpp/torch_xla_test.cpp +++ b/test/cpp/torch_xla_test.cpp @@ -3,6 +3,7 @@ #include #include "absl/memory/memory.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/helpers.h" diff --git a/torch_xla/csrc/aten_fallback.cpp b/torch_xla/csrc/aten_fallback.cpp index cb4436b43784..9feb75e22ce5 100644 --- a/torch_xla/csrc/aten_fallback.cpp +++ b/torch_xla/csrc/aten_fallback.cpp @@ -4,11 +4,12 @@ #include #include #include -#include #include #include +#include + #include "torch_xla/csrc/function_call_tracker.h" #include "torch_xla/csrc/runtime/metrics.h" #include "torch_xla/csrc/runtime/tf_logging.h" diff --git a/torch_xla/csrc/aten_xla_bridge.cpp b/torch_xla/csrc/aten_xla_bridge.cpp index 7f426196fa80..a9a9204342d7 100644 --- a/torch_xla/csrc/aten_xla_bridge.cpp +++ b/torch_xla/csrc/aten_xla_bridge.cpp @@ -1,14 +1,16 @@ #include "torch_xla/csrc/aten_xla_bridge.h" #include -#include #include #include #include +#include + #include "absl/log/absl_check.h" #include "absl/strings/str_cat.h" + #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/runtime/debug_macros.h" #include "torch_xla/csrc/runtime/runtime.h" diff --git a/torch_xla/csrc/aten_xla_bridge.h b/torch_xla/csrc/aten_xla_bridge.h index a8eb5424523e..440bdf59d928 100644 --- a/torch_xla/csrc/aten_xla_bridge.h +++ b/torch_xla/csrc/aten_xla_bridge.h @@ -10,6 +10,7 @@ #include "absl/base/nullability.h" #include "absl/status/statusor.h" #include "absl/types/span.h" + #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/tensor.h" diff --git a/torch_xla/csrc/aten_xla_type.cpp b/torch_xla/csrc/aten_xla_type.cpp index 449d435ef82a..aab9fd45b342 100644 --- a/torch_xla/csrc/aten_xla_type.cpp +++ b/torch_xla/csrc/aten_xla_type.cpp @@ -10,20 +10,22 @@ #include #include #include -#include -#include -#include #include #include #include +#include +#include +#include + #include "absl/base/nullability.h" #include "absl/log/absl_check.h" #include "torch/csrc/lazy/core/helpers.h" #include "torch/csrc/lazy/core/shape_inference.h" #include "torch/csrc/lazy/core/tensor_util.h" #include "torch/csrc/lazy/core/util.h" + #include "torch_xla/csrc/LazyIr.h" #include "torch_xla/csrc/XLANativeFunctions.h" #include "torch_xla/csrc/aten_autograd_ops.h" diff --git a/torch_xla/csrc/autocast_mode.cpp b/torch_xla/csrc/autocast_mode.cpp index 4db31feb6ba9..0baef83f20a4 100644 --- a/torch_xla/csrc/autocast_mode.cpp +++ b/torch_xla/csrc/autocast_mode.cpp @@ -4,6 +4,7 @@ #include #include #include + #include namespace at { diff --git a/torch_xla/csrc/batch_norm.cpp b/torch_xla/csrc/batch_norm.cpp index c8b8e81835b4..649e4932d239 100644 --- a/torch_xla/csrc/batch_norm.cpp +++ b/torch_xla/csrc/batch_norm.cpp @@ -1,10 +1,11 @@ #include "torch_xla/csrc/batch_norm.h" -#include "torch_xla/csrc/helpers.h" -#include "torch_xla/csrc/shape_helper.h" #include "xla/hlo/builder/lib/constants.h" #include "xla/hlo/builder/xla_builder.h" +#include "torch_xla/csrc/helpers.h" +#include "torch_xla/csrc/shape_helper.h" + namespace torch_xla { namespace { diff --git a/torch_xla/csrc/convert_ops.cpp b/torch_xla/csrc/convert_ops.cpp index 1a244d42b3d3..aa2765d0b91c 100644 --- a/torch_xla/csrc/convert_ops.cpp +++ b/torch_xla/csrc/convert_ops.cpp @@ -2,15 +2,16 @@ #include +#include "xla/hlo/builder/lib/constants.h" +#include "xla/literal_util.h" +#include "xla/primitive_util.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/dtype.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/runtime/debug_macros.h" #include "torch_xla/csrc/tensor_util.h" -#include "xla/hlo/builder/lib/constants.h" -#include "xla/literal_util.h" -#include "xla/primitive_util.h" -#include "xla/shape_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/convert_ops.h b/torch_xla/csrc/convert_ops.h index 3d67cb8c1238..3ad627d559c6 100644 --- a/torch_xla/csrc/convert_ops.h +++ b/torch_xla/csrc/convert_ops.h @@ -5,10 +5,11 @@ #include -#include "torch_xla/csrc/device.h" #include "xla/hlo/builder/xla_builder.h" #include "xla/types.h" +#include "torch_xla/csrc/device.h" + namespace torch_xla { xla::XlaOp ConvertTo(xla::XlaOp op, xla::PrimitiveType from, diff --git a/torch_xla/csrc/convolution.cpp b/torch_xla/csrc/convolution.cpp index 6312045ca9e5..5adab53e7e9c 100644 --- a/torch_xla/csrc/convolution.cpp +++ b/torch_xla/csrc/convolution.cpp @@ -1,11 +1,12 @@ #include "torch_xla/csrc/convolution.h" +#include "xla/hlo/builder/lib/constants.h" + #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/runtime/debug_macros.h" #include "torch_xla/csrc/shape_helper.h" #include "torch_xla/csrc/status.h" #include "torch_xla/csrc/xla_lower_util.h" -#include "xla/hlo/builder/lib/constants.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/convolution.h b/torch_xla/csrc/convolution.h index dffc21f0ae64..8a0c3191f503 100644 --- a/torch_xla/csrc/convolution.h +++ b/torch_xla/csrc/convolution.h @@ -2,9 +2,10 @@ #define XLA_TORCH_XLA_CSRC_CONVOLUTION_H_ #include "absl/types/span.h" -#include "torch_xla/csrc/convolution_helper.h" #include "xla/hlo/builder/xla_builder.h" +#include "torch_xla/csrc/convolution_helper.h" + namespace torch_xla { // Computes the convolution of the given input and kernel with the given diff --git a/torch_xla/csrc/cross_replica_reduces.cpp b/torch_xla/csrc/cross_replica_reduces.cpp index 6d8abd33ad6f..0d0f334713d3 100644 --- a/torch_xla/csrc/cross_replica_reduces.cpp +++ b/torch_xla/csrc/cross_replica_reduces.cpp @@ -1,10 +1,12 @@ #include "torch_xla/csrc/cross_replica_reduces.h" -#include - #include +#include + #include "torch/csrc/lazy/core/util.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/device.h" @@ -17,7 +19,6 @@ #include "torch_xla/csrc/tensor_methods.h" #include "torch_xla/csrc/token_handler.h" #include "torch_xla/csrc/xla_graph_executor.h" -#include "xla/shape_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/cross_replica_reduces.h b/torch_xla/csrc/cross_replica_reduces.h index e6877a19aa72..2746cf22b3a3 100644 --- a/torch_xla/csrc/cross_replica_reduces.h +++ b/torch_xla/csrc/cross_replica_reduces.h @@ -5,9 +5,10 @@ #include "absl/types/span.h" #include "torch/csrc/lazy/core/ir.h" +#include "xla/hlo/builder/xla_builder.h" + #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/ir.h" -#include "xla/hlo/builder/xla_builder.h" namespace torch_xla { diff --git a/torch_xla/csrc/data_ops.cpp b/torch_xla/csrc/data_ops.cpp index 166f69f7659d..931ac56b7f96 100644 --- a/torch_xla/csrc/data_ops.cpp +++ b/torch_xla/csrc/data_ops.cpp @@ -1,13 +1,18 @@ #include "torch_xla/csrc/data_ops.h" -#include -#include - #include #include #include +#include +#include + #include "absl/strings/str_join.h" +#include "xla/hlo/builder/lib/constants.h" +#include "xla/hlo/builder/lib/slicing.h" +#include "xla/shape_util.h" +#include "xla/util.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/dtype.h" @@ -19,10 +24,6 @@ #include "torch_xla/csrc/shape_helper.h" #include "torch_xla/csrc/status.h" #include "torch_xla/csrc/tensor_util.h" -#include "xla/hlo/builder/lib/constants.h" -#include "xla/hlo/builder/lib/slicing.h" -#include "xla/shape_util.h" -#include "xla/util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/debug_util.cpp b/torch_xla/csrc/debug_util.cpp index 81c76e386602..99a46bc4f0ad 100644 --- a/torch_xla/csrc/debug_util.cpp +++ b/torch_xla/csrc/debug_util.cpp @@ -1,9 +1,5 @@ #include "torch_xla/csrc/debug_util.h" -#include -#include -#include - #include #include #include @@ -11,8 +7,13 @@ #include #include +#include +#include +#include + #include "absl/memory/memory.h" #include "absl/strings/str_split.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/ir.h" diff --git a/torch_xla/csrc/debug_util.h b/torch_xla/csrc/debug_util.h index 516245d8768a..fdd4aa96840b 100644 --- a/torch_xla/csrc/debug_util.h +++ b/torch_xla/csrc/debug_util.h @@ -6,6 +6,7 @@ #include #include "absl/types/span.h" + #include "torch_xla/csrc/runtime/computation_client.h" #include "torch_xla/csrc/tensor.h" diff --git a/torch_xla/csrc/device.cpp b/torch_xla/csrc/device.cpp index fafb57837543..ead6ec9dea5a 100644 --- a/torch_xla/csrc/device.cpp +++ b/torch_xla/csrc/device.cpp @@ -7,6 +7,7 @@ #include "absl/status/status.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_split.h" + #include "torch_xla/csrc/runtime/debug_macros.h" #include "torch_xla/csrc/runtime/sys_util.h" #include "torch_xla/csrc/status.h" diff --git a/torch_xla/csrc/device.h b/torch_xla/csrc/device.h index 46d5df5ce014..d0fd9423c53f 100644 --- a/torch_xla/csrc/device.h +++ b/torch_xla/csrc/device.h @@ -1,13 +1,13 @@ #ifndef XLA_TORCH_XLA_CSRC_DEVICE_H_ #define XLA_TORCH_XLA_CSRC_DEVICE_H_ +#include +#include + #include #include #include -#include -#include - #include "torch_xla/csrc/runtime/util.h" namespace torch_xla { diff --git a/torch_xla/csrc/dl_convertor.cpp b/torch_xla/csrc/dl_convertor.cpp index 274e30f017d5..845c15696e89 100644 --- a/torch_xla/csrc/dl_convertor.cpp +++ b/torch_xla/csrc/dl_convertor.cpp @@ -9,6 +9,10 @@ #include "absl/log/absl_check.h" #include "absl/status/status.h" #include "absl/types/span.h" +#include "xla/pjrt/pjrt_client.h" +#include "xla/pjrt/pjrt_future.h" +#include "xla/pjrt/pjrt_layout.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/ops/device_data.h" #include "torch_xla/csrc/runtime/computation_client.h" @@ -20,9 +24,6 @@ #include "torch_xla/csrc/tensor.h" #include "torch_xla/csrc/tensor_util.h" #include "torch_xla/csrc/unwrap_data.h" -#include "xla/pjrt/pjrt_client.h" -#include "xla/pjrt/pjrt_future.h" -#include "xla/pjrt/pjrt_layout.h" namespace torch_xla { diff --git a/torch_xla/csrc/dtype.cpp b/torch_xla/csrc/dtype.cpp index 484151c6d5ed..36c04e738526 100644 --- a/torch_xla/csrc/dtype.cpp +++ b/torch_xla/csrc/dtype.cpp @@ -1,7 +1,8 @@ +#include "xla/shape.h" + #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/runtime/debug_macros.h" #include "torch_xla/csrc/runtime/sys_util.h" -#include "xla/shape.h" namespace torch_xla { diff --git a/torch_xla/csrc/dtype.h b/torch_xla/csrc/dtype.h index 399c67fcbdee..42b41162c1de 100644 --- a/torch_xla/csrc/dtype.h +++ b/torch_xla/csrc/dtype.h @@ -1,9 +1,10 @@ #ifndef XLA_TORCH_XLA_CSRC_DTYPE_H_ #define XLA_TORCH_XLA_CSRC_DTYPE_H_ -#include "torch_xla/csrc/device.h" #include "xla/shape.h" +#include "torch_xla/csrc/device.h" + namespace torch_xla { at::ScalarType TorchTypeFromXlaType(xla::PrimitiveType xla_type); diff --git a/torch_xla/csrc/dynamic_shape_detector.h b/torch_xla/csrc/dynamic_shape_detector.h index 5afeed85a1cc..7d73a65bd1e7 100644 --- a/torch_xla/csrc/dynamic_shape_detector.h +++ b/torch_xla/csrc/dynamic_shape_detector.h @@ -1,10 +1,10 @@ #ifndef XLA_TORCH_XLA_CSRC_DYNAMIC_SHAPE_DETECTOR_H_ #define XLA_TORCH_XLA_CSRC_DYNAMIC_SHAPE_DETECTOR_H_ -#include - #include +#include + #include "absl/types/span.h" namespace torch_xla { diff --git a/torch_xla/csrc/elementwise.cpp b/torch_xla/csrc/elementwise.cpp index bf900ac6bc19..35950d14a59f 100644 --- a/torch_xla/csrc/elementwise.cpp +++ b/torch_xla/csrc/elementwise.cpp @@ -1,5 +1,8 @@ #include "torch_xla/csrc/elementwise.h" +#include "xla/hlo/builder/lib/constants.h" +#include "xla/hlo/builder/lib/math.h" + #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/helpers.h" @@ -9,8 +12,6 @@ #include "torch_xla/csrc/shape_helper.h" #include "torch_xla/csrc/tensor_util.h" #include "torch_xla/csrc/xla_lower_util.h" -#include "xla/hlo/builder/lib/constants.h" -#include "xla/hlo/builder/lib/math.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/function_call_tracker.cpp b/torch_xla/csrc/function_call_tracker.cpp index c63fd443499f..efe503c7ee0b 100644 --- a/torch_xla/csrc/function_call_tracker.cpp +++ b/torch_xla/csrc/function_call_tracker.cpp @@ -1,7 +1,5 @@ #include "torch_xla/csrc/function_call_tracker.h" -#include - #include #include #include @@ -9,10 +7,13 @@ #include #include +#include + #include "absl/strings/str_split.h" -#include "torch_xla/csrc/runtime/sys_util.h" #include "tsl/platform/stacktrace.h" +#include "torch_xla/csrc/runtime/sys_util.h" + namespace torch_xla { namespace fn_tracker { namespace { diff --git a/torch_xla/csrc/hash_util.h b/torch_xla/csrc/hash_util.h index 09fe3fd67948..5b7f6041a542 100644 --- a/torch_xla/csrc/hash_util.h +++ b/torch_xla/csrc/hash_util.h @@ -3,10 +3,10 @@ #ifndef XLA_TORCH_XLA_CSRC_HASH_UTIL_H_ #define XLA_TORCH_XLA_CSRC_HASH_UTIL_H_ -#include - #include +#include + namespace torch_xla { // Merges the new hash value into the old hash value by combining them. diff --git a/torch_xla/csrc/helpers.cpp b/torch_xla/csrc/helpers.cpp index 4808bf9db8a1..f3a9730a5dcd 100644 --- a/torch_xla/csrc/helpers.cpp +++ b/torch_xla/csrc/helpers.cpp @@ -1,12 +1,16 @@ #include "torch_xla/csrc/helpers.h" -#include -#include - #include #include +#include +#include + #include "absl/strings/str_join.h" +#include "xla/hlo/builder/lib/constants.h" +#include "xla/primitive_util.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/dtype.h" #include "torch_xla/csrc/runtime/debug_macros.h" @@ -15,9 +19,6 @@ #include "torch_xla/csrc/shape_helper.h" #include "torch_xla/csrc/status.h" #include "torch_xla/csrc/tensor_util.h" -#include "xla/hlo/builder/lib/constants.h" -#include "xla/primitive_util.h" -#include "xla/shape_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/helpers.h b/torch_xla/csrc/helpers.h index cb5993da8e92..55a034478510 100644 --- a/torch_xla/csrc/helpers.h +++ b/torch_xla/csrc/helpers.h @@ -2,27 +2,29 @@ #define XLA_TORCH_XLA_CSRC_HELPERS_H_ #include -#include -#include #include #include #include #include +#include +#include + #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/types/optional.h" #include "absl/types/span.h" -#include "torch_xla/csrc/runtime/debug_macros.h" -#include "torch_xla/csrc/runtime/sys_util.h" -#include "torch_xla/csrc/runtime/util.h" #include "tsl/platform/bfloat16.h" #include "xla/hlo/builder/xla_builder.h" #include "xla/literal_util.h" #include "xla/permutation_util.h" #include "xla/types.h" +#include "torch_xla/csrc/runtime/debug_macros.h" +#include "torch_xla/csrc/runtime/sys_util.h" +#include "torch_xla/csrc/runtime/util.h" + namespace torch_xla { // Miscellaneous helpers for XLA lowering. diff --git a/torch_xla/csrc/init_python_bindings.cpp b/torch_xla/csrc/init_python_bindings.cpp index fa096b8edf42..bda4cf830ba3 100644 --- a/torch_xla/csrc/init_python_bindings.cpp +++ b/torch_xla/csrc/init_python_bindings.cpp @@ -3,14 +3,6 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include #include #include @@ -25,6 +17,15 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include + #include "absl/base/nullability.h" #include "absl/container/flat_hash_map.h" #include "absl/log/absl_check.h" @@ -40,6 +41,12 @@ #include "pybind11/pytypes.h" #include "pybind11/stl.h" #include "pybind11/stl_bind.h" +#include "tsl/platform/env.h" +#include "tsl/profiler/lib/traceme.h" +#include "xla/hlo/parser/hlo_parser.h" +#include "xla/pjrt/distributed/distributed.h" +#include "xla/python/profiler/internal/traceme_wrapper.h" + #include "torch_xla/csrc/XLANativeFunctions.h" #include "torch_xla/csrc/aten_autograd_ops.h" #include "torch_xla/csrc/aten_fallback.h" @@ -78,11 +85,6 @@ #include "torch_xla/csrc/xla_graph_executor.h" #include "torch_xla/csrc/xla_op_builder.h" #include "torch_xla/csrc/xla_sharding_util.h" -#include "tsl/platform/env.h" -#include "tsl/profiler/lib/traceme.h" -#include "xla/hlo/parser/hlo_parser.h" -#include "xla/pjrt/distributed/distributed.h" -#include "xla/python/profiler/internal/traceme_wrapper.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ir.cpp b/torch_xla/csrc/ir.cpp index 11064d158900..c63b772ac45d 100644 --- a/torch_xla/csrc/ir.cpp +++ b/torch_xla/csrc/ir.cpp @@ -1,17 +1,18 @@ #include "torch_xla/csrc/ir.h" +#include +#include +#include + #include #include #include #include -#include -#include -#include - #include "absl/log/absl_log.h" #include "absl/status/status.h" #include "absl/strings/str_cat.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/runtime/cache.h" #include "torch_xla/csrc/runtime/debug_macros.h" diff --git a/torch_xla/csrc/ir.h b/torch_xla/csrc/ir.h index 7e97143d79b0..17944b3c73da 100644 --- a/torch_xla/csrc/ir.h +++ b/torch_xla/csrc/ir.h @@ -2,10 +2,6 @@ #define XLA_TORCH_XLA_CSRC_IR_H_ #include -#include -#include -#include -#include #include #include @@ -16,12 +12,18 @@ #include #include +#include +#include +#include +#include + #include "absl/container/inlined_vector.h" #include "absl/hash/hash.h" #include "absl/types/span.h" +#include "xla/hlo/builder/xla_builder.h" + #include "torch_xla/csrc/dynamic_shape_detector.h" #include "torch_xla/csrc/runtime/types.h" -#include "xla/hlo/builder/xla_builder.h" namespace torch_xla { diff --git a/torch_xla/csrc/ir_dump_util.cpp b/torch_xla/csrc/ir_dump_util.cpp index 8a8fcd73dd44..415cb17f7934 100644 --- a/torch_xla/csrc/ir_dump_util.cpp +++ b/torch_xla/csrc/ir_dump_util.cpp @@ -1,13 +1,14 @@ #include "torch_xla/csrc/ir_dump_util.h" -#include - #include #include #include +#include + #include "absl/container/flat_hash_map.h" #include "absl/types/optional.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/runtime/debug_macros.h" #include "torch_xla/csrc/runtime/runtime.h" diff --git a/torch_xla/csrc/ir_dump_util.h b/torch_xla/csrc/ir_dump_util.h index f47c93f82a1a..bbe9f0707d0c 100644 --- a/torch_xla/csrc/ir_dump_util.h +++ b/torch_xla/csrc/ir_dump_util.h @@ -4,6 +4,7 @@ #include #include "absl/types/span.h" + #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/tensor.h" diff --git a/torch_xla/csrc/layout_manager.cpp b/torch_xla/csrc/layout_manager.cpp index 96636530cfe1..36fb5d8e3900 100644 --- a/torch_xla/csrc/layout_manager.cpp +++ b/torch_xla/csrc/layout_manager.cpp @@ -1,7 +1,5 @@ #include "torch_xla/csrc/layout_manager.h" -#include - #include #include #include @@ -10,13 +8,16 @@ #include #include +#include + #include "absl/strings/str_split.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/runtime/debug_macros.h" #include "torch_xla/csrc/runtime/sys_util.h" #include "torch_xla/csrc/runtime/tf_logging.h" #include "torch_xla/csrc/runtime/util.h" -#include "xla/shape_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/layout_manager.h b/torch_xla/csrc/layout_manager.h index b330c811fa1f..540c6d221e1d 100644 --- a/torch_xla/csrc/layout_manager.h +++ b/torch_xla/csrc/layout_manager.h @@ -2,10 +2,11 @@ #define XLA_TORCH_XLA_CSRC_LAYOUT_MANAGER_H_ #include "absl/types/span.h" -#include "torch_xla/csrc/device.h" #include "xla/shape.h" #include "xla/types.h" +#include "torch_xla/csrc/device.h" + namespace torch_xla { // Creates a minor-to-major layout from given dimensions. The dynamic_dimensions diff --git a/torch_xla/csrc/lowering_context.cpp b/torch_xla/csrc/lowering_context.cpp index ceedd5207e25..4b8f56c8fb73 100644 --- a/torch_xla/csrc/lowering_context.cpp +++ b/torch_xla/csrc/lowering_context.cpp @@ -1,17 +1,18 @@ #include "torch_xla/csrc/lowering_context.h" -#include - #include #include #include #include +#include + #include "absl/log/absl_check.h" #include "absl/log/absl_log.h" #include "absl/status/status.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_replace.h" + #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/runtime/computation_client.h" #include "torch_xla/csrc/runtime/debug_macros.h" diff --git a/torch_xla/csrc/lowering_context.h b/torch_xla/csrc/lowering_context.h index eedabc438041..4a0c56d311e3 100644 --- a/torch_xla/csrc/lowering_context.h +++ b/torch_xla/csrc/lowering_context.h @@ -1,10 +1,6 @@ #ifndef XLA_TORCH_XLA_CSRC_LOWERING_CONTEXT_H_ #define XLA_TORCH_XLA_CSRC_LOWERING_CONTEXT_H_ -#include -#include -#include - #include #include #include @@ -13,15 +9,20 @@ #include #include +#include +#include +#include + #include "absl/status/status.h" #include "absl/types/span.h" -#include "torch_xla/csrc/device.h" -#include "torch_xla/csrc/ir.h" -#include "torch_xla/csrc/runtime/computation_client.h" #include "tsl/platform/macros.h" #include "xla/hlo/builder/xla_builder.h" #include "xla/types.h" +#include "torch_xla/csrc/device.h" +#include "torch_xla/csrc/ir.h" +#include "torch_xla/csrc/runtime/computation_client.h" + namespace torch_xla { class StackFrameIndexBuilder; diff --git a/torch_xla/csrc/matrix.cpp b/torch_xla/csrc/matrix.cpp index 8203034de539..98ffba0a33fc 100644 --- a/torch_xla/csrc/matrix.cpp +++ b/torch_xla/csrc/matrix.cpp @@ -1,14 +1,15 @@ #include "torch_xla/csrc/matrix.h" -#include "torch_xla/csrc/convert_ops.h" -#include "torch_xla/csrc/helpers.h" -#include "torch_xla/csrc/shape_helper.h" #include "xla/hlo/builder/lib/constants.h" #include "xla/hlo/builder/lib/matrix.h" #include "xla/hlo/builder/lib/qr.h" #include "xla/shape_util.h" #include "xla/util.h" +#include "torch_xla/csrc/convert_ops.h" +#include "torch_xla/csrc/helpers.h" +#include "torch_xla/csrc/shape_helper.h" + namespace torch_xla { namespace { diff --git a/torch_xla/csrc/nll_loss.cpp b/torch_xla/csrc/nll_loss.cpp index ba037d574050..e8615d844ed9 100644 --- a/torch_xla/csrc/nll_loss.cpp +++ b/torch_xla/csrc/nll_loss.cpp @@ -1,12 +1,13 @@ #include "torch_xla/csrc/nll_loss.h" #include "absl/types/span.h" +#include "xla/hlo/builder/lib/constants.h" +#include "xla/hlo/builder/lib/math.h" + #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/shape_helper.h" #include "torch_xla/csrc/tensor_util.h" -#include "xla/hlo/builder/lib/constants.h" -#include "xla/hlo/builder/lib/math.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/nll_loss.h b/torch_xla/csrc/nll_loss.h index 321ae311762f..e1ac2dc1cb94 100644 --- a/torch_xla/csrc/nll_loss.h +++ b/torch_xla/csrc/nll_loss.h @@ -2,9 +2,10 @@ #define XLA_TORCH_XLA_CSRC_NLL_LOSS_H_ #include "absl/types/optional.h" -#include "torch_xla/csrc/reduction.h" #include "xla/hlo/builder/xla_builder.h" +#include "torch_xla/csrc/reduction.h" + namespace torch_xla { // Builds the NLLLoss for log-probabilities "logits" and class indices "labels". diff --git a/torch_xla/csrc/ops/all_gather.cpp b/torch_xla/csrc/ops/all_gather.cpp index 23ed15d007f1..acd79e59663a 100644 --- a/torch_xla/csrc/ops/all_gather.cpp +++ b/torch_xla/csrc/ops/all_gather.cpp @@ -1,11 +1,12 @@ #include "torch_xla/csrc/ops/all_gather.h" #include "absl/strings/str_join.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" #include "torch_xla/csrc/ops/xla_ops.h" #include "torch_xla/csrc/runtime/util.h" -#include "xla/shape_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/all_reduce.cpp b/torch_xla/csrc/ops/all_reduce.cpp index 9fafbfcb5152..544dc4007d80 100644 --- a/torch_xla/csrc/ops/all_reduce.cpp +++ b/torch_xla/csrc/ops/all_reduce.cpp @@ -3,10 +3,11 @@ #include #include "absl/strings/str_join.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/xla_ops.h" #include "torch_xla/csrc/runtime/util.h" -#include "xla/shape_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/all_to_all.cpp b/torch_xla/csrc/ops/all_to_all.cpp index d32bf270a0bd..84d5383763c2 100644 --- a/torch_xla/csrc/ops/all_to_all.cpp +++ b/torch_xla/csrc/ops/all_to_all.cpp @@ -1,10 +1,11 @@ #include "torch_xla/csrc/ops/all_to_all.h" #include "absl/strings/str_join.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" #include "torch_xla/csrc/ops/xla_ops.h" -#include "xla/shape_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/amp_foreach_non_finite_check_and_unscale.cpp b/torch_xla/csrc/ops/amp_foreach_non_finite_check_and_unscale.cpp index ac164974020e..b352e10945ba 100644 --- a/torch_xla/csrc/ops/amp_foreach_non_finite_check_and_unscale.cpp +++ b/torch_xla/csrc/ops/amp_foreach_non_finite_check_and_unscale.cpp @@ -1,10 +1,11 @@ #include "torch_xla/csrc/ops/amp_foreach_non_finite_check_and_unscale.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/xla_ops.h" #include "torch_xla/csrc/tensor_util.h" #include "torch_xla/csrc/xla_lower_util.h" -#include "xla/shape_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/amp_update_scale.cpp b/torch_xla/csrc/ops/amp_update_scale.cpp index 40c291a54eb1..e0fb90558f14 100644 --- a/torch_xla/csrc/ops/amp_update_scale.cpp +++ b/torch_xla/csrc/ops/amp_update_scale.cpp @@ -1,10 +1,11 @@ #include "torch_xla/csrc/ops/amp_update_scale.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/xla_ops.h" #include "torch_xla/csrc/tensor_util.h" #include "torch_xla/csrc/xla_lower_util.h" -#include "xla/shape_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/as_strided.cpp b/torch_xla/csrc/ops/as_strided.cpp index 7cc5d8518fc3..fcccd95b5a1b 100644 --- a/torch_xla/csrc/ops/as_strided.cpp +++ b/torch_xla/csrc/ops/as_strided.cpp @@ -1,8 +1,11 @@ #include "torch_xla/csrc/ops/as_strided.h" +#include + #include -#include +#include "xla/shape_util.h" +#include "xla/util.h" #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/helpers.h" @@ -11,8 +14,6 @@ #include "torch_xla/csrc/shape_helper.h" #include "torch_xla/csrc/tensor_util.h" #include "torch_xla/csrc/torch_util.h" -#include "xla/shape_util.h" -#include "xla/util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/as_strided.h b/torch_xla/csrc/ops/as_strided.h index 5fbfc990923b..0b7556352daf 100644 --- a/torch_xla/csrc/ops/as_strided.h +++ b/torch_xla/csrc/ops/as_strided.h @@ -3,9 +3,10 @@ #include -#include "torch_xla/csrc/ir.h" #include "xla/types.h" +#include "torch_xla/csrc/ir.h" + namespace torch_xla { class AsStrided : public XlaNode { diff --git a/torch_xla/csrc/ops/as_strided_view_update.cpp b/torch_xla/csrc/ops/as_strided_view_update.cpp index 77eb336d18cc..973d891af06d 100644 --- a/torch_xla/csrc/ops/as_strided_view_update.cpp +++ b/torch_xla/csrc/ops/as_strided_view_update.cpp @@ -1,5 +1,7 @@ #include "torch_xla/csrc/ops/as_strided_view_update.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" @@ -9,7 +11,6 @@ #include "torch_xla/csrc/shape_helper.h" #include "torch_xla/csrc/tensor_util.h" #include "torch_xla/csrc/torch_util.h" -#include "xla/shape_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/as_strided_view_update.h b/torch_xla/csrc/ops/as_strided_view_update.h index 0a830f0d251d..0822d2038a94 100644 --- a/torch_xla/csrc/ops/as_strided_view_update.h +++ b/torch_xla/csrc/ops/as_strided_view_update.h @@ -3,9 +3,10 @@ #include -#include "torch_xla/csrc/ir.h" #include "xla/types.h" +#include "torch_xla/csrc/ir.h" + namespace torch_xla { class AsStridedViewUpdate : public XlaNode { diff --git a/torch_xla/csrc/ops/avg_pool_nd.cpp b/torch_xla/csrc/ops/avg_pool_nd.cpp index 6797494c5d73..69bcc5711e39 100644 --- a/torch_xla/csrc/ops/avg_pool_nd.cpp +++ b/torch_xla/csrc/ops/avg_pool_nd.cpp @@ -1,6 +1,7 @@ #include "torch_xla/csrc/ops/avg_pool_nd.h" #include "absl/strings/str_join.h" + #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" diff --git a/torch_xla/csrc/ops/cast.cpp b/torch_xla/csrc/ops/cast.cpp index 5dd6005221af..0271b75228cc 100644 --- a/torch_xla/csrc/ops/cast.cpp +++ b/torch_xla/csrc/ops/cast.cpp @@ -2,6 +2,8 @@ #include +#include "xla/primitive_util.h" + #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/dtype.h" #include "torch_xla/csrc/helpers.h" @@ -12,7 +14,6 @@ #include "torch_xla/csrc/shape_helper.h" #include "torch_xla/csrc/tensor_util.h" #include "torch_xla/csrc/torch_util.h" -#include "xla/primitive_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/cast_int4.cpp b/torch_xla/csrc/ops/cast_int4.cpp index 87f23524f983..2dbd2d824380 100644 --- a/torch_xla/csrc/ops/cast_int4.cpp +++ b/torch_xla/csrc/ops/cast_int4.cpp @@ -2,11 +2,12 @@ #include +#include "xla/literal_util.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/xla_ops.h" #include "torch_xla/csrc/quant_util.h" #include "torch_xla/csrc/shape_helper.h" -#include "xla/literal_util.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/cat.h b/torch_xla/csrc/ops/cat.h index c745d54397fc..e11c6f7fca2e 100644 --- a/torch_xla/csrc/ops/cat.h +++ b/torch_xla/csrc/ops/cat.h @@ -4,6 +4,7 @@ #include #include "absl/types/span.h" + #include "torch_xla/csrc/ir.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/collective_permute.cpp b/torch_xla/csrc/ops/collective_permute.cpp index 048355012e0f..c516139c4ead 100644 --- a/torch_xla/csrc/ops/collective_permute.cpp +++ b/torch_xla/csrc/ops/collective_permute.cpp @@ -1,10 +1,11 @@ #include "torch_xla/csrc/ops/collective_permute.h" #include "absl/strings/str_join.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" #include "torch_xla/csrc/ops/xla_ops.h" -#include "xla/shape_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/constant.cpp b/torch_xla/csrc/ops/constant.cpp index 0b8acdc0cd33..ad0c980f1f51 100644 --- a/torch_xla/csrc/ops/constant.cpp +++ b/torch_xla/csrc/ops/constant.cpp @@ -3,11 +3,12 @@ #include #include +#include "xla/layout_util.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/runtime/xla_util.h" #include "torch_xla/csrc/torch_util.h" -#include "xla/layout_util.h" -#include "xla/shape_util.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/constant_pad_nd.cpp b/torch_xla/csrc/ops/constant_pad_nd.cpp index 2707a5a5c4c6..e822c81da58b 100644 --- a/torch_xla/csrc/ops/constant_pad_nd.cpp +++ b/torch_xla/csrc/ops/constant_pad_nd.cpp @@ -1,13 +1,14 @@ #include "torch_xla/csrc/ops/constant_pad_nd.h" #include "absl/strings/str_join.h" +#include "xla/hlo/builder/lib/constants.h" + #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" #include "torch_xla/csrc/ops/scalar.h" #include "torch_xla/csrc/runtime/debug_macros.h" #include "torch_xla/csrc/shape_helper.h" -#include "xla/hlo/builder/lib/constants.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/convolution_backward_overrideable.cpp b/torch_xla/csrc/ops/convolution_backward_overrideable.cpp index 2095d6d8ca99..6e9e5ef3f671 100644 --- a/torch_xla/csrc/ops/convolution_backward_overrideable.cpp +++ b/torch_xla/csrc/ops/convolution_backward_overrideable.cpp @@ -1,6 +1,7 @@ #include "torch_xla/csrc/ops/convolution_backward_overrideable.h" #include "absl/strings/str_join.h" + #include "torch_xla/csrc/convolution.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" diff --git a/torch_xla/csrc/ops/convolution_backward_overrideable.h b/torch_xla/csrc/ops/convolution_backward_overrideable.h index a0981665cbaf..7859af9f70a1 100644 --- a/torch_xla/csrc/ops/convolution_backward_overrideable.h +++ b/torch_xla/csrc/ops/convolution_backward_overrideable.h @@ -2,9 +2,10 @@ #define XLA_TORCH_XLA_CSRC_OPS_CONVOLUTION_BACKWARD_OVERRIDEABLE_H_ #include "absl/types/span.h" -#include "torch_xla/csrc/ir.h" #include "xla/xla_data.pb.h" +#include "torch_xla/csrc/ir.h" + namespace torch_xla { class ConvolutionBackwardOverrideable : public XlaNode { diff --git a/torch_xla/csrc/ops/convolution_overrideable.cpp b/torch_xla/csrc/ops/convolution_overrideable.cpp index 94eb8eb9c15e..4c4260959371 100644 --- a/torch_xla/csrc/ops/convolution_overrideable.cpp +++ b/torch_xla/csrc/ops/convolution_overrideable.cpp @@ -1,6 +1,7 @@ #include "torch_xla/csrc/ops/convolution_overrideable.h" #include "absl/strings/str_join.h" + #include "torch_xla/csrc/convolution.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" diff --git a/torch_xla/csrc/ops/convolution_overrideable.h b/torch_xla/csrc/ops/convolution_overrideable.h index 7f0c053004b2..879999c0a0e6 100644 --- a/torch_xla/csrc/ops/convolution_overrideable.h +++ b/torch_xla/csrc/ops/convolution_overrideable.h @@ -2,9 +2,10 @@ #define XLA_TORCH_XLA_CSRC_OPS_CONVOLUTION_OVERRIDEABLE_H_ #include "absl/types/span.h" -#include "torch_xla/csrc/ir.h" #include "xla/xla_data.pb.h" +#include "torch_xla/csrc/ir.h" + namespace torch_xla { // IR node for 2D & 3D convolutions with or without bias. diff --git a/torch_xla/csrc/ops/cumprod.cpp b/torch_xla/csrc/ops/cumprod.cpp index b5546a4eec1e..fc5bbd0e5864 100644 --- a/torch_xla/csrc/ops/cumprod.cpp +++ b/torch_xla/csrc/ops/cumprod.cpp @@ -2,6 +2,8 @@ #include +#include "xla/hlo/builder/lib/constants.h" + #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" @@ -10,7 +12,6 @@ #include "torch_xla/csrc/shape_helper.h" #include "torch_xla/csrc/tensor_util.h" #include "torch_xla/csrc/torch_util.h" -#include "xla/hlo/builder/lib/constants.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/diagonal.cpp b/torch_xla/csrc/ops/diagonal.cpp index 303a93eb9859..5de226d73828 100644 --- a/torch_xla/csrc/ops/diagonal.cpp +++ b/torch_xla/csrc/ops/diagonal.cpp @@ -2,10 +2,11 @@ #include +#include "xla/shape_util.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/matrix.h" #include "torch_xla/csrc/runtime/debug_macros.h" -#include "xla/shape_util.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/dot_general.cpp b/torch_xla/csrc/ops/dot_general.cpp index 345bfc3a08ff..7a54418fda11 100644 --- a/torch_xla/csrc/ops/dot_general.cpp +++ b/torch_xla/csrc/ops/dot_general.cpp @@ -1,6 +1,7 @@ #include "torch_xla/csrc/ops/dot_general.h" #include + #include #include "torch_xla/csrc/dtype.h" diff --git a/torch_xla/csrc/ops/dynamic_ir.cpp b/torch_xla/csrc/ops/dynamic_ir.cpp index d4e1aac2a616..25f332d7a18a 100644 --- a/torch_xla/csrc/ops/dynamic_ir.cpp +++ b/torch_xla/csrc/ops/dynamic_ir.cpp @@ -1,6 +1,7 @@ #include "torch_xla/csrc/ops/dynamic_ir.h" #include "absl/strings/str_join.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" diff --git a/torch_xla/csrc/ops/dynamic_ir.h b/torch_xla/csrc/ops/dynamic_ir.h index 760138eddffe..49da48051ded 100644 --- a/torch_xla/csrc/ops/dynamic_ir.h +++ b/torch_xla/csrc/ops/dynamic_ir.h @@ -1,8 +1,6 @@ #ifndef XLA_TORCH_XLA_CSRC_OPS_DYNAMIC_IR_H_ #define XLA_TORCH_XLA_CSRC_OPS_DYNAMIC_IR_H_ -#include - #include #include #include @@ -12,8 +10,11 @@ #include #include +#include + #include "absl/log/absl_log.h" #include "torch/csrc/lazy/core/dynamic_ir.h" + #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/ops/scalar.h" #include "torch_xla/csrc/runtime/debug_macros.h" diff --git a/torch_xla/csrc/ops/eigh.cpp b/torch_xla/csrc/ops/eigh.cpp index 17bed6733108..83f65246ebcf 100644 --- a/torch_xla/csrc/ops/eigh.cpp +++ b/torch_xla/csrc/ops/eigh.cpp @@ -2,12 +2,13 @@ #include +#include "xla/hlo/builder/lib/self_adjoint_eig.h" + #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" #include "torch_xla/csrc/tensor_util.h" #include "torch_xla/csrc/torch_util.h" -#include "xla/hlo/builder/lib/self_adjoint_eig.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/eigh.h b/torch_xla/csrc/ops/eigh.h index 07685d812bfb..db86f22877ff 100644 --- a/torch_xla/csrc/ops/eigh.h +++ b/torch_xla/csrc/ops/eigh.h @@ -3,9 +3,10 @@ #include -#include "torch_xla/csrc/ir.h" #include "xla/types.h" +#include "torch_xla/csrc/ir.h" + namespace torch_xla { class Eigh : public XlaNode { diff --git a/torch_xla/csrc/ops/embedding_bag.cpp b/torch_xla/csrc/ops/embedding_bag.cpp index e522f1b5c229..3604608f69cd 100644 --- a/torch_xla/csrc/ops/embedding_bag.cpp +++ b/torch_xla/csrc/ops/embedding_bag.cpp @@ -1,16 +1,17 @@ #include "torch_xla/csrc/ops/embedding_bag.h" +#include "tsl/platform/stacktrace.h" +#include "xla/hlo/builder/lib/constants.h" +#include "xla/hlo/builder/lib/loops.h" +#include "xla/hlo/builder/lib/slicing.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" #include "torch_xla/csrc/ops/xla_ops.h" #include "torch_xla/csrc/shape_helper.h" #include "torch_xla/csrc/xla_lower_util.h" -#include "tsl/platform/stacktrace.h" -#include "xla/hlo/builder/lib/constants.h" -#include "xla/hlo/builder/lib/loops.h" -#include "xla/hlo/builder/lib/slicing.h" -#include "xla/shape_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/expand.cpp b/torch_xla/csrc/ops/expand.cpp index e5dc96f629f8..af105fba9068 100644 --- a/torch_xla/csrc/ops/expand.cpp +++ b/torch_xla/csrc/ops/expand.cpp @@ -1,6 +1,7 @@ #include "torch_xla/csrc/ops/expand.h" #include "absl/strings/str_join.h" + #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" diff --git a/torch_xla/csrc/ops/expand_symint.cpp b/torch_xla/csrc/ops/expand_symint.cpp index dda0fc7d85c2..201ca24d771e 100644 --- a/torch_xla/csrc/ops/expand_symint.cpp +++ b/torch_xla/csrc/ops/expand_symint.cpp @@ -4,11 +4,12 @@ #include #include "absl/strings/str_join.h" +#include "xla/hlo/builder/lib/constants.h" + #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" #include "torch_xla/csrc/runtime/debug_macros.h" -#include "xla/hlo/builder/lib/constants.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/flip.cpp b/torch_xla/csrc/ops/flip.cpp index a6fd7b5e17e2..45db628213b9 100644 --- a/torch_xla/csrc/ops/flip.cpp +++ b/torch_xla/csrc/ops/flip.cpp @@ -1,8 +1,9 @@ #include "torch_xla/csrc/ops/flip.h" -#include "torch_xla/csrc/lowering_context.h" #include "xla/hlo/builder/xla_builder.h" +#include "torch_xla/csrc/lowering_context.h" + namespace torch_xla { Flip::Flip(const torch::lazy::Value& input, std::vector dims) diff --git a/torch_xla/csrc/ops/flip.h b/torch_xla/csrc/ops/flip.h index 99d26b96b308..671123e84522 100644 --- a/torch_xla/csrc/ops/flip.h +++ b/torch_xla/csrc/ops/flip.h @@ -2,6 +2,7 @@ #define XLA_TORCH_XLA_CSRC_OPS_FLIP_H_ #include "absl/types/span.h" + #include "torch_xla/csrc/ir.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/gather.cpp b/torch_xla/csrc/ops/gather.cpp index 3a30d2059e62..4f97c382cdb7 100644 --- a/torch_xla/csrc/ops/gather.cpp +++ b/torch_xla/csrc/ops/gather.cpp @@ -1,10 +1,11 @@ #include "torch_xla/csrc/ops/gather.h" +#include "xla/hlo/builder/lib/slicing.h" + #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" -#include "xla/hlo/builder/lib/slicing.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/generic_slice.cpp b/torch_xla/csrc/ops/generic_slice.cpp index 57591e487c57..86e13b4fd586 100644 --- a/torch_xla/csrc/ops/generic_slice.cpp +++ b/torch_xla/csrc/ops/generic_slice.cpp @@ -1,6 +1,7 @@ #include "torch_xla/csrc/ops/generic_slice.h" #include "absl/strings/str_join.h" + #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" diff --git a/torch_xla/csrc/ops/generic_slice.h b/torch_xla/csrc/ops/generic_slice.h index 472bf898e1d9..88fe37053100 100644 --- a/torch_xla/csrc/ops/generic_slice.h +++ b/torch_xla/csrc/ops/generic_slice.h @@ -2,6 +2,7 @@ #define XLA_TORCH_XLA_CSRC_OPS_GENERIC_SLICE_H_ #include "absl/types/span.h" + #include "torch_xla/csrc/ir.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/get_dimensions_size.cpp b/torch_xla/csrc/ops/get_dimensions_size.cpp index 44bfb56e7601..74b7695fd535 100644 --- a/torch_xla/csrc/ops/get_dimensions_size.cpp +++ b/torch_xla/csrc/ops/get_dimensions_size.cpp @@ -1,11 +1,12 @@ #include "torch_xla/csrc/ops/get_dimensions_size.h" #include "absl/strings/str_join.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/xla_ops.h" #include "torch_xla/csrc/tensor_util.h" -#include "xla/shape_util.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/index_ops.cpp b/torch_xla/csrc/ops/index_ops.cpp index 2b6038bce0a2..ba306c373d72 100644 --- a/torch_xla/csrc/ops/index_ops.cpp +++ b/torch_xla/csrc/ops/index_ops.cpp @@ -3,8 +3,11 @@ #include #include #include + #include +#include "xla/permutation_util.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" @@ -23,7 +26,6 @@ #include "torch_xla/csrc/tensor_util.h" #include "torch_xla/csrc/xla_graph_executor.h" #include "torch_xla/csrc/xla_lower_util.h" -#include "xla/permutation_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/index_select.cpp b/torch_xla/csrc/ops/index_select.cpp index 59c48ec8ef3f..11e88c97b296 100644 --- a/torch_xla/csrc/ops/index_select.cpp +++ b/torch_xla/csrc/ops/index_select.cpp @@ -1,9 +1,10 @@ #include "torch_xla/csrc/ops/index_select.h" +#include "xla/hlo/builder/lib/slicing.h" + #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" -#include "xla/hlo/builder/lib/slicing.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/logsumexp.cpp b/torch_xla/csrc/ops/logsumexp.cpp index ac466e18a534..d6ab75db8aa9 100644 --- a/torch_xla/csrc/ops/logsumexp.cpp +++ b/torch_xla/csrc/ops/logsumexp.cpp @@ -1,6 +1,7 @@ #include "torch_xla/csrc/ops/logsumexp.h" #include "absl/strings/str_join.h" + #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" diff --git a/torch_xla/csrc/ops/masked_select.cpp b/torch_xla/csrc/ops/masked_select.cpp index e64051789f51..3644f8166520 100644 --- a/torch_xla/csrc/ops/masked_select.cpp +++ b/torch_xla/csrc/ops/masked_select.cpp @@ -1,9 +1,10 @@ #include "torch_xla/csrc/ops/masked_select.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/tensor_util.h" #include "torch_xla/csrc/xla_lower_util.h" -#include "xla/shape_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/mean.cpp b/torch_xla/csrc/ops/mean.cpp index ee45be8d7987..f9765ef2232b 100644 --- a/torch_xla/csrc/ops/mean.cpp +++ b/torch_xla/csrc/ops/mean.cpp @@ -3,6 +3,7 @@ #include #include "absl/strings/str_join.h" + #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" diff --git a/torch_xla/csrc/ops/mean.h b/torch_xla/csrc/ops/mean.h index 3612b6b65cdf..380ba9eef70e 100644 --- a/torch_xla/csrc/ops/mean.h +++ b/torch_xla/csrc/ops/mean.h @@ -6,9 +6,10 @@ #include #include -#include "torch_xla/csrc/ir.h" #include "xla/types.h" +#include "torch_xla/csrc/ir.h" + namespace torch_xla { class Mean : public XlaNode { diff --git a/torch_xla/csrc/ops/mse_loss.cpp b/torch_xla/csrc/ops/mse_loss.cpp index c816c32e4f5f..196865423a99 100644 --- a/torch_xla/csrc/ops/mse_loss.cpp +++ b/torch_xla/csrc/ops/mse_loss.cpp @@ -1,6 +1,7 @@ #include "torch_xla/csrc/ops/mse_loss.h" #include + #include #include "torch_xla/csrc/lowering_context.h" diff --git a/torch_xla/csrc/ops/mse_loss.h b/torch_xla/csrc/ops/mse_loss.h index 1e6d657c4d43..fbdcc8f9c06b 100644 --- a/torch_xla/csrc/ops/mse_loss.h +++ b/torch_xla/csrc/ops/mse_loss.h @@ -1,9 +1,10 @@ #ifndef XLA_TORCH_XLA_CSRC_OPS_MSE_LOSS_H_ #define XLA_TORCH_XLA_CSRC_OPS_MSE_LOSS_H_ +#include "xla/types.h" + #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/reduction.h" -#include "xla/types.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/mse_loss_backward.h b/torch_xla/csrc/ops/mse_loss_backward.h index 969881503727..20c667d9b3f1 100644 --- a/torch_xla/csrc/ops/mse_loss_backward.h +++ b/torch_xla/csrc/ops/mse_loss_backward.h @@ -1,9 +1,10 @@ #ifndef XLA_TORCH_XLA_CSRC_OPS_MSE_LOSS_BACKWARD_H_ #define XLA_TORCH_XLA_CSRC_OPS_MSE_LOSS_BACKWARD_H_ +#include "xla/types.h" + #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/reduction.h" -#include "xla/types.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/nll_loss.cpp b/torch_xla/csrc/ops/nll_loss.cpp index c87f054d16ee..009b2ecfcbb5 100644 --- a/torch_xla/csrc/ops/nll_loss.cpp +++ b/torch_xla/csrc/ops/nll_loss.cpp @@ -3,6 +3,7 @@ #include #include "absl/types/span.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/nll_loss.h" #include "torch_xla/csrc/ops/infer_output_shape.h" diff --git a/torch_xla/csrc/ops/nll_loss.h b/torch_xla/csrc/ops/nll_loss.h index ba42dc6d3a85..c27c6b3607ee 100644 --- a/torch_xla/csrc/ops/nll_loss.h +++ b/torch_xla/csrc/ops/nll_loss.h @@ -2,6 +2,7 @@ #define XLA_TORCH_XLA_CSRC_OPS_NLL_LOSS_H_ #include "absl/types/optional.h" + #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/reduction.h" diff --git a/torch_xla/csrc/ops/nll_loss2d.cpp b/torch_xla/csrc/ops/nll_loss2d.cpp index 66e2fa37b7fb..7b0c67b58029 100644 --- a/torch_xla/csrc/ops/nll_loss2d.cpp +++ b/torch_xla/csrc/ops/nll_loss2d.cpp @@ -3,6 +3,7 @@ #include #include "absl/types/span.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/nll_loss.h" #include "torch_xla/csrc/ops/infer_output_shape.h" diff --git a/torch_xla/csrc/ops/nll_loss2d.h b/torch_xla/csrc/ops/nll_loss2d.h index f344128d231b..85027a65911a 100644 --- a/torch_xla/csrc/ops/nll_loss2d.h +++ b/torch_xla/csrc/ops/nll_loss2d.h @@ -2,6 +2,7 @@ #define XLA_TORCH_XLA_CSRC_OPS_NLL_LOSS2D_H_ #include "absl/types/optional.h" + #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/reduction.h" diff --git a/torch_xla/csrc/ops/nll_loss2d_backward.h b/torch_xla/csrc/ops/nll_loss2d_backward.h index dd2531c30bb1..8ccfb9967ec0 100644 --- a/torch_xla/csrc/ops/nll_loss2d_backward.h +++ b/torch_xla/csrc/ops/nll_loss2d_backward.h @@ -2,6 +2,7 @@ #define XLA_TORCH_XLA_CSRC_OPS_NLL_LOSS2D_BACKWARD_H_ #include "absl/types/optional.h" + #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/reduction.h" diff --git a/torch_xla/csrc/ops/nll_loss_backward.h b/torch_xla/csrc/ops/nll_loss_backward.h index 2772e2820167..d3a053d9d7f9 100644 --- a/torch_xla/csrc/ops/nll_loss_backward.h +++ b/torch_xla/csrc/ops/nll_loss_backward.h @@ -2,6 +2,7 @@ #define XLA_TORCH_XLA_CSRC_OPS_NLL_LOSS_BACKWARD_H_ #include "absl/types/optional.h" + #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/reduction.h" diff --git a/torch_xla/csrc/ops/nonzero.cpp b/torch_xla/csrc/ops/nonzero.cpp index a02b23a48e30..823dd0fe1686 100644 --- a/torch_xla/csrc/ops/nonzero.cpp +++ b/torch_xla/csrc/ops/nonzero.cpp @@ -1,9 +1,10 @@ #include "torch_xla/csrc/ops/nonzero.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/tensor_util.h" #include "torch_xla/csrc/xla_lower_util.h" -#include "xla/shape_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/ops.cpp b/torch_xla/csrc/ops/ops.cpp index 527b07af31d0..34d86f35b1c6 100644 --- a/torch_xla/csrc/ops/ops.cpp +++ b/torch_xla/csrc/ops/ops.cpp @@ -1,9 +1,16 @@ #include "torch_xla/csrc/ops/ops.h" +#include + #include #include -#include +#include "xla/hlo/builder/lib/constants.h" +#include "xla/hlo/builder/lib/logdet.h" +#include "xla/hlo/builder/lib/math.h" +#include "xla/hlo/builder/lib/matrix.h" +#include "xla/hlo/builder/lib/slicing.h" +#include "xla/shape_util.h" #include "torch_xla/csrc/LazyIr.h" #include "torch_xla/csrc/convert_ops.h" @@ -31,12 +38,6 @@ #include "torch_xla/csrc/tensor_util.h" #include "torch_xla/csrc/torch_util.h" #include "torch_xla/csrc/xla_lower_util.h" -#include "xla/hlo/builder/lib/constants.h" -#include "xla/hlo/builder/lib/logdet.h" -#include "xla/hlo/builder/lib/math.h" -#include "xla/hlo/builder/lib/matrix.h" -#include "xla/hlo/builder/lib/slicing.h" -#include "xla/shape_util.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/ops_lower_fn.cpp b/torch_xla/csrc/ops/ops_lower_fn.cpp index ed25cf087f23..9a0f8eaf579f 100644 --- a/torch_xla/csrc/ops/ops_lower_fn.cpp +++ b/torch_xla/csrc/ops/ops_lower_fn.cpp @@ -1,5 +1,10 @@ #include +#include "xla/hlo/builder/lib/constants.h" +#include "xla/hlo/builder/lib/logdet.h" +#include "xla/hlo/builder/lib/math.h" +#include "xla/hlo/builder/lib/matrix.h" + #include "torch_xla/csrc/LazyIr.h" #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/data_ops.h" @@ -11,10 +16,6 @@ #include "torch_xla/csrc/reduction.h" #include "torch_xla/csrc/shape_helper.h" #include "torch_xla/csrc/xla_lower_util.h" -#include "xla/hlo/builder/lib/constants.h" -#include "xla/hlo/builder/lib/logdet.h" -#include "xla/hlo/builder/lib/math.h" -#include "xla/hlo/builder/lib/matrix.h" namespace torch_xla { torch_xla::XlaOpVector Abs::Lower(LoweringContext* loctx) const { diff --git a/torch_xla/csrc/ops/ops_xla_shape_fn.cpp b/torch_xla/csrc/ops/ops_xla_shape_fn.cpp index 1881f6631c9f..cbf42f5b1990 100644 --- a/torch_xla/csrc/ops/ops_xla_shape_fn.cpp +++ b/torch_xla/csrc/ops/ops_xla_shape_fn.cpp @@ -2,14 +2,15 @@ #include +#include "xla/hlo/builder/lib/logdet.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/elementwise.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/pooling.h" #include "torch_xla/csrc/reduction.h" #include "torch_xla/csrc/xla_lower_util.h" -#include "xla/hlo/builder/lib/logdet.h" -#include "xla/shape_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/optimization_barrier.cpp b/torch_xla/csrc/ops/optimization_barrier.cpp index 119ff1426e8a..0728a529f5b3 100644 --- a/torch_xla/csrc/ops/optimization_barrier.cpp +++ b/torch_xla/csrc/ops/optimization_barrier.cpp @@ -1,10 +1,11 @@ #include "torch_xla/csrc/ops/optimization_barrier.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/xla_ops.h" #include "torch_xla/csrc/tensor_util.h" #include "torch_xla/csrc/xla_lower_util.h" -#include "xla/shape_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/permute.h b/torch_xla/csrc/ops/permute.h index 3c43bb1c27ac..c419e28f1b7c 100644 --- a/torch_xla/csrc/ops/permute.h +++ b/torch_xla/csrc/ops/permute.h @@ -2,6 +2,7 @@ #define XLA_TORCH_XLA_CSRC_OPS_PERMUTE_H_ #include "absl/types/span.h" + #include "torch_xla/csrc/ir.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/prod.cpp b/torch_xla/csrc/ops/prod.cpp index 1806dd0f94c1..bb0cc5a90147 100644 --- a/torch_xla/csrc/ops/prod.cpp +++ b/torch_xla/csrc/ops/prod.cpp @@ -3,6 +3,7 @@ #include #include "absl/strings/str_join.h" + #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" diff --git a/torch_xla/csrc/ops/prod.h b/torch_xla/csrc/ops/prod.h index 3fbff25929f3..a2153aba2b26 100644 --- a/torch_xla/csrc/ops/prod.h +++ b/torch_xla/csrc/ops/prod.h @@ -6,6 +6,7 @@ #include #include "absl/types/span.h" + #include "torch_xla/csrc/ir.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/qr.cpp b/torch_xla/csrc/ops/qr.cpp index 77eb4f717450..a067a77d41d6 100644 --- a/torch_xla/csrc/ops/qr.cpp +++ b/torch_xla/csrc/ops/qr.cpp @@ -1,12 +1,13 @@ #include "torch_xla/csrc/ops/qr.h" -#include "torch_xla/csrc/data_ops.h" -#include "torch_xla/csrc/helpers.h" -#include "torch_xla/csrc/lowering_context.h" #include "xla/hlo/builder/lib/constants.h" #include "xla/hlo/builder/lib/matrix.h" #include "xla/hlo/builder/lib/qr.h" +#include "torch_xla/csrc/data_ops.h" +#include "torch_xla/csrc/helpers.h" +#include "torch_xla/csrc/lowering_context.h" + namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/randperm.cpp b/torch_xla/csrc/ops/randperm.cpp index a40ae1ecc36a..c9a0b6450ed1 100644 --- a/torch_xla/csrc/ops/randperm.cpp +++ b/torch_xla/csrc/ops/randperm.cpp @@ -1,13 +1,14 @@ #include "torch_xla/csrc/ops/randperm.h" -#include "torch_xla/csrc/lowering_context.h" -#include "torch_xla/csrc/ops/infer_output_shape.h" -#include "torch_xla/csrc/ops/xla_ops.h" #include "tsl/platform/stacktrace.h" #include "tsl/platform/statusor.h" #include "xla/hlo/builder/lib/loops.h" #include "xla/shape_util.h" +#include "torch_xla/csrc/lowering_context.h" +#include "torch_xla/csrc/ops/infer_output_shape.h" +#include "torch_xla/csrc/ops/xla_ops.h" + namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/reduce_scatter.cpp b/torch_xla/csrc/ops/reduce_scatter.cpp index 81bab7342cf3..91404dda0fb5 100644 --- a/torch_xla/csrc/ops/reduce_scatter.cpp +++ b/torch_xla/csrc/ops/reduce_scatter.cpp @@ -3,10 +3,11 @@ #include #include "absl/strings/str_join.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" #include "torch_xla/csrc/ops/xla_ops.h" -#include "xla/shape_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/reflection_pad2d.cpp b/torch_xla/csrc/ops/reflection_pad2d.cpp index 85e7ff4092cc..bb143154d4a2 100644 --- a/torch_xla/csrc/ops/reflection_pad2d.cpp +++ b/torch_xla/csrc/ops/reflection_pad2d.cpp @@ -1,6 +1,7 @@ #include "torch_xla/csrc/ops/reflection_pad2d.h" #include "absl/strings/str_join.h" + #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" diff --git a/torch_xla/csrc/ops/reflection_pad2d_backward.cpp b/torch_xla/csrc/ops/reflection_pad2d_backward.cpp index 17d5737ca3f2..2d892fffdaae 100644 --- a/torch_xla/csrc/ops/reflection_pad2d_backward.cpp +++ b/torch_xla/csrc/ops/reflection_pad2d_backward.cpp @@ -1,6 +1,7 @@ #include "torch_xla/csrc/ops/reflection_pad2d_backward.h" #include "absl/strings/str_join.h" + #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" diff --git a/torch_xla/csrc/ops/replication_pad.h b/torch_xla/csrc/ops/replication_pad.h index 3fab2e5750d6..e63525fa10e1 100644 --- a/torch_xla/csrc/ops/replication_pad.h +++ b/torch_xla/csrc/ops/replication_pad.h @@ -2,6 +2,7 @@ #define XLA_TORCH_XLA_CSRC_OPS_REPLICATION_PAD_H_ #include "absl/types/span.h" + #include "torch_xla/csrc/ir.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/replication_pad_backward.cpp b/torch_xla/csrc/ops/replication_pad_backward.cpp index c8f151e17e08..fd002f7c985e 100644 --- a/torch_xla/csrc/ops/replication_pad_backward.cpp +++ b/torch_xla/csrc/ops/replication_pad_backward.cpp @@ -1,6 +1,7 @@ #include "torch_xla/csrc/ops/replication_pad_backward.h" #include "absl/strings/str_join.h" + #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" diff --git a/torch_xla/csrc/ops/resize.cpp b/torch_xla/csrc/ops/resize.cpp index 9cc27534bc7b..4d0b1e7d147b 100644 --- a/torch_xla/csrc/ops/resize.cpp +++ b/torch_xla/csrc/ops/resize.cpp @@ -1,9 +1,10 @@ #include "torch_xla/csrc/ops/resize.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/runtime/debug_macros.h" -#include "xla/shape_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/rrelu_with_noise.h b/torch_xla/csrc/ops/rrelu_with_noise.h index ca458495d846..af6a56294a09 100644 --- a/torch_xla/csrc/ops/rrelu_with_noise.h +++ b/torch_xla/csrc/ops/rrelu_with_noise.h @@ -3,9 +3,10 @@ #include -#include "torch_xla/csrc/ir.h" #include "xla/types.h" +#include "torch_xla/csrc/ir.h" + namespace torch_xla { class RreluWithNoise : public XlaNode { diff --git a/torch_xla/csrc/ops/scalar.cpp b/torch_xla/csrc/ops/scalar.cpp index 81731bd174c7..b3c6d4c1d6c4 100644 --- a/torch_xla/csrc/ops/scalar.cpp +++ b/torch_xla/csrc/ops/scalar.cpp @@ -3,10 +3,11 @@ #include #include +#include "xla/shape_util.h" + #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/runtime/debug_macros.h" -#include "xla/shape_util.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/split.cpp b/torch_xla/csrc/ops/split.cpp index ea8353f31d0c..aa2b0fd5a708 100644 --- a/torch_xla/csrc/ops/split.cpp +++ b/torch_xla/csrc/ops/split.cpp @@ -1,6 +1,7 @@ #include "torch_xla/csrc/ops/split.h" #include "absl/strings/str_join.h" + #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" diff --git a/torch_xla/csrc/ops/stack.h b/torch_xla/csrc/ops/stack.h index be71c156d777..1cc72279f5ba 100644 --- a/torch_xla/csrc/ops/stack.h +++ b/torch_xla/csrc/ops/stack.h @@ -2,6 +2,7 @@ #define XLA_TORCH_XLA_CSRC_OPS_STACK_H_ #include "absl/types/span.h" + #include "torch_xla/csrc/ir.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/std.cpp b/torch_xla/csrc/ops/std.cpp index bc97f57a6d7f..1a9f4cc6cb98 100644 --- a/torch_xla/csrc/ops/std.cpp +++ b/torch_xla/csrc/ops/std.cpp @@ -1,6 +1,7 @@ #include "torch_xla/csrc/ops/std.h" #include "absl/strings/str_join.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" #include "torch_xla/csrc/reduction.h" diff --git a/torch_xla/csrc/ops/std.h b/torch_xla/csrc/ops/std.h index 6c9531d6982e..d494e07ae11a 100644 --- a/torch_xla/csrc/ops/std.h +++ b/torch_xla/csrc/ops/std.h @@ -3,9 +3,10 @@ #include -#include "torch_xla/csrc/ir.h" #include "xla/types.h" +#include "torch_xla/csrc/ir.h" + namespace torch_xla { class Std : public XlaNode { diff --git a/torch_xla/csrc/ops/std_mean.cpp b/torch_xla/csrc/ops/std_mean.cpp index 4c3f7d027f1b..6cb0966e47ae 100644 --- a/torch_xla/csrc/ops/std_mean.cpp +++ b/torch_xla/csrc/ops/std_mean.cpp @@ -1,6 +1,7 @@ #include "torch_xla/csrc/ops/std_mean.h" #include "absl/strings/str_join.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" #include "torch_xla/csrc/reduction.h" diff --git a/torch_xla/csrc/ops/std_mean.h b/torch_xla/csrc/ops/std_mean.h index ba1037b518e8..3494a15c2d98 100644 --- a/torch_xla/csrc/ops/std_mean.h +++ b/torch_xla/csrc/ops/std_mean.h @@ -3,9 +3,10 @@ #include -#include "torch_xla/csrc/ir.h" #include "xla/types.h" +#include "torch_xla/csrc/ir.h" + namespace torch_xla { class StdMean : public XlaNode { diff --git a/torch_xla/csrc/ops/sum.cpp b/torch_xla/csrc/ops/sum.cpp index fcb8cb77db04..f1694ee3412a 100644 --- a/torch_xla/csrc/ops/sum.cpp +++ b/torch_xla/csrc/ops/sum.cpp @@ -3,6 +3,7 @@ #include #include "absl/strings/str_join.h" + #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" diff --git a/torch_xla/csrc/ops/sum.h b/torch_xla/csrc/ops/sum.h index 638baa63834b..67ecfdc0542b 100644 --- a/torch_xla/csrc/ops/sum.h +++ b/torch_xla/csrc/ops/sum.h @@ -6,6 +6,7 @@ #include #include "absl/types/span.h" + #include "torch_xla/csrc/ir.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/svd.cpp b/torch_xla/csrc/ops/svd.cpp index 1b6de1f51ed5..64bacbed6411 100644 --- a/torch_xla/csrc/ops/svd.cpp +++ b/torch_xla/csrc/ops/svd.cpp @@ -2,14 +2,15 @@ #include +#include "xla/hlo/builder/lib/constants.h" +#include "xla/hlo/builder/lib/matrix.h" +#include "xla/hlo/builder/lib/svd.h" + #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/runtime/util.h" #include "torch_xla/csrc/shape_helper.h" -#include "xla/hlo/builder/lib/constants.h" -#include "xla/hlo/builder/lib/matrix.h" -#include "xla/hlo/builder/lib/svd.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/symeig.cpp b/torch_xla/csrc/ops/symeig.cpp index 4b63a15cbfad..996f91ba5cc2 100644 --- a/torch_xla/csrc/ops/symeig.cpp +++ b/torch_xla/csrc/ops/symeig.cpp @@ -1,11 +1,12 @@ #include "torch_xla/csrc/ops/symeig.h" -#include "torch_xla/csrc/lowering_context.h" -#include "torch_xla/csrc/shape_helper.h" #include "xla/hlo/builder/lib/constants.h" #include "xla/hlo/builder/lib/matrix.h" #include "xla/hlo/builder/lib/self_adjoint_eig.h" +#include "torch_xla/csrc/lowering_context.h" +#include "torch_xla/csrc/shape_helper.h" + namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/triangular_solve.cpp b/torch_xla/csrc/ops/triangular_solve.cpp index 4bf1d77940c4..13e353abfa96 100644 --- a/torch_xla/csrc/ops/triangular_solve.cpp +++ b/torch_xla/csrc/ops/triangular_solve.cpp @@ -1,11 +1,12 @@ #include "torch_xla/csrc/ops/triangular_solve.h" +#include "xla/hlo/builder/xla_builder.h" +#include "xla/layout_util.h" + #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/shape_helper.h" #include "torch_xla/csrc/status.h" -#include "xla/hlo/builder/xla_builder.h" -#include "xla/layout_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/ops/update_slice.cpp b/torch_xla/csrc/ops/update_slice.cpp index 7404e9c95c74..89f31aa1d161 100644 --- a/torch_xla/csrc/ops/update_slice.cpp +++ b/torch_xla/csrc/ops/update_slice.cpp @@ -1,6 +1,7 @@ #include "torch_xla/csrc/ops/update_slice.h" #include "absl/strings/str_join.h" + #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" diff --git a/torch_xla/csrc/ops/update_slice.h b/torch_xla/csrc/ops/update_slice.h index 32e14bbe61ee..89075c67203e 100644 --- a/torch_xla/csrc/ops/update_slice.h +++ b/torch_xla/csrc/ops/update_slice.h @@ -2,6 +2,7 @@ #define XLA_TORCH_XLA_CSRC_OPS_UPDATE_SLICE_H_ #include "absl/types/span.h" + #include "torch_xla/csrc/ir.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/upsample_bilinear2d.cpp b/torch_xla/csrc/ops/upsample_bilinear2d.cpp index bb8c3e9de14d..c54ff16c562d 100644 --- a/torch_xla/csrc/ops/upsample_bilinear2d.cpp +++ b/torch_xla/csrc/ops/upsample_bilinear2d.cpp @@ -1,9 +1,10 @@ #include "torch_xla/csrc/ops/upsample_bilinear2d.h" #include "absl/strings/str_join.h" +#include "xla/util.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/resize_ops.h" -#include "xla/util.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/upsample_bilinear2d_backward.cpp b/torch_xla/csrc/ops/upsample_bilinear2d_backward.cpp index 4d02d99ab642..dfee51ff52fe 100644 --- a/torch_xla/csrc/ops/upsample_bilinear2d_backward.cpp +++ b/torch_xla/csrc/ops/upsample_bilinear2d_backward.cpp @@ -1,6 +1,7 @@ #include "torch_xla/csrc/ops/upsample_bilinear2d_backward.h" #include "absl/strings/str_join.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/resize_ops.h" #include "torch_xla/csrc/runtime/debug_macros.h" diff --git a/torch_xla/csrc/ops/upsample_nearest2d.cpp b/torch_xla/csrc/ops/upsample_nearest2d.cpp index bdac0d14e4a2..b3ffa57be615 100644 --- a/torch_xla/csrc/ops/upsample_nearest2d.cpp +++ b/torch_xla/csrc/ops/upsample_nearest2d.cpp @@ -1,9 +1,10 @@ #include "torch_xla/csrc/ops/upsample_nearest2d.h" #include "absl/strings/str_join.h" +#include "xla/util.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/resize_ops.h" -#include "xla/util.h" namespace torch_xla { diff --git a/torch_xla/csrc/ops/upsample_nearest2d_backward.cpp b/torch_xla/csrc/ops/upsample_nearest2d_backward.cpp index 675273d16840..dde736caae91 100644 --- a/torch_xla/csrc/ops/upsample_nearest2d_backward.cpp +++ b/torch_xla/csrc/ops/upsample_nearest2d_backward.cpp @@ -1,6 +1,7 @@ #include "torch_xla/csrc/ops/upsample_nearest2d_backward.h" #include "absl/strings/str_join.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/resize_ops.h" #include "torch_xla/csrc/runtime/debug_macros.h" diff --git a/torch_xla/csrc/ops/var.cpp b/torch_xla/csrc/ops/var.cpp index 583569c95d2b..433b5d7ad10c 100644 --- a/torch_xla/csrc/ops/var.cpp +++ b/torch_xla/csrc/ops/var.cpp @@ -1,6 +1,7 @@ #include "torch_xla/csrc/ops/var.h" #include "absl/strings/str_join.h" + #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" diff --git a/torch_xla/csrc/ops/var.h b/torch_xla/csrc/ops/var.h index e373fdacdd6d..b6e652ce5ce8 100644 --- a/torch_xla/csrc/ops/var.h +++ b/torch_xla/csrc/ops/var.h @@ -3,9 +3,10 @@ #include -#include "torch_xla/csrc/ir.h" #include "xla/types.h" +#include "torch_xla/csrc/ir.h" + namespace torch_xla { class Var : public XlaNode { diff --git a/torch_xla/csrc/ops/var_mean.cpp b/torch_xla/csrc/ops/var_mean.cpp index d56e23b5b067..c06ad2eec8ac 100644 --- a/torch_xla/csrc/ops/var_mean.cpp +++ b/torch_xla/csrc/ops/var_mean.cpp @@ -1,6 +1,7 @@ #include "torch_xla/csrc/ops/var_mean.h" #include "absl/strings/str_join.h" + #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" diff --git a/torch_xla/csrc/ops/var_mean.h b/torch_xla/csrc/ops/var_mean.h index 8d8f4adf311a..e294d717bc7a 100644 --- a/torch_xla/csrc/ops/var_mean.h +++ b/torch_xla/csrc/ops/var_mean.h @@ -3,9 +3,10 @@ #include -#include "torch_xla/csrc/ir.h" #include "xla/types.h" +#include "torch_xla/csrc/ir.h" + namespace torch_xla { class VarMean : public XlaNode { diff --git a/torch_xla/csrc/ops/view.cpp b/torch_xla/csrc/ops/view.cpp index 8b9eebed64af..c9cb68e44d59 100644 --- a/torch_xla/csrc/ops/view.cpp +++ b/torch_xla/csrc/ops/view.cpp @@ -1,11 +1,12 @@ #include "torch_xla/csrc/ops/view.h" #include "absl/strings/str_join.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/shape_helper.h" -#include "xla/shape_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/pooling.cpp b/torch_xla/csrc/pooling.cpp index 934de6db67db..47b3f1b5c95e 100644 --- a/torch_xla/csrc/pooling.cpp +++ b/torch_xla/csrc/pooling.cpp @@ -4,6 +4,12 @@ #include #include "absl/status/status.h" +#include "xla/hlo/builder/lib/arithmetic.h" +#include "xla/hlo/builder/lib/constants.h" +#include "xla/hlo/builder/lib/loops.h" +#include "xla/hlo/builder/lib/pooling.h" +#include "xla/hlo/builder/lib/slicing.h" + #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/runtime/debug_macros.h" @@ -12,11 +18,6 @@ #include "torch_xla/csrc/status.h" #include "torch_xla/csrc/tensor_util.h" #include "torch_xla/csrc/xla_lower_util.h" -#include "xla/hlo/builder/lib/arithmetic.h" -#include "xla/hlo/builder/lib/constants.h" -#include "xla/hlo/builder/lib/loops.h" -#include "xla/hlo/builder/lib/pooling.h" -#include "xla/hlo/builder/lib/slicing.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/pooling.h b/torch_xla/csrc/pooling.h index 73bccd2baf41..30f80668bd78 100644 --- a/torch_xla/csrc/pooling.h +++ b/torch_xla/csrc/pooling.h @@ -2,9 +2,10 @@ #define XLA_TORCH_XLA_CSRC_POOLING_H_ #include "absl/types/span.h" -#include "torch_xla/csrc/device.h" #include "xla/hlo/builder/xla_builder.h" +#include "torch_xla/csrc/device.h" + namespace torch_xla { struct MaxPoolResult { diff --git a/torch_xla/csrc/random.cpp b/torch_xla/csrc/random.cpp index a2f4699b933a..e24d79a1cca4 100644 --- a/torch_xla/csrc/random.cpp +++ b/torch_xla/csrc/random.cpp @@ -3,6 +3,9 @@ #include #include +#include "xla/hlo/builder/lib/constants.h" +#include "xla/hlo/builder/lib/prng.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/device.h" @@ -10,8 +13,6 @@ #include "torch_xla/csrc/runtime/debug_macros.h" #include "torch_xla/csrc/runtime/sys_util.h" #include "torch_xla/csrc/shape_helper.h" -#include "xla/hlo/builder/lib/constants.h" -#include "xla/hlo/builder/lib/prng.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/reduction.cpp b/torch_xla/csrc/reduction.cpp index 007032e794ba..9e759aef7000 100644 --- a/torch_xla/csrc/reduction.cpp +++ b/torch_xla/csrc/reduction.cpp @@ -1,12 +1,18 @@ #include "torch_xla/csrc/reduction.h" #include -#include -#include #include #include +#include +#include + +#include "xla/hlo/builder/lib/arithmetic.h" +#include "xla/hlo/builder/lib/constants.h" +#include "xla/hlo/builder/lib/matrix.h" +#include "xla/literal_util.h" + #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/ops/einsum_utilities.h" @@ -14,10 +20,6 @@ #include "torch_xla/csrc/shape_helper.h" #include "torch_xla/csrc/status.h" #include "torch_xla/csrc/tensor_util.h" -#include "xla/hlo/builder/lib/arithmetic.h" -#include "xla/hlo/builder/lib/constants.h" -#include "xla/hlo/builder/lib/matrix.h" -#include "xla/literal_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/resize_ops.cpp b/torch_xla/csrc/resize_ops.cpp index 7cdb8cd5ddc0..db9bb8dcfa0a 100644 --- a/torch_xla/csrc/resize_ops.cpp +++ b/torch_xla/csrc/resize_ops.cpp @@ -1,6 +1,10 @@ #include "torch_xla/csrc/resize_ops.h" #include "absl/strings/str_cat.h" +#include "xla/hlo/builder/lib/constants.h" +#include "xla/shape_util.h" +#include "xla/util.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/helpers.h" @@ -8,9 +12,6 @@ #include "torch_xla/csrc/runtime/sys_util.h" #include "torch_xla/csrc/shape_builder.h" #include "torch_xla/csrc/shape_helper.h" -#include "xla/hlo/builder/lib/constants.h" -#include "xla/shape_util.h" -#include "xla/util.h" namespace torch_xla { namespace resize { diff --git a/torch_xla/csrc/runtime/cache.h b/torch_xla/csrc/runtime/cache.h index caf062a6ccee..1f4ffed7e3c0 100644 --- a/torch_xla/csrc/runtime/cache.h +++ b/torch_xla/csrc/runtime/cache.h @@ -2,7 +2,6 @@ #define XLA_CLIENT_CACHE_H_ #include -#include #include #include @@ -14,6 +13,8 @@ #include #include +#include + namespace torch_xla { namespace runtime { namespace util { diff --git a/torch_xla/csrc/runtime/computation_client.cpp b/torch_xla/csrc/runtime/computation_client.cpp index 2cf2dcec177d..57ee918f1e99 100644 --- a/torch_xla/csrc/runtime/computation_client.cpp +++ b/torch_xla/csrc/runtime/computation_client.cpp @@ -10,12 +10,13 @@ #include "absl/memory/memory.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_split.h" +#include "tsl/platform/stacktrace_handler.h" +#include "xla/status_macros.h" + #include "torch_xla/csrc/runtime/debug_macros.h" #include "torch_xla/csrc/runtime/env_vars.h" #include "torch_xla/csrc/runtime/sys_util.h" #include "torch_xla/csrc/runtime/xla_util.h" -#include "tsl/platform/stacktrace_handler.h" -#include "xla/status_macros.h" namespace torch_xla { namespace runtime { diff --git a/torch_xla/csrc/runtime/computation_client.h b/torch_xla/csrc/runtime/computation_client.h index 364641a88692..2d81c7fb3f5b 100644 --- a/torch_xla/csrc/runtime/computation_client.h +++ b/torch_xla/csrc/runtime/computation_client.h @@ -2,11 +2,6 @@ #define XLA_CLIENT_COMPUTATION_CLIENT_H_ #include -#include -#include -#include -#include -#include #include #include @@ -15,10 +10,23 @@ #include #include +#include +#include +#include +#include +#include + #include "absl/container/flat_hash_map.h" #include "absl/status/statusor.h" #include "absl/types/optional.h" #include "absl/types/span.h" +#include "xla/hlo/builder/xla_computation.h" +#include "xla/hlo/ir/hlo_module.h" +#include "xla/literal_util.h" +#include "xla/pjrt/pjrt_client.h" +#include "xla/pjrt/pjrt_common.h" +#include "xla/types.h" + #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/runtime/debug_macros.h" #include "torch_xla/csrc/runtime/metrics.h" @@ -26,12 +34,6 @@ #include "torch_xla/csrc/runtime/types.h" #include "torch_xla/csrc/runtime/util.h" #include "torch_xla/csrc/status.h" -#include "xla/hlo/builder/xla_computation.h" -#include "xla/hlo/ir/hlo_module.h" -#include "xla/literal_util.h" -#include "xla/pjrt/pjrt_client.h" -#include "xla/pjrt/pjrt_common.h" -#include "xla/types.h" namespace torch_xla { namespace runtime { diff --git a/torch_xla/csrc/runtime/debug_macros.h b/torch_xla/csrc/runtime/debug_macros.h index 19e958a792ee..da920642e1dd 100644 --- a/torch_xla/csrc/runtime/debug_macros.h +++ b/torch_xla/csrc/runtime/debug_macros.h @@ -2,10 +2,11 @@ #define XLA_CLIENT_DEBUG_MACROS_H_ #include "absl/status/status.h" -#include "torch_xla/csrc/runtime/tf_logging.h" #include "tsl/platform/stacktrace.h" #include "tsl/platform/statusor.h" +#include "torch_xla/csrc/runtime/tf_logging.h" + // DEPRECATED // ========== // These macros are deprecated in favor of error handling by propagating abseil diff --git a/torch_xla/csrc/runtime/ifrt_computation_client.cpp b/torch_xla/csrc/runtime/ifrt_computation_client.cpp index 54eccb2727f5..91548ff38efb 100644 --- a/torch_xla/csrc/runtime/ifrt_computation_client.cpp +++ b/torch_xla/csrc/runtime/ifrt_computation_client.cpp @@ -8,15 +8,6 @@ #include "absl/strings/ascii.h" #include "absl/synchronization/blocking_counter.h" #include "absl/types/span.h" -#include "torch_xla/csrc/runtime/computation_client.h" -#include "torch_xla/csrc/runtime/debug_macros.h" -#include "torch_xla/csrc/runtime/env_hash.h" -#include "torch_xla/csrc/runtime/env_vars.h" -#include "torch_xla/csrc/runtime/pjrt_registry.h" -#include "torch_xla/csrc/runtime/stablehlo_helper.h" -#include "torch_xla/csrc/runtime/tf_logging.h" -#include "torch_xla/csrc/runtime/xla_coordinator.h" -#include "torch_xla/csrc/status.h" #include "tsl/profiler/lib/traceme.h" #include "xla/hlo/builder/xla_builder.h" #include "xla/hlo/builder/xla_computation.h" @@ -38,6 +29,16 @@ #include "xla/python/pjrt_ifrt/xla_sharding.h" #include "xla/shape.h" +#include "torch_xla/csrc/runtime/computation_client.h" +#include "torch_xla/csrc/runtime/debug_macros.h" +#include "torch_xla/csrc/runtime/env_hash.h" +#include "torch_xla/csrc/runtime/env_vars.h" +#include "torch_xla/csrc/runtime/pjrt_registry.h" +#include "torch_xla/csrc/runtime/stablehlo_helper.h" +#include "torch_xla/csrc/runtime/tf_logging.h" +#include "torch_xla/csrc/runtime/xla_coordinator.h" +#include "torch_xla/csrc/status.h" + using xla::internal::XlaBuilderFriend; namespace torch_xla { diff --git a/torch_xla/csrc/runtime/ifrt_computation_client.h b/torch_xla/csrc/runtime/ifrt_computation_client.h index 6e7875457105..8b3a9d811224 100644 --- a/torch_xla/csrc/runtime/ifrt_computation_client.h +++ b/torch_xla/csrc/runtime/ifrt_computation_client.h @@ -1,17 +1,13 @@ #ifndef XLA_CLIENT_IFRT_COMPUTATION_CLIENT_H_ #define XLA_CLIENT_IFRT_COMPUTATION_CLIENT_H_ -#include - #include #include #include +#include + #include "absl/types/span.h" -#include "torch_xla/csrc/runtime/computation_client.h" -#include "torch_xla/csrc/runtime/debug_macros.h" -#include "torch_xla/csrc/runtime/operation_manager.h" -#include "torch_xla/csrc/runtime/util.h" #include "xla/hlo/builder/xla_computation.h" #include "xla/literal.h" #include "xla/pjrt/pjrt_client.h" @@ -23,6 +19,11 @@ #include "xla/python/pjrt_ifrt/xla_compiler.h" #include "xla/shape.h" +#include "torch_xla/csrc/runtime/computation_client.h" +#include "torch_xla/csrc/runtime/debug_macros.h" +#include "torch_xla/csrc/runtime/operation_manager.h" +#include "torch_xla/csrc/runtime/util.h" + namespace torch_xla { namespace runtime { diff --git a/torch_xla/csrc/runtime/ifrt_computation_client_test.cpp b/torch_xla/csrc/runtime/ifrt_computation_client_test.cpp index 4efc9550b8de..6a6ead72512e 100644 --- a/torch_xla/csrc/runtime/ifrt_computation_client_test.cpp +++ b/torch_xla/csrc/runtime/ifrt_computation_client_test.cpp @@ -6,9 +6,6 @@ #include #include -#include "torch_xla/csrc/runtime/computation_client.h" -#include "torch_xla/csrc/runtime/tensor_source.h" -#include "torch_xla/csrc/status.h" #include "tsl/platform/env.h" #include "tsl/platform/logging.h" #include "tsl/platform/statusor.h" @@ -20,6 +17,10 @@ #include "xla/tests/literal_test_util.h" #include "xla/tsl/lib/core/status_test_util.h" +#include "torch_xla/csrc/runtime/computation_client.h" +#include "torch_xla/csrc/runtime/tensor_source.h" +#include "torch_xla/csrc/status.h" + namespace torch_xla { namespace runtime { diff --git a/torch_xla/csrc/runtime/metrics.cpp b/torch_xla/csrc/runtime/metrics.cpp index c458021f78dc..b5982bae17fc 100644 --- a/torch_xla/csrc/runtime/metrics.cpp +++ b/torch_xla/csrc/runtime/metrics.cpp @@ -6,9 +6,10 @@ #include "absl/memory/memory.h" #include "absl/strings/str_split.h" +#include "tsl/platform/macros.h" + #include "torch_xla/csrc/runtime/debug_macros.h" #include "torch_xla/csrc/runtime/util.h" -#include "tsl/platform/macros.h" namespace torch_xla { namespace runtime { diff --git a/torch_xla/csrc/runtime/metrics.h b/torch_xla/csrc/runtime/metrics.h index 8fe2f97b98bb..6d088509db14 100644 --- a/torch_xla/csrc/runtime/metrics.h +++ b/torch_xla/csrc/runtime/metrics.h @@ -9,9 +9,10 @@ #include #include "absl/strings/str_cat.h" -#include "torch_xla/csrc/runtime/sys_util.h" #include "xla/types.h" +#include "torch_xla/csrc/runtime/sys_util.h" + namespace torch_xla { namespace runtime { namespace metrics { diff --git a/torch_xla/csrc/runtime/metrics_analysis.cpp b/torch_xla/csrc/runtime/metrics_analysis.cpp index eccc18de7651..6937a74f8737 100644 --- a/torch_xla/csrc/runtime/metrics_analysis.cpp +++ b/torch_xla/csrc/runtime/metrics_analysis.cpp @@ -3,6 +3,7 @@ #include "absl/strings/match.h" #include "absl/strings/str_format.h" #include "absl/types/variant.h" + #include "torch_xla/csrc/runtime/metrics.h" #include "torch_xla/csrc/runtime/tf_logging.h" #include "torch_xla/csrc/runtime/types.h" diff --git a/torch_xla/csrc/runtime/operation_manager.cpp b/torch_xla/csrc/runtime/operation_manager.cpp index 817bfacbba3a..a5e40cccf7bb 100644 --- a/torch_xla/csrc/runtime/operation_manager.cpp +++ b/torch_xla/csrc/runtime/operation_manager.cpp @@ -3,6 +3,7 @@ #include #include "absl/types/span.h" + #include "torch_xla/csrc/runtime/debug_macros.h" #include "torch_xla/csrc/runtime/tf_logging.h" diff --git a/torch_xla/csrc/runtime/pjrt_computation_client.cpp b/torch_xla/csrc/runtime/pjrt_computation_client.cpp index 5a0cb99475b6..aa0145481e3b 100644 --- a/torch_xla/csrc/runtime/pjrt_computation_client.cpp +++ b/torch_xla/csrc/runtime/pjrt_computation_client.cpp @@ -8,6 +8,18 @@ #include "absl/strings/ascii.h" #include "absl/synchronization/blocking_counter.h" #include "absl/types/span.h" +#include "tsl/profiler/lib/traceme.h" +#include "xla/hlo/builder/xla_builder.h" +#include "xla/hlo/builder/xla_computation.h" +#include "xla/literal.h" +#include "xla/pjrt/c/pjrt_c_api_wrapper_impl.h" +#include "xla/pjrt/pjrt_api.h" +#include "xla/pjrt/pjrt_c_api_client.h" +#include "xla/pjrt/pjrt_client.h" +#include "xla/pjrt/pjrt_executable.h" +#include "xla/service/custom_call_target_registry.h" +#include "xla/shape.h" + #include "torch_xla/csrc/runtime/computation_client.h" #include "torch_xla/csrc/runtime/debug_macros.h" #include "torch_xla/csrc/runtime/env_hash.h" @@ -20,17 +32,6 @@ #include "torch_xla/csrc/runtime/util.h" #include "torch_xla/csrc/runtime/xla_coordinator.h" #include "torch_xla/csrc/status.h" -#include "tsl/profiler/lib/traceme.h" -#include "xla/hlo/builder/xla_builder.h" -#include "xla/hlo/builder/xla_computation.h" -#include "xla/literal.h" -#include "xla/pjrt/c/pjrt_c_api_wrapper_impl.h" -#include "xla/pjrt/pjrt_api.h" -#include "xla/pjrt/pjrt_c_api_client.h" -#include "xla/pjrt/pjrt_client.h" -#include "xla/pjrt/pjrt_executable.h" -#include "xla/service/custom_call_target_registry.h" -#include "xla/shape.h" namespace torch_xla { namespace runtime { diff --git a/torch_xla/csrc/runtime/pjrt_computation_client.h b/torch_xla/csrc/runtime/pjrt_computation_client.h index fc516a7042c9..f7a8fd3463ef 100644 --- a/torch_xla/csrc/runtime/pjrt_computation_client.h +++ b/torch_xla/csrc/runtime/pjrt_computation_client.h @@ -1,17 +1,13 @@ #ifndef XLA_CLIENT_PJRT_COMPUTATION_CLIENT_H_ #define XLA_CLIENT_PJRT_COMPUTATION_CLIENT_H_ -#include - #include #include #include +#include + #include "absl/types/span.h" -#include "torch_xla/csrc/runtime/computation_client.h" -#include "torch_xla/csrc/runtime/debug_macros.h" -#include "torch_xla/csrc/runtime/operation_manager.h" -#include "torch_xla/csrc/runtime/util.h" #include "tsl/platform/env.h" #include "tsl/platform/threadpool.h" #include "xla/hlo/builder/xla_computation.h" @@ -21,6 +17,11 @@ #include "xla/pjrt/pjrt_executable.h" #include "xla/shape.h" +#include "torch_xla/csrc/runtime/computation_client.h" +#include "torch_xla/csrc/runtime/debug_macros.h" +#include "torch_xla/csrc/runtime/operation_manager.h" +#include "torch_xla/csrc/runtime/util.h" + namespace torch_xla { namespace runtime { diff --git a/torch_xla/csrc/runtime/pjrt_computation_client_test.cpp b/torch_xla/csrc/runtime/pjrt_computation_client_test.cpp index c19499e515a7..b82702d95aa2 100644 --- a/torch_xla/csrc/runtime/pjrt_computation_client_test.cpp +++ b/torch_xla/csrc/runtime/pjrt_computation_client_test.cpp @@ -8,15 +8,16 @@ #include #include -#include "torch_xla/csrc/runtime/computation_client.h" -#include "torch_xla/csrc/runtime/tensor_source.h" -#include "torch_xla/csrc/status.h" #include "xla/hlo/builder/xla_builder.h" #include "xla/hlo/builder/xla_computation.h" #include "xla/literal.h" #include "xla/literal_util.h" #include "xla/tests/literal_test_util.h" +#include "torch_xla/csrc/runtime/computation_client.h" +#include "torch_xla/csrc/runtime/tensor_source.h" +#include "torch_xla/csrc/status.h" + namespace torch_xla { namespace runtime { diff --git a/torch_xla/csrc/runtime/pjrt_registry.cpp b/torch_xla/csrc/runtime/pjrt_registry.cpp index 73c6c624ad3b..d7cc0f1e0f87 100644 --- a/torch_xla/csrc/runtime/pjrt_registry.cpp +++ b/torch_xla/csrc/runtime/pjrt_registry.cpp @@ -4,13 +4,6 @@ #include "absl/log/absl_check.h" #include "absl/log/initialize.h" -#include "torch_xla/csrc/runtime/debug_macros.h" -#include "torch_xla/csrc/runtime/env_vars.h" -#include "torch_xla/csrc/runtime/profiler.h" -#include "torch_xla/csrc/runtime/sys_util.h" -#include "torch_xla/csrc/runtime/tf_logging.h" -#include "torch_xla/csrc/runtime/xla_coordinator.h" -#include "torch_xla/csrc/status.h" #include "xla/pjrt/c/pjrt_c_api.h" #include "xla/pjrt/cpu/cpu_client.h" #include "xla/pjrt/distributed/client.h" @@ -19,6 +12,14 @@ #include "xla/pjrt/pjrt_api.h" #include "xla/pjrt/pjrt_c_api_client.h" +#include "torch_xla/csrc/runtime/debug_macros.h" +#include "torch_xla/csrc/runtime/env_vars.h" +#include "torch_xla/csrc/runtime/profiler.h" +#include "torch_xla/csrc/runtime/sys_util.h" +#include "torch_xla/csrc/runtime/tf_logging.h" +#include "torch_xla/csrc/runtime/xla_coordinator.h" +#include "torch_xla/csrc/status.h" + namespace torch_xla { namespace runtime { diff --git a/torch_xla/csrc/runtime/pjrt_registry.h b/torch_xla/csrc/runtime/pjrt_registry.h index eb072de4b66c..d6ea4ecf6af6 100644 --- a/torch_xla/csrc/runtime/pjrt_registry.h +++ b/torch_xla/csrc/runtime/pjrt_registry.h @@ -1,10 +1,11 @@ #ifndef XLA_CLIENT_INITIALIZE_PJRT_CLIENT_H_ #define XLA_CLIENT_INITIALIZE_PJRT_CLIENT_H_ -#include "torch_xla/csrc/runtime/xla_coordinator.h" #include "xla/pjrt/pjrt_client.h" #include "xla/pjrt/pjrt_common.h" +#include "torch_xla/csrc/runtime/xla_coordinator.h" + namespace torch_xla { namespace runtime { diff --git a/torch_xla/csrc/runtime/profiler.cpp b/torch_xla/csrc/runtime/profiler.cpp index 4da3d9d628c6..70a1b909ad34 100644 --- a/torch_xla/csrc/runtime/profiler.cpp +++ b/torch_xla/csrc/runtime/profiler.cpp @@ -4,7 +4,6 @@ #include "absl/container/flat_hash_map.h" #include "absl/status/status.h" -#include "torch_xla/csrc/runtime/tf_logging.h" #include "tsl/profiler/lib/profiler_factory.h" #include "xla/backends/profiler/plugin/plugin_tracer.h" #include "xla/backends/profiler/plugin/profiler_c_api.h" @@ -13,6 +12,8 @@ #include "xla/tsl/profiler/rpc/client/capture_profile.h" #include "xla/tsl/profiler/rpc/profiler_server.h" +#include "torch_xla/csrc/runtime/tf_logging.h" + namespace torch_xla { namespace runtime { namespace profiler { diff --git a/torch_xla/csrc/runtime/runtime.cpp b/torch_xla/csrc/runtime/runtime.cpp index 4dced2531bd5..46efc72b0550 100644 --- a/torch_xla/csrc/runtime/runtime.cpp +++ b/torch_xla/csrc/runtime/runtime.cpp @@ -3,12 +3,13 @@ #include #include "absl/log/absl_check.h" +#include "tsl/platform/stacktrace_handler.h" + #include "torch_xla/csrc/runtime/computation_client.h" #include "torch_xla/csrc/runtime/env_vars.h" #include "torch_xla/csrc/runtime/ifrt_computation_client.h" #include "torch_xla/csrc/runtime/pjrt_computation_client.h" #include "torch_xla/csrc/status.h" -#include "tsl/platform/stacktrace_handler.h" namespace torch_xla::runtime { diff --git a/torch_xla/csrc/runtime/runtime.h b/torch_xla/csrc/runtime/runtime.h index 9d9c3f59f29e..917b46062d68 100644 --- a/torch_xla/csrc/runtime/runtime.h +++ b/torch_xla/csrc/runtime/runtime.h @@ -3,6 +3,7 @@ #include "absl/base/attributes.h" #include "absl/status/statusor.h" + #include "torch_xla/csrc/runtime/computation_client.h" namespace torch_xla::runtime { diff --git a/torch_xla/csrc/runtime/stablehlo_helper.cpp b/torch_xla/csrc/runtime/stablehlo_helper.cpp index 857ec5809175..d2bb31aa5d77 100644 --- a/torch_xla/csrc/runtime/stablehlo_helper.cpp +++ b/torch_xla/csrc/runtime/stablehlo_helper.cpp @@ -10,15 +10,16 @@ #include "stablehlo/dialect/StablehloOps.h" // from @stablehlo #include "stablehlo/dialect/Version.h" // from @stablehlo #include "stablehlo/dialect/VhloOps.h" // from @stablehlo +#include "xla/hlo/translate/hlo_to_mhlo/hlo_to_mlir_hlo.h" +#include "xla/hlo/translate/mhlo_to_hlo/mlir_hlo_to_hlo.h" +#include "xla/mlir_hlo/mhlo/transforms/passes.h" +#include "xla/service/spmd/shardy/stablehlo_round_trip/stablehlo_import.h" + #include "torch_xla/csrc/runtime/debug_macros.h" #include "torch_xla/csrc/runtime/stablehlo_composite_helper.h" #include "torch_xla/csrc/runtime/sys_util.h" #include "torch_xla/csrc/runtime/xla_mlir_debuginfo_helper.h" #include "torch_xla/csrc/runtime/xla_util.h" -#include "xla/hlo/translate/hlo_to_mhlo/hlo_to_mlir_hlo.h" -#include "xla/hlo/translate/mhlo_to_hlo/mlir_hlo_to_hlo.h" -#include "xla/mlir_hlo/mhlo/transforms/passes.h" -#include "xla/service/spmd/shardy/stablehlo_round_trip/stablehlo_import.h" namespace torch_xla { diff --git a/torch_xla/csrc/runtime/tensor_source.h b/torch_xla/csrc/runtime/tensor_source.h index 888396ae6783..20c9f674c9e1 100644 --- a/torch_xla/csrc/runtime/tensor_source.h +++ b/torch_xla/csrc/runtime/tensor_source.h @@ -2,19 +2,21 @@ #define XLA_CLIENT_TENSOR_SOURCE_H_ #include -#include #include #include #include -#include "torch_xla/csrc/dtype.h" -#include "torch_xla/csrc/runtime/debug_macros.h" -#include "torch_xla/csrc/status.h" +#include + #include "xla/literal.h" #include "xla/shape.h" #include "xla/shape_util.h" +#include "torch_xla/csrc/dtype.h" +#include "torch_xla/csrc/runtime/debug_macros.h" +#include "torch_xla/csrc/status.h" + namespace torch_xla { namespace runtime { diff --git a/torch_xla/csrc/runtime/tf_logging.cpp b/torch_xla/csrc/runtime/tf_logging.cpp index 3f6419a5127b..a8c2d7644aa1 100644 --- a/torch_xla/csrc/runtime/tf_logging.cpp +++ b/torch_xla/csrc/runtime/tf_logging.cpp @@ -1,13 +1,15 @@ #include "torch_xla/csrc/runtime/tf_logging.h" #include -#include #include -#include "torch_xla/csrc/status.h" +#include + #include "tsl/platform/stacktrace.h" +#include "torch_xla/csrc/status.h" + namespace torch_xla { namespace runtime { namespace internal { diff --git a/torch_xla/csrc/runtime/tf_logging.h b/torch_xla/csrc/runtime/tf_logging.h index 5cecbea07b02..a58d6c67db37 100644 --- a/torch_xla/csrc/runtime/tf_logging.h +++ b/torch_xla/csrc/runtime/tf_logging.h @@ -4,6 +4,7 @@ #include #include "absl/log/absl_log.h" + #include "torch_xla/csrc/runtime/tsl_platform_logging.h" namespace torch_xla { diff --git a/torch_xla/csrc/runtime/util.h b/torch_xla/csrc/runtime/util.h index 112ee44f2c72..5b47c4bdd086 100644 --- a/torch_xla/csrc/runtime/util.h +++ b/torch_xla/csrc/runtime/util.h @@ -17,10 +17,11 @@ #include "absl/status/statusor.h" #include "absl/types/optional.h" #include "absl/types/span.h" -#include "torch_xla/csrc/runtime/types.h" #include "tsl/platform/errors.h" #include "tsl/platform/hash.h" +#include "torch_xla/csrc/runtime/types.h" + namespace torch_xla { namespace runtime { namespace util { diff --git a/torch_xla/csrc/runtime/xla_coordinator.cpp b/torch_xla/csrc/runtime/xla_coordinator.cpp index ff31bc4df729..497388e7ae9d 100644 --- a/torch_xla/csrc/runtime/xla_coordinator.cpp +++ b/torch_xla/csrc/runtime/xla_coordinator.cpp @@ -1,10 +1,11 @@ #include "torch_xla/csrc/runtime/xla_coordinator.h" +#include "xla/pjrt/distributed/distributed.h" + #include "torch_xla/csrc/runtime/debug_macros.h" #include "torch_xla/csrc/runtime/env_vars.h" #include "torch_xla/csrc/runtime/sys_util.h" #include "torch_xla/csrc/status.h" -#include "xla/pjrt/distributed/distributed.h" namespace torch_xla { namespace runtime { diff --git a/torch_xla/csrc/runtime/xla_util.cpp b/torch_xla/csrc/runtime/xla_util.cpp index bd995661a2ad..24981a141cec 100644 --- a/torch_xla/csrc/runtime/xla_util.cpp +++ b/torch_xla/csrc/runtime/xla_util.cpp @@ -1,22 +1,23 @@ #include "torch_xla/csrc/runtime/xla_util.h" -#include - #include #include #include #include #include -#include "torch_xla/csrc/runtime/sys_util.h" -#include "torch_xla/csrc/runtime/tf_logging.h" -#include "torch_xla/csrc/runtime/util.h" +#include + #include "tsl/platform/errors.h" #include "tsl/platform/stacktrace.h" #include "xla/shape_util.h" #include "xla/tsl/lib/strings/proto_serialization.h" #include "xla/util.h" +#include "torch_xla/csrc/runtime/sys_util.h" +#include "torch_xla/csrc/runtime/tf_logging.h" +#include "torch_xla/csrc/runtime/util.h" + namespace torch_xla { namespace runtime { namespace util { diff --git a/torch_xla/csrc/runtime/xla_util.h b/torch_xla/csrc/runtime/xla_util.h index 8ebd9f4307ca..17079ccf2fd6 100644 --- a/torch_xla/csrc/runtime/xla_util.h +++ b/torch_xla/csrc/runtime/xla_util.h @@ -1,18 +1,19 @@ #ifndef XLA_CLIENT_XLA_UTIL_H_ #define XLA_CLIENT_XLA_UTIL_H_ -#include - #include +#include + #include "absl/status/status.h" #include "absl/types/span.h" -#include "torch_xla/csrc/runtime/types.h" #include "xla/hlo/builder/xla_computation.h" #include "xla/hlo/ir/hlo_module.h" #include "xla/service/hlo.pb.h" #include "xla/status_macros.h" +#include "torch_xla/csrc/runtime/types.h" + namespace torch_xla { namespace runtime { namespace util { diff --git a/torch_xla/csrc/runtime/xla_util_test.cpp b/torch_xla/csrc/runtime/xla_util_test.cpp index 9178fc133780..24b328813c5b 100644 --- a/torch_xla/csrc/runtime/xla_util_test.cpp +++ b/torch_xla/csrc/runtime/xla_util_test.cpp @@ -11,7 +11,6 @@ #include "absl/status/status.h" #include "absl/types/span.h" -#include "torch_xla/csrc/runtime/debug_macros.h" #include "tsl/platform/errors.h" #include "tsl/platform/protobuf.h" #include "tsl/platform/status_matchers.h" @@ -21,6 +20,8 @@ #include "xla/tsl/protobuf/error_codes.pb.h" #include "xla_util.h" +#include "torch_xla/csrc/runtime/debug_macros.h" + namespace torch_xla { namespace runtime { namespace util { diff --git a/torch_xla/csrc/shape_helper.cpp b/torch_xla/csrc/shape_helper.cpp index ac393796e6ee..08d8158139e4 100644 --- a/torch_xla/csrc/shape_helper.cpp +++ b/torch_xla/csrc/shape_helper.cpp @@ -1,8 +1,9 @@ #include "torch_xla/csrc/shape_helper.h" -#include "torch_xla/csrc/status.h" #include "xla/hlo/builder/xla_builder.h" +#include "torch_xla/csrc/status.h" + namespace torch_xla { const xla::Shape& ShapeHelper::ShapeOfXlaOp(xla::XlaOp op) { diff --git a/torch_xla/csrc/softmax_builder.cpp b/torch_xla/csrc/softmax_builder.cpp index 240b0e4ac411..af4c2aaf1dcd 100644 --- a/torch_xla/csrc/softmax_builder.cpp +++ b/torch_xla/csrc/softmax_builder.cpp @@ -1,9 +1,10 @@ #include "torch_xla/csrc/softmax_builder.h" +#include "xla/hlo/builder/lib/constants.h" + #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/runtime/debug_macros.h" #include "torch_xla/csrc/shape_helper.h" -#include "xla/hlo/builder/lib/constants.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/stack_frame_index_builder.h b/torch_xla/csrc/stack_frame_index_builder.h index d7a8e6cb440b..1d4529e773a1 100644 --- a/torch_xla/csrc/stack_frame_index_builder.h +++ b/torch_xla/csrc/stack_frame_index_builder.h @@ -1,11 +1,11 @@ #pragma once -#include // SourceLocation - #include #include #include +#include // SourceLocation + #include "xla/service/hlo.pb.h" #include "xla/types.h" diff --git a/torch_xla/csrc/status.cpp b/torch_xla/csrc/status.cpp index 44f732fd6e97..e9145a79aea8 100644 --- a/torch_xla/csrc/status.cpp +++ b/torch_xla/csrc/status.cpp @@ -1,12 +1,13 @@ #include "torch_xla/csrc/status.h" #include -#include #include #include #include +#include + #include "absl/log/absl_check.h" #include "absl/strings/str_cat.h" #include "tsl/platform/stacktrace.h" diff --git a/torch_xla/csrc/tensor.cpp b/torch_xla/csrc/tensor.cpp index d80b27b16e14..57b4f62c4a56 100644 --- a/torch_xla/csrc/tensor.cpp +++ b/torch_xla/csrc/tensor.cpp @@ -1,14 +1,5 @@ #include "torch_xla/csrc/tensor.h" -#include -#include -#include -#include -#include -#include -#include -#include - #include #include #include @@ -19,6 +10,19 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tsl/platform/errors.h" +#include "tsl/profiler/lib/traceme.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/debug_util.h" #include "torch_xla/csrc/dtype.h" @@ -45,9 +49,6 @@ #include "torch_xla/csrc/torch_util.h" #include "torch_xla/csrc/xla_graph_executor.h" #include "torch_xla/csrc/xla_sharding_util.h" -#include "tsl/platform/errors.h" -#include "tsl/profiler/lib/traceme.h" -#include "xla/shape_util.h" namespace torch_xla { diff --git a/torch_xla/csrc/tensor.h b/torch_xla/csrc/tensor.h index 69bd8aa3a562..66a8e14e9134 100644 --- a/torch_xla/csrc/tensor.h +++ b/torch_xla/csrc/tensor.h @@ -2,14 +2,16 @@ #define XLA_TORCH_XLA_CSRC_TENSOR_H_ #include -#include -#include -#include #include #include +#include +#include +#include + #include "absl/base/nullability.h" + #include "torch_xla/csrc/runtime/util.h" #include "torch_xla/csrc/view.h" diff --git a/torch_xla/csrc/tensor_impl.cpp b/torch_xla/csrc/tensor_impl.cpp index ee5ae3bce804..2c79eff110f5 100644 --- a/torch_xla/csrc/tensor_impl.cpp +++ b/torch_xla/csrc/tensor_impl.cpp @@ -4,12 +4,14 @@ #include #include #include + #include #include #include #include #include "absl/log/absl_check.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/ir_builder.h" diff --git a/torch_xla/csrc/tensor_methods.cpp b/torch_xla/csrc/tensor_methods.cpp index 03865b29dccd..65d4e1b4ac8d 100644 --- a/torch_xla/csrc/tensor_methods.cpp +++ b/torch_xla/csrc/tensor_methods.cpp @@ -2,14 +2,15 @@ #include #include -#include -#include -#include #include #include #include +#include +#include +#include + #include "absl/base/nullability.h" #include "absl/log/absl_check.h" #include "absl/status/status.h" @@ -17,6 +18,8 @@ #include "absl/strings/str_join.h" #include "absl/strings/str_split.h" #include "absl/types/span.h" +#include "xla/literal_util.h" + #include "torch_xla/csrc/LazyIr.h" #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/data_ops.h" @@ -160,7 +163,6 @@ #include "torch_xla/csrc/tensor_ops.h" #include "torch_xla/csrc/tensor_util.h" #include "torch_xla/csrc/xla_graph_executor.h" -#include "xla/literal_util.h" namespace torch_xla { namespace tensor_methods { diff --git a/torch_xla/csrc/tensor_methods.h b/torch_xla/csrc/tensor_methods.h index 7b18ff37ec99..c916a11b4329 100644 --- a/torch_xla/csrc/tensor_methods.h +++ b/torch_xla/csrc/tensor_methods.h @@ -3,6 +3,7 @@ #include "absl/base/nullability.h" #include "absl/types/span.h" + #include "torch_xla/csrc/cross_replica_reduces.h" #include "torch_xla/csrc/ops/custom_sharding.h" #include "torch_xla/csrc/runtime/computation_client.h" diff --git a/torch_xla/csrc/tensor_ops.cpp b/torch_xla/csrc/tensor_ops.cpp index 47e69dbd183d..d49fa4e0358a 100644 --- a/torch_xla/csrc/tensor_ops.cpp +++ b/torch_xla/csrc/tensor_ops.cpp @@ -4,6 +4,7 @@ #include #include "absl/base/nullability.h" + #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/runtime/computation_client.h" diff --git a/torch_xla/csrc/tensor_util.cpp b/torch_xla/csrc/tensor_util.cpp index fb88e21cc721..cef072f4c537 100644 --- a/torch_xla/csrc/tensor_util.cpp +++ b/torch_xla/csrc/tensor_util.cpp @@ -2,8 +2,6 @@ #include #include -#include -#include #include #include @@ -12,7 +10,14 @@ #include #include +#include +#include + #include "absl/synchronization/blocking_counter.h" +#include "tsl/platform/bfloat16.h" +#include "xla/literal_util.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/dtype.h" #include "torch_xla/csrc/helpers.h" @@ -29,9 +34,6 @@ #include "torch_xla/csrc/torch_util.h" #include "torch_xla/csrc/xla_backend_impl.h" #include "torch_xla/csrc/xla_sharding_util.h" -#include "tsl/platform/bfloat16.h" -#include "xla/literal_util.h" -#include "xla/shape_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/tensor_util.h b/torch_xla/csrc/tensor_util.h index a0f6dea480f1..4a6f73bd3bd9 100644 --- a/torch_xla/csrc/tensor_util.h +++ b/torch_xla/csrc/tensor_util.h @@ -2,20 +2,22 @@ #define XLA_TORCH_XLA_CSRC_TENSOR_UTIL_H_ #include -#include -#include #include #include +#include +#include + #include "absl/types/span.h" +#include "xla/literal.h" +#include "xla/shape.h" +#include "xla/types.h" + #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/runtime/computation_client.h" #include "torch_xla/csrc/tensor.h" #include "torch_xla/csrc/unwrap_data.h" -#include "xla/literal.h" -#include "xla/shape.h" -#include "xla/types.h" namespace torch_xla { diff --git a/torch_xla/csrc/thread_pool.cpp b/torch_xla/csrc/thread_pool.cpp index e440afce7bda..aae14aa1ef39 100644 --- a/torch_xla/csrc/thread_pool.cpp +++ b/torch_xla/csrc/thread_pool.cpp @@ -2,10 +2,11 @@ #include -#include "torch_xla/csrc/runtime/sys_util.h" #include "tsl/platform/env.h" #include "tsl/platform/threadpool.h" +#include "torch_xla/csrc/runtime/sys_util.h" + namespace torch_xla { namespace thread { diff --git a/torch_xla/csrc/token_handler.cpp b/torch_xla/csrc/token_handler.cpp index 56eadeac984c..d7d41c01f09a 100644 --- a/torch_xla/csrc/token_handler.cpp +++ b/torch_xla/csrc/token_handler.cpp @@ -1,11 +1,12 @@ #include "torch_xla/csrc/token_handler.h" +#include "xla/hlo/builder/lib/constants.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/runtime/sys_util.h" #include "torch_xla/csrc/shape_helper.h" -#include "xla/hlo/builder/lib/constants.h" -#include "xla/shape_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/torch_util.h b/torch_xla/csrc/torch_util.h index 82b73cadfd53..b45695ad6d66 100644 --- a/torch_xla/csrc/torch_util.h +++ b/torch_xla/csrc/torch_util.h @@ -4,15 +4,17 @@ #include #include #include + +#include + #include #include #include #include -#include +#include "xla/shape.h" #include "torch_xla/csrc/runtime/debug_macros.h" -#include "xla/shape.h" namespace torch_xla { diff --git a/torch_xla/csrc/unwrap_data.cpp b/torch_xla/csrc/unwrap_data.cpp index 90e61a24773b..f6c1bba835e7 100644 --- a/torch_xla/csrc/unwrap_data.cpp +++ b/torch_xla/csrc/unwrap_data.cpp @@ -1,12 +1,13 @@ +#include +#include + #include #include #include #include -#include -#include - #include "absl/types/span.h" + #include "torch_xla/csrc/runtime/computation_client.h" namespace torch_xla { diff --git a/torch_xla/csrc/unwrap_data.h b/torch_xla/csrc/unwrap_data.h index 6bf1cc60e0ac..932d9e0be738 100644 --- a/torch_xla/csrc/unwrap_data.h +++ b/torch_xla/csrc/unwrap_data.h @@ -1,12 +1,13 @@ #ifndef XLA_TORCH_XLA_CSRC_UNWRAP_DATA_H_ #define XLA_TORCH_XLA_CSRC_UNWRAP_DATA_H_ +#include + #include #include -#include - #include "absl/types/span.h" + #include "torch_xla/csrc/runtime/computation_client.h" namespace torch_xla { diff --git a/torch_xla/csrc/view.cpp b/torch_xla/csrc/view.cpp index 7f5dd4b172f6..f024cb6fa213 100644 --- a/torch_xla/csrc/view.cpp +++ b/torch_xla/csrc/view.cpp @@ -1,11 +1,14 @@ #include "torch_xla/csrc/view.h" -#include - #include #include #include +#include + +#include "xla/shape_util.h" +#include "xla/util.h" + #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/ops/as_strided.h" #include "torch_xla/csrc/ops/as_strided_view_update.h" @@ -21,8 +24,6 @@ #include "torch_xla/csrc/ops/view.h" #include "torch_xla/csrc/runtime/debug_macros.h" #include "torch_xla/csrc/runtime/util.h" -#include "xla/shape_util.h" -#include "xla/util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/view.h b/torch_xla/csrc/view.h index df6fd58a3bad..0725f1b298f3 100644 --- a/torch_xla/csrc/view.h +++ b/torch_xla/csrc/view.h @@ -5,10 +5,11 @@ #include #include "absl/types/optional.h" -#include "torch_xla/csrc/ir.h" #include "xla/shape.h" #include "xla/types.h" +#include "torch_xla/csrc/ir.h" + namespace torch_xla { struct SelectInfo { diff --git a/torch_xla/csrc/xla_backend_impl.h b/torch_xla/csrc/xla_backend_impl.h index 72bdb6a9573f..a4af99651d45 100644 --- a/torch_xla/csrc/xla_backend_impl.h +++ b/torch_xla/csrc/xla_backend_impl.h @@ -1,11 +1,11 @@ #ifndef XLA_TORCH_XLA_CSRC_XLA_BACKEND_IMPL_H_ #define XLA_TORCH_XLA_CSRC_XLA_BACKEND_IMPL_H_ -#include - #include #include +#include + #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/runtime/computation_client.h" diff --git a/torch_xla/csrc/xla_generator.cpp b/torch_xla/csrc/xla_generator.cpp index 948fc08843f8..cb334b1ba955 100644 --- a/torch_xla/csrc/xla_generator.cpp +++ b/torch_xla/csrc/xla_generator.cpp @@ -15,6 +15,7 @@ #include #include "absl/status/status.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/runtime/computation_client.h" #include "torch_xla/csrc/runtime/runtime.h" diff --git a/torch_xla/csrc/xla_graph_executor.cpp b/torch_xla/csrc/xla_graph_executor.cpp index a174bcbeb730..fdfb2a61a3e9 100644 --- a/torch_xla/csrc/xla_graph_executor.cpp +++ b/torch_xla/csrc/xla_graph_executor.cpp @@ -1,15 +1,6 @@ #include "torch_xla/csrc/xla_graph_executor.h" #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include @@ -23,10 +14,25 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include "absl/container/flat_hash_map.h" #include "absl/memory/memory.h" #include "absl/strings/str_join.h" #include "stablehlo/dialect/Serialization.h" // from @stablehlo +#include "tsl/platform/errors.h" +#include "tsl/profiler/lib/traceme.h" +#include "xla/literal_util.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/dtype.h" #include "torch_xla/csrc/hash_util.h" @@ -59,10 +65,6 @@ #include "torch_xla/csrc/version.h" #include "torch_xla/csrc/xla_backend_impl.h" #include "torch_xla/csrc/xla_sharding_util.h" -#include "tsl/platform/errors.h" -#include "tsl/profiler/lib/traceme.h" -#include "xla/literal_util.h" -#include "xla/shape_util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/xla_graph_executor.h b/torch_xla/csrc/xla_graph_executor.h index 5e1acaa9d471..e4dcedce8268 100644 --- a/torch_xla/csrc/xla_graph_executor.h +++ b/torch_xla/csrc/xla_graph_executor.h @@ -2,15 +2,19 @@ #define XLA_TORCH_XLA_CSRC_XLA_GRAPH_EXECUTOR_H_ #include -#include -#include #include #include #include #include +#include +#include + #include "absl/synchronization/blocking_counter.h" +#include "xla/hlo/builder/xla_builder.h" +#include "xla/types.h" + #include "torch_xla/csrc/cross_replica_reduces.h" #include "torch_xla/csrc/debug_util.h" #include "torch_xla/csrc/device.h" @@ -23,8 +27,6 @@ #include "torch_xla/csrc/tensor.h" #include "torch_xla/csrc/torch_util.h" #include "torch_xla/csrc/view.h" -#include "xla/hlo/builder/xla_builder.h" -#include "xla/types.h" namespace torch_xla { diff --git a/torch_xla/csrc/xla_lower_util.cpp b/torch_xla/csrc/xla_lower_util.cpp index 0b41ea258a49..7908294f4533 100644 --- a/torch_xla/csrc/xla_lower_util.cpp +++ b/torch_xla/csrc/xla_lower_util.cpp @@ -1,12 +1,22 @@ #include "torch_xla/csrc/xla_lower_util.h" -#include -#include - #include #include +#include +#include + #include "absl/status/status.h" +#include "xla/hlo/builder/lib/arithmetic.h" +#include "xla/hlo/builder/lib/comparators.h" +#include "xla/hlo/builder/lib/constants.h" +#include "xla/hlo/builder/lib/loops.h" +#include "xla/hlo/builder/lib/math.h" +#include "xla/hlo/builder/lib/slicing.h" +#include "xla/shape_util.h" +#include "xla/stream_executor/dnn.h" +#include "xla/util.h" + #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/elementwise.h" @@ -19,15 +29,6 @@ #include "torch_xla/csrc/shape_helper.h" #include "torch_xla/csrc/status.h" #include "torch_xla/csrc/tensor_util.h" -#include "xla/hlo/builder/lib/arithmetic.h" -#include "xla/hlo/builder/lib/comparators.h" -#include "xla/hlo/builder/lib/constants.h" -#include "xla/hlo/builder/lib/loops.h" -#include "xla/hlo/builder/lib/math.h" -#include "xla/hlo/builder/lib/slicing.h" -#include "xla/shape_util.h" -#include "xla/stream_executor/dnn.h" -#include "xla/util.h" namespace torch_xla { namespace { diff --git a/torch_xla/csrc/xla_lower_util.h b/torch_xla/csrc/xla_lower_util.h index f2dc8a1915e9..b7be213e19f7 100644 --- a/torch_xla/csrc/xla_lower_util.h +++ b/torch_xla/csrc/xla_lower_util.h @@ -5,10 +5,11 @@ #include "absl/types/optional.h" #include "absl/types/span.h" -#include "torch_xla/csrc/device.h" #include "xla/hlo/builder/xla_builder.h" #include "xla/hlo/ir/hlo_sharding.h" +#include "torch_xla/csrc/device.h" + namespace torch_xla { xla::XlaOp PadToSize(xla::XlaOp input, absl::Span size, diff --git a/torch_xla/csrc/xla_manual_registration.cpp b/torch_xla/csrc/xla_manual_registration.cpp index f5e5f74f3805..6aad79940407 100644 --- a/torch_xla/csrc/xla_manual_registration.cpp +++ b/torch_xla/csrc/xla_manual_registration.cpp @@ -1,5 +1,6 @@ #include #include + #include #include "torch_xla/csrc/XLANativeFunctions.h" diff --git a/torch_xla/csrc/xla_op_builder.cpp b/torch_xla/csrc/xla_op_builder.cpp index 3403f4af42b9..c8fac77a0359 100644 --- a/torch_xla/csrc/xla_op_builder.cpp +++ b/torch_xla/csrc/xla_op_builder.cpp @@ -3,12 +3,6 @@ #include #include "absl/types/optional.h" -#include "torch_xla/csrc/convert_ops.h" -#include "torch_xla/csrc/helpers.h" -#include "torch_xla/csrc/runtime/computation_client.h" -#include "torch_xla/csrc/runtime/debug_macros.h" -#include "torch_xla/csrc/status.h" -#include "torch_xla/csrc/tensor_util.h" #include "xla/hlo/builder/lib/logdet.h" #include "xla/hlo/builder/lib/math.h" #include "xla/hlo/builder/lib/matrix.h" @@ -16,6 +10,13 @@ #include "xla/primitive_util.h" #include "xla/shape_util.h" +#include "torch_xla/csrc/convert_ops.h" +#include "torch_xla/csrc/helpers.h" +#include "torch_xla/csrc/runtime/computation_client.h" +#include "torch_xla/csrc/runtime/debug_macros.h" +#include "torch_xla/csrc/status.h" +#include "torch_xla/csrc/tensor_util.h" + namespace torch_xla { namespace op_builder { namespace { diff --git a/torch_xla/csrc/xla_op_builder.h b/torch_xla/csrc/xla_op_builder.h index b020c7d9a73c..2864c6fcec05 100644 --- a/torch_xla/csrc/xla_op_builder.h +++ b/torch_xla/csrc/xla_op_builder.h @@ -1,12 +1,12 @@ #ifndef XLA_TORCH_XLA_CSRC_XLA_OP_BUILDER_H_ #define XLA_TORCH_XLA_CSRC_XLA_OP_BUILDER_H_ -#include - #include #include #include +#include + #include "xla/hlo/builder/xla_builder.h" namespace torch_xla { diff --git a/torch_xla/csrc/xla_sharding_util.cpp b/torch_xla/csrc/xla_sharding_util.cpp index 2c6de2e8b33e..967d7f17102a 100644 --- a/torch_xla/csrc/xla_sharding_util.cpp +++ b/torch_xla/csrc/xla_sharding_util.cpp @@ -7,6 +7,18 @@ #include "absl/synchronization/blocking_counter.h" #include "torch/csrc/lazy/core/ir_util.h" +#include "tsl/profiler/lib/traceme.h" +#include "xla/execution_options_util.h" +#include "xla/hlo/ir/hlo_module.h" +#include "xla/hlo/parser/hlo_parser.h" +#include "xla/hlo/pass/hlo_pass_pipeline.h" +#include "xla/protobuf_util.h" +#include "xla/service/hlo_verifier.h" +#include "xla/service/sharding_propagation.h" +#include "xla/service/spmd/spmd_partitioner.h" +#include "xla/xla.pb.h" +#include "xla_sharding_util.h" + #include "torch_xla/csrc/aten_autograd_ops.h" #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/device.h" @@ -20,17 +32,6 @@ #include "torch_xla/csrc/tensor_util.h" #include "torch_xla/csrc/thread_pool.h" #include "torch_xla/csrc/xla_graph_executor.h" -#include "tsl/profiler/lib/traceme.h" -#include "xla/execution_options_util.h" -#include "xla/hlo/ir/hlo_module.h" -#include "xla/hlo/parser/hlo_parser.h" -#include "xla/hlo/pass/hlo_pass_pipeline.h" -#include "xla/protobuf_util.h" -#include "xla/service/hlo_verifier.h" -#include "xla/service/sharding_propagation.h" -#include "xla/service/spmd/spmd_partitioner.h" -#include "xla/xla.pb.h" -#include "xla_sharding_util.h" namespace torch_xla { diff --git a/torch_xla/csrc/xla_sharding_util.h b/torch_xla/csrc/xla_sharding_util.h index a925c470748a..3b30833d3264 100644 --- a/torch_xla/csrc/xla_sharding_util.h +++ b/torch_xla/csrc/xla_sharding_util.h @@ -1,17 +1,18 @@ #ifndef XLA_TORCH_XLA_CSRC_XLA_SHARDING_UTIL_H_ #define XLA_TORCH_XLA_CSRC_XLA_SHARDING_UTIL_H_ +#include + #include -#include +#include "xla/hlo/builder/xla_builder.h" +#include "xla/hlo/builder/xla_computation.h" +#include "xla/service/hlo.pb.h" #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/runtime/computation_client.h" #include "torch_xla/csrc/tensor.h" -#include "xla/hlo/builder/xla_builder.h" -#include "xla/hlo/builder/xla_computation.h" -#include "xla/service/hlo.pb.h" namespace torch_xla { From 3858923763ab807e3e56f9bcbcbeed870d6830b7 Mon Sep 17 00:00:00 2001 From: Yukio Siraichi Date: Tue, 18 Nov 2025 16:04:33 -0300 Subject: [PATCH 3/4] Merge groups. --- .clang-format | 32 +++++++++++-------- test/cpp/cpp_test_util.h | 3 +- test/cpp/metrics_snapshot.cpp | 2 +- test/cpp/test_aten_xla_tensor_1.cpp | 8 ++--- test/cpp/test_aten_xla_tensor_2.cpp | 8 ++--- test/cpp/test_aten_xla_tensor_3.cpp | 8 ++--- test/cpp/test_aten_xla_tensor_4.cpp | 8 ++--- test/cpp/test_aten_xla_tensor_5.cpp | 8 ++--- test/cpp/test_aten_xla_tensor_6.cpp | 8 ++--- test/cpp/test_debug_macros.cpp | 3 +- test/cpp/test_ir.cpp | 5 ++- test/cpp/test_lazy.cpp | 5 ++- test/cpp/test_replication.cpp | 5 ++- test/cpp/test_status_common.h | 3 +- test/cpp/test_symint.cpp | 3 +- test/cpp/test_tensor.cpp | 7 ++-- test/cpp/test_xla_backend_intf.cpp | 3 +- test/cpp/test_xla_generator.cpp | 3 +- test/cpp/test_xla_sharding.cpp | 8 ++--- torch_xla/csrc/aten_xla_bridge.cpp | 3 +- torch_xla/csrc/aten_xla_type.cpp | 10 ++---- torch_xla/csrc/cross_replica_reduces.cpp | 4 +-- torch_xla/csrc/cross_replica_reduces.h | 2 +- torch_xla/csrc/data_ops.cpp | 5 ++- torch_xla/csrc/debug_util.cpp | 5 ++- torch_xla/csrc/dynamic_shape_detector.h | 3 +- torch_xla/csrc/function_call_tracker.cpp | 3 +- torch_xla/csrc/helpers.cpp | 5 ++- torch_xla/csrc/helpers.h | 5 ++- torch_xla/csrc/init_python_bindings.cpp | 17 +++++----- torch_xla/csrc/ir.cpp | 7 ++-- torch_xla/csrc/ir.h | 9 +++--- torch_xla/csrc/ir_dump_util.cpp | 3 +- torch_xla/csrc/layout_manager.cpp | 3 +- torch_xla/csrc/lowering_context.cpp | 3 +- torch_xla/csrc/lowering_context.h | 7 ++-- torch_xla/csrc/ops/all_reduce.cpp | 3 +- torch_xla/csrc/ops/as_strided.cpp | 3 +- torch_xla/csrc/ops/cast.cpp | 3 +- torch_xla/csrc/ops/cast_int4.cpp | 3 +- torch_xla/csrc/ops/cumprod.cpp | 3 +- torch_xla/csrc/ops/dynamic_ir.h | 4 +-- torch_xla/csrc/ops/expand_symint.cpp | 5 ++- torch_xla/csrc/ops/index_ops.cpp | 3 +- torch_xla/csrc/ops/mean.cpp | 3 +- torch_xla/csrc/ops/nll_loss.cpp | 3 +- torch_xla/csrc/ops/nll_loss2d.cpp | 3 +- torch_xla/csrc/ops/ops.cpp | 5 ++- torch_xla/csrc/ops/ops_lower_fn.cpp | 3 +- torch_xla/csrc/ops/ops_xla_shape_fn.cpp | 3 +- torch_xla/csrc/ops/prod.cpp | 3 +- torch_xla/csrc/ops/reduce_scatter.cpp | 3 +- torch_xla/csrc/ops/sum.cpp | 3 +- torch_xla/csrc/ops/svd.cpp | 3 +- torch_xla/csrc/pooling.cpp | 5 ++- torch_xla/csrc/reduction.cpp | 5 ++- torch_xla/csrc/runtime/computation_client.h | 11 +++---- .../csrc/runtime/ifrt_computation_client.h | 3 +- .../csrc/runtime/pjrt_computation_client.h | 3 +- torch_xla/csrc/runtime/runtime.cpp | 3 +- torch_xla/csrc/runtime/tensor_source.h | 3 +- torch_xla/csrc/runtime/tf_logging.cpp | 3 +- torch_xla/csrc/runtime/xla_util.cpp | 3 +- torch_xla/csrc/runtime/xla_util.h | 3 +- torch_xla/csrc/runtime/xla_util_test.cpp | 1 - torch_xla/csrc/stack_frame_index_builder.h | 3 +- torch_xla/csrc/status.cpp | 3 +- torch_xla/csrc/tensor.cpp | 7 ++-- torch_xla/csrc/tensor.h | 3 +- torch_xla/csrc/tensor_impl.cpp | 3 +- torch_xla/csrc/tensor_methods.cpp | 7 ++-- torch_xla/csrc/tensor_ops.cpp | 3 +- torch_xla/csrc/tensor_util.cpp | 5 ++- torch_xla/csrc/tensor_util.h | 5 ++- torch_xla/csrc/torch_util.h | 3 +- torch_xla/csrc/unwrap_data.cpp | 3 +- torch_xla/csrc/unwrap_data.h | 3 +- torch_xla/csrc/view.cpp | 3 +- torch_xla/csrc/xla_graph_executor.cpp | 17 +++++----- torch_xla/csrc/xla_graph_executor.h | 5 ++- torch_xla/csrc/xla_lower_util.cpp | 5 ++- torch_xla/csrc/xla_op_builder.h | 3 +- torch_xla/csrc/xla_sharding_util.cpp | 2 +- torch_xla/csrc/xla_sharding_util.h | 3 +- 84 files changed, 163 insertions(+), 249 deletions(-) diff --git a/.clang-format b/.clang-format index e04798c31d54..b422b17f8906 100644 --- a/.clang-format +++ b/.clang-format @@ -67,16 +67,22 @@ ForEachMacros: - BOOST_FOREACH IncludeBlocks: Regroup # Include Groups (by priority): -# 1. C system headers: `#include <*.h>` -# 2. C++ system headers: `#include <*>` -# 3. PyTorch API headers: `#include ` -# - All PyTorch source files under `torch/csrc` already include PyTorch -# headers with angle-brackets -# - Make this into its own group (insted of, say, (4)), since it's the only -# external dependency using angle-brackets -# 4. Anything that's not (5) or (6) -# 5. Project headers: `#include "torch_xla/*.h"` -# 6. Test headers: `#include "test/*.h"` +# 1. C system headers: `#include <*.h>` +# 2. C++ system headers: `#include <*>` +# 3. External headers: +# a) PyTorch API headers: `#include ` +# b) PyTorch ATen headers: `#include ` +# c) PyTorch headers: `#include ` +# d) abseil-cpp headers: `#include "absl/*.h" +# e) OpenXLA headers: `#include "xla/*.h" +# +# Note that PyTorch headers should be included with angle-brackets so as to +# keep consistency with PyTorch source code. This should also prevent a +# header to be included twice. +# +# 4. Project headers: +# a) _XLAC headers: `#include "torch_xla/csrc/*.h"` +# b) Test headers: `#include "test/*.h"` IncludeCategories: - Regex: '^' Priority: 3 @@ -85,11 +91,11 @@ IncludeCategories: - Regex: '^<.*' Priority: 2 - Regex: '"torch_xla/.*"' - Priority: 5 + Priority: 4 - Regex: '"test/.*"' - Priority: 6 - - Regex: '.*' Priority: 4 + - Regex: '.*' + Priority: 3 IncludeIsMainRegex: '([-_](test|unittest))?$' IndentCaseLabels: true IndentPPDirectives: None diff --git a/test/cpp/cpp_test_util.h b/test/cpp/cpp_test_util.h index a41620083dbe..82f57a7acae9 100644 --- a/test/cpp/cpp_test_util.h +++ b/test/cpp/cpp_test_util.h @@ -8,9 +8,8 @@ #include #include -#include - #include "absl/types/span.h" +#include #include "torch_xla/csrc/debug_util.h" #include "torch_xla/csrc/device.h" diff --git a/test/cpp/metrics_snapshot.cpp b/test/cpp/metrics_snapshot.cpp index 1d38fd543d61..604b488d2f72 100644 --- a/test/cpp/metrics_snapshot.cpp +++ b/test/cpp/metrics_snapshot.cpp @@ -2,7 +2,7 @@ #include -#include "torch/csrc/lazy/core/metrics.h" +#include #include "torch_xla/csrc/runtime/tf_logging.h" #include "torch_xla/csrc/runtime/util.h" diff --git a/test/cpp/test_aten_xla_tensor_1.cpp b/test/cpp/test_aten_xla_tensor_1.cpp index f24104298985..84d22898bc61 100644 --- a/test/cpp/test_aten_xla_tensor_1.cpp +++ b/test/cpp/test_aten_xla_tensor_1.cpp @@ -2,11 +2,12 @@ #include -#include - #include "xla/permutation_util.h" #include "xla/util.h" +#include +#include "test/cpp/cpp_test_util.h" +#include "test/cpp/torch_xla_test.h" #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/ops/dynamic_ir.h" @@ -15,9 +16,6 @@ #include "torch_xla/csrc/runtime/metrics.h" #include "torch_xla/csrc/torch_util.h" -#include "test/cpp/cpp_test_util.h" -#include "test/cpp/torch_xla_test.h" - namespace torch_xla { namespace cpp_test { namespace { diff --git a/test/cpp/test_aten_xla_tensor_2.cpp b/test/cpp/test_aten_xla_tensor_2.cpp index aa3b3a7db4d7..e79b3baa32ee 100644 --- a/test/cpp/test_aten_xla_tensor_2.cpp +++ b/test/cpp/test_aten_xla_tensor_2.cpp @@ -3,11 +3,12 @@ #include #include -#include - #include "xla/permutation_util.h" #include "xla/util.h" +#include +#include "test/cpp/cpp_test_util.h" +#include "test/cpp/torch_xla_test.h" #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/ops/dynamic_ir.h" @@ -16,9 +17,6 @@ #include "torch_xla/csrc/runtime/metrics.h" #include "torch_xla/csrc/torch_util.h" -#include "test/cpp/cpp_test_util.h" -#include "test/cpp/torch_xla_test.h" - namespace torch_xla { namespace cpp_test { namespace { diff --git a/test/cpp/test_aten_xla_tensor_3.cpp b/test/cpp/test_aten_xla_tensor_3.cpp index b8bd444ddcd8..1841c566af68 100644 --- a/test/cpp/test_aten_xla_tensor_3.cpp +++ b/test/cpp/test_aten_xla_tensor_3.cpp @@ -2,11 +2,12 @@ #include -#include - #include "xla/permutation_util.h" #include "xla/util.h" +#include +#include "test/cpp/cpp_test_util.h" +#include "test/cpp/torch_xla_test.h" #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/ops/dynamic_ir.h" @@ -15,9 +16,6 @@ #include "torch_xla/csrc/runtime/metrics.h" #include "torch_xla/csrc/torch_util.h" -#include "test/cpp/cpp_test_util.h" -#include "test/cpp/torch_xla_test.h" - namespace torch_xla { namespace cpp_test { namespace { diff --git a/test/cpp/test_aten_xla_tensor_4.cpp b/test/cpp/test_aten_xla_tensor_4.cpp index eb0fadd14d48..fdf997bc32a9 100644 --- a/test/cpp/test_aten_xla_tensor_4.cpp +++ b/test/cpp/test_aten_xla_tensor_4.cpp @@ -2,11 +2,12 @@ #include -#include - #include "xla/permutation_util.h" #include "xla/util.h" +#include +#include "test/cpp/cpp_test_util.h" +#include "test/cpp/torch_xla_test.h" #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/ops/dynamic_ir.h" @@ -15,9 +16,6 @@ #include "torch_xla/csrc/runtime/metrics.h" #include "torch_xla/csrc/torch_util.h" -#include "test/cpp/cpp_test_util.h" -#include "test/cpp/torch_xla_test.h" - namespace torch_xla { namespace cpp_test { namespace { diff --git a/test/cpp/test_aten_xla_tensor_5.cpp b/test/cpp/test_aten_xla_tensor_5.cpp index 5f512b0ff7f8..6f3d136d216c 100644 --- a/test/cpp/test_aten_xla_tensor_5.cpp +++ b/test/cpp/test_aten_xla_tensor_5.cpp @@ -2,11 +2,12 @@ #include -#include - #include "xla/permutation_util.h" #include "xla/util.h" +#include +#include "test/cpp/cpp_test_util.h" +#include "test/cpp/torch_xla_test.h" #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/ops/dynamic_ir.h" @@ -15,9 +16,6 @@ #include "torch_xla/csrc/runtime/metrics.h" #include "torch_xla/csrc/torch_util.h" -#include "test/cpp/cpp_test_util.h" -#include "test/cpp/torch_xla_test.h" - namespace torch_xla { namespace cpp_test { namespace { diff --git a/test/cpp/test_aten_xla_tensor_6.cpp b/test/cpp/test_aten_xla_tensor_6.cpp index 32e9d53acb0e..2df3e12ad506 100644 --- a/test/cpp/test_aten_xla_tensor_6.cpp +++ b/test/cpp/test_aten_xla_tensor_6.cpp @@ -2,11 +2,12 @@ #include -#include - #include "xla/permutation_util.h" #include "xla/util.h" +#include +#include "test/cpp/cpp_test_util.h" +#include "test/cpp/torch_xla_test.h" #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/ops/dynamic_ir.h" @@ -15,9 +16,6 @@ #include "torch_xla/csrc/runtime/metrics.h" #include "torch_xla/csrc/torch_util.h" -#include "test/cpp/cpp_test_util.h" -#include "test/cpp/torch_xla_test.h" - namespace torch_xla { namespace cpp_test { namespace { diff --git a/test/cpp/test_debug_macros.cpp b/test/cpp/test_debug_macros.cpp index 55af1c032efe..e62e40484fe6 100644 --- a/test/cpp/test_debug_macros.cpp +++ b/test/cpp/test_debug_macros.cpp @@ -1,11 +1,10 @@ #include #include +#include "test/cpp/cpp_test_util.h" #include "torch_xla/csrc/runtime/debug_macros.h" #include "torch_xla/csrc/runtime/env_vars.h" -#include "test/cpp/cpp_test_util.h" - namespace torch_xla::cpp_test { namespace { diff --git a/test/cpp/test_ir.cpp b/test/cpp/test_ir.cpp index da654bdc1a71..39b155a564ff 100644 --- a/test/cpp/test_ir.cpp +++ b/test/cpp/test_ir.cpp @@ -2,6 +2,8 @@ #include +#include "test/cpp/cpp_test_util.h" +#include "test/cpp/torch_xla_test.h" #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/arithmetic_ir_ops.h" @@ -14,9 +16,6 @@ #include "torch_xla/csrc/ops/unselect.h" #include "torch_xla/csrc/ops/update_slice.h" -#include "test/cpp/cpp_test_util.h" -#include "test/cpp/torch_xla_test.h" - namespace torch_xla { namespace cpp_test { diff --git a/test/cpp/test_lazy.cpp b/test/cpp/test_lazy.cpp index 90082a3b9d7d..6188479a9d3e 100644 --- a/test/cpp/test_lazy.cpp +++ b/test/cpp/test_lazy.cpp @@ -1,11 +1,10 @@ #include -#include "torch/csrc/lazy/core/shape.h" #include "xla/shape.h" - -#include "torch_xla/csrc/helpers.h" +#include #include "test/cpp/torch_xla_test.h" +#include "torch_xla/csrc/helpers.h" namespace torch_xla { namespace cpp_test { diff --git a/test/cpp/test_replication.cpp b/test/cpp/test_replication.cpp index 2cb9f05ba1af..b59f4805a15b 100644 --- a/test/cpp/test_replication.cpp +++ b/test/cpp/test_replication.cpp @@ -7,6 +7,8 @@ #include "xla/hlo/builder/xla_builder.h" #include "xla/shape_util.h" +#include "test/cpp/cpp_test_util.h" +#include "test/cpp/torch_xla_test.h" #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/runtime/debug_macros.h" @@ -16,9 +18,6 @@ #include "torch_xla/csrc/thread_pool.h" #include "torch_xla/csrc/torch_util.h" -#include "test/cpp/cpp_test_util.h" -#include "test/cpp/torch_xla_test.h" - namespace torch_xla { namespace cpp_test { namespace { diff --git a/test/cpp/test_status_common.h b/test/cpp/test_status_common.h index c7adbb5c369c..1c1a09b3c973 100644 --- a/test/cpp/test_status_common.h +++ b/test/cpp/test_status_common.h @@ -30,11 +30,10 @@ #include "absl/status/status.h" #include "absl/status/statusor.h" +#include "test/cpp/cpp_test_util.h" #include "torch_xla/csrc/runtime/env_vars.h" #include "torch_xla/csrc/status.h" -#include "test/cpp/cpp_test_util.h" - namespace torch_xla { // Enum to control whether C++ error context is shown in status messages. diff --git a/test/cpp/test_symint.cpp b/test/cpp/test_symint.cpp index c8bead772480..ed0659f46824 100644 --- a/test/cpp/test_symint.cpp +++ b/test/cpp/test_symint.cpp @@ -2,6 +2,7 @@ #include +#include "test/cpp/cpp_test_util.h" #include "torch_xla/csrc/LazyIr.h" #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/ops/dynamic_ir.h" @@ -9,8 +10,6 @@ #include "torch_xla/csrc/ops/ops.h" #include "torch_xla/csrc/torch_util.h" -#include "test/cpp/cpp_test_util.h" - namespace torch_xla { namespace cpp_test { diff --git a/test/cpp/test_tensor.cpp b/test/cpp/test_tensor.cpp index 69abc54d6977..bfb3ba99e916 100644 --- a/test/cpp/test_tensor.cpp +++ b/test/cpp/test_tensor.cpp @@ -5,16 +5,15 @@ #include #include "absl/base/nullability.h" -#include "torch/csrc/autograd/variable.h" +#include +#include "test/cpp/cpp_test_util.h" +#include "test/cpp/torch_xla_test.h" #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/tensor.h" #include "torch_xla/csrc/tensor_methods.h" #include "torch_xla/csrc/tensor_util.h" -#include "test/cpp/cpp_test_util.h" -#include "test/cpp/torch_xla_test.h" - namespace torch_xla { namespace cpp_test { namespace { diff --git a/test/cpp/test_xla_backend_intf.cpp b/test/cpp/test_xla_backend_intf.cpp index b175948152ff..25a39e57abb8 100644 --- a/test/cpp/test_xla_backend_intf.cpp +++ b/test/cpp/test_xla_backend_intf.cpp @@ -1,12 +1,11 @@ #include +#include "test/cpp/cpp_test_util.h" #include "torch_xla/csrc/runtime/computation_client.h" #include "torch_xla/csrc/status.h" #include "torch_xla/csrc/tensor_util.h" #include "torch_xla/csrc/xla_backend_impl.h" -#include "test/cpp/cpp_test_util.h" - namespace torch_xla { namespace cpp_test { diff --git a/test/cpp/test_xla_generator.cpp b/test/cpp/test_xla_generator.cpp index e331df2e3052..40f6780adae1 100644 --- a/test/cpp/test_xla_generator.cpp +++ b/test/cpp/test_xla_generator.cpp @@ -5,9 +5,8 @@ #include -#include "torch_xla/csrc/xla_generator.h" - #include "test/cpp/torch_xla_test.h" +#include "torch_xla/csrc/xla_generator.h" namespace torch_xla { namespace cpp_test { diff --git a/test/cpp/test_xla_sharding.cpp b/test/cpp/test_xla_sharding.cpp index fb0ae2e7f91f..8cbfafcd984a 100644 --- a/test/cpp/test_xla_sharding.cpp +++ b/test/cpp/test_xla_sharding.cpp @@ -5,11 +5,12 @@ #include -#include - #include "xla/protobuf_util.h" #include "xla/xla_data.pb.h" +#include +#include "test/cpp/cpp_test_util.h" +#include "test/cpp/torch_xla_test.h" #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/runtime/computation_client.h" @@ -22,9 +23,6 @@ #include "torch_xla/csrc/tensor_util.h" #include "torch_xla/csrc/xla_sharding_util.h" -#include "test/cpp/cpp_test_util.h" -#include "test/cpp/torch_xla_test.h" - namespace torch_xla { namespace cpp_test { namespace { diff --git a/torch_xla/csrc/aten_xla_bridge.cpp b/torch_xla/csrc/aten_xla_bridge.cpp index a9a9204342d7..c8c4d79bc74e 100644 --- a/torch_xla/csrc/aten_xla_bridge.cpp +++ b/torch_xla/csrc/aten_xla_bridge.cpp @@ -6,10 +6,9 @@ #include #include -#include - #include "absl/log/absl_check.h" #include "absl/strings/str_cat.h" +#include #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/runtime/debug_macros.h" diff --git a/torch_xla/csrc/aten_xla_type.cpp b/torch_xla/csrc/aten_xla_type.cpp index aab9fd45b342..1a915b492579 100644 --- a/torch_xla/csrc/aten_xla_type.cpp +++ b/torch_xla/csrc/aten_xla_type.cpp @@ -15,17 +15,13 @@ #include #include +#include "absl/base/nullability.h" +#include "absl/log/absl_check.h" +#include #include #include #include -#include "absl/base/nullability.h" -#include "absl/log/absl_check.h" -#include "torch/csrc/lazy/core/helpers.h" -#include "torch/csrc/lazy/core/shape_inference.h" -#include "torch/csrc/lazy/core/tensor_util.h" -#include "torch/csrc/lazy/core/util.h" - #include "torch_xla/csrc/LazyIr.h" #include "torch_xla/csrc/XLANativeFunctions.h" #include "torch_xla/csrc/aten_autograd_ops.h" diff --git a/torch_xla/csrc/cross_replica_reduces.cpp b/torch_xla/csrc/cross_replica_reduces.cpp index 0d0f334713d3..c21085ace063 100644 --- a/torch_xla/csrc/cross_replica_reduces.cpp +++ b/torch_xla/csrc/cross_replica_reduces.cpp @@ -2,10 +2,8 @@ #include -#include - -#include "torch/csrc/lazy/core/util.h" #include "xla/shape_util.h" +#include #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/convert_ops.h" diff --git a/torch_xla/csrc/cross_replica_reduces.h b/torch_xla/csrc/cross_replica_reduces.h index 2746cf22b3a3..2766bfaa5a22 100644 --- a/torch_xla/csrc/cross_replica_reduces.h +++ b/torch_xla/csrc/cross_replica_reduces.h @@ -4,8 +4,8 @@ #include #include "absl/types/span.h" -#include "torch/csrc/lazy/core/ir.h" #include "xla/hlo/builder/xla_builder.h" +#include #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/ir.h" diff --git a/torch_xla/csrc/data_ops.cpp b/torch_xla/csrc/data_ops.cpp index 931ac56b7f96..450f63276930 100644 --- a/torch_xla/csrc/data_ops.cpp +++ b/torch_xla/csrc/data_ops.cpp @@ -4,14 +4,13 @@ #include #include -#include -#include - #include "absl/strings/str_join.h" #include "xla/hlo/builder/lib/constants.h" #include "xla/hlo/builder/lib/slicing.h" #include "xla/shape_util.h" #include "xla/util.h" +#include +#include #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/convert_ops.h" diff --git a/torch_xla/csrc/debug_util.cpp b/torch_xla/csrc/debug_util.cpp index 99a46bc4f0ad..2332ad6da489 100644 --- a/torch_xla/csrc/debug_util.cpp +++ b/torch_xla/csrc/debug_util.cpp @@ -7,13 +7,12 @@ #include #include +#include "absl/memory/memory.h" +#include "absl/strings/str_split.h" #include #include #include -#include "absl/memory/memory.h" -#include "absl/strings/str_split.h" - #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/ir.h" diff --git a/torch_xla/csrc/dynamic_shape_detector.h b/torch_xla/csrc/dynamic_shape_detector.h index 7d73a65bd1e7..907ecd2ac7e9 100644 --- a/torch_xla/csrc/dynamic_shape_detector.h +++ b/torch_xla/csrc/dynamic_shape_detector.h @@ -3,9 +3,8 @@ #include -#include - #include "absl/types/span.h" +#include namespace torch_xla { diff --git a/torch_xla/csrc/function_call_tracker.cpp b/torch_xla/csrc/function_call_tracker.cpp index efe503c7ee0b..795de88d5d81 100644 --- a/torch_xla/csrc/function_call_tracker.cpp +++ b/torch_xla/csrc/function_call_tracker.cpp @@ -7,10 +7,9 @@ #include #include -#include - #include "absl/strings/str_split.h" #include "tsl/platform/stacktrace.h" +#include #include "torch_xla/csrc/runtime/sys_util.h" diff --git a/torch_xla/csrc/helpers.cpp b/torch_xla/csrc/helpers.cpp index f3a9730a5dcd..f31dab307080 100644 --- a/torch_xla/csrc/helpers.cpp +++ b/torch_xla/csrc/helpers.cpp @@ -3,13 +3,12 @@ #include #include -#include -#include - #include "absl/strings/str_join.h" #include "xla/hlo/builder/lib/constants.h" #include "xla/primitive_util.h" #include "xla/shape_util.h" +#include +#include #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/dtype.h" diff --git a/torch_xla/csrc/helpers.h b/torch_xla/csrc/helpers.h index 55a034478510..1dbeb4897bdb 100644 --- a/torch_xla/csrc/helpers.h +++ b/torch_xla/csrc/helpers.h @@ -8,9 +8,6 @@ #include #include -#include -#include - #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/types/optional.h" @@ -20,6 +17,8 @@ #include "xla/literal_util.h" #include "xla/permutation_util.h" #include "xla/types.h" +#include +#include #include "torch_xla/csrc/runtime/debug_macros.h" #include "torch_xla/csrc/runtime/sys_util.h" diff --git a/torch_xla/csrc/init_python_bindings.cpp b/torch_xla/csrc/init_python_bindings.cpp index bda4cf830ba3..84cc8ab9e799 100644 --- a/torch_xla/csrc/init_python_bindings.cpp +++ b/torch_xla/csrc/init_python_bindings.cpp @@ -17,15 +17,6 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include - #include "absl/base/nullability.h" #include "absl/container/flat_hash_map.h" #include "absl/log/absl_check.h" @@ -46,6 +37,14 @@ #include "xla/hlo/parser/hlo_parser.h" #include "xla/pjrt/distributed/distributed.h" #include "xla/python/profiler/internal/traceme_wrapper.h" +#include +#include +#include +#include +#include +#include +#include +#include #include "torch_xla/csrc/XLANativeFunctions.h" #include "torch_xla/csrc/aten_autograd_ops.h" diff --git a/torch_xla/csrc/ir.cpp b/torch_xla/csrc/ir.cpp index c63b772ac45d..18d5959bd3d0 100644 --- a/torch_xla/csrc/ir.cpp +++ b/torch_xla/csrc/ir.cpp @@ -4,15 +4,14 @@ #include #include +#include "absl/log/absl_log.h" +#include "absl/status/status.h" +#include "absl/strings/str_cat.h" #include #include #include #include -#include "absl/log/absl_log.h" -#include "absl/status/status.h" -#include "absl/strings/str_cat.h" - #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/runtime/cache.h" #include "torch_xla/csrc/runtime/debug_macros.h" diff --git a/torch_xla/csrc/ir.h b/torch_xla/csrc/ir.h index 17944b3c73da..59ed00ce12ae 100644 --- a/torch_xla/csrc/ir.h +++ b/torch_xla/csrc/ir.h @@ -12,15 +12,14 @@ #include #include -#include -#include -#include -#include - #include "absl/container/inlined_vector.h" #include "absl/hash/hash.h" #include "absl/types/span.h" #include "xla/hlo/builder/xla_builder.h" +#include +#include +#include +#include #include "torch_xla/csrc/dynamic_shape_detector.h" #include "torch_xla/csrc/runtime/types.h" diff --git a/torch_xla/csrc/ir_dump_util.cpp b/torch_xla/csrc/ir_dump_util.cpp index 415cb17f7934..951ac036617a 100644 --- a/torch_xla/csrc/ir_dump_util.cpp +++ b/torch_xla/csrc/ir_dump_util.cpp @@ -4,10 +4,9 @@ #include #include -#include - #include "absl/container/flat_hash_map.h" #include "absl/types/optional.h" +#include #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/runtime/debug_macros.h" diff --git a/torch_xla/csrc/layout_manager.cpp b/torch_xla/csrc/layout_manager.cpp index 36fb5d8e3900..6186e66cec83 100644 --- a/torch_xla/csrc/layout_manager.cpp +++ b/torch_xla/csrc/layout_manager.cpp @@ -8,10 +8,9 @@ #include #include -#include - #include "absl/strings/str_split.h" #include "xla/shape_util.h" +#include #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/runtime/debug_macros.h" diff --git a/torch_xla/csrc/lowering_context.cpp b/torch_xla/csrc/lowering_context.cpp index 4b8f56c8fb73..2e2f04da5787 100644 --- a/torch_xla/csrc/lowering_context.cpp +++ b/torch_xla/csrc/lowering_context.cpp @@ -5,13 +5,12 @@ #include #include -#include - #include "absl/log/absl_check.h" #include "absl/log/absl_log.h" #include "absl/status/status.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_replace.h" +#include #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/runtime/computation_client.h" diff --git a/torch_xla/csrc/lowering_context.h b/torch_xla/csrc/lowering_context.h index 4a0c56d311e3..0d2b7e351d9b 100644 --- a/torch_xla/csrc/lowering_context.h +++ b/torch_xla/csrc/lowering_context.h @@ -9,15 +9,14 @@ #include #include -#include -#include -#include - #include "absl/status/status.h" #include "absl/types/span.h" #include "tsl/platform/macros.h" #include "xla/hlo/builder/xla_builder.h" #include "xla/types.h" +#include +#include +#include #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/ir.h" diff --git a/torch_xla/csrc/ops/all_reduce.cpp b/torch_xla/csrc/ops/all_reduce.cpp index 544dc4007d80..7b1585af5ccc 100644 --- a/torch_xla/csrc/ops/all_reduce.cpp +++ b/torch_xla/csrc/ops/all_reduce.cpp @@ -1,9 +1,8 @@ #include "torch_xla/csrc/ops/all_reduce.h" -#include - #include "absl/strings/str_join.h" #include "xla/shape_util.h" +#include #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/xla_ops.h" diff --git a/torch_xla/csrc/ops/as_strided.cpp b/torch_xla/csrc/ops/as_strided.cpp index fcccd95b5a1b..a5fafca8f8a4 100644 --- a/torch_xla/csrc/ops/as_strided.cpp +++ b/torch_xla/csrc/ops/as_strided.cpp @@ -2,10 +2,9 @@ #include -#include - #include "xla/shape_util.h" #include "xla/util.h" +#include #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/helpers.h" diff --git a/torch_xla/csrc/ops/cast.cpp b/torch_xla/csrc/ops/cast.cpp index 0271b75228cc..26fefb820b3b 100644 --- a/torch_xla/csrc/ops/cast.cpp +++ b/torch_xla/csrc/ops/cast.cpp @@ -1,8 +1,7 @@ #include "torch_xla/csrc/ops/cast.h" -#include - #include "xla/primitive_util.h" +#include #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/dtype.h" diff --git a/torch_xla/csrc/ops/cast_int4.cpp b/torch_xla/csrc/ops/cast_int4.cpp index 2dbd2d824380..713d516f1a8b 100644 --- a/torch_xla/csrc/ops/cast_int4.cpp +++ b/torch_xla/csrc/ops/cast_int4.cpp @@ -1,8 +1,7 @@ #include "torch_xla/csrc/ops/cast_int4.h" -#include - #include "xla/literal_util.h" +#include #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/xla_ops.h" diff --git a/torch_xla/csrc/ops/cumprod.cpp b/torch_xla/csrc/ops/cumprod.cpp index fc5bbd0e5864..522ab81b021f 100644 --- a/torch_xla/csrc/ops/cumprod.cpp +++ b/torch_xla/csrc/ops/cumprod.cpp @@ -1,8 +1,7 @@ #include "torch_xla/csrc/ops/cumprod.h" -#include - #include "xla/hlo/builder/lib/constants.h" +#include #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/helpers.h" diff --git a/torch_xla/csrc/ops/dynamic_ir.h b/torch_xla/csrc/ops/dynamic_ir.h index 49da48051ded..298c3a76f92f 100644 --- a/torch_xla/csrc/ops/dynamic_ir.h +++ b/torch_xla/csrc/ops/dynamic_ir.h @@ -10,10 +10,8 @@ #include #include -#include - #include "absl/log/absl_log.h" -#include "torch/csrc/lazy/core/dynamic_ir.h" +#include #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/ops/scalar.h" diff --git a/torch_xla/csrc/ops/expand_symint.cpp b/torch_xla/csrc/ops/expand_symint.cpp index 201ca24d771e..0339e45ad70e 100644 --- a/torch_xla/csrc/ops/expand_symint.cpp +++ b/torch_xla/csrc/ops/expand_symint.cpp @@ -1,10 +1,9 @@ #include "torch_xla/csrc/ops/expand_symint.h" -#include -#include - #include "absl/strings/str_join.h" #include "xla/hlo/builder/lib/constants.h" +#include +#include #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/lowering_context.h" diff --git a/torch_xla/csrc/ops/index_ops.cpp b/torch_xla/csrc/ops/index_ops.cpp index ba306c373d72..7aea60a9252a 100644 --- a/torch_xla/csrc/ops/index_ops.cpp +++ b/torch_xla/csrc/ops/index_ops.cpp @@ -4,9 +4,8 @@ #include #include -#include - #include "xla/permutation_util.h" +#include #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/helpers.h" diff --git a/torch_xla/csrc/ops/mean.cpp b/torch_xla/csrc/ops/mean.cpp index f9765ef2232b..1e8bd344f647 100644 --- a/torch_xla/csrc/ops/mean.cpp +++ b/torch_xla/csrc/ops/mean.cpp @@ -1,8 +1,7 @@ #include "torch_xla/csrc/ops/mean.h" -#include - #include "absl/strings/str_join.h" +#include #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" diff --git a/torch_xla/csrc/ops/nll_loss.cpp b/torch_xla/csrc/ops/nll_loss.cpp index 009b2ecfcbb5..765d3a6a32c1 100644 --- a/torch_xla/csrc/ops/nll_loss.cpp +++ b/torch_xla/csrc/ops/nll_loss.cpp @@ -1,8 +1,7 @@ #include "torch_xla/csrc/ops/nll_loss.h" -#include - #include "absl/types/span.h" +#include #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/nll_loss.h" diff --git a/torch_xla/csrc/ops/nll_loss2d.cpp b/torch_xla/csrc/ops/nll_loss2d.cpp index 7b0c67b58029..387c1379291d 100644 --- a/torch_xla/csrc/ops/nll_loss2d.cpp +++ b/torch_xla/csrc/ops/nll_loss2d.cpp @@ -1,8 +1,7 @@ #include "torch_xla/csrc/ops/nll_loss2d.h" -#include - #include "absl/types/span.h" +#include #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/nll_loss.h" diff --git a/torch_xla/csrc/ops/ops.cpp b/torch_xla/csrc/ops/ops.cpp index 34d86f35b1c6..59da3680757a 100644 --- a/torch_xla/csrc/ops/ops.cpp +++ b/torch_xla/csrc/ops/ops.cpp @@ -2,15 +2,14 @@ #include -#include -#include - #include "xla/hlo/builder/lib/constants.h" #include "xla/hlo/builder/lib/logdet.h" #include "xla/hlo/builder/lib/math.h" #include "xla/hlo/builder/lib/matrix.h" #include "xla/hlo/builder/lib/slicing.h" #include "xla/shape_util.h" +#include +#include #include "torch_xla/csrc/LazyIr.h" #include "torch_xla/csrc/convert_ops.h" diff --git a/torch_xla/csrc/ops/ops_lower_fn.cpp b/torch_xla/csrc/ops/ops_lower_fn.cpp index 9a0f8eaf579f..cf78a028dc4c 100644 --- a/torch_xla/csrc/ops/ops_lower_fn.cpp +++ b/torch_xla/csrc/ops/ops_lower_fn.cpp @@ -1,9 +1,8 @@ -#include - #include "xla/hlo/builder/lib/constants.h" #include "xla/hlo/builder/lib/logdet.h" #include "xla/hlo/builder/lib/math.h" #include "xla/hlo/builder/lib/matrix.h" +#include #include "torch_xla/csrc/LazyIr.h" #include "torch_xla/csrc/convert_ops.h" diff --git a/torch_xla/csrc/ops/ops_xla_shape_fn.cpp b/torch_xla/csrc/ops/ops_xla_shape_fn.cpp index cbf42f5b1990..22eae6effec0 100644 --- a/torch_xla/csrc/ops/ops_xla_shape_fn.cpp +++ b/torch_xla/csrc/ops/ops_xla_shape_fn.cpp @@ -1,9 +1,8 @@ #include "torch_xla/csrc/ops/ops_xla_shape_fn.h" -#include - #include "xla/hlo/builder/lib/logdet.h" #include "xla/shape_util.h" +#include #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/elementwise.h" diff --git a/torch_xla/csrc/ops/prod.cpp b/torch_xla/csrc/ops/prod.cpp index bb0cc5a90147..ce9bafd0dc45 100644 --- a/torch_xla/csrc/ops/prod.cpp +++ b/torch_xla/csrc/ops/prod.cpp @@ -1,8 +1,7 @@ #include "torch_xla/csrc/ops/prod.h" -#include - #include "absl/strings/str_join.h" +#include #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/helpers.h" diff --git a/torch_xla/csrc/ops/reduce_scatter.cpp b/torch_xla/csrc/ops/reduce_scatter.cpp index 91404dda0fb5..54de84a9cf8f 100644 --- a/torch_xla/csrc/ops/reduce_scatter.cpp +++ b/torch_xla/csrc/ops/reduce_scatter.cpp @@ -1,9 +1,8 @@ #include "torch_xla/csrc/ops/reduce_scatter.h" -#include - #include "absl/strings/str_join.h" #include "xla/shape_util.h" +#include #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" diff --git a/torch_xla/csrc/ops/sum.cpp b/torch_xla/csrc/ops/sum.cpp index f1694ee3412a..68ee3bb78a85 100644 --- a/torch_xla/csrc/ops/sum.cpp +++ b/torch_xla/csrc/ops/sum.cpp @@ -1,8 +1,7 @@ #include "torch_xla/csrc/ops/sum.h" -#include - #include "absl/strings/str_join.h" +#include #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/helpers.h" diff --git a/torch_xla/csrc/ops/svd.cpp b/torch_xla/csrc/ops/svd.cpp index 64bacbed6411..ff97e8a69758 100644 --- a/torch_xla/csrc/ops/svd.cpp +++ b/torch_xla/csrc/ops/svd.cpp @@ -1,10 +1,9 @@ #include "torch_xla/csrc/ops/svd.h" -#include - #include "xla/hlo/builder/lib/constants.h" #include "xla/hlo/builder/lib/matrix.h" #include "xla/hlo/builder/lib/svd.h" +#include #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/helpers.h" diff --git a/torch_xla/csrc/pooling.cpp b/torch_xla/csrc/pooling.cpp index 47b3f1b5c95e..6eb0f55ae927 100644 --- a/torch_xla/csrc/pooling.cpp +++ b/torch_xla/csrc/pooling.cpp @@ -1,14 +1,13 @@ #include "torch_xla/csrc/pooling.h" -#include -#include - #include "absl/status/status.h" #include "xla/hlo/builder/lib/arithmetic.h" #include "xla/hlo/builder/lib/constants.h" #include "xla/hlo/builder/lib/loops.h" #include "xla/hlo/builder/lib/pooling.h" #include "xla/hlo/builder/lib/slicing.h" +#include +#include #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/helpers.h" diff --git a/torch_xla/csrc/reduction.cpp b/torch_xla/csrc/reduction.cpp index 9e759aef7000..1822e420cdfb 100644 --- a/torch_xla/csrc/reduction.cpp +++ b/torch_xla/csrc/reduction.cpp @@ -5,13 +5,12 @@ #include #include -#include -#include - #include "xla/hlo/builder/lib/arithmetic.h" #include "xla/hlo/builder/lib/constants.h" #include "xla/hlo/builder/lib/matrix.h" #include "xla/literal_util.h" +#include +#include #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/helpers.h" diff --git a/torch_xla/csrc/runtime/computation_client.h b/torch_xla/csrc/runtime/computation_client.h index 2d81c7fb3f5b..9e5284c7ed4f 100644 --- a/torch_xla/csrc/runtime/computation_client.h +++ b/torch_xla/csrc/runtime/computation_client.h @@ -10,12 +10,6 @@ #include #include -#include -#include -#include -#include -#include - #include "absl/container/flat_hash_map.h" #include "absl/status/statusor.h" #include "absl/types/optional.h" @@ -26,6 +20,11 @@ #include "xla/pjrt/pjrt_client.h" #include "xla/pjrt/pjrt_common.h" #include "xla/types.h" +#include +#include +#include +#include +#include #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/runtime/debug_macros.h" diff --git a/torch_xla/csrc/runtime/ifrt_computation_client.h b/torch_xla/csrc/runtime/ifrt_computation_client.h index 8b3a9d811224..6a92071e4ce5 100644 --- a/torch_xla/csrc/runtime/ifrt_computation_client.h +++ b/torch_xla/csrc/runtime/ifrt_computation_client.h @@ -5,8 +5,6 @@ #include #include -#include - #include "absl/types/span.h" #include "xla/hlo/builder/xla_computation.h" #include "xla/literal.h" @@ -18,6 +16,7 @@ #include "xla/python/pjrt_ifrt/pjrt_dtype.h" #include "xla/python/pjrt_ifrt/xla_compiler.h" #include "xla/shape.h" +#include #include "torch_xla/csrc/runtime/computation_client.h" #include "torch_xla/csrc/runtime/debug_macros.h" diff --git a/torch_xla/csrc/runtime/pjrt_computation_client.h b/torch_xla/csrc/runtime/pjrt_computation_client.h index f7a8fd3463ef..887bcf2eb45e 100644 --- a/torch_xla/csrc/runtime/pjrt_computation_client.h +++ b/torch_xla/csrc/runtime/pjrt_computation_client.h @@ -5,8 +5,6 @@ #include #include -#include - #include "absl/types/span.h" #include "tsl/platform/env.h" #include "tsl/platform/threadpool.h" @@ -16,6 +14,7 @@ #include "xla/pjrt/pjrt_client.h" #include "xla/pjrt/pjrt_executable.h" #include "xla/shape.h" +#include #include "torch_xla/csrc/runtime/computation_client.h" #include "torch_xla/csrc/runtime/debug_macros.h" diff --git a/torch_xla/csrc/runtime/runtime.cpp b/torch_xla/csrc/runtime/runtime.cpp index 46efc72b0550..051e7c823ed6 100644 --- a/torch_xla/csrc/runtime/runtime.cpp +++ b/torch_xla/csrc/runtime/runtime.cpp @@ -1,9 +1,8 @@ #include "torch_xla/csrc/runtime/runtime.h" -#include - #include "absl/log/absl_check.h" #include "tsl/platform/stacktrace_handler.h" +#include #include "torch_xla/csrc/runtime/computation_client.h" #include "torch_xla/csrc/runtime/env_vars.h" diff --git a/torch_xla/csrc/runtime/tensor_source.h b/torch_xla/csrc/runtime/tensor_source.h index 20c9f674c9e1..b4981d065d2e 100644 --- a/torch_xla/csrc/runtime/tensor_source.h +++ b/torch_xla/csrc/runtime/tensor_source.h @@ -7,11 +7,10 @@ #include #include -#include - #include "xla/literal.h" #include "xla/shape.h" #include "xla/shape_util.h" +#include #include "torch_xla/csrc/dtype.h" #include "torch_xla/csrc/runtime/debug_macros.h" diff --git a/torch_xla/csrc/runtime/tf_logging.cpp b/torch_xla/csrc/runtime/tf_logging.cpp index a8c2d7644aa1..428b4ef8c336 100644 --- a/torch_xla/csrc/runtime/tf_logging.cpp +++ b/torch_xla/csrc/runtime/tf_logging.cpp @@ -4,9 +4,8 @@ #include -#include - #include "tsl/platform/stacktrace.h" +#include #include "torch_xla/csrc/status.h" diff --git a/torch_xla/csrc/runtime/xla_util.cpp b/torch_xla/csrc/runtime/xla_util.cpp index 24981a141cec..a294a0d909af 100644 --- a/torch_xla/csrc/runtime/xla_util.cpp +++ b/torch_xla/csrc/runtime/xla_util.cpp @@ -6,13 +6,12 @@ #include #include -#include - #include "tsl/platform/errors.h" #include "tsl/platform/stacktrace.h" #include "xla/shape_util.h" #include "xla/tsl/lib/strings/proto_serialization.h" #include "xla/util.h" +#include #include "torch_xla/csrc/runtime/sys_util.h" #include "torch_xla/csrc/runtime/tf_logging.h" diff --git a/torch_xla/csrc/runtime/xla_util.h b/torch_xla/csrc/runtime/xla_util.h index 17079ccf2fd6..b3ad0f5ecf9d 100644 --- a/torch_xla/csrc/runtime/xla_util.h +++ b/torch_xla/csrc/runtime/xla_util.h @@ -3,14 +3,13 @@ #include -#include - #include "absl/status/status.h" #include "absl/types/span.h" #include "xla/hlo/builder/xla_computation.h" #include "xla/hlo/ir/hlo_module.h" #include "xla/service/hlo.pb.h" #include "xla/status_macros.h" +#include #include "torch_xla/csrc/runtime/types.h" diff --git a/torch_xla/csrc/runtime/xla_util_test.cpp b/torch_xla/csrc/runtime/xla_util_test.cpp index 24b328813c5b..f37537a3a1af 100644 --- a/torch_xla/csrc/runtime/xla_util_test.cpp +++ b/torch_xla/csrc/runtime/xla_util_test.cpp @@ -18,7 +18,6 @@ #include "xla/hlo/builder/xla_computation.h" #include "xla/tsl/lib/core/status_test_util.h" #include "xla/tsl/protobuf/error_codes.pb.h" -#include "xla_util.h" #include "torch_xla/csrc/runtime/debug_macros.h" diff --git a/torch_xla/csrc/stack_frame_index_builder.h b/torch_xla/csrc/stack_frame_index_builder.h index 1d4529e773a1..61f43e4ef8e3 100644 --- a/torch_xla/csrc/stack_frame_index_builder.h +++ b/torch_xla/csrc/stack_frame_index_builder.h @@ -4,10 +4,9 @@ #include #include -#include // SourceLocation - #include "xla/service/hlo.pb.h" #include "xla/types.h" +#include // SourceLocation namespace torch_xla { diff --git a/torch_xla/csrc/status.cpp b/torch_xla/csrc/status.cpp index e9145a79aea8..51649bd1787a 100644 --- a/torch_xla/csrc/status.cpp +++ b/torch_xla/csrc/status.cpp @@ -6,11 +6,10 @@ #include #include -#include - #include "absl/log/absl_check.h" #include "absl/strings/str_cat.h" #include "tsl/platform/stacktrace.h" +#include namespace torch_xla { diff --git a/torch_xla/csrc/tensor.cpp b/torch_xla/csrc/tensor.cpp index 57b4f62c4a56..cbf57207a0b3 100644 --- a/torch_xla/csrc/tensor.cpp +++ b/torch_xla/csrc/tensor.cpp @@ -10,6 +10,9 @@ #include #include +#include "tsl/platform/errors.h" +#include "tsl/profiler/lib/traceme.h" +#include "xla/shape_util.h" #include #include #include @@ -19,10 +22,6 @@ #include #include -#include "tsl/platform/errors.h" -#include "tsl/profiler/lib/traceme.h" -#include "xla/shape_util.h" - #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/debug_util.h" #include "torch_xla/csrc/dtype.h" diff --git a/torch_xla/csrc/tensor.h b/torch_xla/csrc/tensor.h index 66a8e14e9134..ad51ec880eca 100644 --- a/torch_xla/csrc/tensor.h +++ b/torch_xla/csrc/tensor.h @@ -6,12 +6,11 @@ #include #include +#include "absl/base/nullability.h" #include #include #include -#include "absl/base/nullability.h" - #include "torch_xla/csrc/runtime/util.h" #include "torch_xla/csrc/view.h" diff --git a/torch_xla/csrc/tensor_impl.cpp b/torch_xla/csrc/tensor_impl.cpp index 2c79eff110f5..9cb1027cdfe3 100644 --- a/torch_xla/csrc/tensor_impl.cpp +++ b/torch_xla/csrc/tensor_impl.cpp @@ -5,13 +5,12 @@ #include #include +#include "absl/log/absl_check.h" #include #include #include #include -#include "absl/log/absl_check.h" - #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/ir_builder.h" diff --git a/torch_xla/csrc/tensor_methods.cpp b/torch_xla/csrc/tensor_methods.cpp index 65d4e1b4ac8d..c3b57ceecc4a 100644 --- a/torch_xla/csrc/tensor_methods.cpp +++ b/torch_xla/csrc/tensor_methods.cpp @@ -7,10 +7,6 @@ #include #include -#include -#include -#include - #include "absl/base/nullability.h" #include "absl/log/absl_check.h" #include "absl/status/status.h" @@ -19,6 +15,9 @@ #include "absl/strings/str_split.h" #include "absl/types/span.h" #include "xla/literal_util.h" +#include +#include +#include #include "torch_xla/csrc/LazyIr.h" #include "torch_xla/csrc/aten_xla_bridge.h" diff --git a/torch_xla/csrc/tensor_ops.cpp b/torch_xla/csrc/tensor_ops.cpp index d49fa4e0358a..3c1426b061b2 100644 --- a/torch_xla/csrc/tensor_ops.cpp +++ b/torch_xla/csrc/tensor_ops.cpp @@ -1,10 +1,9 @@ #include "torch_xla/csrc/tensor_ops.h" +#include "absl/base/nullability.h" #include #include -#include "absl/base/nullability.h" - #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/runtime/computation_client.h" diff --git a/torch_xla/csrc/tensor_util.cpp b/torch_xla/csrc/tensor_util.cpp index cef072f4c537..45f87da0d120 100644 --- a/torch_xla/csrc/tensor_util.cpp +++ b/torch_xla/csrc/tensor_util.cpp @@ -10,13 +10,12 @@ #include #include -#include -#include - #include "absl/synchronization/blocking_counter.h" #include "tsl/platform/bfloat16.h" #include "xla/literal_util.h" #include "xla/shape_util.h" +#include +#include #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/dtype.h" diff --git a/torch_xla/csrc/tensor_util.h b/torch_xla/csrc/tensor_util.h index 4a6f73bd3bd9..2d055ce1866e 100644 --- a/torch_xla/csrc/tensor_util.h +++ b/torch_xla/csrc/tensor_util.h @@ -6,13 +6,12 @@ #include #include -#include -#include - #include "absl/types/span.h" #include "xla/literal.h" #include "xla/shape.h" #include "xla/types.h" +#include +#include #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/runtime/computation_client.h" diff --git a/torch_xla/csrc/torch_util.h b/torch_xla/csrc/torch_util.h index b45695ad6d66..a5cbeeb8b628 100644 --- a/torch_xla/csrc/torch_util.h +++ b/torch_xla/csrc/torch_util.h @@ -7,13 +7,12 @@ #include +#include "xla/shape.h" #include #include #include #include -#include "xla/shape.h" - #include "torch_xla/csrc/runtime/debug_macros.h" namespace torch_xla { diff --git a/torch_xla/csrc/unwrap_data.cpp b/torch_xla/csrc/unwrap_data.cpp index f6c1bba835e7..1989d938c22b 100644 --- a/torch_xla/csrc/unwrap_data.cpp +++ b/torch_xla/csrc/unwrap_data.cpp @@ -1,13 +1,12 @@ #include #include +#include "absl/types/span.h" #include #include #include #include -#include "absl/types/span.h" - #include "torch_xla/csrc/runtime/computation_client.h" namespace torch_xla { diff --git a/torch_xla/csrc/unwrap_data.h b/torch_xla/csrc/unwrap_data.h index 932d9e0be738..eee1a787d9ec 100644 --- a/torch_xla/csrc/unwrap_data.h +++ b/torch_xla/csrc/unwrap_data.h @@ -3,11 +3,10 @@ #include +#include "absl/types/span.h" #include #include -#include "absl/types/span.h" - #include "torch_xla/csrc/runtime/computation_client.h" namespace torch_xla { diff --git a/torch_xla/csrc/view.cpp b/torch_xla/csrc/view.cpp index f024cb6fa213..6acca8362e4f 100644 --- a/torch_xla/csrc/view.cpp +++ b/torch_xla/csrc/view.cpp @@ -4,10 +4,9 @@ #include #include -#include - #include "xla/shape_util.h" #include "xla/util.h" +#include #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/ops/as_strided.h" diff --git a/torch_xla/csrc/xla_graph_executor.cpp b/torch_xla/csrc/xla_graph_executor.cpp index fdfb2a61a3e9..a0f99e45c11a 100644 --- a/torch_xla/csrc/xla_graph_executor.cpp +++ b/torch_xla/csrc/xla_graph_executor.cpp @@ -14,6 +14,14 @@ #include #include +#include "absl/container/flat_hash_map.h" +#include "absl/memory/memory.h" +#include "absl/strings/str_join.h" +#include "stablehlo/dialect/Serialization.h" // from @stablehlo +#include "tsl/platform/errors.h" +#include "tsl/profiler/lib/traceme.h" +#include "xla/literal_util.h" +#include "xla/shape_util.h" #include #include #include @@ -24,15 +32,6 @@ #include #include -#include "absl/container/flat_hash_map.h" -#include "absl/memory/memory.h" -#include "absl/strings/str_join.h" -#include "stablehlo/dialect/Serialization.h" // from @stablehlo -#include "tsl/platform/errors.h" -#include "tsl/profiler/lib/traceme.h" -#include "xla/literal_util.h" -#include "xla/shape_util.h" - #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/dtype.h" #include "torch_xla/csrc/hash_util.h" diff --git a/torch_xla/csrc/xla_graph_executor.h b/torch_xla/csrc/xla_graph_executor.h index e4dcedce8268..38fa8f831708 100644 --- a/torch_xla/csrc/xla_graph_executor.h +++ b/torch_xla/csrc/xla_graph_executor.h @@ -8,12 +8,11 @@ #include #include -#include -#include - #include "absl/synchronization/blocking_counter.h" #include "xla/hlo/builder/xla_builder.h" #include "xla/types.h" +#include +#include #include "torch_xla/csrc/cross_replica_reduces.h" #include "torch_xla/csrc/debug_util.h" diff --git a/torch_xla/csrc/xla_lower_util.cpp b/torch_xla/csrc/xla_lower_util.cpp index 7908294f4533..98d2cdb8fc34 100644 --- a/torch_xla/csrc/xla_lower_util.cpp +++ b/torch_xla/csrc/xla_lower_util.cpp @@ -3,9 +3,6 @@ #include #include -#include -#include - #include "absl/status/status.h" #include "xla/hlo/builder/lib/arithmetic.h" #include "xla/hlo/builder/lib/comparators.h" @@ -16,6 +13,8 @@ #include "xla/shape_util.h" #include "xla/stream_executor/dnn.h" #include "xla/util.h" +#include +#include #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/data_ops.h" diff --git a/torch_xla/csrc/xla_op_builder.h b/torch_xla/csrc/xla_op_builder.h index 2864c6fcec05..f9f1200d3401 100644 --- a/torch_xla/csrc/xla_op_builder.h +++ b/torch_xla/csrc/xla_op_builder.h @@ -5,9 +5,8 @@ #include #include -#include - #include "xla/hlo/builder/xla_builder.h" +#include namespace torch_xla { namespace op_builder { diff --git a/torch_xla/csrc/xla_sharding_util.cpp b/torch_xla/csrc/xla_sharding_util.cpp index 967d7f17102a..91b1e82bcd58 100644 --- a/torch_xla/csrc/xla_sharding_util.cpp +++ b/torch_xla/csrc/xla_sharding_util.cpp @@ -6,7 +6,6 @@ #include #include "absl/synchronization/blocking_counter.h" -#include "torch/csrc/lazy/core/ir_util.h" #include "tsl/profiler/lib/traceme.h" #include "xla/execution_options_util.h" #include "xla/hlo/ir/hlo_module.h" @@ -18,6 +17,7 @@ #include "xla/service/spmd/spmd_partitioner.h" #include "xla/xla.pb.h" #include "xla_sharding_util.h" +#include #include "torch_xla/csrc/aten_autograd_ops.h" #include "torch_xla/csrc/aten_xla_bridge.h" diff --git a/torch_xla/csrc/xla_sharding_util.h b/torch_xla/csrc/xla_sharding_util.h index 3b30833d3264..f6fd596a7f4b 100644 --- a/torch_xla/csrc/xla_sharding_util.h +++ b/torch_xla/csrc/xla_sharding_util.h @@ -3,11 +3,10 @@ #include -#include - #include "xla/hlo/builder/xla_builder.h" #include "xla/hlo/builder/xla_computation.h" #include "xla/service/hlo.pb.h" +#include #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/lowering_context.h" From aeec3f59fd84b1bd56b1816b20b3166a200f3a8c Mon Sep 17 00:00:00 2001 From: Yukio Siraichi Date: Tue, 18 Nov 2025 19:51:13 -0300 Subject: [PATCH 4/4] Fix include ordering build issue. --- .clang-format | 48 ++++++++++++------- test/cpp/cpp_test_util.h | 3 +- test/cpp/test_aten_xla_tensor_1.cpp | 3 +- test/cpp/test_aten_xla_tensor_2.cpp | 3 +- test/cpp/test_aten_xla_tensor_3.cpp | 3 +- test/cpp/test_aten_xla_tensor_4.cpp | 3 +- test/cpp/test_aten_xla_tensor_5.cpp | 3 +- test/cpp/test_aten_xla_tensor_6.cpp | 3 +- test/cpp/test_lazy.cpp | 3 +- test/cpp/test_tensor.cpp | 3 +- test/cpp/test_xla_sharding.cpp | 3 +- torch_xla/csrc/aten_xla_bridge.cpp | 3 +- torch_xla/csrc/aten_xla_type.cpp | 5 +- torch_xla/csrc/cross_replica_reduces.cpp | 3 +- torch_xla/csrc/cross_replica_reduces.h | 3 +- torch_xla/csrc/data_ops.cpp | 5 +- torch_xla/csrc/debug_util.cpp | 5 +- torch_xla/csrc/dynamic_shape_detector.h | 3 +- torch_xla/csrc/function_call_tracker.cpp | 3 +- torch_xla/csrc/helpers.cpp | 5 +- torch_xla/csrc/helpers.h | 5 +- torch_xla/csrc/init_python_bindings.cpp | 17 +++---- torch_xla/csrc/ir.cpp | 7 +-- torch_xla/csrc/ir.h | 9 ++-- torch_xla/csrc/ir_dump_util.cpp | 3 +- torch_xla/csrc/layout_manager.cpp | 3 +- torch_xla/csrc/lowering_context.cpp | 3 +- torch_xla/csrc/lowering_context.h | 7 +-- torch_xla/csrc/ops/all_reduce.cpp | 3 +- torch_xla/csrc/ops/as_strided.cpp | 3 +- torch_xla/csrc/ops/cast.cpp | 3 +- torch_xla/csrc/ops/cast_int4.cpp | 3 +- torch_xla/csrc/ops/cumprod.cpp | 3 +- torch_xla/csrc/ops/dynamic_ir.h | 3 +- torch_xla/csrc/ops/expand_symint.cpp | 5 +- torch_xla/csrc/ops/index_ops.cpp | 3 +- torch_xla/csrc/ops/mean.cpp | 3 +- torch_xla/csrc/ops/nll_loss.cpp | 3 +- torch_xla/csrc/ops/nll_loss2d.cpp | 3 +- torch_xla/csrc/ops/ops.cpp | 5 +- torch_xla/csrc/ops/ops_lower_fn.cpp | 3 +- torch_xla/csrc/ops/ops_xla_shape_fn.cpp | 3 +- torch_xla/csrc/ops/prod.cpp | 3 +- torch_xla/csrc/ops/reduce_scatter.cpp | 3 +- torch_xla/csrc/ops/sum.cpp | 3 +- torch_xla/csrc/ops/svd.cpp | 3 +- torch_xla/csrc/pooling.cpp | 5 +- torch_xla/csrc/reduction.cpp | 5 +- torch_xla/csrc/runtime/computation_client.h | 11 +++-- .../csrc/runtime/ifrt_computation_client.h | 3 +- .../csrc/runtime/pjrt_computation_client.h | 3 +- torch_xla/csrc/runtime/runtime.cpp | 3 +- torch_xla/csrc/runtime/tensor_source.h | 3 +- torch_xla/csrc/runtime/tf_logging.cpp | 3 +- torch_xla/csrc/runtime/xla_util.cpp | 3 +- torch_xla/csrc/runtime/xla_util.h | 3 +- torch_xla/csrc/stack_frame_index_builder.h | 3 +- torch_xla/csrc/status.cpp | 3 +- torch_xla/csrc/tensor.cpp | 7 +-- torch_xla/csrc/tensor.h | 3 +- torch_xla/csrc/tensor_impl.cpp | 3 +- torch_xla/csrc/tensor_methods.cpp | 7 +-- torch_xla/csrc/tensor_ops.cpp | 3 +- torch_xla/csrc/tensor_util.cpp | 5 +- torch_xla/csrc/tensor_util.h | 5 +- torch_xla/csrc/torch_util.h | 3 +- torch_xla/csrc/unwrap_data.cpp | 3 +- torch_xla/csrc/unwrap_data.h | 3 +- torch_xla/csrc/view.cpp | 3 +- torch_xla/csrc/xla_graph_executor.cpp | 17 +++---- torch_xla/csrc/xla_graph_executor.h | 5 +- torch_xla/csrc/xla_lower_util.cpp | 5 +- torch_xla/csrc/xla_op_builder.h | 3 +- torch_xla/csrc/xla_sharding_util.cpp | 3 +- torch_xla/csrc/xla_sharding_util.h | 3 +- 75 files changed, 222 insertions(+), 132 deletions(-) diff --git a/.clang-format b/.clang-format index b422b17f8906..a10c270ac0a0 100644 --- a/.clang-format +++ b/.clang-format @@ -67,22 +67,38 @@ ForEachMacros: - BOOST_FOREACH IncludeBlocks: Regroup # Include Groups (by priority): -# 1. C system headers: `#include <*.h>` -# 2. C++ system headers: `#include <*>` -# 3. External headers: -# a) PyTorch API headers: `#include ` -# b) PyTorch ATen headers: `#include ` -# c) PyTorch headers: `#include ` -# d) abseil-cpp headers: `#include "absl/*.h" -# e) OpenXLA headers: `#include "xla/*.h" +# 1. C system headers: `#include <*.h>` +# +# 2. C++ system headers: `#include <*>` +# +# 3. PyTorch headers: +# a) API headers: `#include ` +# b) ATen headers: `#include ` +# c) c10 headers: `#include ` # # Note that PyTorch headers should be included with angle-brackets so as to -# keep consistency with PyTorch source code. This should also prevent a -# header to be included twice. +# keep consistency with PyTorch source code. This should also prevent +# headers to be included twice because of different paths. +# +# Google C++ Style Guide dictates (3) and (4) should belong to the same +# group. However, this breaks PyTorch/XLA build. The problem is that both +# PyTorch and abseil-cpp (included by OpenXLA) define (among many) the +# `LOG()` macro. This leads to problems, such as OpenXLA functions calling +# PyTorch `LOG()` macro due to include order. +# +# In order to avoid such a problem, we make PyTorch into its own group, +# just after the system libraries. This works because including OpenXLA +# headers will redefine PyTorch `LOG()` macro, solving the problem above. +# This, however might fail one day, if PyTorch starts calling `LOG()` macro +# in one of the headers we include in PyTorch/XLA. +# +# 4. External headers: +# a) abseil-cpp headers: `#include "absl/*.h" +# b) OpenXLA headers: `#include "xla/*.h" # -# 4. Project headers: -# a) _XLAC headers: `#include "torch_xla/csrc/*.h"` -# b) Test headers: `#include "test/*.h"` +# 5. Project headers: +# a) _XLAC headers: `#include "torch_xla/csrc/*.h"` +# b) Test headers: `#include "test/*.h"` IncludeCategories: - Regex: '^' Priority: 3 @@ -91,11 +107,11 @@ IncludeCategories: - Regex: '^<.*' Priority: 2 - Regex: '"torch_xla/.*"' - Priority: 4 + Priority: 5 - Regex: '"test/.*"' - Priority: 4 + Priority: 5 - Regex: '.*' - Priority: 3 + Priority: 4 IncludeIsMainRegex: '([-_](test|unittest))?$' IndentCaseLabels: true IndentPPDirectives: None diff --git a/test/cpp/cpp_test_util.h b/test/cpp/cpp_test_util.h index 82f57a7acae9..a41620083dbe 100644 --- a/test/cpp/cpp_test_util.h +++ b/test/cpp/cpp_test_util.h @@ -8,9 +8,10 @@ #include #include -#include "absl/types/span.h" #include +#include "absl/types/span.h" + #include "torch_xla/csrc/debug_util.h" #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/dtype.h" diff --git a/test/cpp/test_aten_xla_tensor_1.cpp b/test/cpp/test_aten_xla_tensor_1.cpp index 84d22898bc61..f9e53e036a3f 100644 --- a/test/cpp/test_aten_xla_tensor_1.cpp +++ b/test/cpp/test_aten_xla_tensor_1.cpp @@ -2,9 +2,10 @@ #include +#include + #include "xla/permutation_util.h" #include "xla/util.h" -#include #include "test/cpp/cpp_test_util.h" #include "test/cpp/torch_xla_test.h" diff --git a/test/cpp/test_aten_xla_tensor_2.cpp b/test/cpp/test_aten_xla_tensor_2.cpp index e79b3baa32ee..0047ae123fab 100644 --- a/test/cpp/test_aten_xla_tensor_2.cpp +++ b/test/cpp/test_aten_xla_tensor_2.cpp @@ -3,9 +3,10 @@ #include #include +#include + #include "xla/permutation_util.h" #include "xla/util.h" -#include #include "test/cpp/cpp_test_util.h" #include "test/cpp/torch_xla_test.h" diff --git a/test/cpp/test_aten_xla_tensor_3.cpp b/test/cpp/test_aten_xla_tensor_3.cpp index 1841c566af68..e26ed43a5c09 100644 --- a/test/cpp/test_aten_xla_tensor_3.cpp +++ b/test/cpp/test_aten_xla_tensor_3.cpp @@ -2,9 +2,10 @@ #include +#include + #include "xla/permutation_util.h" #include "xla/util.h" -#include #include "test/cpp/cpp_test_util.h" #include "test/cpp/torch_xla_test.h" diff --git a/test/cpp/test_aten_xla_tensor_4.cpp b/test/cpp/test_aten_xla_tensor_4.cpp index fdf997bc32a9..8225c8bc979c 100644 --- a/test/cpp/test_aten_xla_tensor_4.cpp +++ b/test/cpp/test_aten_xla_tensor_4.cpp @@ -2,9 +2,10 @@ #include +#include + #include "xla/permutation_util.h" #include "xla/util.h" -#include #include "test/cpp/cpp_test_util.h" #include "test/cpp/torch_xla_test.h" diff --git a/test/cpp/test_aten_xla_tensor_5.cpp b/test/cpp/test_aten_xla_tensor_5.cpp index 6f3d136d216c..7a9383b4d776 100644 --- a/test/cpp/test_aten_xla_tensor_5.cpp +++ b/test/cpp/test_aten_xla_tensor_5.cpp @@ -2,9 +2,10 @@ #include +#include + #include "xla/permutation_util.h" #include "xla/util.h" -#include #include "test/cpp/cpp_test_util.h" #include "test/cpp/torch_xla_test.h" diff --git a/test/cpp/test_aten_xla_tensor_6.cpp b/test/cpp/test_aten_xla_tensor_6.cpp index 2df3e12ad506..bb1a00a203ed 100644 --- a/test/cpp/test_aten_xla_tensor_6.cpp +++ b/test/cpp/test_aten_xla_tensor_6.cpp @@ -2,9 +2,10 @@ #include +#include + #include "xla/permutation_util.h" #include "xla/util.h" -#include #include "test/cpp/cpp_test_util.h" #include "test/cpp/torch_xla_test.h" diff --git a/test/cpp/test_lazy.cpp b/test/cpp/test_lazy.cpp index 6188479a9d3e..1bd5cc71f495 100644 --- a/test/cpp/test_lazy.cpp +++ b/test/cpp/test_lazy.cpp @@ -1,8 +1,9 @@ #include -#include "xla/shape.h" #include +#include "xla/shape.h" + #include "test/cpp/torch_xla_test.h" #include "torch_xla/csrc/helpers.h" diff --git a/test/cpp/test_tensor.cpp b/test/cpp/test_tensor.cpp index bfb3ba99e916..1328f5fc528b 100644 --- a/test/cpp/test_tensor.cpp +++ b/test/cpp/test_tensor.cpp @@ -4,9 +4,10 @@ #include #include -#include "absl/base/nullability.h" #include +#include "absl/base/nullability.h" + #include "test/cpp/cpp_test_util.h" #include "test/cpp/torch_xla_test.h" #include "torch_xla/csrc/aten_xla_bridge.h" diff --git a/test/cpp/test_xla_sharding.cpp b/test/cpp/test_xla_sharding.cpp index 8cbfafcd984a..f544292301db 100644 --- a/test/cpp/test_xla_sharding.cpp +++ b/test/cpp/test_xla_sharding.cpp @@ -5,9 +5,10 @@ #include +#include + #include "xla/protobuf_util.h" #include "xla/xla_data.pb.h" -#include #include "test/cpp/cpp_test_util.h" #include "test/cpp/torch_xla_test.h" diff --git a/torch_xla/csrc/aten_xla_bridge.cpp b/torch_xla/csrc/aten_xla_bridge.cpp index c8c4d79bc74e..a9a9204342d7 100644 --- a/torch_xla/csrc/aten_xla_bridge.cpp +++ b/torch_xla/csrc/aten_xla_bridge.cpp @@ -6,9 +6,10 @@ #include #include +#include + #include "absl/log/absl_check.h" #include "absl/strings/str_cat.h" -#include #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/runtime/debug_macros.h" diff --git a/torch_xla/csrc/aten_xla_type.cpp b/torch_xla/csrc/aten_xla_type.cpp index 1a915b492579..bf7a4003acc6 100644 --- a/torch_xla/csrc/aten_xla_type.cpp +++ b/torch_xla/csrc/aten_xla_type.cpp @@ -15,13 +15,14 @@ #include #include -#include "absl/base/nullability.h" -#include "absl/log/absl_check.h" #include #include #include #include +#include "absl/base/nullability.h" +#include "absl/log/absl_check.h" + #include "torch_xla/csrc/LazyIr.h" #include "torch_xla/csrc/XLANativeFunctions.h" #include "torch_xla/csrc/aten_autograd_ops.h" diff --git a/torch_xla/csrc/cross_replica_reduces.cpp b/torch_xla/csrc/cross_replica_reduces.cpp index c21085ace063..06a9dd1b89e7 100644 --- a/torch_xla/csrc/cross_replica_reduces.cpp +++ b/torch_xla/csrc/cross_replica_reduces.cpp @@ -2,9 +2,10 @@ #include -#include "xla/shape_util.h" #include +#include "xla/shape_util.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/device.h" diff --git a/torch_xla/csrc/cross_replica_reduces.h b/torch_xla/csrc/cross_replica_reduces.h index 2766bfaa5a22..b2d95c3fa5d7 100644 --- a/torch_xla/csrc/cross_replica_reduces.h +++ b/torch_xla/csrc/cross_replica_reduces.h @@ -3,9 +3,10 @@ #include +#include + #include "absl/types/span.h" #include "xla/hlo/builder/xla_builder.h" -#include #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/ir.h" diff --git a/torch_xla/csrc/data_ops.cpp b/torch_xla/csrc/data_ops.cpp index 450f63276930..931ac56b7f96 100644 --- a/torch_xla/csrc/data_ops.cpp +++ b/torch_xla/csrc/data_ops.cpp @@ -4,13 +4,14 @@ #include #include +#include +#include + #include "absl/strings/str_join.h" #include "xla/hlo/builder/lib/constants.h" #include "xla/hlo/builder/lib/slicing.h" #include "xla/shape_util.h" #include "xla/util.h" -#include -#include #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/convert_ops.h" diff --git a/torch_xla/csrc/debug_util.cpp b/torch_xla/csrc/debug_util.cpp index 2332ad6da489..99a46bc4f0ad 100644 --- a/torch_xla/csrc/debug_util.cpp +++ b/torch_xla/csrc/debug_util.cpp @@ -7,12 +7,13 @@ #include #include -#include "absl/memory/memory.h" -#include "absl/strings/str_split.h" #include #include #include +#include "absl/memory/memory.h" +#include "absl/strings/str_split.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/ir.h" diff --git a/torch_xla/csrc/dynamic_shape_detector.h b/torch_xla/csrc/dynamic_shape_detector.h index 907ecd2ac7e9..7d73a65bd1e7 100644 --- a/torch_xla/csrc/dynamic_shape_detector.h +++ b/torch_xla/csrc/dynamic_shape_detector.h @@ -3,9 +3,10 @@ #include -#include "absl/types/span.h" #include +#include "absl/types/span.h" + namespace torch_xla { struct TrieNode; diff --git a/torch_xla/csrc/function_call_tracker.cpp b/torch_xla/csrc/function_call_tracker.cpp index 795de88d5d81..efe503c7ee0b 100644 --- a/torch_xla/csrc/function_call_tracker.cpp +++ b/torch_xla/csrc/function_call_tracker.cpp @@ -7,9 +7,10 @@ #include #include +#include + #include "absl/strings/str_split.h" #include "tsl/platform/stacktrace.h" -#include #include "torch_xla/csrc/runtime/sys_util.h" diff --git a/torch_xla/csrc/helpers.cpp b/torch_xla/csrc/helpers.cpp index f31dab307080..f3a9730a5dcd 100644 --- a/torch_xla/csrc/helpers.cpp +++ b/torch_xla/csrc/helpers.cpp @@ -3,12 +3,13 @@ #include #include +#include +#include + #include "absl/strings/str_join.h" #include "xla/hlo/builder/lib/constants.h" #include "xla/primitive_util.h" #include "xla/shape_util.h" -#include -#include #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/dtype.h" diff --git a/torch_xla/csrc/helpers.h b/torch_xla/csrc/helpers.h index 1dbeb4897bdb..55a034478510 100644 --- a/torch_xla/csrc/helpers.h +++ b/torch_xla/csrc/helpers.h @@ -8,6 +8,9 @@ #include #include +#include +#include + #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/types/optional.h" @@ -17,8 +20,6 @@ #include "xla/literal_util.h" #include "xla/permutation_util.h" #include "xla/types.h" -#include -#include #include "torch_xla/csrc/runtime/debug_macros.h" #include "torch_xla/csrc/runtime/sys_util.h" diff --git a/torch_xla/csrc/init_python_bindings.cpp b/torch_xla/csrc/init_python_bindings.cpp index 84cc8ab9e799..bda4cf830ba3 100644 --- a/torch_xla/csrc/init_python_bindings.cpp +++ b/torch_xla/csrc/init_python_bindings.cpp @@ -17,6 +17,15 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include + #include "absl/base/nullability.h" #include "absl/container/flat_hash_map.h" #include "absl/log/absl_check.h" @@ -37,14 +46,6 @@ #include "xla/hlo/parser/hlo_parser.h" #include "xla/pjrt/distributed/distributed.h" #include "xla/python/profiler/internal/traceme_wrapper.h" -#include -#include -#include -#include -#include -#include -#include -#include #include "torch_xla/csrc/XLANativeFunctions.h" #include "torch_xla/csrc/aten_autograd_ops.h" diff --git a/torch_xla/csrc/ir.cpp b/torch_xla/csrc/ir.cpp index 18d5959bd3d0..c63b772ac45d 100644 --- a/torch_xla/csrc/ir.cpp +++ b/torch_xla/csrc/ir.cpp @@ -4,14 +4,15 @@ #include #include -#include "absl/log/absl_log.h" -#include "absl/status/status.h" -#include "absl/strings/str_cat.h" #include #include #include #include +#include "absl/log/absl_log.h" +#include "absl/status/status.h" +#include "absl/strings/str_cat.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/runtime/cache.h" #include "torch_xla/csrc/runtime/debug_macros.h" diff --git a/torch_xla/csrc/ir.h b/torch_xla/csrc/ir.h index 59ed00ce12ae..17944b3c73da 100644 --- a/torch_xla/csrc/ir.h +++ b/torch_xla/csrc/ir.h @@ -12,15 +12,16 @@ #include #include -#include "absl/container/inlined_vector.h" -#include "absl/hash/hash.h" -#include "absl/types/span.h" -#include "xla/hlo/builder/xla_builder.h" #include #include #include #include +#include "absl/container/inlined_vector.h" +#include "absl/hash/hash.h" +#include "absl/types/span.h" +#include "xla/hlo/builder/xla_builder.h" + #include "torch_xla/csrc/dynamic_shape_detector.h" #include "torch_xla/csrc/runtime/types.h" diff --git a/torch_xla/csrc/ir_dump_util.cpp b/torch_xla/csrc/ir_dump_util.cpp index 951ac036617a..415cb17f7934 100644 --- a/torch_xla/csrc/ir_dump_util.cpp +++ b/torch_xla/csrc/ir_dump_util.cpp @@ -4,9 +4,10 @@ #include #include +#include + #include "absl/container/flat_hash_map.h" #include "absl/types/optional.h" -#include #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/runtime/debug_macros.h" diff --git a/torch_xla/csrc/layout_manager.cpp b/torch_xla/csrc/layout_manager.cpp index 6186e66cec83..36fb5d8e3900 100644 --- a/torch_xla/csrc/layout_manager.cpp +++ b/torch_xla/csrc/layout_manager.cpp @@ -8,9 +8,10 @@ #include #include +#include + #include "absl/strings/str_split.h" #include "xla/shape_util.h" -#include #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/runtime/debug_macros.h" diff --git a/torch_xla/csrc/lowering_context.cpp b/torch_xla/csrc/lowering_context.cpp index 2e2f04da5787..4b8f56c8fb73 100644 --- a/torch_xla/csrc/lowering_context.cpp +++ b/torch_xla/csrc/lowering_context.cpp @@ -5,12 +5,13 @@ #include #include +#include + #include "absl/log/absl_check.h" #include "absl/log/absl_log.h" #include "absl/status/status.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_replace.h" -#include #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/runtime/computation_client.h" diff --git a/torch_xla/csrc/lowering_context.h b/torch_xla/csrc/lowering_context.h index 0d2b7e351d9b..4a0c56d311e3 100644 --- a/torch_xla/csrc/lowering_context.h +++ b/torch_xla/csrc/lowering_context.h @@ -9,14 +9,15 @@ #include #include +#include +#include +#include + #include "absl/status/status.h" #include "absl/types/span.h" #include "tsl/platform/macros.h" #include "xla/hlo/builder/xla_builder.h" #include "xla/types.h" -#include -#include -#include #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/ir.h" diff --git a/torch_xla/csrc/ops/all_reduce.cpp b/torch_xla/csrc/ops/all_reduce.cpp index 7b1585af5ccc..544dc4007d80 100644 --- a/torch_xla/csrc/ops/all_reduce.cpp +++ b/torch_xla/csrc/ops/all_reduce.cpp @@ -1,8 +1,9 @@ #include "torch_xla/csrc/ops/all_reduce.h" +#include + #include "absl/strings/str_join.h" #include "xla/shape_util.h" -#include #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/xla_ops.h" diff --git a/torch_xla/csrc/ops/as_strided.cpp b/torch_xla/csrc/ops/as_strided.cpp index a5fafca8f8a4..fcccd95b5a1b 100644 --- a/torch_xla/csrc/ops/as_strided.cpp +++ b/torch_xla/csrc/ops/as_strided.cpp @@ -2,9 +2,10 @@ #include +#include + #include "xla/shape_util.h" #include "xla/util.h" -#include #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/helpers.h" diff --git a/torch_xla/csrc/ops/cast.cpp b/torch_xla/csrc/ops/cast.cpp index 26fefb820b3b..0271b75228cc 100644 --- a/torch_xla/csrc/ops/cast.cpp +++ b/torch_xla/csrc/ops/cast.cpp @@ -1,8 +1,9 @@ #include "torch_xla/csrc/ops/cast.h" -#include "xla/primitive_util.h" #include +#include "xla/primitive_util.h" + #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/dtype.h" #include "torch_xla/csrc/helpers.h" diff --git a/torch_xla/csrc/ops/cast_int4.cpp b/torch_xla/csrc/ops/cast_int4.cpp index 713d516f1a8b..2dbd2d824380 100644 --- a/torch_xla/csrc/ops/cast_int4.cpp +++ b/torch_xla/csrc/ops/cast_int4.cpp @@ -1,8 +1,9 @@ #include "torch_xla/csrc/ops/cast_int4.h" -#include "xla/literal_util.h" #include +#include "xla/literal_util.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/xla_ops.h" #include "torch_xla/csrc/quant_util.h" diff --git a/torch_xla/csrc/ops/cumprod.cpp b/torch_xla/csrc/ops/cumprod.cpp index 522ab81b021f..fc5bbd0e5864 100644 --- a/torch_xla/csrc/ops/cumprod.cpp +++ b/torch_xla/csrc/ops/cumprod.cpp @@ -1,8 +1,9 @@ #include "torch_xla/csrc/ops/cumprod.h" -#include "xla/hlo/builder/lib/constants.h" #include +#include "xla/hlo/builder/lib/constants.h" + #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" diff --git a/torch_xla/csrc/ops/dynamic_ir.h b/torch_xla/csrc/ops/dynamic_ir.h index 298c3a76f92f..b6860644379e 100644 --- a/torch_xla/csrc/ops/dynamic_ir.h +++ b/torch_xla/csrc/ops/dynamic_ir.h @@ -10,9 +10,10 @@ #include #include -#include "absl/log/absl_log.h" #include +#include "absl/log/absl_log.h" + #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/ops/scalar.h" #include "torch_xla/csrc/runtime/debug_macros.h" diff --git a/torch_xla/csrc/ops/expand_symint.cpp b/torch_xla/csrc/ops/expand_symint.cpp index 0339e45ad70e..201ca24d771e 100644 --- a/torch_xla/csrc/ops/expand_symint.cpp +++ b/torch_xla/csrc/ops/expand_symint.cpp @@ -1,10 +1,11 @@ #include "torch_xla/csrc/ops/expand_symint.h" -#include "absl/strings/str_join.h" -#include "xla/hlo/builder/lib/constants.h" #include #include +#include "absl/strings/str_join.h" +#include "xla/hlo/builder/lib/constants.h" + #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" diff --git a/torch_xla/csrc/ops/index_ops.cpp b/torch_xla/csrc/ops/index_ops.cpp index 7aea60a9252a..ba306c373d72 100644 --- a/torch_xla/csrc/ops/index_ops.cpp +++ b/torch_xla/csrc/ops/index_ops.cpp @@ -4,9 +4,10 @@ #include #include -#include "xla/permutation_util.h" #include +#include "xla/permutation_util.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" diff --git a/torch_xla/csrc/ops/mean.cpp b/torch_xla/csrc/ops/mean.cpp index 1e8bd344f647..f9765ef2232b 100644 --- a/torch_xla/csrc/ops/mean.cpp +++ b/torch_xla/csrc/ops/mean.cpp @@ -1,8 +1,9 @@ #include "torch_xla/csrc/ops/mean.h" -#include "absl/strings/str_join.h" #include +#include "absl/strings/str_join.h" + #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" diff --git a/torch_xla/csrc/ops/nll_loss.cpp b/torch_xla/csrc/ops/nll_loss.cpp index 765d3a6a32c1..009b2ecfcbb5 100644 --- a/torch_xla/csrc/ops/nll_loss.cpp +++ b/torch_xla/csrc/ops/nll_loss.cpp @@ -1,8 +1,9 @@ #include "torch_xla/csrc/ops/nll_loss.h" -#include "absl/types/span.h" #include +#include "absl/types/span.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/nll_loss.h" #include "torch_xla/csrc/ops/infer_output_shape.h" diff --git a/torch_xla/csrc/ops/nll_loss2d.cpp b/torch_xla/csrc/ops/nll_loss2d.cpp index 387c1379291d..7b0c67b58029 100644 --- a/torch_xla/csrc/ops/nll_loss2d.cpp +++ b/torch_xla/csrc/ops/nll_loss2d.cpp @@ -1,8 +1,9 @@ #include "torch_xla/csrc/ops/nll_loss2d.h" -#include "absl/types/span.h" #include +#include "absl/types/span.h" + #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/nll_loss.h" #include "torch_xla/csrc/ops/infer_output_shape.h" diff --git a/torch_xla/csrc/ops/ops.cpp b/torch_xla/csrc/ops/ops.cpp index 59da3680757a..34d86f35b1c6 100644 --- a/torch_xla/csrc/ops/ops.cpp +++ b/torch_xla/csrc/ops/ops.cpp @@ -2,14 +2,15 @@ #include +#include +#include + #include "xla/hlo/builder/lib/constants.h" #include "xla/hlo/builder/lib/logdet.h" #include "xla/hlo/builder/lib/math.h" #include "xla/hlo/builder/lib/matrix.h" #include "xla/hlo/builder/lib/slicing.h" #include "xla/shape_util.h" -#include -#include #include "torch_xla/csrc/LazyIr.h" #include "torch_xla/csrc/convert_ops.h" diff --git a/torch_xla/csrc/ops/ops_lower_fn.cpp b/torch_xla/csrc/ops/ops_lower_fn.cpp index cf78a028dc4c..9a0f8eaf579f 100644 --- a/torch_xla/csrc/ops/ops_lower_fn.cpp +++ b/torch_xla/csrc/ops/ops_lower_fn.cpp @@ -1,8 +1,9 @@ +#include + #include "xla/hlo/builder/lib/constants.h" #include "xla/hlo/builder/lib/logdet.h" #include "xla/hlo/builder/lib/math.h" #include "xla/hlo/builder/lib/matrix.h" -#include #include "torch_xla/csrc/LazyIr.h" #include "torch_xla/csrc/convert_ops.h" diff --git a/torch_xla/csrc/ops/ops_xla_shape_fn.cpp b/torch_xla/csrc/ops/ops_xla_shape_fn.cpp index 22eae6effec0..cbf42f5b1990 100644 --- a/torch_xla/csrc/ops/ops_xla_shape_fn.cpp +++ b/torch_xla/csrc/ops/ops_xla_shape_fn.cpp @@ -1,8 +1,9 @@ #include "torch_xla/csrc/ops/ops_xla_shape_fn.h" +#include + #include "xla/hlo/builder/lib/logdet.h" #include "xla/shape_util.h" -#include #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/elementwise.h" diff --git a/torch_xla/csrc/ops/prod.cpp b/torch_xla/csrc/ops/prod.cpp index ce9bafd0dc45..bb0cc5a90147 100644 --- a/torch_xla/csrc/ops/prod.cpp +++ b/torch_xla/csrc/ops/prod.cpp @@ -1,8 +1,9 @@ #include "torch_xla/csrc/ops/prod.h" -#include "absl/strings/str_join.h" #include +#include "absl/strings/str_join.h" + #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" diff --git a/torch_xla/csrc/ops/reduce_scatter.cpp b/torch_xla/csrc/ops/reduce_scatter.cpp index 54de84a9cf8f..91404dda0fb5 100644 --- a/torch_xla/csrc/ops/reduce_scatter.cpp +++ b/torch_xla/csrc/ops/reduce_scatter.cpp @@ -1,8 +1,9 @@ #include "torch_xla/csrc/ops/reduce_scatter.h" +#include + #include "absl/strings/str_join.h" #include "xla/shape_util.h" -#include #include "torch_xla/csrc/lowering_context.h" #include "torch_xla/csrc/ops/infer_output_shape.h" diff --git a/torch_xla/csrc/ops/sum.cpp b/torch_xla/csrc/ops/sum.cpp index 68ee3bb78a85..f1694ee3412a 100644 --- a/torch_xla/csrc/ops/sum.cpp +++ b/torch_xla/csrc/ops/sum.cpp @@ -1,8 +1,9 @@ #include "torch_xla/csrc/ops/sum.h" -#include "absl/strings/str_join.h" #include +#include "absl/strings/str_join.h" + #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/lowering_context.h" diff --git a/torch_xla/csrc/ops/svd.cpp b/torch_xla/csrc/ops/svd.cpp index ff97e8a69758..64bacbed6411 100644 --- a/torch_xla/csrc/ops/svd.cpp +++ b/torch_xla/csrc/ops/svd.cpp @@ -1,9 +1,10 @@ #include "torch_xla/csrc/ops/svd.h" +#include + #include "xla/hlo/builder/lib/constants.h" #include "xla/hlo/builder/lib/matrix.h" #include "xla/hlo/builder/lib/svd.h" -#include #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/helpers.h" diff --git a/torch_xla/csrc/pooling.cpp b/torch_xla/csrc/pooling.cpp index 6eb0f55ae927..47b3f1b5c95e 100644 --- a/torch_xla/csrc/pooling.cpp +++ b/torch_xla/csrc/pooling.cpp @@ -1,13 +1,14 @@ #include "torch_xla/csrc/pooling.h" +#include +#include + #include "absl/status/status.h" #include "xla/hlo/builder/lib/arithmetic.h" #include "xla/hlo/builder/lib/constants.h" #include "xla/hlo/builder/lib/loops.h" #include "xla/hlo/builder/lib/pooling.h" #include "xla/hlo/builder/lib/slicing.h" -#include -#include #include "torch_xla/csrc/data_ops.h" #include "torch_xla/csrc/helpers.h" diff --git a/torch_xla/csrc/reduction.cpp b/torch_xla/csrc/reduction.cpp index 1822e420cdfb..9e759aef7000 100644 --- a/torch_xla/csrc/reduction.cpp +++ b/torch_xla/csrc/reduction.cpp @@ -5,12 +5,13 @@ #include #include +#include +#include + #include "xla/hlo/builder/lib/arithmetic.h" #include "xla/hlo/builder/lib/constants.h" #include "xla/hlo/builder/lib/matrix.h" #include "xla/literal_util.h" -#include -#include #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/helpers.h" diff --git a/torch_xla/csrc/runtime/computation_client.h b/torch_xla/csrc/runtime/computation_client.h index 9e5284c7ed4f..2d81c7fb3f5b 100644 --- a/torch_xla/csrc/runtime/computation_client.h +++ b/torch_xla/csrc/runtime/computation_client.h @@ -10,6 +10,12 @@ #include #include +#include +#include +#include +#include +#include + #include "absl/container/flat_hash_map.h" #include "absl/status/statusor.h" #include "absl/types/optional.h" @@ -20,11 +26,6 @@ #include "xla/pjrt/pjrt_client.h" #include "xla/pjrt/pjrt_common.h" #include "xla/types.h" -#include -#include -#include -#include -#include #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/runtime/debug_macros.h" diff --git a/torch_xla/csrc/runtime/ifrt_computation_client.h b/torch_xla/csrc/runtime/ifrt_computation_client.h index 6a92071e4ce5..8b3a9d811224 100644 --- a/torch_xla/csrc/runtime/ifrt_computation_client.h +++ b/torch_xla/csrc/runtime/ifrt_computation_client.h @@ -5,6 +5,8 @@ #include #include +#include + #include "absl/types/span.h" #include "xla/hlo/builder/xla_computation.h" #include "xla/literal.h" @@ -16,7 +18,6 @@ #include "xla/python/pjrt_ifrt/pjrt_dtype.h" #include "xla/python/pjrt_ifrt/xla_compiler.h" #include "xla/shape.h" -#include #include "torch_xla/csrc/runtime/computation_client.h" #include "torch_xla/csrc/runtime/debug_macros.h" diff --git a/torch_xla/csrc/runtime/pjrt_computation_client.h b/torch_xla/csrc/runtime/pjrt_computation_client.h index 887bcf2eb45e..f7a8fd3463ef 100644 --- a/torch_xla/csrc/runtime/pjrt_computation_client.h +++ b/torch_xla/csrc/runtime/pjrt_computation_client.h @@ -5,6 +5,8 @@ #include #include +#include + #include "absl/types/span.h" #include "tsl/platform/env.h" #include "tsl/platform/threadpool.h" @@ -14,7 +16,6 @@ #include "xla/pjrt/pjrt_client.h" #include "xla/pjrt/pjrt_executable.h" #include "xla/shape.h" -#include #include "torch_xla/csrc/runtime/computation_client.h" #include "torch_xla/csrc/runtime/debug_macros.h" diff --git a/torch_xla/csrc/runtime/runtime.cpp b/torch_xla/csrc/runtime/runtime.cpp index 051e7c823ed6..46efc72b0550 100644 --- a/torch_xla/csrc/runtime/runtime.cpp +++ b/torch_xla/csrc/runtime/runtime.cpp @@ -1,8 +1,9 @@ #include "torch_xla/csrc/runtime/runtime.h" +#include + #include "absl/log/absl_check.h" #include "tsl/platform/stacktrace_handler.h" -#include #include "torch_xla/csrc/runtime/computation_client.h" #include "torch_xla/csrc/runtime/env_vars.h" diff --git a/torch_xla/csrc/runtime/tensor_source.h b/torch_xla/csrc/runtime/tensor_source.h index b4981d065d2e..20c9f674c9e1 100644 --- a/torch_xla/csrc/runtime/tensor_source.h +++ b/torch_xla/csrc/runtime/tensor_source.h @@ -7,10 +7,11 @@ #include #include +#include + #include "xla/literal.h" #include "xla/shape.h" #include "xla/shape_util.h" -#include #include "torch_xla/csrc/dtype.h" #include "torch_xla/csrc/runtime/debug_macros.h" diff --git a/torch_xla/csrc/runtime/tf_logging.cpp b/torch_xla/csrc/runtime/tf_logging.cpp index 428b4ef8c336..a8c2d7644aa1 100644 --- a/torch_xla/csrc/runtime/tf_logging.cpp +++ b/torch_xla/csrc/runtime/tf_logging.cpp @@ -4,9 +4,10 @@ #include -#include "tsl/platform/stacktrace.h" #include +#include "tsl/platform/stacktrace.h" + #include "torch_xla/csrc/status.h" namespace torch_xla { diff --git a/torch_xla/csrc/runtime/xla_util.cpp b/torch_xla/csrc/runtime/xla_util.cpp index a294a0d909af..24981a141cec 100644 --- a/torch_xla/csrc/runtime/xla_util.cpp +++ b/torch_xla/csrc/runtime/xla_util.cpp @@ -6,12 +6,13 @@ #include #include +#include + #include "tsl/platform/errors.h" #include "tsl/platform/stacktrace.h" #include "xla/shape_util.h" #include "xla/tsl/lib/strings/proto_serialization.h" #include "xla/util.h" -#include #include "torch_xla/csrc/runtime/sys_util.h" #include "torch_xla/csrc/runtime/tf_logging.h" diff --git a/torch_xla/csrc/runtime/xla_util.h b/torch_xla/csrc/runtime/xla_util.h index b3ad0f5ecf9d..17079ccf2fd6 100644 --- a/torch_xla/csrc/runtime/xla_util.h +++ b/torch_xla/csrc/runtime/xla_util.h @@ -3,13 +3,14 @@ #include +#include + #include "absl/status/status.h" #include "absl/types/span.h" #include "xla/hlo/builder/xla_computation.h" #include "xla/hlo/ir/hlo_module.h" #include "xla/service/hlo.pb.h" #include "xla/status_macros.h" -#include #include "torch_xla/csrc/runtime/types.h" diff --git a/torch_xla/csrc/stack_frame_index_builder.h b/torch_xla/csrc/stack_frame_index_builder.h index 61f43e4ef8e3..1d4529e773a1 100644 --- a/torch_xla/csrc/stack_frame_index_builder.h +++ b/torch_xla/csrc/stack_frame_index_builder.h @@ -4,9 +4,10 @@ #include #include +#include // SourceLocation + #include "xla/service/hlo.pb.h" #include "xla/types.h" -#include // SourceLocation namespace torch_xla { diff --git a/torch_xla/csrc/status.cpp b/torch_xla/csrc/status.cpp index 51649bd1787a..e9145a79aea8 100644 --- a/torch_xla/csrc/status.cpp +++ b/torch_xla/csrc/status.cpp @@ -6,10 +6,11 @@ #include #include +#include + #include "absl/log/absl_check.h" #include "absl/strings/str_cat.h" #include "tsl/platform/stacktrace.h" -#include namespace torch_xla { diff --git a/torch_xla/csrc/tensor.cpp b/torch_xla/csrc/tensor.cpp index cbf57207a0b3..57b4f62c4a56 100644 --- a/torch_xla/csrc/tensor.cpp +++ b/torch_xla/csrc/tensor.cpp @@ -10,9 +10,6 @@ #include #include -#include "tsl/platform/errors.h" -#include "tsl/profiler/lib/traceme.h" -#include "xla/shape_util.h" #include #include #include @@ -22,6 +19,10 @@ #include #include +#include "tsl/platform/errors.h" +#include "tsl/profiler/lib/traceme.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/debug_util.h" #include "torch_xla/csrc/dtype.h" diff --git a/torch_xla/csrc/tensor.h b/torch_xla/csrc/tensor.h index ad51ec880eca..66a8e14e9134 100644 --- a/torch_xla/csrc/tensor.h +++ b/torch_xla/csrc/tensor.h @@ -6,11 +6,12 @@ #include #include -#include "absl/base/nullability.h" #include #include #include +#include "absl/base/nullability.h" + #include "torch_xla/csrc/runtime/util.h" #include "torch_xla/csrc/view.h" diff --git a/torch_xla/csrc/tensor_impl.cpp b/torch_xla/csrc/tensor_impl.cpp index 9cb1027cdfe3..2c79eff110f5 100644 --- a/torch_xla/csrc/tensor_impl.cpp +++ b/torch_xla/csrc/tensor_impl.cpp @@ -5,12 +5,13 @@ #include #include -#include "absl/log/absl_check.h" #include #include #include #include +#include "absl/log/absl_check.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/ir_builder.h" diff --git a/torch_xla/csrc/tensor_methods.cpp b/torch_xla/csrc/tensor_methods.cpp index c3b57ceecc4a..65d4e1b4ac8d 100644 --- a/torch_xla/csrc/tensor_methods.cpp +++ b/torch_xla/csrc/tensor_methods.cpp @@ -7,6 +7,10 @@ #include #include +#include +#include +#include + #include "absl/base/nullability.h" #include "absl/log/absl_check.h" #include "absl/status/status.h" @@ -15,9 +19,6 @@ #include "absl/strings/str_split.h" #include "absl/types/span.h" #include "xla/literal_util.h" -#include -#include -#include #include "torch_xla/csrc/LazyIr.h" #include "torch_xla/csrc/aten_xla_bridge.h" diff --git a/torch_xla/csrc/tensor_ops.cpp b/torch_xla/csrc/tensor_ops.cpp index 3c1426b061b2..d49fa4e0358a 100644 --- a/torch_xla/csrc/tensor_ops.cpp +++ b/torch_xla/csrc/tensor_ops.cpp @@ -1,9 +1,10 @@ #include "torch_xla/csrc/tensor_ops.h" -#include "absl/base/nullability.h" #include #include +#include "absl/base/nullability.h" + #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/runtime/computation_client.h" diff --git a/torch_xla/csrc/tensor_util.cpp b/torch_xla/csrc/tensor_util.cpp index 45f87da0d120..cef072f4c537 100644 --- a/torch_xla/csrc/tensor_util.cpp +++ b/torch_xla/csrc/tensor_util.cpp @@ -10,12 +10,13 @@ #include #include +#include +#include + #include "absl/synchronization/blocking_counter.h" #include "tsl/platform/bfloat16.h" #include "xla/literal_util.h" #include "xla/shape_util.h" -#include -#include #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/dtype.h" diff --git a/torch_xla/csrc/tensor_util.h b/torch_xla/csrc/tensor_util.h index 2d055ce1866e..4a6f73bd3bd9 100644 --- a/torch_xla/csrc/tensor_util.h +++ b/torch_xla/csrc/tensor_util.h @@ -6,12 +6,13 @@ #include #include +#include +#include + #include "absl/types/span.h" #include "xla/literal.h" #include "xla/shape.h" #include "xla/types.h" -#include -#include #include "torch_xla/csrc/device.h" #include "torch_xla/csrc/runtime/computation_client.h" diff --git a/torch_xla/csrc/torch_util.h b/torch_xla/csrc/torch_util.h index a5cbeeb8b628..b45695ad6d66 100644 --- a/torch_xla/csrc/torch_util.h +++ b/torch_xla/csrc/torch_util.h @@ -7,12 +7,13 @@ #include -#include "xla/shape.h" #include #include #include #include +#include "xla/shape.h" + #include "torch_xla/csrc/runtime/debug_macros.h" namespace torch_xla { diff --git a/torch_xla/csrc/unwrap_data.cpp b/torch_xla/csrc/unwrap_data.cpp index 1989d938c22b..f6c1bba835e7 100644 --- a/torch_xla/csrc/unwrap_data.cpp +++ b/torch_xla/csrc/unwrap_data.cpp @@ -1,12 +1,13 @@ #include #include -#include "absl/types/span.h" #include #include #include #include +#include "absl/types/span.h" + #include "torch_xla/csrc/runtime/computation_client.h" namespace torch_xla { diff --git a/torch_xla/csrc/unwrap_data.h b/torch_xla/csrc/unwrap_data.h index eee1a787d9ec..932d9e0be738 100644 --- a/torch_xla/csrc/unwrap_data.h +++ b/torch_xla/csrc/unwrap_data.h @@ -3,10 +3,11 @@ #include -#include "absl/types/span.h" #include #include +#include "absl/types/span.h" + #include "torch_xla/csrc/runtime/computation_client.h" namespace torch_xla { diff --git a/torch_xla/csrc/view.cpp b/torch_xla/csrc/view.cpp index 6acca8362e4f..f024cb6fa213 100644 --- a/torch_xla/csrc/view.cpp +++ b/torch_xla/csrc/view.cpp @@ -4,9 +4,10 @@ #include #include +#include + #include "xla/shape_util.h" #include "xla/util.h" -#include #include "torch_xla/csrc/helpers.h" #include "torch_xla/csrc/ops/as_strided.h" diff --git a/torch_xla/csrc/xla_graph_executor.cpp b/torch_xla/csrc/xla_graph_executor.cpp index a0f99e45c11a..fdfb2a61a3e9 100644 --- a/torch_xla/csrc/xla_graph_executor.cpp +++ b/torch_xla/csrc/xla_graph_executor.cpp @@ -14,14 +14,6 @@ #include #include -#include "absl/container/flat_hash_map.h" -#include "absl/memory/memory.h" -#include "absl/strings/str_join.h" -#include "stablehlo/dialect/Serialization.h" // from @stablehlo -#include "tsl/platform/errors.h" -#include "tsl/profiler/lib/traceme.h" -#include "xla/literal_util.h" -#include "xla/shape_util.h" #include #include #include @@ -32,6 +24,15 @@ #include #include +#include "absl/container/flat_hash_map.h" +#include "absl/memory/memory.h" +#include "absl/strings/str_join.h" +#include "stablehlo/dialect/Serialization.h" // from @stablehlo +#include "tsl/platform/errors.h" +#include "tsl/profiler/lib/traceme.h" +#include "xla/literal_util.h" +#include "xla/shape_util.h" + #include "torch_xla/csrc/aten_xla_bridge.h" #include "torch_xla/csrc/dtype.h" #include "torch_xla/csrc/hash_util.h" diff --git a/torch_xla/csrc/xla_graph_executor.h b/torch_xla/csrc/xla_graph_executor.h index 38fa8f831708..e4dcedce8268 100644 --- a/torch_xla/csrc/xla_graph_executor.h +++ b/torch_xla/csrc/xla_graph_executor.h @@ -8,11 +8,12 @@ #include #include +#include +#include + #include "absl/synchronization/blocking_counter.h" #include "xla/hlo/builder/xla_builder.h" #include "xla/types.h" -#include -#include #include "torch_xla/csrc/cross_replica_reduces.h" #include "torch_xla/csrc/debug_util.h" diff --git a/torch_xla/csrc/xla_lower_util.cpp b/torch_xla/csrc/xla_lower_util.cpp index 98d2cdb8fc34..7908294f4533 100644 --- a/torch_xla/csrc/xla_lower_util.cpp +++ b/torch_xla/csrc/xla_lower_util.cpp @@ -3,6 +3,9 @@ #include #include +#include +#include + #include "absl/status/status.h" #include "xla/hlo/builder/lib/arithmetic.h" #include "xla/hlo/builder/lib/comparators.h" @@ -13,8 +16,6 @@ #include "xla/shape_util.h" #include "xla/stream_executor/dnn.h" #include "xla/util.h" -#include -#include #include "torch_xla/csrc/convert_ops.h" #include "torch_xla/csrc/data_ops.h" diff --git a/torch_xla/csrc/xla_op_builder.h b/torch_xla/csrc/xla_op_builder.h index f9f1200d3401..2864c6fcec05 100644 --- a/torch_xla/csrc/xla_op_builder.h +++ b/torch_xla/csrc/xla_op_builder.h @@ -5,9 +5,10 @@ #include #include -#include "xla/hlo/builder/xla_builder.h" #include +#include "xla/hlo/builder/xla_builder.h" + namespace torch_xla { namespace op_builder { diff --git a/torch_xla/csrc/xla_sharding_util.cpp b/torch_xla/csrc/xla_sharding_util.cpp index 91b1e82bcd58..2f90a6a0bca1 100644 --- a/torch_xla/csrc/xla_sharding_util.cpp +++ b/torch_xla/csrc/xla_sharding_util.cpp @@ -5,6 +5,8 @@ #include #include +#include + #include "absl/synchronization/blocking_counter.h" #include "tsl/profiler/lib/traceme.h" #include "xla/execution_options_util.h" @@ -17,7 +19,6 @@ #include "xla/service/spmd/spmd_partitioner.h" #include "xla/xla.pb.h" #include "xla_sharding_util.h" -#include #include "torch_xla/csrc/aten_autograd_ops.h" #include "torch_xla/csrc/aten_xla_bridge.h" diff --git a/torch_xla/csrc/xla_sharding_util.h b/torch_xla/csrc/xla_sharding_util.h index f6fd596a7f4b..3b30833d3264 100644 --- a/torch_xla/csrc/xla_sharding_util.h +++ b/torch_xla/csrc/xla_sharding_util.h @@ -3,10 +3,11 @@ #include +#include + #include "xla/hlo/builder/xla_builder.h" #include "xla/hlo/builder/xla_computation.h" #include "xla/service/hlo.pb.h" -#include #include "torch_xla/csrc/ir.h" #include "torch_xla/csrc/lowering_context.h"