Skip to content

Commit f46a63f

Browse files
authored
[SYCL] Fixed AMD compilation for bfloat16 to use generic impl. (#10009)
We don't have AMD native bfloat16 support but this fix at least allows us to use a generic implementation. --------- Signed-off-by: JackAKirk <[email protected]>
1 parent a12c4a4 commit f46a63f

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

sycl/include/sycl/ext/oneapi/bfloat16.hpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,11 @@ class bfloat16 {
115115

116116
// Unary minus operator overloading
117117
friend bfloat16 operator-(bfloat16 &lhs) {
118-
#if defined(__SYCL_DEVICE_ONLY__)
119-
#if defined(__NVPTX__)
120-
#if (__SYCL_CUDA_ARCH__ >= 800)
118+
#if defined(__SYCL_DEVICE_ONLY__) && defined(__NVPTX__) && \
119+
(__SYCL_CUDA_ARCH__ >= 800)
121120
return detail::bitsToBfloat16(__nvvm_neg_bf16(lhs.value));
122-
#else
123-
return -to_float(lhs.value);
124-
#endif
125-
#else
121+
#elif defined(__SYCL_DEVICE_ONLY__) && defined(__SPIR__)
126122
return bfloat16{-__devicelib_ConvertBF16ToFINTEL(lhs.value)};
127-
#endif
128123
#else
129124
return -to_float(lhs.value);
130125
#endif

sycl/test-e2e/BFloat16/bfloat16_type.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
// TODO currently the feature isn't supported on FPGA.
77
// UNSUPPORTED: accelerator
88
//
9-
// Not currently supported on HIP.
10-
// UNSUPPORTED: hip
119

1210
//==----------- bfloat16_type.cpp - SYCL bfloat16 type test ----------------==//
1311
//

0 commit comments

Comments
 (0)