Skip to content

Commit 8d9066b

Browse files
authored
Applying review comments
Default constructor, copy constructor and destructor are explicitly declared as defult. Add clarification that the extension is an optional kernel feture Rounding mode is specified Minor improvement to the example Fix a typo
1 parent 6771315 commit 8d9066b

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

sycl/doc/extensions/Bf16Conversion/SYCL_INTEL_bf16_conversion.asciidoc

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ The purpose of conversion from float to bfloat16 is to reduce ammount of memory
6565
required to store floating-point numbers. Computations are expected to be done with
6666
32-bit floating-point values.
6767

68+
This extension is an optional kernel feature as described in
69+
https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html#sec:optional-kernel-features[section 5.7]
70+
of the SYCL 2020 spec. Therefore, attempting to submit a kernel using this
71+
feature to a device that does not support it should cause a synchronous
72+
`errc::kernel_not_supported` exception to be thrown from the kernel invocation`
73+
command (e.g. from `parallel_for`).
6874

6975
== Feature test macro
7076

@@ -97,12 +103,14 @@ enum class aspect {
97103
If a SYCL device has the `ext_intel_bf16_conversion` aspect, then it natively
98104
supports conversion of values of `float` type to `bfloat16` and back.
99105

100-
If the device doesn't have the aspect, objects of `bfloat16` class ust not be
106+
If the device doesn't have the aspect, objects of `bfloat16` class must not be
101107
used in the device code.
102108

103109
== New `bfloat16` class
104110

105-
The following class provides the conversion functionality:
111+
The `bfloat16` class below provides the conversion functionality. Conversion
112+
from `float` to `bfloat16` is done with round to nearest even(RTE) rounding
113+
mode.
106114

107115
[source]
108116
----
@@ -117,11 +125,15 @@ bfloat16 {
117125
storage_t value;
118126
119127
public:
128+
bfloat16() = default;
129+
bfloat16(const bfloat16&) = default;
130+
~bfloat16() = default;
131+
120132
// Direct initialization
121-
bfloat16(const storage_t& a)
133+
bfloat16(const storage_t&)
122134
123135
// Convert from float to bfloat16
124-
bfloat16(const float& a);
136+
bfloat16(const float&);
125137
126138
// Convert from bfloat16 to float
127139
operator float() const;
@@ -140,6 +152,11 @@ public:
140152

141153
[source]
142154
----
155+
#include <sycl/sycl.hpp>
156+
#include <sycl/ext/intel/experimental/bfloat16.hpp>
157+
158+
using sycl::ext::intel::experimental::bfloat16;
159+
143160
bfloat16 operator+(const bfloat16 &lhs, const bfloat16 &rhs) {
144161
return static_cast<float>(lhs) + static_cast<float>(rhs);
145162
}
@@ -150,7 +167,7 @@ float foo(float a, float b) {
150167
bfloat16 B {b};
151168
152169
// Convert A and B from bfloat16 to float, do addition on floating-pointer
153-
// numbers, then convert the result to bfloat16 and store in C.
170+
// numbers, then convert the result to bfloat16 and store it in C.
154171
bfloat16 C = A + B;
155172
156173
// Return the result converted from bfloat16 to float.

0 commit comments

Comments
 (0)