Skip to content

Commit

Permalink
Expose TORCH_XPU_API to Pytorch
Browse files Browse the repository at this point in the history
  • Loading branch information
etaf committed May 20, 2024
1 parent 5bf9e0c commit 5d6c3e7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
6 changes: 6 additions & 0 deletions src/aten/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# ATen XPU sources

file(GLOB xpu_cpp "*.cpp")
file(GLOB xpu_h "*.h")
file(GLOB xpu_sycl "sycl/*.cpp")

list(APPEND ATen_XPU_CPP_SRCS ${xpu_cpp})
list(APPEND ATen_XPU_SYCL_SRCS ${xpu_sycl})

set(ATen_XPU_CPP_SRCS ${ATen_XPU_CPP_SRCS} PARENT_SCOPE)
set(ATen_XPU_SYCL_SRCS ${ATen_XPU_SYCL_SRCS} PARENT_SCOPE)


foreach(HEADER ${xpu_h})
install(FILES ${HEADER} DESTINATION "include/ATen/xpu")
endforeach()
1 change: 1 addition & 0 deletions src/aten/EmptyTensor.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#define TORCH_ASSERT_NO_OPERATORS
#include <ATen/Context.h>
#include <ATen/EmptyTensor.h>
#include <ATen/xpu/EmptyTensor.h>
#include <c10/core/DeviceGuard.h>
#include <c10/xpu/XPUCachingAllocator.h>

Expand Down
13 changes: 7 additions & 6 deletions src/aten/EmptyTensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,38 @@
namespace at::detail {

// XXX: add TORCH_XPU_API
TensorBase empty_xpu(
TORCH_XPU_API TensorBase empty_xpu(
IntArrayRef size,
ScalarType dtype,
c10::optional<Device> device_opt,
c10::optional<c10::MemoryFormat> memory_format_opt);

TensorBase empty_xpu(
TORCH_XPU_API TensorBase empty_xpu(
IntArrayRef size,
c10::optional<ScalarType> dtype_opt,
c10::optional<Layout> layout_opt,
c10::optional<Device> device_opt,
c10::optional<bool> pin_memory_opt,
c10::optional<c10::MemoryFormat> memory_format_opt);

TensorBase empty_xpu(IntArrayRef size, const TensorOptions& options);
TORCH_XPU_API TensorBase
empty_xpu(IntArrayRef size, const TensorOptions& options);

TensorBase empty_strided_xpu(
TORCH_XPU_API TensorBase empty_strided_xpu(
IntArrayRef size,
IntArrayRef stride,
ScalarType dtype,
c10::optional<Device> device_opt);

TensorBase empty_strided_xpu(
TORCH_XPU_API TensorBase empty_strided_xpu(
IntArrayRef size,
IntArrayRef stride,
c10::optional<ScalarType> dtype_opt,
c10::optional<Layout> layout_opt,
c10::optional<Device> device_opt,
c10::optional<bool> pin_memory_opt);

TensorBase empty_strided_xpu(
TORCH_XPU_API TensorBase empty_strided_xpu(
IntArrayRef size,
IntArrayRef stride,
const TensorOptions& options);
Expand Down

0 comments on commit 5d6c3e7

Please sign in to comment.