Skip to content

Commit

Permalink
Fix missing native.h issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
cfgfung committed Jan 19, 2025
1 parent 512ef17 commit f3e3478
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 7 deletions.
19 changes: 19 additions & 0 deletions src/ATen/native/sparse/xpu/SparseCsrTensorMath.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once
#include <xpu/ATen/ops/_convert_indices_from_coo_to_csr_native.h>
#include <ATen/native/sparse/xpu/sycl/SparseCsrTensorMathKernels.h>

namespace at::native{

TORCH_IMPL_FUNC(_convert_indices_from_coo_to_csr_structured_xpu)(
const Tensor& input,
const int64_t size,
const bool out_int32,
const Tensor& result){
xpu::convert_indices_from_coo_to_csr_structured_kernel(
input,
size,
out_int32,
result);
};

} // namespace at::native
16 changes: 9 additions & 7 deletions src/ATen/native/sparse/xpu/sycl/SparseCsrTensorMathKernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@

#include <ATen/native/xpu/sycl/Loops.h>
#include <ATen/native/xpu/sycl/pstl/PSTLFunctions.h>
#include <ATen/native/sparse/xpu/sycl/SparseCsrTensorMathKernels.h>
#include <comm/SYCLContext.h>
#include <xpu/ATen/ops/_convert_indices_from_coo_to_csr_native.h>

namespace at::native{
namespace at::native::xpu{

template <typename input_t, typename output_t>
struct convertIndicesFromCooToCsrXPUFunctor {
Expand Down Expand Up @@ -61,7 +61,7 @@ struct convertIndicesFromCooToCsrXPUFunctor {


template <typename input_t, typename output_t>
void convert_indices_from_coo_to_csr_xpu(
void launch_convert_indices_from_coo_to_csr_xpu_kernel(
const Tensor& result,
const Tensor& input,
const int64_t size){
Expand Down Expand Up @@ -89,7 +89,7 @@ void convert_indices_from_coo_to_csr_xpu(
sycl_kernel_submit(global_range, local_range, getCurrentSYCLQueue(), functor);
}

TORCH_IMPL_FUNC(_convert_indices_from_coo_to_csr_structured_xpu) (
void convert_indices_from_coo_to_csr_structured_kernel(
const Tensor& input,
const int64_t size,
const bool out_int32,
Expand All @@ -98,17 +98,19 @@ TORCH_IMPL_FUNC(_convert_indices_from_coo_to_csr_structured_xpu) (
if (out_int32) {
AT_DISPATCH_INTEGRAL_TYPES(
input.scalar_type(), "convert_indices_from_coo_to_csr_xpu", [&] {
convert_indices_from_coo_to_csr_xpu<scalar_t, int>(
launch_convert_indices_from_coo_to_csr_xpu_kernel<scalar_t, int>(
result, input, size);
});
} else {
AT_DISPATCH_INTEGRAL_TYPES(
input.scalar_type(), "convert_indices_from_coo_to_csr_xpu", [&] {
convert_indices_from_coo_to_csr_xpu<scalar_t, int64_t>(
launch_convert_indices_from_coo_to_csr_xpu_kernel<scalar_t, int64_t>(
result, input, size);
});
}
}

} // namespace at::native
} // namespace at::native::xpu



14 changes: 14 additions & 0 deletions src/ATen/native/sparse/xpu/sycl/SparseCsrTensorMathKernels.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include <ATen/native/SparseTensorUtils.h>
#include <ATen/native/TensorIterator.h>

namespace at::native::xpu {

TORCH_XPU_API void convert_indices_from_coo_to_csr_structured_kernel(
const Tensor& input,
const int64_t size,
const bool out_int32,
const Tensor& result);

} // namespace at::native::xpu

0 comments on commit f3e3478

Please sign in to comment.