This repository was archived by the owner on Mar 28, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 6
6
#include < sycl/sycl.hpp>
7
7
8
8
using bfloat16 = sycl::ext::oneapi::experimental::bfloat16;
9
- using Bfloat16StorageT = typename std::invoke_result_t <decltype (&bfloat16::raw), bfloat16>;
9
+ using Bfloat16StorageT =
10
+ typename std::invoke_result_t <decltype (&bfloat16::raw), bfloat16>;
10
11
11
12
bool test (float Val, Bfloat16StorageT Bits) {
12
- std::cout << " Value: " << Val << " Bits: " << std::hex << " 0x" << Bits << std::dec << " ...\n " ;
13
+ std::cout << " Value: " << Val << " Bits: " << std::hex << " 0x" << Bits
14
+ << std::dec << " ...\n " ;
13
15
bool passed = true ;
14
16
{
15
17
std::cout << " float -> bfloat16 conversion ..." ;
16
18
Bfloat16StorageT RawVal = bfloat16 (Val).raw ();
17
19
bool Res = (RawVal == Bits);
18
20
passed &= Res;
19
-
21
+
20
22
if (Res) {
21
23
std::cout << " passed\n " ;
22
24
} else {
23
- std::cout << " failed. " << std::hex << " 0x" << RawVal << " != " << " 0x" << Bits << " (gold)\n " << std::dec;
25
+ std::cout << " failed. " << std::hex << " 0x" << RawVal << " != "
26
+ << " 0x" << Bits << " (gold)\n "
27
+ << std::dec;
24
28
}
25
29
}
26
30
{
@@ -31,8 +35,7 @@ bool test(float Val, Bfloat16StorageT Bits) {
31
35
32
36
if (Res) {
33
37
std::cout << " passed\n " ;
34
- }
35
- else {
38
+ } else {
36
39
std::cout << " failed. " << Val << " (Gold) != " << NewVal << " \n " ;
37
40
}
38
41
}
You can’t perform that action at this time.
0 commit comments