Skip to content

Commit 44e9c2d

Browse files
authored
Update SYCL_INTEL_bf16_conversion.asciidoc
Align the document with changes made in intel#4989
1 parent abb0f5c commit 44e9c2d

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

sycl/doc/extensions/Bf16Conversion/SYCL_INTEL_bf16_conversion.asciidoc

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ public:
124124
bfloat16(const bfloat16 &) = default;
125125
~bfloat16() = default;
126126
127+
// Explicit initialization
128+
static bfloat16 from_bits(const storage_t &a);
129+
127130
// Explicit conversion functions
128131
static storage_t from_float(const float &a);
129132
static float to_float(const storage_t &a);
@@ -132,15 +135,16 @@ public:
132135
bfloat16(const float &a);
133136
bfloat16 &operator=(const float &a);
134137
135-
// Convert from bfloat16 to float
138+
// Convert bfloat16 to floating-point types
136139
operator float() const;
140+
operator sycl::half() const
137141
138-
// Get bfloat16 as uint16.
139-
operator storage_t() const;
140-
141-
// Convert to bool type
142+
// Convert bfloat16 to bool type
142143
explicit operator bool();
143144
145+
// Get bfloat16 as raw bits.
146+
storage_t raw() const;
147+
144148
friend bfloat16 operator-(bfloat16 &bf) { /* ... */ }
145149
146150
// OP is: prefix ++, --
@@ -177,6 +181,9 @@ Table 1. Member functions of `bfloat16` class.
177181
|===
178182
| Member Function | Description
179183

184+
| `static bfloat16 from_bits(const storage_t &a);`
185+
| Create `bfloat16` with the `value` equals to `a`.
186+
180187
| `static storage_t from_float(const float &a);`
181188
| Explicitly convert from `float` to `bfloat16`.
182189

@@ -192,13 +199,16 @@ Table 1. Member functions of `bfloat16` class.
192199
| `operator float() const;`
193200
| Return `bfloat16` value converted to `float`.
194201

195-
| `operator storage_t() const;`
196-
| Return `uint16_t` value, whose bits represent `bfloat16` value.
202+
| `operator sycl::half() const;`
203+
| Return `bfloat16` value converted to `sycl::half`.
197204

198205
| `explicit operator bool() { /* ... */ }`
199-
| Convert `bfloat16` to `bool` type. Return `false` if the value equals to
206+
| Convert `bfloat16` to `bool` type. Return `false` if the `value` equals to
200207
zero, return `true` otherwise.
201208

209+
| `storage_t raw() const`
210+
| Return raw bits representing the `bfloat16` value.
211+
202212
| `friend bfloat16 operator-(bfloat16 &bf) { /* ... */ }`
203213
| Construct new instance of `bfloat16` class with negated value of the `bf`.
204214

@@ -329,4 +339,7 @@ None.
329339
Add operator overloadings +
330340
Apply code review suggestions
331341
|3|2021-08-18|Alexey Sotkin |Remove `uint16_t` constructor
342+
|4|2021-12-30|Alexey Sotkin |Add methods to explicitly set/get the value
343+
with/as raw bits. +
344+
Add `operator sycl::half()`
332345
|========================================

0 commit comments

Comments
 (0)