Skip to content

Commit fb5bcbc

Browse files
committed
Applying review comments
- Apply clang-format.patch - Remove non-const members - Add default constructors and destructor - Add [[sycl_detail::uses_aspects(ext_intel_bf16_conversion)]] attribute to the class declaration Signed-off-by: Alexey Sotkin <[email protected]>
1 parent af56b2f commit fb5bcbc

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

sycl/include/sycl/ext/intel/experimental/bfloat16.hpp

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,21 @@ namespace ext {
1616
namespace intel {
1717
namespace experimental {
1818

19-
class bfloat16 {
19+
class [[sycl_detail::uses_aspects(ext_intel_bf16_conversion)]]
20+
bfloat16 {
2021
using storage_t = uint16_t;
2122
storage_t value;
2223

2324
public:
25+
bfloat16() = default;
26+
bfloat16(const bfloat16&) = default;
27+
~bfloat16() = default;
28+
2429
// Direct initialization
25-
bfloat16(const storage_t& a) : value(a) {}
30+
bfloat16(const storage_t &a) : value(a) {}
2631

2732
// convert from float to bfloat16
28-
bfloat16(const float& a) {
33+
bfloat16(const float &a) {
2934
#if defined(__SYCL_DEVICE_ONLY__)
3035
value = __spirv_ConvertFToBF16INTEL(a);
3136
#else
@@ -35,7 +40,7 @@ class bfloat16 {
3540
}
3641

3742
// convert from bfloat16 to float
38-
operator float() {
43+
operator float() const {
3944
#if defined(__SYCL_DEVICE_ONLY__)
4045
return __spirv_ConvertBF16ToFINTEL(value);
4146
#else
@@ -44,18 +49,8 @@ class bfloat16 {
4449
#endif
4550
}
4651

47-
operator float() const {
48-
return this->operator float();
49-
}
50-
5152
// 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; }
5954
};
6055

6156
} // namespace experimental
@@ -66,4 +61,5 @@ namespace __SYCL2020_DEPRECATED("use 'ext::intel' instead") INTEL {
6661
using namespace ext::intel;
6762
}
6863
} // namespace sycl
69-
} // namespace cl
64+
} // __SYCL_INLINE_NAMESPACE(cl)
65+

0 commit comments

Comments
 (0)