Skip to content

Commit 4cc2e63

Browse files
committed
Switching to SYCL 2020 exception
Also fixing coding style in the test. Signed-off-by: Alexey Sotkin <[email protected]>
1 parent cd21221 commit 4cc2e63

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ class [[sycl_detail::uses_aspects(ext_intel_bf16_conversion)]] bfloat16 {
3030
#if defined(__SYCL_DEVICE_ONLY__)
3131
return __spirv_ConvertFToBF16INTEL(a);
3232
#else
33-
throw runtime_error("Bfloat16 conversion is not supported on HOST device.",
34-
PI_INVALID_DEVICE);
33+
throw exception{errc::feature_not_supported,
34+
Bfloat16 conversion is not supported on host device};
3535
#endif
3636
}
3737
static float to_float(const storage_t &a) {
3838
#if defined(__SYCL_DEVICE_ONLY__)
3939
return __spirv_ConvertBF16ToFINTEL(a);
4040
#else
41-
throw runtime_error("Bfloat16 conversion is not supported on HOST device.",
42-
PI_INVALID_DEVICE);
41+
throw exception{errc::feature_not_supported,
42+
Bfloat16 conversion is not supported on host device};
4343
#endif
4444
}
4545

sycl/test/extensions/bfloat16.cpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,15 @@ float op(float a, float b) {
3636
// CHECK-NOT: fptoui
3737
}
3838

39-
int main (int argc, char *argv[])
40-
{
41-
float data[3] = {7.0, 8.1, 0.0};
42-
cl::sycl::queue deviceQueue;
43-
cl::sycl::buffer<float, 1> buf {data, cl::sycl::range<1> {3}};
44-
45-
deviceQueue.submit ([&] (cl::sycl::handler& cgh)
46-
{
47-
auto numbers = buf.get_access<cl::sycl::access::mode::read_write> (cgh);
48-
cgh.single_task<class simple_kernel> ([=] ()
49-
{
50-
numbers[2] = op(numbers[0], numbers[1]);
51-
});
52-
});
39+
int main(int argc, char *argv[]) {
40+
float data[3] = {7.0, 8.1, 0.0};
41+
cl::sycl::queue deviceQueue;
42+
cl::sycl::buffer<float, 1> buf{data, cl::sycl::range<1>{3}};
43+
44+
deviceQueue.submit([&](cl::sycl::handler &cgh) {
45+
auto numbers = buf.get_access<cl::sycl::access::mode::read_write>(cgh);
46+
cgh.single_task<class simple_kernel>(
47+
[=]() { numbers[2] = op(numbers[0], numbers[1]); });
48+
});
5349
return 0;
5450
}

0 commit comments

Comments
 (0)