-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into majing/histogram
- Loading branch information
Showing
23 changed files
with
538 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <ATen/Dispatch.h> | ||
#include <ATen/native/TensorIterator.h> | ||
|
||
#include <ATen/native/xpu/sycl/Loops.h> | ||
|
||
namespace at::native::xpu { | ||
|
||
template <typename scalar_t> | ||
struct CopysignFunctor { | ||
scalar_t operator()(scalar_t a, scalar_t b) const { | ||
return std::copysign(a, b); | ||
} | ||
}; | ||
|
||
void copysign_kernel(TensorIteratorBase& iter) { | ||
AT_DISPATCH_FLOATING_TYPES_AND2( | ||
at::ScalarType::Half, | ||
at::ScalarType::BFloat16, | ||
iter.common_dtype(), | ||
"copysign_xpu", | ||
[&]() { gpu_kernel_with_scalars(iter, CopysignFunctor<scalar_t>()); }); | ||
} | ||
|
||
} // namespace at::native::xpu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#pragma once | ||
|
||
#include <ATen/native/TensorIterator.h> | ||
|
||
namespace at::native::xpu { | ||
|
||
void copysign_kernel(TensorIteratorBase& iter); | ||
|
||
} // namespace at::native::xpu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include <ATen/Dispatch.h> | ||
#include <ATen/OpMathType.h> | ||
|
||
#include <ATen/native/xpu/sycl/Loops.h> | ||
|
||
namespace at::native::xpu { | ||
|
||
template <typename scalar_t> | ||
struct AsinComplexFunctor { | ||
using opmath_t = at::opmath_type<scalar_t>; | ||
scalar_t operator()(const scalar_t a) const { | ||
return std::asin(static_cast<opmath_t>(a)); | ||
} | ||
}; | ||
|
||
template <typename scalar_t> | ||
struct AsinFunctor { | ||
scalar_t operator()(const scalar_t a) const { | ||
return std::asin(a); | ||
} | ||
}; | ||
|
||
void asin_kernel(TensorIteratorBase& iter) { | ||
auto common_dtype = iter.common_dtype(); | ||
if (at::isComplexType(common_dtype)) { | ||
AT_DISPATCH_COMPLEX_TYPES_AND( | ||
kComplexHalf, common_dtype, "asin_xpu", [&]() { | ||
gpu_kernel(iter, AsinComplexFunctor<scalar_t>()); | ||
}); | ||
} else { | ||
AT_DISPATCH_FLOATING_TYPES_AND2( | ||
ScalarType::Half, | ||
ScalarType::BFloat16, | ||
common_dtype, | ||
"asin_xpu", | ||
[&]() { gpu_kernel(iter, AsinFunctor<scalar_t>()); }); | ||
} | ||
} | ||
|
||
} // namespace at::native::xpu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#pragma once | ||
|
||
#include <ATen/native/TensorIterator.h> | ||
|
||
namespace at::native::xpu { | ||
|
||
void asin_kernel(TensorIteratorBase& iter); | ||
|
||
} // namespace at::native::xpu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include <ATen/Dispatch.h> | ||
#include <ATen/OpMathType.h> | ||
|
||
#include <ATen/native/xpu/sycl/Loops.h> | ||
|
||
namespace at::native::xpu { | ||
|
||
template <typename scalar_t> | ||
struct AsinhComplexFunctor { | ||
using opmath_t = at::opmath_type<scalar_t>; | ||
scalar_t operator()(const scalar_t a) const { | ||
return std::asinh(static_cast<opmath_t>(a)); | ||
} | ||
}; | ||
|
||
template <typename scalar_t> | ||
struct AsinhFunctor { | ||
scalar_t operator()(const scalar_t a) const { | ||
return std::asinh(a); | ||
} | ||
}; | ||
|
||
void asinh_kernel(TensorIteratorBase& iter) { | ||
auto common_dtype = iter.common_dtype(); | ||
if (at::isComplexType(common_dtype)) { | ||
AT_DISPATCH_COMPLEX_TYPES_AND( | ||
kComplexHalf, common_dtype, "asinh_xpu", [&]() { | ||
gpu_kernel(iter, AsinhComplexFunctor<scalar_t>()); | ||
}); | ||
} else { | ||
AT_DISPATCH_FLOATING_TYPES_AND2( | ||
ScalarType::Half, | ||
ScalarType::BFloat16, | ||
common_dtype, | ||
"asinh_xpu", | ||
[&]() { gpu_kernel(iter, AsinhFunctor<scalar_t>()); }); | ||
} | ||
} | ||
|
||
} // namespace at::native::xpu |
Oops, something went wrong.