@@ -79,13 +79,59 @@ __DEVICE__ float tgamma(float __x) { return ::tgammaf(__x); }
79
79
#endif // __NVPTX__
80
80
81
81
#ifdef __AMDGCN__
82
- #pragma omp begin declare variant match( \
83
- device = {arch (amdgcn)}, implementation = {extension (match_any, allow_templates)})
82
+ #pragma omp begin declare variant match(device = {arch(amdgcn)})
83
+
84
+ #pragma push_macro("__constant__")
85
+ #define __constant__ __attribute__ ((constant))
86
+
84
87
#define __HIP__
85
88
#define __OPENMP_AMDGCN__
89
+
86
90
#include < __clang_hip_cmath.h>
91
+
92
+ #pragma pop_macro("__constant__")
93
+ #undef __OPENMP_AMDGCN__
87
94
#undef __HIP__
88
95
96
+ // Define overloads otherwise which are absent
97
+ #define __DEVICE__ static constexpr __attribute__ ((always_inline, nothrow))
98
+
99
+ __DEVICE__ float acos(float __x) { return ::acosf (__x); }
100
+ __DEVICE__ float acosh (float __x) { return ::acoshf (__x); }
101
+ __DEVICE__ float asin (float __x) { return ::asinf (__x); }
102
+ __DEVICE__ float asinh (float __x) { return ::asinhf (__x); }
103
+ __DEVICE__ float atan (float __x) { return ::atanf (__x); }
104
+ __DEVICE__ float atan2 (float __x, float __y) { return ::atan2f (__x, __y); }
105
+ __DEVICE__ float atanh (float __x) { return ::atanhf (__x); }
106
+ __DEVICE__ float cbrt (float __x) { return ::cbrtf (__x); }
107
+ __DEVICE__ float cosh (float __x) { return ::coshf (__x); }
108
+ __DEVICE__ float erf (float __x) { return ::erff (__x); }
109
+ __DEVICE__ float erfc (float __x) { return ::erfcf (__x); }
110
+ __DEVICE__ float exp2 (float __x) { return ::exp2f (__x); }
111
+ __DEVICE__ float expm1 (float __x) { return ::expm1f (__x); }
112
+ __DEVICE__ float fdim (float __x, float __y) { return ::fdimf (__x, __y); }
113
+ __DEVICE__ float hypot (float __x, float __y) { return ::hypotf (__x, __y); }
114
+ __DEVICE__ int ilogb (float __x) { return ::ilogbf (__x); }
115
+ __DEVICE__ float ldexp (float __arg, int __exp) {
116
+ return ::ldexpf (__arg, __exp);
117
+ }
118
+ __DEVICE__ float lgamma (float __x) { return ::lgammaf (__x); }
119
+ __DEVICE__ float log1p (float __x) { return ::log1pf (__x); }
120
+ __DEVICE__ float logb (float __x) { return ::logbf (__x); }
121
+ __DEVICE__ float nextafter (float __x, float __y) {
122
+ return ::nextafterf (__x, __y);
123
+ }
124
+ __DEVICE__ float remainder (float __x, float __y) {
125
+ return ::remainderf (__x, __y);
126
+ }
127
+ __DEVICE__ float scalbn (float __x, int __y) { return ::scalbnf (__x, __y); }
128
+ __DEVICE__ float sinh (float __x) { return ::sinhf (__x); }
129
+ __DEVICE__ float tan (float __x) { return ::tanf (__x); }
130
+ __DEVICE__ float tanh (float __x) { return ::tanhf (__x); }
131
+ __DEVICE__ float tgamma (float __x) { return ::tgammaf (__x); }
132
+
133
+ #undef __DEVICE__
134
+
89
135
#pragma omp end declare variant
90
136
#endif // __AMDGCN__
91
137
0 commit comments