Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit a4baf32

Browse files
[SYCL] Wait on queue in non-uniform-wk-gp-test (#612)
Streams may leak if the associated queue is not synchronized. These changes forces an explicit wait on queue in non-uniform-wk-gp-test. Signed-off-by: Steffen Larsen <[email protected]>
1 parent 21f8205 commit a4baf32

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

SYCL/Basic/diagnostics/non-uniform-wk-gp-test.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
using namespace cl::sycl;
1414

1515
int test() {
16-
try {
17-
queue q = queue();
18-
auto device = q.get_device();
19-
auto deviceName = device.get_info<cl::sycl::info::device::name>();
20-
std::cout << " Device Name: " << deviceName << std::endl;
16+
queue q = queue();
17+
auto device = q.get_device();
18+
auto deviceName = device.get_info<cl::sycl::info::device::name>();
19+
std::cout << " Device Name: " << deviceName << std::endl;
2120

21+
int res = 1;
22+
try {
2223
const int N = 1;
2324
q.submit([&](handler &cgh) {
2425
cl::sycl::stream kernelout(108 * 64 + 128, 64, cgh);
@@ -29,23 +30,23 @@ int test() {
2930
<< cl::sycl::endl;
3031
});
3132
});
32-
33+
std::cout << "Test failed: no exception thrown." << std::endl;
3334
} catch (sycl::runtime_error &E) {
3435
if (std::string(E.what()).find(
3536
"Non-uniform work-groups are not supported by the target device") !=
3637
std::string::npos) {
3738
std::cout << E.what() << std::endl;
3839
std::cout << "Test passed: caught the expected error." << std::endl;
39-
return 0;
40+
res = 0;
4041
} else {
4142
std::cout << E.what() << std::endl;
4243
std::cout << "Test failed: received error is incorrect." << std::endl;
43-
return 1;
4444
}
4545
}
46+
q.wait();
4647

4748
std::cout << "Test passed: results are correct." << std::endl;
48-
return 0;
49+
return res;
4950
}
5051

5152
int main() {

0 commit comments

Comments
 (0)