|
3 | 3 | // See LICENSE.TXT |
4 | 4 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
5 | 5 |
|
6 | | -#include <CL/sycl.hpp> |
| 6 | +#include <sycl/sycl.hpp> |
7 | 7 |
|
8 | 8 | int main() { |
9 | | - cl::sycl::queue sycl_queue; |
| 9 | + sycl::queue sycl_queue; |
10 | 10 |
|
11 | 11 | const int height = 8; |
12 | 12 | const int width = 8; |
13 | | - auto image_range = cl::sycl::range<2>(height, width); |
| 13 | + auto image_range = sycl::range<2>(height, width); |
14 | 14 | const int channels = 4; |
15 | 15 | std::vector<float> in_data(height * width * channels, 0.5f); |
16 | 16 | std::vector<float> out_data(height * width * channels, 0); |
17 | 17 |
|
18 | | - cl::sycl::image<2> image_in( |
19 | | - in_data.data(), cl::sycl::image_channel_order::rgba, |
20 | | - cl::sycl::image_channel_type::fp32, image_range); |
21 | | - cl::sycl::image<2> image_out( |
22 | | - out_data.data(), cl::sycl::image_channel_order::rgba, |
23 | | - cl::sycl::image_channel_type::fp32, image_range); |
| 18 | + sycl::image<2> image_in(in_data.data(), sycl::image_channel_order::rgba, |
| 19 | + sycl::image_channel_type::fp32, image_range); |
| 20 | + sycl::image<2> image_out(out_data.data(), sycl::image_channel_order::rgba, |
| 21 | + sycl::image_channel_type::fp32, image_range); |
24 | 22 |
|
25 | | - auto work_range = |
26 | | - cl::sycl::nd_range<2>(image_range, cl::sycl::range<2>(1, 1)); |
27 | | - sycl_queue.submit([&](cl::sycl::handler &cgh) { |
28 | | - cl::sycl::accessor<cl::sycl::float4, 2, cl::sycl::access::mode::read, |
29 | | - cl::sycl::access::target::image> |
| 23 | + auto work_range = sycl::nd_range<2>(image_range, sycl::range<2>(1, 1)); |
| 24 | + sycl_queue.submit([&](sycl::handler &cgh) { |
| 25 | + sycl::accessor<sycl::float4, 2, sycl::access::mode::read, |
| 26 | + sycl::access::target::image> |
30 | 27 | in_acc(image_in, cgh); |
31 | | - cl::sycl::accessor<cl::sycl::float4, 2, cl::sycl::access::mode::write, |
32 | | - cl::sycl::access::target::image> |
| 28 | + sycl::accessor<sycl::float4, 2, sycl::access::mode::write, |
| 29 | + sycl::access::target::image> |
33 | 30 | out_acc(image_out, cgh); |
34 | 31 |
|
35 | | - cl::sycl::sampler smpl( |
36 | | - cl::sycl::coordinate_normalization_mode::unnormalized, |
37 | | - cl::sycl::addressing_mode::clamp, |
38 | | - cl::sycl::filtering_mode::nearest); |
| 32 | + sycl::sampler smpl(sycl::coordinate_normalization_mode::unnormalized, |
| 33 | + sycl::addressing_mode::clamp, |
| 34 | + sycl::filtering_mode::nearest); |
39 | 35 |
|
40 | 36 | cgh.parallel_for<class image_copy>( |
41 | | - work_range, [=](cl::sycl::nd_item<2> item_id) { |
42 | | - auto coords = cl::sycl::int2(item_id.get_global_id(0), |
43 | | - item_id.get_global_id(1)); |
| 37 | + work_range, [=](sycl::nd_item<2> item_id) { |
| 38 | + auto coords = sycl::int2(item_id.get_global_id(0), |
| 39 | + item_id.get_global_id(1)); |
44 | 40 | out_acc.write(coords, in_acc.read(coords, smpl)); |
45 | 41 | }); |
46 | 42 | }); |
|
0 commit comments