Commit 9473e013 authored by Paul's avatar Paul
Browse files

Add pi constant

parent 0ff00ef6
...@@ -28,10 +28,6 @@ ...@@ -28,10 +28,6 @@
#include <hip/hip_runtime.h> #include <hip/hip_runtime.h>
#include <hip/hip_fp16.h> #include <hip/hip_fp16.h>
#include <hip/math_functions.h> #include <hip/math_functions.h>
#include <hip/hip_math_constants.h>
#elif defined(MIGRAPHX_ENABLE_HIPRTC_WORKAROUNDS)
#include <hip/hip_common.h>
#include <hip/hip_math_constants.h>
#endif #endif
#endif // MIGRAPHX_GUARD_KERNELS_HIP_HPP #endif // MIGRAPHX_GUARD_KERNELS_HIP_HPP
...@@ -32,6 +32,9 @@ ...@@ -32,6 +32,9 @@
namespace migraphx { namespace migraphx {
template <class T> inline constexpr T pi_v = 3.141592653589793238462643383279502;
inline constexpr double pi = pi_v<double>;
namespace math { namespace math {
constexpr float as_float(migraphx::half x) { return x; } constexpr float as_float(migraphx::half x) { return x; }
template <class T> template <class T>
...@@ -221,7 +224,7 @@ constexpr auto min(const T& a, const U& b) ...@@ -221,7 +224,7 @@ constexpr auto min(const T& a, const U& b)
template <class T, MIGRAPHX_REQUIRES(is_same<vec_type<T>, half>{})> template <class T, MIGRAPHX_REQUIRES(is_same<vec_type<T>, half>{})>
constexpr T sin(T x) constexpr T sin(T x)
{ {
constexpr const T shift = HIP_PIO2_F; constexpr const T shift = pi / 2;
return migraphx::cos(shift - x); return migraphx::cos(shift - x);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment