Skip to content

Commit f710886

Browse files
[SYCL] Add SYCL2020 target::device enumeration value (#4587)
Signed-off-by: Chris Perkins <[email protected]>
1 parent 9c0508b commit f710886

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

sycl/include/CL/sycl/access/access.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ enum class target {
2121
image = 2017,
2222
host_buffer = 2018,
2323
host_image = 2019,
24-
image_array = 2020
24+
image_array = 2020,
25+
device = global_buffer,
2526
};
2627

2728
enum class mode {
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
2+
3+
// This short test simply confirms that target::device
4+
// is supported correctly.
5+
// TODO: delete this test and test the functionality
6+
// over in llvm-test-suite along with the other changes
7+
// needed to support the SYCL 2020 target updates.
8+
9+
#include <CL/sycl.hpp>
10+
11+
int main() {
12+
sycl::queue testQueue;
13+
sycl::range<1> ndRng(1);
14+
int kernelResult;
15+
{
16+
sycl::buffer<int, 1> buffer(&kernelResult, ndRng);
17+
18+
testQueue.submit([&](sycl::handler &cgh) {
19+
auto ptr = buffer.get_access<sycl::access_mode::read_write,
20+
sycl::target::device>(cgh);
21+
cgh.single_task<class kernel>([=]() { ptr[0] = 5; });
22+
});
23+
} // ~buffer
24+
25+
// std::cout << "kernelResult should be 5: " << kernelResult << std::endl;
26+
assert(kernelResult == 5);
27+
28+
return 0;
29+
}

0 commit comments

Comments
 (0)