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

Commit 7aaeec5

Browse files
Preventing silent failure in 'in_order_kernels.cpp' (#465)
1 parent 7689457 commit 7aaeec5

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

SYCL/InorderQueue/in_order_kernels.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ int main() {
2222
auto dev = q.get_device();
2323
auto ctx = q.get_context();
2424
const int N = 8;
25+
int err_cnt = 0;
2526

2627
if (dev.get_info<info::device::usm_shared_allocations>()) {
2728
auto A = (int *)malloc_shared(N * sizeof(int), dev, ctx);
@@ -95,10 +96,18 @@ int main() {
9596
q.wait();
9697

9798
for (int i = 0; i < N; i++) {
98-
if (A[i] != 11)
99-
return 1;
99+
if (A[i] != 11) {
100+
std::cerr << "Mismatch at index " << i << " : " << A[i]
101+
<< " != 11 (expected)" << std::endl;
102+
err_cnt++;
103+
}
104+
}
105+
if (err_cnt != 0) {
106+
std::cerr << "Total mismatch = " << err_cnt << std::endl;
107+
return 1;
100108
}
101109
}
102110

111+
std::cout << "Passed\n";
103112
return 0;
104113
}

0 commit comments

Comments
 (0)