Skip to content

Commit dbbff9b

Browse files
committed
[SYCL][CUDA] Lit exceptions (intel#1304)
# Conflicts: # sycl/test/basic_tests/image_api.cpp
2 parents fab6d0e + 1b78429 commit dbbff9b

20 files changed

Lines changed: 162 additions & 152 deletions

sycl/test/aot/accelerator.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ void simple_vadd(const std::array<T, N>& VA, const std::array<T, N>& VB,
3636
std::cerr << "Unknown async exception was caught." << std::endl;
3737
}
3838
}
39+
throw "ERROR: Asynchronous exception(s)";
3940
});
4041

4142
cl::sycl::range<1> numOfItems{N};

sycl/test/aot/cpu.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ void simple_vadd(const std::array<T, N>& VA, const std::array<T, N>& VB,
3636
std::cerr << "Unknown async exception was caught." << std::endl;
3737
}
3838
}
39+
throw "ERROR: Asynchronous exception(s)";
3940
});
4041

4142
cl::sycl::range<1> numOfItems{N};

sycl/test/aot/gpu.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ void simple_vadd(const std::array<T, N>& VA, const std::array<T, N>& VB,
3838
std::cerr << "Unknown async exception was caught." << std::endl;
3939
}
4040
}
41+
throw "ERROR: Asynchronous exception(s)";
4142
});
4243

4344
cl::sycl::range<1> numOfItems{N};

sycl/test/aot/multiple-devices.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ void simple_vadd(const std::array<T, N>& VA, const std::array<T, N>& VB,
9090
std::cerr << "Unknown async exception was caught." << std::endl;
9191
}
9292
}
93+
throw "ERROR: Asynchronous exception(s)";
9394
});
9495

9596
cl::sycl::range<1> numOfItems{N};

sycl/test/aot/with-llvm-bc.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ void simple_vadd(const std::array<T, N>& VA, const std::array<T, N>& VB,
4040
std::cerr << "Unknown async exception was caught." << std::endl;
4141
}
4242
}
43+
throw "ERROR: Asynchronous exception(s)";
4344
});
4445

4546
cl::sycl::range<1> numOfItems{N};

sycl/test/basic_tests/accessor/accessor.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ int main() {
215215

216216
} catch (cl::sycl::exception e) {
217217
std::cout << "SYCL exception caught: " << e.what();
218-
return 1;
218+
throw;
219219
}
220220
}
221221

@@ -237,7 +237,7 @@ int main() {
237237
buf.get_access<sycl::access::mode::discard_read_write>();
238238
} catch (cl::sycl::exception e) {
239239
std::cout << "SYCL exception caught: " << e.what();
240-
return 1;
240+
throw;
241241
}
242242
}
243243

@@ -349,11 +349,11 @@ int main() {
349349

350350
auto host_acc = buf.get_access<sycl::access::mode::read>();
351351
for (int i = 0; i != 3; ++i)
352-
assert(host_acc[i] == 42);
352+
CHECK(host_acc[i] == 42);
353353

354354
} catch (cl::sycl::exception e) {
355355
std::cout << "SYCL exception caught: " << e.what();
356-
return 1;
356+
throw;
357357
}
358358
}
359359

@@ -376,8 +376,8 @@ int main() {
376376
}
377377
CHECK(data == 399);
378378
} catch (sycl::exception e) {
379-
std::cout << "SYCL exception caught: " << e.what();
380-
return 1;
379+
std::cerr << "SYCL exception caught: " << e.what();
380+
throw;
381381
}
382382
}
383383

sycl/test/basic_tests/context.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ int main() {
2020
context c;
2121
} catch (device_error e) {
2222
std::cout << "Failed to create device for context" << std::endl;
23+
throw;
2324
}
2425

2526
auto devices = device::get_devices();

sycl/test/basic_tests/device_event.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ int test_strideN(size_t stride) {
6666
std::cout << e.what();
6767
}
6868
}
69+
throw "ERROR: Asynchronous exception(s)";
6970
});
7071

7172
buffer<int, 1> out_buf(out_data, range<1>(nElems));
@@ -109,7 +110,7 @@ int test_strideN(size_t stride) {
109110

110111
} catch (exception e) {
111112
std::cout << "SYCL exception caught: " << e.what();
112-
return 2;
113+
throw;
113114
}
114115

115116
return check_results(out_data, stride);

sycl/test/basic_tests/event_async_exception.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ int main() {
3333

3434
e.wait_and_throw();
3535
return 1;
36-
} catch (runtime_error e) {
36+
} catch (runtime_error expectedException) {
3737
return 0;
3838
}
3939
}

sycl/test/basic_tests/info.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,4 +363,6 @@ int main() {
363363
std::cout << separator << "Platform from context information\n" << separator;
364364
auto cplt = ctx.get_info<cl::sycl::info::context::platform>();
365365
print_info<info::platform::name, string_class>(cplt, "Name");
366+
367+
return 0;
366368
}

0 commit comments

Comments
 (0)