Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<torch/.*>'
Priority: 3
- Regex: '^<ATen/.*>'
Priority: 3
- Regex: '^<c10/.*>'
Priority: 3
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Expand Down
3 changes: 2 additions & 1 deletion test/cpp/test_replication.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include <ATen/ATen.h>
#include <gtest/gtest.h>

#include <iostream>

#include <ATen/ATen.h>

#include "absl/synchronization/blocking_counter.h"
#include "xla/hlo/builder/xla_builder.h"
#include "xla/shape_util.h"
Expand Down
3 changes: 2 additions & 1 deletion test/cpp/test_status_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#ifndef XLA_TEST_CPP_TEST_STATUS_COMMON_H_
#define XLA_TEST_CPP_TEST_STATUS_COMMON_H_

#include <c10/util/Exception.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>

Expand All @@ -27,6 +26,8 @@
#include <stdexcept>
#include <utility>

#include <c10/util/Exception.h>

#include "absl/status/status.h"
#include "absl/status/statusor.h"

Expand Down
2 changes: 1 addition & 1 deletion test/cpp/test_tensor.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include <ATen/ATen.h>
#include <gtest/gtest.h>

#include <limits>
#include <vector>

#include <ATen/ATen.h>
#include <torch/csrc/autograd/variable.h>

#include "absl/base/nullability.h"
Expand Down
2 changes: 1 addition & 1 deletion test/cpp/test_xla_sharding.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include <ATen/ATen.h>
#include <google/protobuf/repeated_field.h>
#include <gtest/gtest.h>
#include <stdlib.h>

#include <iostream>

#include <ATen/ATen.h>
#include <torch/csrc/lazy/core/lazy_graph_executor.h>

#include "xla/protobuf_util.h"
Expand Down
7 changes: 3 additions & 4 deletions torch_xla/csrc/aten_fallback.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#include "torch_xla/csrc/aten_fallback.h"

#include <unordered_map>
#include <vector>

#include <ATen/DLConvertor.h>
#include <ATen/native/CPUFallback.h>
#include <ATen/ops/_copy_from_and_resize.h>
#include <ATen/ops/_to_cpu.h>

#include <unordered_map>
#include <vector>

#include <torch/csrc/utils/device_lazy_init.h>

#include "torch_xla/csrc/function_call_tracker.h"
Expand Down
3 changes: 1 addition & 2 deletions torch_xla/csrc/aten_xla_bridge.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#include "torch_xla/csrc/aten_xla_bridge.h"

#include <ATen/FunctionalTensorWrapper.h>

#include <map>
#include <string>
#include <vector>

#include <ATen/FunctionalTensorWrapper.h>
#include <torch/csrc/lazy/core/tensor_util.h>

#include "absl/log/absl_check.h"
Expand Down
4 changes: 2 additions & 2 deletions torch_xla/csrc/aten_xla_bridge.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#ifndef XLA_TORCH_XLA_CSRC_ATEN_XLA_BRIDGE_H_
#define XLA_TORCH_XLA_CSRC_ATEN_XLA_BRIDGE_H_

#include <vector>

#include <ATen/Device.h>
#include <ATen/Functions.h>
#include <ATen/Tensor.h>

#include <vector>

#include "absl/base/nullability.h"
#include "absl/status/statusor.h"
#include "absl/types/span.h"
Expand Down
9 changes: 4 additions & 5 deletions torch_xla/csrc/aten_xla_type.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#include <iterator>
#include <mutex>
#include <optional>

#include <ATen/ExpandUtils.h>
#include <ATen/FunctionalTensorWrapper.h>
#include <ATen/MetaFunctions.h>
Expand All @@ -10,11 +14,6 @@
#include <ATen/ops/_embedding_bag_backward_native.h>
#include <ATen/ops/expand_copy.h>
#include <c10/core/Contiguity.h>

#include <iterator>
#include <mutex>
#include <optional>

#include <torch/csrc/lazy/core/helpers.h>
#include <torch/csrc/lazy/core/shape_inference.h>
#include <torch/csrc/lazy/core/tensor_util.h>
Expand Down
1 change: 0 additions & 1 deletion torch_xla/csrc/autocast_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <ATen/autocast_mode.h>
#include <c10/core/impl/LocalDispatchKeySet.h>
#include <c10/util/intrusive_ptr.h>

#include <torch/library.h>

namespace at {
Expand Down
4 changes: 2 additions & 2 deletions torch_xla/csrc/convert_ops.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef XLA_TORCH_XLA_CSRC_CONVERT_OPS_H_
#define XLA_TORCH_XLA_CSRC_CONVERT_OPS_H_

#include <c10/core/ScalarType.h>

#include <optional>

#include <c10/core/ScalarType.h>

#include "xla/hlo/builder/xla_builder.h"
#include "xla/types.h"

Expand Down
4 changes: 2 additions & 2 deletions torch_xla/csrc/data_ops.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef XLA_TORCH_XLA_CSRC_DATA_OPS_H_
#define XLA_TORCH_XLA_CSRC_DATA_OPS_H_

#include <c10/core/ScalarType.h>

#include <vector>

#include <c10/core/ScalarType.h>

#include "absl/types/optional.h"
#include "absl/types/span.h"
#include "xla/hlo/builder/xla_builder.h"
Expand Down
4 changes: 2 additions & 2 deletions torch_xla/csrc/dl_convertor.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "torch_xla/csrc/dl_convertor.h"

#include <ATen/DLConvertor.h>

#include <memory>
#include <utility>
#include <vector>

#include <ATen/DLConvertor.h>

#include "absl/log/absl_check.h"
#include "absl/status/status.h"
#include "absl/types/span.h"
Expand Down
3 changes: 1 addition & 2 deletions torch_xla/csrc/helpers.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#ifndef XLA_TORCH_XLA_CSRC_HELPERS_H_
#define XLA_TORCH_XLA_CSRC_HELPERS_H_

#include <c10/core/Scalar.h>

#include <functional>
#include <optional>
#include <tuple>
#include <vector>

#include <c10/core/Scalar.h>
#include <torch/csrc/lazy/core/shape.h>
#include <torch/csrc/lazy/core/util.h>

Expand Down
6 changes: 3 additions & 3 deletions torch_xla/csrc/init_python_bindings.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#include <ATen/dlpack.h>
#include <Python.h>
#include <c10/core/Device.h>
#include <c10/util/Metaprogramming.h>
#include <google/protobuf/text_format.h>

#include <algorithm>
Expand All @@ -17,6 +14,9 @@
#include <unordered_map>
#include <vector>

#include <ATen/dlpack.h>
#include <c10/core/Device.h>
#include <c10/util/Metaprogramming.h>
#include <torch/csrc/Exceptions.h>
#include <torch/csrc/autograd/utils/wrap_outputs.h>
#include <torch/csrc/autograd/variable.h>
Expand Down
3 changes: 1 addition & 2 deletions torch_xla/csrc/ir.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef XLA_TORCH_XLA_CSRC_IR_H_
#define XLA_TORCH_XLA_CSRC_IR_H_

#include <ATen/core/interned_strings.h>

#include <functional>
#include <iostream>
#include <memory>
Expand All @@ -12,6 +10,7 @@
#include <utility>
#include <vector>

#include <ATen/core/interned_strings.h>
#include <torch/csrc/lazy/core/hash.h>
#include <torch/csrc/lazy/core/ir.h>
#include <torch/csrc/lazy/core/ir_builder.h>
Expand Down
4 changes: 2 additions & 2 deletions torch_xla/csrc/ops/cast.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef XLA_TORCH_XLA_CSRC_OPS_CAST_H_
#define XLA_TORCH_XLA_CSRC_OPS_CAST_H_

#include <c10/core/ScalarType.h>

#include <optional>

#include <c10/core/ScalarType.h>

#include "torch_xla/csrc/ir.h"

namespace torch_xla {
Expand Down
4 changes: 2 additions & 2 deletions torch_xla/csrc/ops/cumprod.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef XLA_TORCH_XLA_CSRC_OPS_CUMPROD_H_
#define XLA_TORCH_XLA_CSRC_OPS_CUMPROD_H_

#include <c10/core/ScalarType.h>

#include <optional>

#include <c10/core/ScalarType.h>

#include "torch_xla/csrc/ir.h"

namespace torch_xla {
Expand Down
4 changes: 2 additions & 2 deletions torch_xla/csrc/ops/cumsum.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef XLA_TORCH_XLA_CSRC_OPS_CUMSUM_H_
#define XLA_TORCH_XLA_CSRC_OPS_CUMSUM_H_

#include <c10/core/ScalarType.h>

#include <optional>

#include <c10/core/ScalarType.h>

#include "torch_xla/csrc/ir.h"

namespace torch_xla {
Expand Down
1 change: 0 additions & 1 deletion torch_xla/csrc/ops/dot_general.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "torch_xla/csrc/ops/dot_general.h"

#include <c10/core/ScalarType.h>

#include <torch/csrc/lazy/core/tensor_util.h>

#include "torch_xla/csrc/dtype.h"
Expand Down
1 change: 0 additions & 1 deletion torch_xla/csrc/ops/index_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <ATen/ExpandUtils.h>
#include <ATen/Functions.h>
#include <ATen/ops/select_copy.h>

#include <torch/csrc/lazy/core/util.h>

#include "xla/permutation_util.h"
Expand Down
4 changes: 2 additions & 2 deletions torch_xla/csrc/ops/log_softmax.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef XLA_TORCH_XLA_CSRC_OPS_LOG_SOFTMAX_H_
#define XLA_TORCH_XLA_CSRC_OPS_LOG_SOFTMAX_H_

#include <c10/core/ScalarType.h>

#include <optional>

#include <c10/core/ScalarType.h>

#include "torch_xla/csrc/ir.h"

namespace torch_xla {
Expand Down
4 changes: 2 additions & 2 deletions torch_xla/csrc/ops/mean.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef XLA_TORCH_XLA_CSRC_OPS_MEAN_H_
#define XLA_TORCH_XLA_CSRC_OPS_MEAN_H_

#include <c10/core/ScalarType.h>

#include <optional>
#include <vector>

#include <c10/core/ScalarType.h>

#include "xla/types.h"

#include "torch_xla/csrc/ir.h"
Expand Down
1 change: 0 additions & 1 deletion torch_xla/csrc/ops/mse_loss.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "torch_xla/csrc/ops/mse_loss.h"

#include <ATen/core/Reduction.h>

#include <torch/csrc/lazy/core/util.h>

#include "torch_xla/csrc/lowering_context.h"
Expand Down
4 changes: 2 additions & 2 deletions torch_xla/csrc/ops/prod.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef XLA_TORCH_XLA_CSRC_OPS_PROD_H_
#define XLA_TORCH_XLA_CSRC_OPS_PROD_H_

#include <c10/core/ScalarType.h>

#include <optional>

#include <c10/core/ScalarType.h>

#include "absl/types/span.h"

#include "torch_xla/csrc/ir.h"
Expand Down
4 changes: 2 additions & 2 deletions torch_xla/csrc/ops/scalar.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef XLA_TORCH_XLA_CSRC_OPS_SCALAR_H_
#define XLA_TORCH_XLA_CSRC_OPS_SCALAR_H_

#include <iostream>

#include <ATen/core/Formatting.h>
#include <c10/core/Scalar.h>

#include <iostream>

#include "torch_xla/csrc/ir.h"
#include "torch_xla/csrc/runtime/types.h"

Expand Down
4 changes: 2 additions & 2 deletions torch_xla/csrc/ops/softmax.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef XLA_TORCH_XLA_CSRC_OPS_SOFTMAX_H_
#define XLA_TORCH_XLA_CSRC_OPS_SOFTMAX_H_

#include <c10/core/ScalarType.h>

#include <optional>

#include <c10/core/ScalarType.h>

#include "torch_xla/csrc/ir.h"

namespace torch_xla {
Expand Down
4 changes: 2 additions & 2 deletions torch_xla/csrc/ops/sum.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef XLA_TORCH_XLA_CSRC_OPS_SUM_H_
#define XLA_TORCH_XLA_CSRC_OPS_SUM_H_

#include <c10/core/ScalarType.h>

#include <optional>

#include <c10/core/ScalarType.h>

#include "absl/types/span.h"

#include "torch_xla/csrc/ir.h"
Expand Down
3 changes: 1 addition & 2 deletions torch_xla/csrc/reduction.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#include "torch_xla/csrc/reduction.h"

#include <ATen/core/Reduction.h>

#include <cmath>
#include <unordered_set>

#include <ATen/core/Reduction.h>
#include <torch/csrc/lazy/core/helpers.h>
#include <torch/csrc/lazy/core/util.h>

Expand Down
3 changes: 1 addition & 2 deletions torch_xla/csrc/runtime/computation_client.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#ifndef XLA_CLIENT_COMPUTATION_CLIENT_H_
#define XLA_CLIENT_COMPUTATION_CLIENT_H_

#include <ATen/Tensor.h>

#include <algorithm>
#include <cmath>
#include <map>
#include <memory>
#include <string>
#include <vector>

#include <ATen/Tensor.h>
#include <torch/csrc/lazy/backend/backend_data.h>
#include <torch/csrc/lazy/backend/lowering_context.h>
#include <torch/csrc/lazy/core/hash.h>
Expand Down
Loading