File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
documentation/library_guide/api_for_sycl_kernels Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ Below is an example code that shows how to use ``oneapi::dpl::swap`` in SYCL dev
18
18
#include <sycl/sycl.hpp>
19
19
#include <iostream>
20
20
#include <cstdint>
21
-
22
21
int main()
23
22
{
24
23
sycl::queue queue;
@@ -27,16 +26,17 @@ Below is an example code that shows how to use ``oneapi::dpl::swap`` in SYCL dev
27
26
std::cout << "Initial data: " << data[0] << ", " << data[1] << std::endl;
28
27
sycl::buffer<std::uint32_t> buffer(data, size);
29
28
queue.submit([&](sycl::handler& cgh) {
30
- auto access = buffer.template get_access< sycl::access::mode:: read_write>(cgh );
29
+ auto access = buffer.get_access(cgh, sycl::read_write);
31
30
cgh.single_task<class KernelSwap>([=]() {
32
31
oneapi::dpl::swap(access[0], access[1]);
33
32
});
34
33
}).wait();
35
- auto host_access = buffer.template get_access< sycl::access::mode::read>( );
34
+ auto host_access = buffer.get_host_access( sycl::read_only );
36
35
std::cout << "After swap: " << host_access[0] << ", " << host_access[1] << std::endl;
37
36
return 0;
38
37
}
39
38
39
+
40
40
Use the following command to build and run the program (assuming it resides in the ``kernel_swap.cpp file ``):
41
41
42
42
.. code :: cpp
You can’t perform that action at this time.
0 commit comments