Skip to content

Commit

Permalink
replace include header
Browse files Browse the repository at this point in the history
  • Loading branch information
guangyey committed Feb 25, 2025
1 parent 9334d3a commit 8620737
Show file tree
Hide file tree
Showing 45 changed files with 108 additions and 121 deletions.
6 changes: 0 additions & 6 deletions cmake/Codegen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,6 @@ GEN_XPU(
${XPU_AOTI_SHIM_SOURCE}
)

# The c_shim_xpu.cpp needs include files in ${CMAKE_BINARY_DIR}/xpu/ATen/ops/*.h)
# The include path is auto generated as "#include <ATen/ops/*.h">
# To follow the design of aoti codegen, here ${CMAKE_BINARY_DIR}/xpu is added to
# $TORCH_XPU_OPS_INCLUDE_DIRS, so that "#include <ATen/ops/*.h>" works.
list(APPEND TORCH_XPU_OPS_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/xpu)

list(APPEND xpu_generated_src
${RegisterXPU_GENERATED}
${RegisterSparseXPU_GENERATED}
Expand Down
4 changes: 2 additions & 2 deletions src/ATen/native/sparse/xpu/SparseCsrTensorMath.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <ATen/native/sparse/SparseStubs.h>
#include <ATen/native/sparse/xpu/sycl/SparseCsrTensorMathKernels.h>
#include <xpu/ATen/ops/_convert_indices_from_coo_to_csr_native.h>
#include <xpu/ATen/ops/_convert_indices_from_csr_to_coo_native.h>
#include <ATen/ops/_convert_indices_from_coo_to_csr_native.h>
#include <ATen/ops/_convert_indices_from_csr_to_coo_native.h>

namespace at::native {

Expand Down
6 changes: 3 additions & 3 deletions src/ATen/native/xpu/Activation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#include <ATen/native/TensorIterator.h>

#include <ATen/ops/empty_like.h>
#include <xpu/ATen/ops/empty.h>
#include <xpu/ATen/ops/gelu_backward_native.h>
#include <xpu/ATen/ops/gelu_native.h>
#include <ATen/ops/empty.h>
#include <ATen/ops/gelu_backward_native.h>
#include <ATen/ops/gelu_native.h>

#include <ATen/native/xpu/sycl/ActivationEluKernels.h>
#include <ATen/native/xpu/sycl/ActivationGeluKernel.h>
Expand Down
4 changes: 2 additions & 2 deletions src/ATen/native/xpu/AdaptiveAveragePooling2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

#include <ATen/ops/mean.h>
#include <ATen/ops/zeros_like.h>
#include <xpu/ATen/ops/_adaptive_avg_pool2d_backward_native.h>
#include <xpu/ATen/ops/_adaptive_avg_pool2d_native.h>
#include <ATen/ops/_adaptive_avg_pool2d_backward_native.h>
#include <ATen/ops/_adaptive_avg_pool2d_native.h>

#include <ATen/native/xpu/sycl/AdaptiveAveragePooling2dKernels.h>

Expand Down
4 changes: 2 additions & 2 deletions src/ATen/native/xpu/AdaptiveAveragePooling3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#include <ATen/ops/empty.h>
#include <ATen/ops/empty_like.h>
#include <xpu/ATen/ops/adaptive_avg_pool3d_backward_native.h>
#include <xpu/ATen/ops/adaptive_avg_pool3d_native.h>
#include <ATen/ops/adaptive_avg_pool3d_backward_native.h>
#include <ATen/ops/adaptive_avg_pool3d_native.h>

namespace at::native {

Expand Down
4 changes: 2 additions & 2 deletions src/ATen/native/xpu/AdaptiveMaxPooling2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <ATen/native/xpu/sycl/AdaptiveMaxPooling2dKernels.h>
#include <comm/RegisterUtils.h>

#include <xpu/ATen/ops/adaptive_max_pool2d_backward_native.h>
#include <xpu/ATen/ops/adaptive_max_pool2d_native.h>
#include <ATen/ops/adaptive_max_pool2d_backward_native.h>
#include <ATen/ops/adaptive_max_pool2d_native.h>

namespace at {
namespace native {
Expand Down
4 changes: 2 additions & 2 deletions src/ATen/native/xpu/AdaptiveMaxPooling3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <ATen/native/xpu/sycl/AdaptiveMaxPooling3dKernels.h>

#include <ATen/ops/empty.h>
#include <xpu/ATen/ops/adaptive_max_pool3d_backward_native.h>
#include <xpu/ATen/ops/adaptive_max_pool3d_native.h>
#include <ATen/ops/adaptive_max_pool3d_backward_native.h>
#include <ATen/ops/adaptive_max_pool3d_native.h>

namespace at {
namespace native {
Expand Down
4 changes: 2 additions & 2 deletions src/ATen/native/xpu/AveragePool2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <ATen/native/xpu/sycl/AveragePool2dKernels.h>
#include <comm/RegisterUtils.h>

#include <xpu/ATen/ops/avg_pool2d_backward_native.h>
#include <xpu/ATen/ops/avg_pool2d_native.h>
#include <ATen/ops/avg_pool2d_backward_native.h>
#include <ATen/ops/avg_pool2d_native.h>

namespace at {
namespace native {
Expand Down
4 changes: 2 additions & 2 deletions src/ATen/native/xpu/AveragePool3d.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <ATen/core/Tensor.h>
#include <ATen/native/xpu/sycl/AveragePool3dKernels.h>

#include <xpu/ATen/ops/avg_pool3d_backward_native.h>
#include <xpu/ATen/ops/avg_pool3d_native.h>
#include <ATen/ops/avg_pool3d_backward_native.h>
#include <ATen/ops/avg_pool3d_native.h>

namespace at {
namespace native {
Expand Down
2 changes: 1 addition & 1 deletion src/ATen/native/xpu/BinaryOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <ATen/native/DispatchStub.h>
#include <ATen/native/TensorIterator.h>

#include <xpu/ATen/ops/add_native.h>
#include <ATen/ops/add_native.h>

#include <ATen/native/xpu/sycl/BinaryBitwiseOpsKernels.h>
#include <ATen/native/xpu/sycl/BinaryGeometricKernels.h>
Expand Down
2 changes: 1 addition & 1 deletion src/ATen/native/xpu/Col2Im.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <ATen/native/xpu/sycl/Col2ImKernel.h>

#include <comm/xpu_aten.h>
#include <xpu/ATen/ops/col2im_native.h>
#include <ATen/ops/col2im_native.h>

namespace at::native {

Expand Down
6 changes: 3 additions & 3 deletions src/ATen/native/xpu/DilatedMaxPool2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#include <ATen/native/xpu/sycl/DilatedMaxPool2d.h>
#include <comm/RegisterUtils.h>

#include <xpu/ATen/ops/max.h>
#include <xpu/ATen/ops/max_pool2d_with_indices_backward_native.h>
#include <xpu/ATen/ops/max_pool2d_with_indices_native.h>
#include <ATen/ops/max.h>
#include <ATen/ops/max_pool2d_with_indices_backward_native.h>
#include <ATen/ops/max_pool2d_with_indices_native.h>

namespace at {
namespace native {
Expand Down
4 changes: 2 additions & 2 deletions src/ATen/native/xpu/DilatedMaxPool3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#include <ATen/native/xpu/sycl/DilatedMaxPool3d.h>

#include <ATen/ops/empty.h>
#include <xpu/ATen/ops/max_pool3d_with_indices_backward_native.h>
#include <xpu/ATen/ops/max_pool3d_with_indices_native.h>
#include <ATen/ops/max_pool3d_with_indices_backward_native.h>
#include <ATen/ops/max_pool3d_with_indices_native.h>
namespace at {
namespace native {

Expand Down
4 changes: 2 additions & 2 deletions src/ATen/native/xpu/Dropout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include <ATen/native/TensorIterator.h>
#include <ATen/native/xpu/sycl/DropoutKernels.h>

#include <xpu/ATen/ops/native_dropout_backward_native.h>
#include <xpu/ATen/ops/native_dropout_native.h>
#include <ATen/ops/native_dropout_backward_native.h>
#include <ATen/ops/native_dropout_native.h>

#include <comm/xpu_aten.h>

Expand Down
2 changes: 1 addition & 1 deletion src/ATen/native/xpu/Embedding.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <ATen/core/op_registration/adaption.h>

#include <xpu/ATen/ops/embedding_dense_backward_native.h>
#include <ATen/ops/embedding_dense_backward_native.h>

#include <ATen/native/xpu/sycl/EmbeddingKernels.h>
#include <comm/xpu_aten.h>
Expand Down
4 changes: 2 additions & 2 deletions src/ATen/native/xpu/EmbeddingBag.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <xpu/ATen/ops/_embedding_bag_forward_only_native.h>
#include <xpu/ATen/ops/_embedding_bag_native.h>
#include <ATen/ops/_embedding_bag_forward_only_native.h>
#include <ATen/ops/_embedding_bag_native.h>

#include <ATen/native/xpu/sycl/EmbeddingBagKernels.h>
#include <comm/xpu_aten.h>
Expand Down
2 changes: 1 addition & 1 deletion src/ATen/native/xpu/Equal.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <ATen/NamedTensorUtils.h>

#include <xpu/ATen/ops/equal_native.h>
#include <ATen/ops/equal_native.h>

namespace at {
namespace xpu {
Expand Down
4 changes: 2 additions & 2 deletions src/ATen/native/xpu/ForeachOpScalarList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#include <ATen/native/xpu/sycl/ForeachPointwiseOpScalarListKernels.h>
#include <ATen/native/xpu/sycl/ForeachTernaryOpScalarListKernels.h>

#include <xpu/ATen/ops/_foreach_add_native.h>
#include <xpu/ATen/ops/_foreach_mul_native.h>
#include <ATen/ops/_foreach_add_native.h>
#include <ATen/ops/_foreach_mul_native.h>

namespace at {
namespace native {
Expand Down
4 changes: 2 additions & 2 deletions src/ATen/native/xpu/ForeachReduceOp.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <ATen/native/ForeachUtils.h>

#include <ATen/native/xpu/sycl/ForeachReduceKernels.h>
#include <xpu/ATen/ops/_foreach_max_native.h>
#include <xpu/ATen/ops/_foreach_norm_native.h>
#include <ATen/ops/_foreach_max_native.h>
#include <ATen/ops/_foreach_norm_native.h>

namespace at {
namespace native {
Expand Down
4 changes: 2 additions & 2 deletions src/ATen/native/xpu/FractionalMaxPool2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include <ATen/native/cpu/mixed_data_type.h>
#include <ATen/native/xpu/sycl/FractionalMaxPool2dKernels.h>

#include <xpu/ATen/ops/fractional_max_pool2d_backward_native.h>
#include <xpu/ATen/ops/fractional_max_pool2d_native.h>
#include <ATen/ops/fractional_max_pool2d_backward_native.h>
#include <ATen/ops/fractional_max_pool2d_native.h>

namespace at::native {

Expand Down
4 changes: 2 additions & 2 deletions src/ATen/native/xpu/FractionalMaxPool3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <ATen/native/xpu/sycl/FractionalMaxPool3dKernels.h>
#include <ATen/ops/empty.h>

#include <xpu/ATen/ops/fractional_max_pool3d_backward_native.h>
#include <xpu/ATen/ops/fractional_max_pool3d_native.h>
#include <ATen/ops/fractional_max_pool3d_backward_native.h>
#include <ATen/ops/fractional_max_pool3d_native.h>

namespace at::native {

Expand Down
2 changes: 1 addition & 1 deletion src/ATen/native/xpu/Im2Col.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <ATen/native/TensorIterator.h>
#include <torch/library.h>

#include <xpu/ATen/ops/im2col_native.h>
#include <ATen/ops/im2col_native.h>

#include <ATen/native/xpu/sycl/Im2ColKernel.h>
#include <comm/xpu_aten.h>
Expand Down
2 changes: 1 addition & 1 deletion src/ATen/native/xpu/Indexing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <comm/xpu_aten.h>

#include <ATen/ops/index.h>
#include <xpu/ATen/ops/index_native.h>
#include <ATen/ops/index_native.h>

namespace at {
namespace native {
Expand Down
4 changes: 2 additions & 2 deletions src/ATen/native/xpu/LossMultiMargin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#include <ATen/native/xpu/sycl/MultiMarginLossKernels.h>

#include <ATen/ops/empty.h>
#include <xpu/ATen/ops/multi_margin_loss_backward_native.h>
#include <xpu/ATen/ops/multi_margin_loss_native.h>
#include <ATen/ops/multi_margin_loss_backward_native.h>
#include <ATen/ops/multi_margin_loss_native.h>

namespace at::native {

Expand Down
4 changes: 2 additions & 2 deletions src/ATen/native/xpu/LossNLL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <comm/RegisterUtils.h>
#include <comm/xpu_aten.h>

#include <xpu/ATen/ops/nll_loss_backward_native.h>
#include <xpu/ATen/ops/nll_loss_forward_native.h>
#include <ATen/ops/nll_loss_backward_native.h>
#include <ATen/ops/nll_loss_forward_native.h>

namespace at {
namespace native {
Expand Down
2 changes: 1 addition & 1 deletion src/ATen/native/xpu/PinnedMemoryAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <ATen/xpu/PinnedMemoryAllocator.h>
#include <comm/xpu_aten.h>

#include <xpu/ATen/ops/is_pinned_native.h>
#include <ATen/ops/is_pinned_native.h>

namespace at {
namespace native {
Expand Down
8 changes: 4 additions & 4 deletions src/ATen/native/xpu/RangeFactories.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
#include <comm/xpu_aten.h>
#include <torch/library.h>

#include <xpu/ATen/ops/arange_native.h>
#include <xpu/ATen/ops/linspace_native.h>
#include <xpu/ATen/ops/logspace_native.h>
#include <xpu/ATen/ops/range_native.h>
#include <ATen/ops/arange_native.h>
#include <ATen/ops/linspace_native.h>
#include <ATen/ops/logspace_native.h>
#include <ATen/ops/range_native.h>

namespace at {

Expand Down
12 changes: 6 additions & 6 deletions src/ATen/native/xpu/ReflectionPad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

#include <ATen/ops/empty.h>
#include <ATen/ops/zeros_like.h>
#include <xpu/ATen/ops/reflection_pad1d_backward_native.h>
#include <xpu/ATen/ops/reflection_pad1d_native.h>
#include <xpu/ATen/ops/reflection_pad2d_backward_native.h>
#include <xpu/ATen/ops/reflection_pad2d_native.h>
#include <xpu/ATen/ops/reflection_pad3d_backward_native.h>
#include <xpu/ATen/ops/reflection_pad3d_native.h>
#include <ATen/ops/reflection_pad1d_backward_native.h>
#include <ATen/ops/reflection_pad1d_native.h>
#include <ATen/ops/reflection_pad2d_backward_native.h>
#include <ATen/ops/reflection_pad2d_native.h>
#include <ATen/ops/reflection_pad3d_backward_native.h>
#include <ATen/ops/reflection_pad3d_native.h>
#include "ATen/TensorMeta.h"

namespace at {
Expand Down
12 changes: 6 additions & 6 deletions src/ATen/native/xpu/ReplicationPadding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

#include <comm/RegisterUtils.h>

#include <xpu/ATen/ops/replication_pad1d_backward_native.h>
#include <xpu/ATen/ops/replication_pad1d_native.h>
#include <xpu/ATen/ops/replication_pad2d_backward_native.h>
#include <xpu/ATen/ops/replication_pad2d_native.h>
#include <xpu/ATen/ops/replication_pad3d_backward_native.h>
#include <xpu/ATen/ops/replication_pad3d_native.h>
#include <ATen/ops/replication_pad1d_backward_native.h>
#include <ATen/ops/replication_pad1d_native.h>
#include <ATen/ops/replication_pad2d_backward_native.h>
#include <ATen/ops/replication_pad2d_native.h>
#include <ATen/ops/replication_pad3d_backward_native.h>
#include <ATen/ops/replication_pad3d_native.h>

namespace at {
namespace native {
Expand Down
13 changes: 3 additions & 10 deletions src/ATen/native/xpu/Resize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,13 @@
#include <torch/library.h>

#include <ATen/native/Resize.h>
#include <xpu/ATen/ops/copy.h>
#include <xpu/ATen/ops/resize_native.h>
#include <xpu/ATen/ops/set_native.h>
#include <ATen/ops/copy.h>
#include <ATen/ops/resize_native.h>
#include <ATen/ops/set_native.h>

#include <ATen/native/xpu/sycl/ResizeKernel.h>

namespace at {

namespace native {
const at::Tensor& resize_(
const at::Tensor& self,
at::IntArrayRef size,
::std::optional<at::MemoryFormat> memory_format = ::std::nullopt);
}
namespace native::xpu {

const Tensor& resize_xpu_(
Expand Down
8 changes: 4 additions & 4 deletions src/ATen/native/xpu/SoftMax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#include <comm/RegisterUtils.h>
#include <comm/xpu_aten.h>

#include <xpu/ATen/ops/_log_softmax_backward_data_native.h>
#include <xpu/ATen/ops/_log_softmax_native.h>
#include <xpu/ATen/ops/_softmax_backward_data_native.h>
#include <xpu/ATen/ops/_softmax_native.h>
#include <ATen/ops/_log_softmax_backward_data_native.h>
#include <ATen/ops/_log_softmax_native.h>
#include <ATen/ops/_softmax_backward_data_native.h>
#include <ATen/ops/_softmax_native.h>
namespace at::native {

TORCH_IMPL_FUNC(softmax_xpu_out)
Expand Down
2 changes: 1 addition & 1 deletion src/ATen/native/xpu/SummaryOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <ATen/native/xpu/sycl/SummaryOpsKernels.h>
#include <comm/SYCLContext.h>

#include <xpu/ATen/ops/bincount_native.h>
#include <ATen/ops/bincount_native.h>

namespace at {
namespace native {
Expand Down
6 changes: 3 additions & 3 deletions src/ATen/native/xpu/TensorAdvancedIndexing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

#include <ATen/ops/index_add_meta.h>
#include <ATen/ops/index_reduce_meta.h>
#include <xpu/ATen/ops/index_add_native.h>
#include <xpu/ATen/ops/index_reduce_native.h> //generated
//#include <xpu/ATen/ops/index_reduce_prod_native.h> //generated
#include <ATen/ops/index_add_native.h>
#include <ATen/ops/index_reduce_native.h> //generated
//#include <ATen/ops/index_reduce_prod_native.h> //generated

namespace at {

Expand Down
2 changes: 1 addition & 1 deletion src/ATen/native/xpu/TensorFactories.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <ATen/ops/empty_native.h>
#include <ATen/ops/empty_strided_native.h>
#include <xpu/ATen/ops/_efficientzerotensor_native.h>
#include <ATen/ops/_efficientzerotensor_native.h>

#include <ATen/native/xpu/sycl/ComplexKernels.h>
#include <ATen/native/xpu/sycl/RandpermKernel.h>
Expand Down
Loading

0 comments on commit 8620737

Please sign in to comment.