Skip to content

Commit 6fbb1c0

Browse files
authored
[SYCL][E2E] fix an uninitialized memory usage in test case (intel#18771)
`Buf` is uninitialized in this test case, which would lead to device memory sanitizer reporting the error. This patch addresses this problem.
1 parent 8eb6d34 commit 6fbb1c0

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

sycl/test-e2e/Assert/Inputs/kernels_in_file2.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ void enqueueKernel_1_fromFile2(queue *Q) {
2727
Q->submit([&](handler &CGH) {
2828
auto Acc = Buf.template get_access<mode::read_write>(CGH);
2929

30-
CGH.parallel_for<class kernel1_from_separate_file>(
31-
numOfItems, [=](sycl::id<1> wiID) { check_nil(Acc[wiID]); });
30+
CGH.parallel_for<class kernel1_from_separate_file>(numOfItems,
31+
[=](sycl::id<1> wiID) {
32+
Acc[wiID] = wiID % 2;
33+
check_nil(Acc[wiID]);
34+
});
3235
});
3336
}
3437

@@ -39,7 +42,10 @@ void enqueueKernel_2_fromFile2(queue *Q) {
3942
Q->submit([&](handler &CGH) {
4043
auto Acc = Buf.template get_access<mode::read_write>(CGH);
4144

42-
CGH.parallel_for<class kernel2_from_separate_file>(
43-
numOfItems, [=](sycl::id<1> wiID) { check_nil(Acc[wiID]); });
45+
CGH.parallel_for<class kernel2_from_separate_file>(numOfItems,
46+
[=](sycl::id<1> wiID) {
47+
Acc[wiID] = wiID % 2;
48+
check_nil(Acc[wiID]);
49+
});
4450
});
4551
}

0 commit comments

Comments
 (0)