Skip to content

Commit 877f420

Browse files
authored
[libclc][Native CPU] Add missing _CLC_DEF. (#19367)
libclc functions are meant to be declared with _CLC_DECL and defined with _CLC_DEF. A few Native CPU functions were defined without _CLC_DEF, so add the missing macro. This is effectively NFC, this applied to trivial functions that were being defined without always_inline but that would be inlined anyway.
1 parent 2bb9169 commit 877f420

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

libclc/libspirv/lib/native_cpu/math/helpers.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
// __builtin_elementwise_##NAME
1616
#ifndef IS_FABS
1717
#define GEN_UNARY_VECTOR_BUILTIN(NAME, TYPE, NUM) \
18-
_CLC_OVERLOAD TYPE##NUM GETNAME(NAME)(TYPE##NUM n) { \
18+
_CLC_DEF _CLC_OVERLOAD TYPE##NUM GETNAME(NAME)(TYPE##NUM n) { \
1919
return __builtin_elementwise_##NAME(n); \
2020
}
2121
#else
2222
#define GEN_UNARY_VECTOR_BUILTIN(NAME, TYPE, NUM) \
23-
_CLC_OVERLOAD TYPE##NUM GETNAME(NAME)(TYPE##NUM n) { \
23+
_CLC_DEF _CLC_OVERLOAD TYPE##NUM GETNAME(NAME)(TYPE##NUM n) { \
2424
return __builtin_elementwise_abs(n); \
2525
}
2626
#endif
@@ -33,7 +33,9 @@
3333
GEN_UNARY_VECTOR_BUILTIN(NAME, TYPE, 16)
3434

3535
#define GEN_UNARY_BUILTIN_T(NAME, TYPE) \
36-
_CLC_OVERLOAD TYPE GETNAME(NAME)(TYPE n) { return __builtin_##NAME(n); }
36+
_CLC_DEF _CLC_OVERLOAD TYPE GETNAME(NAME)(TYPE n) { \
37+
return __builtin_##NAME(n); \
38+
}
3739

3840
#if defined(cl_khr_fp16)
3941
#define GEN_UNARY_FP16(NAME) \
@@ -58,8 +60,8 @@
5860
GEN_UNARY_FP64(NAME)
5961

6062
#define GEN_TERNARY_VECTOR_BUILTIN(NAME, TYPE, NUM) \
61-
_CLC_OVERLOAD TYPE##NUM GETNAME(NAME)(TYPE##NUM n1, TYPE##NUM n2, \
62-
TYPE##NUM n3) { \
63+
_CLC_DEF _CLC_OVERLOAD TYPE##NUM GETNAME(NAME)(TYPE##NUM n1, TYPE##NUM n2, \
64+
TYPE##NUM n3) { \
6365
return __builtin_elementwise_##NAME(n1, n2, n3); \
6466
}
6567

@@ -71,7 +73,7 @@
7173
GEN_TERNARY_VECTOR_BUILTIN(NAME, TYPE, 16)
7274

7375
#define GEN_TERNARY_BUILTIN_T(NAME, TYPE) \
74-
_CLC_OVERLOAD TYPE GETNAME(NAME)(TYPE n1, TYPE n2, TYPE n3) { \
76+
_CLC_DEF _CLC_OVERLOAD TYPE GETNAME(NAME)(TYPE n1, TYPE n2, TYPE n3) { \
7577
return __builtin_##NAME(n1, n2, n3); \
7678
}
7779

0 commit comments

Comments
 (0)