12
12
#include < dpct/dpct.hpp>
13
13
14
14
dpct::image_wrapper<sycl::float4, 2 > tex42;
15
- dpct::image_wrapper<sycl::char4 , 1 > tex_char4 ;
16
- dpct::image_wrapper<sycl::ushort4 , 3 > tex43;
15
+ dpct::image_wrapper<sycl::int4 , 1 > tex_int4 ;
16
+ dpct::image_wrapper<sycl::uint4 , 3 > tex43;
17
17
18
18
// test_feature:image_accessor_ext
19
19
void test_image (sycl::float4* out, dpct::image_accessor_ext<sycl::float4, 2 > acc42,
20
- dpct::image_accessor_ext<sycl::char4 , 1 > acc21,
21
- dpct::image_accessor_ext<sycl::ushort4 , 3 > acc13) {
20
+ dpct::image_accessor_ext<sycl::int4 , 1 > acc21,
21
+ dpct::image_accessor_ext<sycl::uint4 , 3 > acc13) {
22
22
// test_feature:read
23
23
out[0 ] = acc42.read (0 .5f , 0 .5f );
24
24
// test_feature:read
25
- sycl::ushort4 data13 = acc13.read ((uint64_t )3 , (int )4 , (short )5 );
25
+ sycl::uint4 data13 = acc13.read ((uint64_t )3 , (int )4 , (short )5 );
26
26
// test_feature:read
27
- sycl::char4 data21 = acc21.read (0 .5f );
27
+ sycl::int4 data21 = acc21.read (0 .5f );
28
28
int a = data21.x ();
29
29
int b = data13.x ();
30
30
out[1 ] = {a,b,a,b};
@@ -33,21 +33,21 @@ void test_image(sycl::float4* out, dpct::image_accessor_ext<sycl::float4, 2> acc
33
33
int main () {
34
34
35
35
sycl::float4 *host_buffer = new sycl::float4[640 * 480 * 24 ];
36
- sycl::char4 *host_char_buffer = new sycl::char4 [640 ];
36
+ sycl::int4 *host_char_buffer = new sycl::int4 [640 ];
37
37
38
38
for (int i = 0 ; i < 640 * 480 * 24 ; ++i) {
39
39
host_buffer[i] = sycl::float4{10 .0f , 10 .0f , 10 .0f , 10 .0f };
40
40
if (i < 640 )
41
- host_char_buffer[i] = sycl::char4 {30 , 30 , 30 , 30 };
41
+ host_char_buffer[i] = sycl::int4 {30 , 30 , 30 , 30 };
42
42
}
43
43
sycl::float4 *device_buffer;
44
44
device_buffer = (sycl::float4 *)dpct::dpct_malloc (
45
45
640 * 480 * 24 * sizeof (sycl::float4));
46
46
dpct::dpct_memcpy (device_buffer, host_buffer, 640 * 480 * 24 * sizeof (sycl::float4));
47
47
48
48
dpct::image_channel chn1 =
49
- dpct::image_channel (16 , 16 , 16 , 16 , dpct::image_channel_data_type::unsigned_int);
50
- dpct::image_channel chn2 = dpct::image_channel::create<sycl::char4 >();
49
+ dpct::image_channel (32 , 32 , 32 , 32 , dpct::image_channel_data_type::unsigned_int);
50
+ dpct::image_channel chn2 = dpct::image_channel::create<sycl::int4 >();
51
51
dpct::image_channel chn4 =
52
52
dpct::image_channel (32 , 32 , 32 , 32 , dpct::image_channel_data_type::fp);
53
53
chn4.set_channel_size (4 , 32 );
@@ -62,9 +62,9 @@ int main() {
62
62
63
63
tex42.attach (image_data2, 640 , 480 , 650 * sizeof (sycl::float4));
64
64
65
- dpct::dpct_memcpy (array1->to_pitched_data (), sycl::id<3 >(0 , 0 , 0 ), dpct::pitched_data (host_buffer, 640 * sizeof (sycl::char4 ), 640 * sizeof (sycl::char4 ), 1 ), sycl::id<3 >(0 , 0 , 0 ), sycl::range<3 >(640 * sizeof (sycl::char4 ), 1 , 1 ));
65
+ dpct::dpct_memcpy (array1->to_pitched_data (), sycl::id<3 >(0 , 0 , 0 ), dpct::pitched_data (host_buffer, 640 * sizeof (sycl::int4 ), 640 * sizeof (sycl::int4 ), 1 ), sycl::id<3 >(0 , 0 , 0 ), sycl::range<3 >(640 * sizeof (sycl::int4 ), 1 , 1 ));
66
66
dpct::dpct_memcpy (dpct::pitched_data (image_data2, 650 * sizeof (sycl::float4), 640 * sizeof (sycl::float4*), 480 ), sycl::id<3 >(0 , 0 , 0 ), dpct::pitched_data (host_buffer, 640 * 480 * sizeof (sycl::float4), 640 * 480 * sizeof (sycl::float4), 1 ), sycl::id<3 >(0 , 0 , 0 ), sycl::range<3 >(640 * 480 * sizeof (sycl::float4), 1 , 1 ));
67
- dpct::dpct_memcpy (array3->to_pitched_data (), sycl::id<3 >(0 , 0 , 0 ), dpct::pitched_data (device_buffer, 640 * 480 * 24 * sizeof (sycl::ushort4 ), 640 * 480 * 24 * sizeof (sycl::ushort4 ), 1 ), sycl::id<3 >(0 , 0 , 0 ), sycl::range<3 >(640 * 480 * 24 * sizeof (sycl::ushort4 ), 1 , 1 ));
67
+ dpct::dpct_memcpy (array3->to_pitched_data (), sycl::id<3 >(0 , 0 , 0 ), dpct::pitched_data (device_buffer, 640 * 480 * 24 * sizeof (sycl::uint4 ), 640 * 480 * 24 * sizeof (sycl::uint4 ), 1 ), sycl::id<3 >(0 , 0 , 0 ), sycl::range<3 >(640 * 480 * 24 * sizeof (sycl::uint4 ), 1 , 1 ));
68
68
69
69
tex43.attach (array3);
70
70
@@ -102,7 +102,7 @@ int main() {
102
102
dpct::get_default_queue ().submit ([&](sycl::handler &cgh) {
103
103
auto acc42 = tex42.get_access (cgh);
104
104
auto acc13 = tex43.get_access (cgh);
105
- auto acc21 = static_cast <dpct::image_wrapper<sycl::char4 , 1 > *>(tex41)->get_access (cgh);
105
+ auto acc21 = static_cast <dpct::image_wrapper<sycl::int4 , 1 > *>(tex41)->get_access (cgh);
106
106
107
107
auto smpl42 = tex42.get_sampler ();
108
108
auto smpl13 = tex43.get_sampler ();
@@ -112,8 +112,8 @@ int main() {
112
112
113
113
cgh.single_task <dpct_kernel_name<class dpct_single_kernel >>([=] {
114
114
test_image (acc_out.get_pointer (),dpct::image_accessor_ext<sycl::float4, 2 >(smpl42, acc42),
115
- dpct::image_accessor_ext<sycl::char4 , 1 >(smpl21, acc21),
116
- dpct::image_accessor_ext<sycl::ushort4 , 3 >(smpl13, acc13));
115
+ dpct::image_accessor_ext<sycl::int4 , 1 >(smpl21, acc21),
116
+ dpct::image_accessor_ext<sycl::uint4 , 3 >(smpl13, acc13));
117
117
});
118
118
});
119
119
}
0 commit comments