@@ -16,16 +16,21 @@ namespace ext {
16
16
namespace intel {
17
17
namespace experimental {
18
18
19
- class bfloat16 {
19
+ class [[sycl_detail::uses_aspects(ext_intel_bf16_conversion)]]
20
+ bfloat16 {
20
21
using storage_t = uint16_t ;
21
22
storage_t value;
22
23
23
24
public:
25
+ bfloat16 () = default ;
26
+ bfloat16 (const bfloat16&) = default ;
27
+ ~bfloat16 () = default ;
28
+
24
29
// Direct initialization
25
- bfloat16 (const storage_t & a) : value(a) {}
30
+ bfloat16 (const storage_t & a) : value (a) {}
26
31
27
32
// convert from float to bfloat16
28
- bfloat16 (const float & a) {
33
+ bfloat16 (const float & a) {
29
34
#if defined(__SYCL_DEVICE_ONLY__)
30
35
value = __spirv_ConvertFToBF16INTEL (a);
31
36
#else
@@ -35,7 +40,7 @@ class bfloat16 {
35
40
}
36
41
37
42
// convert from bfloat16 to float
38
- operator float () {
43
+ operator float () const {
39
44
#if defined(__SYCL_DEVICE_ONLY__)
40
45
return __spirv_ConvertBF16ToFINTEL (value);
41
46
#else
@@ -44,18 +49,8 @@ class bfloat16 {
44
49
#endif
45
50
}
46
51
47
- operator float () const {
48
- return this ->operator float ();
49
- }
50
-
51
52
// Get bfloat16 as uint16.
52
- operator storage_t () const {
53
- return value;
54
- }
55
-
56
- operator storage_t () {
57
- return value;
58
- }
53
+ operator storage_t () const { return value; }
59
54
};
60
55
61
56
} // namespace experimental
@@ -66,4 +61,5 @@ namespace __SYCL2020_DEPRECATED("use 'ext::intel' instead") INTEL {
66
61
using namespace ext ::intel;
67
62
}
68
63
} // namespace sycl
69
- } // namespace cl
64
+ } // __SYCL_INLINE_NAMESPACE(cl)
65
+
0 commit comments