Skip to content

Commit ac08ed7

Browse files
committed
Add memory buffer test
1 parent ad809b4 commit ac08ed7

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// REQUIRES: linux, cpu || (gpu && level_zero)
2+
// RUN: %{build} %device_msan_flags -O1 -g -o %t2.out
3+
// RUN: %{run} not %t2.out 2>&1 | FileCheck %s
4+
// RUN: %{build} %device_msan_flags -O2 -g -o %t3.out
5+
// RUN: %{run} not %t3.out 2>&1 | FileCheck %s
6+
7+
#include <sycl/detail/core.hpp>
8+
9+
__attribute__((noinline)) long long foo(int data1, long long data2) {
10+
return data1 + data2;
11+
}
12+
13+
int main() {
14+
sycl::queue q;
15+
16+
sycl::buffer<int, 1> buf1(sycl::range<1>(1));
17+
sycl::buffer<long long, 1> buf2(sycl::range<1>(1));
18+
q.submit([&](sycl::handler &h) {
19+
auto array1 = buf1.get_access<sycl::access::mode::read_write>(h);
20+
auto array2 = buf2.get_access<sycl::access::mode::read_write>(h);
21+
h.single_task<class MyKernel>(
22+
[=]() { array1[0] = foo(array1[0], array2[0]); });
23+
}).wait();
24+
// CHECK: use-of-uninitialized-value
25+
// CHECK: kernel <{{.*MyKernel}}>
26+
// CHECK: #0 {{.*}} {{.*check_buffer.cpp}}:[[@LINE-4]]
27+
28+
return 0;
29+
}

0 commit comments

Comments
 (0)