|
1 |
| -// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify -DSYCL2020_CONFORMANT_APIS %s |
2 |
| -// expected-no-diagnostics |
| 1 | +// RUN: %clangxx -fsycl -DSYCL2020_CONFORMANT_APIS %s -o %t.out |
| 2 | +// RUN: %RUN_ON_HOST %t.out |
3 | 3 | //
|
4 | 4 | //===----------------------------------------------------------------------===//
|
5 |
| -// This test checks that sycl::get_native<sycl::backend::opencl>(event) return |
6 |
| -// std::vector<cl_event> when backend = opencl, according to: |
7 |
| -// SYCL™ 2020 Specification (revision 3) |
| 5 | +// This test verifies that sycl::get_native<backend::opencl> and |
| 6 | +// sycl::make_event<backend::opencl> work according to the SYCL™ 2020 |
| 7 | +// Specification (revision 4) |
8 | 8 | //===----------------------------------------------------------------------===//
|
9 | 9 |
|
10 | 10 | #include <sycl/sycl.hpp>
|
11 | 11 |
|
12 | 12 | int main() {
|
13 |
| -#ifdef SYCL_BACKEND_OPENCL |
14 | 13 | sycl::queue Queue;
|
15 | 14 | if (Queue.get_backend() == sycl::backend::opencl) {
|
16 | 15 | sycl::event event = Queue.submit([&](sycl::handler &cgh) {
|
17 | 16 | cgh.single_task<class event_kernel>([]() {});
|
18 | 17 | });
|
19 |
| - std::vector<cl_event> interopEventVec = |
20 |
| - sycl::get_native<sycl::backend::opencl>(event); |
| 18 | + // Check that get_native function returns a vector |
| 19 | + std::vector<cl_event> ClEventVec = get_native<sycl::backend::opencl>(event); |
| 20 | + // Check that make_event is working properly with vector<cl_event> as a |
| 21 | + // param |
| 22 | + sycl::event SyclEvent = sycl::make_event<sycl::backend::opencl>( |
| 23 | + ClEventVec, Queue.get_context()); |
| 24 | + std::vector<cl_event> ClEventVecFromMake = |
| 25 | + sycl::get_native<sycl::backend::opencl>(SyclEvent); |
| 26 | + if (ClEventVec[0] != ClEventVecFromMake[0]) |
| 27 | + throw std::runtime_error("Cl events are not the same"); |
21 | 28 | }
|
22 |
| -#endif |
| 29 | + return 0; |
23 | 30 | }
|
0 commit comments