@@ -232,7 +232,8 @@ extern "C" __DPCPP_SYCL_EXTERNAL void
232
232
__devicelib_ConvertBF16ToFINTELVec16 (const uint16_t *, float *) noexcept ;
233
233
#endif
234
234
235
- template <int N> void BF16VecToFloatVec (const bfloat16 src[N], float dst[N]) {
235
+ template <int N>
236
+ inline void BF16VecToFloatVec (const bfloat16 src[N], float dst[N]) {
236
237
static_assert (N == 1 || N == 2 || N == 3 || N == 4 || N == 8 || N == 16 ,
237
238
" Unsupported vector size" );
238
239
#if defined(__SYCL_DEVICE_ONLY__) && (defined(__SPIR__) || defined(__SPIRV__))
@@ -272,7 +273,7 @@ extern "C" __DPCPP_SYCL_EXTERNAL void
272
273
__devicelib_ConvertFToBF16INTELVec16 (const float *, uint16_t *) noexcept ;
273
274
#endif
274
275
275
- template <int N> void FloatVecToBF16Vec (float src[N], bfloat16 dst[N]) {
276
+ template <int N> inline void FloatVecToBF16Vec (float src[N], bfloat16 dst[N]) {
276
277
static_assert (N == 1 || N == 2 || N == 3 || N == 4 || N == 8 || N == 16 ,
277
278
" Unsupported vector size" );
278
279
#if defined(__SYCL_DEVICE_ONLY__) && (defined(__SPIR__) || defined(__SPIRV__))
@@ -436,7 +437,7 @@ inline bfloat16 getBFloat16FromDoubleWithRTE(const double &d) {
436
437
}
437
438
438
439
// Function to get the most significant bit position of a number.
439
- template <typename Ty> size_t get_msb_pos (const Ty &x) {
440
+ template <typename Ty> inline size_t get_msb_pos (const Ty &x) {
440
441
assert (x != 0 );
441
442
size_t idx = 0 ;
442
443
Ty mask = ((Ty)1 << (sizeof (Ty) * 8 - 1 ));
@@ -454,7 +455,7 @@ template <typename Ty> size_t get_msb_pos(const Ty &x) {
454
455
// Reference:
455
456
// https://github.com/intel/llvm/blob/sycl/libdevice/imf_bf16.hpp#L302
456
457
template <typename T>
457
- bfloat16
458
+ inline bfloat16
458
459
getBFloat16FromUIntegralWithRoundingMode (T &u, SYCLRoundingMode roundingMode) {
459
460
460
461
size_t msb_pos = get_msb_pos (u);
@@ -508,7 +509,7 @@ getBFloat16FromUIntegralWithRoundingMode(T &u, SYCLRoundingMode roundingMode) {
508
509
// Reference:
509
510
// https://github.com/intel/llvm/blob/sycl/libdevice/imf_bf16.hpp#L353
510
511
template <typename T>
511
- bfloat16
512
+ inline bfloat16
512
513
getBFloat16FromSIntegralWithRoundingMode (T &i, SYCLRoundingMode roundingMode) {
513
514
// Get unsigned type corresponding to T.
514
515
typedef typename std::make_unsigned_t <T> UTy;
@@ -557,9 +558,8 @@ getBFloat16FromSIntegralWithRoundingMode(T &i, SYCLRoundingMode roundingMode) {
557
558
}
558
559
559
560
template <typename Ty, int rm>
560
- bfloat16 getBfloat16WithRoundingMode (const Ty &a) {
561
-
562
- if (!a)
561
+ inline bfloat16 getBfloat16WithRoundingMode (const Ty &a) {
562
+ if (a == 0 )
563
563
return bfloat16{0 .0f };
564
564
565
565
constexpr SYCLRoundingMode roundingMode = static_cast <SYCLRoundingMode>(rm);
0 commit comments