Skip to content

Commit 7b43680

Browse files
Refactor the builtins to use more overloads (AdaptiveCpp#1751)
This is a wholesale refactor of the builtins, splitting them into 3 files for generic, math + integer, as well as relational builtins. As part of the refactoring, some functions have been refactored from solely using templates to using overloads and templates, while others have had their templates updated according to the latest spec. Because of the support for floats and vectors/marrays, the actual `builtin_interface` has been changed, particularly with the functions taking pointer arguments.
1 parent d62d3c4 commit 7b43680

File tree

12 files changed

+1260
-1221
lines changed

12 files changed

+1260
-1221
lines changed

include/hipSYCL/sycl/libkernel/builtin_interface.hpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ T __acpp_fract(T x, T* ptr) noexcept {
186186
HIPSYCL_RETURN_DISPATCH_BUILTIN(__acpp_fract, x, ptr);
187187
}
188188

189-
template<class T, class IntPtr>
190-
HIPSYCL_BUILTIN T __acpp_frexp(T x, IntPtr y) noexcept {
189+
template<class T>
190+
HIPSYCL_BUILTIN T __acpp_frexp(T x, int* y) noexcept {
191191
HIPSYCL_RETURN_DISPATCH_BUILTIN(__acpp_frexp, x, y);
192192
}
193193

@@ -201,8 +201,8 @@ HIPSYCL_BUILTIN int __acpp_ilogb(T x) noexcept {
201201
HIPSYCL_RETURN_DISPATCH_BUILTIN(__acpp_ilogb, x);
202202
}
203203

204-
template<class T, class IntType>
205-
HIPSYCL_BUILTIN T __acpp_ldexp(T x, IntType k) noexcept {
204+
template<class T>
205+
HIPSYCL_BUILTIN T __acpp_ldexp(T x, int k) noexcept {
206206
HIPSYCL_RETURN_DISPATCH_BUILTIN(__acpp_ldexp, x, k);
207207
}
208208

@@ -211,8 +211,8 @@ HIPSYCL_BUILTIN T __acpp_lgamma(T x) noexcept {
211211
HIPSYCL_RETURN_DISPATCH_BUILTIN(__acpp_acos, x);
212212
}
213213

214-
template<class T, class IntPtr>
215-
HIPSYCL_BUILTIN T __acpp_lgamma_r(T x, IntPtr y) noexcept {
214+
template<class T>
215+
HIPSYCL_BUILTIN T __acpp_lgamma_r(T x, int* y) noexcept {
216216
HIPSYCL_RETURN_DISPATCH_BUILTIN(__acpp_lgamma_r, x, y);
217217
}
218218

@@ -256,8 +256,8 @@ HIPSYCL_BUILTIN T __acpp_minmag(T x, T y) noexcept {
256256
HIPSYCL_RETURN_DISPATCH_BUILTIN(__acpp_minmag, x, y);
257257
}
258258

259-
template<class T, class FloatPtr>
260-
HIPSYCL_BUILTIN T __acpp_modf(T x, FloatPtr y) noexcept {
259+
template<class T>
260+
HIPSYCL_BUILTIN T __acpp_modf(T x, T* y) noexcept {
261261
HIPSYCL_RETURN_DISPATCH_BUILTIN(__acpp_modf, x, y);
262262
}
263263

@@ -276,8 +276,8 @@ HIPSYCL_BUILTIN T __acpp_powr(T x, T y) noexcept {
276276
HIPSYCL_RETURN_DISPATCH_BUILTIN(__acpp_powr, x, y);
277277
}
278278

279-
template<class T, class IntType>
280-
HIPSYCL_BUILTIN T __acpp_pown(T x, IntType y) noexcept {
279+
template<class T>
280+
HIPSYCL_BUILTIN T __acpp_pown(T x, int y) noexcept {
281281
HIPSYCL_RETURN_DISPATCH_BUILTIN(__acpp_pown, x, y);
282282
}
283283

@@ -291,8 +291,8 @@ HIPSYCL_BUILTIN T __acpp_rint(T x) noexcept {
291291
HIPSYCL_RETURN_DISPATCH_BUILTIN(__acpp_rint, x);
292292
}
293293

294-
template<class T, class IntType>
295-
HIPSYCL_BUILTIN T __acpp_rootn(T x, IntType y) noexcept {
294+
template<class T>
295+
HIPSYCL_BUILTIN T __acpp_rootn(T x, int y) noexcept {
296296
HIPSYCL_RETURN_DISPATCH_BUILTIN(__acpp_rootn, x, y);
297297
}
298298

@@ -311,8 +311,8 @@ HIPSYCL_BUILTIN T __acpp_sin(T x) noexcept {
311311
HIPSYCL_RETURN_DISPATCH_BUILTIN(__acpp_sin, x);
312312
}
313313

314-
template<class T, class FloatPtr>
315-
HIPSYCL_BUILTIN T __acpp_sincos(T x, FloatPtr cosval) noexcept {
314+
template<class T>
315+
HIPSYCL_BUILTIN T __acpp_sincos(T x, T* cosval) noexcept {
316316
HIPSYCL_RETURN_DISPATCH_BUILTIN(__acpp_sincos, x, cosval);
317317
}
318318

0 commit comments

Comments
 (0)