Skip to content

Commit 4644e85

Browse files
[SYCL] Try to fix internal self-build after builtins refactoring PR (#12436)
clang rejects dllexport defintion if previous declaration didn't have it, make sure we have declaration/definition in sync when building libsycl.
1 parent aadd1e7 commit 4644e85

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

sycl/include/sycl/detail/builtins/helper_macros.hpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@
188188
DEVICE_IMPL_TEMPLATE_CUSTOM_DELEGATE(NUM_ARGS, NAME, ENABLER, \
189189
builtin_marray_impl, sycl, __VA_ARGS__)
190190

191+
#ifdef __SYCL_BUILD_SYCL_DLL
192+
#define SYCL_BUILTIN_EXPORT __SYCL_EXPORT
193+
#else
194+
#define SYCL_BUILTIN_EXPORT
195+
#endif
196+
191197
// Use extern function declaration in function scope to save compile time.
192198
// Otherwise the FE has to parse multiple types/VLs/functions costing us around
193199
// 0.3s in compile-time. It also allows us to skip providing all the explicit
@@ -204,7 +210,7 @@
204210
*/ \
205211
using ret_ty = typename detail::RET_TYPE_TRAITS< \
206212
typename detail::first_type<Ts...>::type>::type; \
207-
extern ret_ty __##NAME##_impl(Ts...); \
213+
extern SYCL_BUILTIN_EXPORT ret_ty __##NAME##_impl(Ts...); \
208214
return __##NAME##_impl(xs...); \
209215
} \
210216
template <NUM_ARGS##_TYPENAME_TYPE> \
@@ -223,7 +229,8 @@
223229

224230
#define HOST_IMPL_SCALAR_RET_TYPE(NUM_ARGS, NAME, RET_TYPE, TYPE) \
225231
inline RET_TYPE NAME(NUM_ARGS##_TYPE_ARG(TYPE)) { \
226-
extern RET_TYPE __##NAME##_impl(NUM_ARGS##_TYPE(TYPE)); \
232+
extern SYCL_BUILTIN_EXPORT RET_TYPE __##NAME##_impl( \
233+
NUM_ARGS##_TYPE(TYPE)); \
227234
return __##NAME##_impl(NUM_ARGS##_ARG); \
228235
}
229236

sycl/include/sycl/detail/builtins/math_functions.inc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ detail::builtin_enable_math_allow_scalar_t<T0> modf(
394394
#else
395395
#define SCALAR_EXTERN_LAST_INT(NAME, TYPE) \
396396
inline TYPE NAME(TYPE x, int y) { \
397-
extern TYPE __##NAME##_impl(TYPE, int); \
397+
extern SYCL_BUILTIN_EXPORT TYPE __##NAME##_impl(TYPE, int); \
398398
return __##NAME##_impl(x, y); \
399399
}
400400
#define BUILTIN_MATH_LAST_INT(NAME) \
@@ -488,15 +488,15 @@ inline int ilogb(half x) {
488488
DEVICE_IMPL_TEMPLATE(ONE_ARG, ilogb, builtin_enable_ilogb_t, __spirv_ocl_ilogb)
489489
#else
490490
inline int ilogb(float x) {
491-
extern int __ilogb_impl(float);
491+
extern SYCL_BUILTIN_EXPORT int __ilogb_impl(float);
492492
return __ilogb_impl(x);
493493
}
494494
inline int ilogb(double x) {
495-
extern int __ilogb_impl(double);
495+
extern SYCL_BUILTIN_EXPORT int __ilogb_impl(double);
496496
return __ilogb_impl(x);
497497
}
498498
inline int ilogb(half x) {
499-
extern int __ilogb_impl(half);
499+
extern SYCL_BUILTIN_EXPORT int __ilogb_impl(half);
500500
return __ilogb_impl(x);
501501
}
502502
HOST_IMPL_TEMPLATE(ONE_ARG, ilogb, builtin_enable_ilogb_t, math,

0 commit comments

Comments
 (0)