@@ -34,7 +34,9 @@ template <typename T> struct point {
34
34
35
35
template <typename T> void test_fill (T Val);
36
36
template <typename T> void test_copy_ptr_acc ();
37
+ template <typename T> void test_3D_copy_ptr_acc ();
37
38
template <typename T> void test_copy_acc_ptr ();
39
+ template <typename T> void test_3D_copy_acc_ptr ();
38
40
template <typename T> void test_copy_shared_ptr_acc ();
39
41
template <typename T> void test_copy_shared_ptr_const_acc ();
40
42
template <typename T> void test_copy_acc_shared_ptr ();
@@ -72,6 +74,14 @@ int main() {
72
74
test_copy_ptr_acc<point<int >>();
73
75
test_copy_ptr_acc<point<float >>();
74
76
}
77
+ // handler.copy(ptr, acc) 3D
78
+ {
79
+ test_3D_copy_ptr_acc<int >();
80
+ test_3D_copy_ptr_acc<int >();
81
+ test_3D_copy_ptr_acc<point<int >>();
82
+ test_3D_copy_ptr_acc<point<int >>();
83
+ test_3D_copy_ptr_acc<point<float >>();
84
+ }
75
85
// handler.copy(acc, ptr)
76
86
{
77
87
test_copy_acc_ptr<int >();
@@ -80,6 +90,14 @@ int main() {
80
90
test_copy_acc_ptr<point<int >>();
81
91
test_copy_acc_ptr<point<float >>();
82
92
}
93
+ // handler.copy(acc, ptr) 3D
94
+ {
95
+ test_3D_copy_acc_ptr<int >();
96
+ test_3D_copy_acc_ptr<int >();
97
+ test_3D_copy_acc_ptr<point<int >>();
98
+ test_3D_copy_acc_ptr<point<int >>();
99
+ test_3D_copy_acc_ptr<point<float >>();
100
+ }
83
101
// handler.copy(shared_ptr, acc)
84
102
{
85
103
test_copy_shared_ptr_acc<int >();
@@ -277,6 +295,28 @@ template <typename T> void test_copy_ptr_acc() {
277
295
assert (DstValue == 99 );
278
296
}
279
297
298
+ template <typename T> void test_3D_copy_ptr_acc () {
299
+ const range<3 > Range{2 , 3 , 4 };
300
+ const size_t Size = 2 * 3 * 4 ;
301
+ T Data[Size] = {0 };
302
+ T Values[Size] = {0 };
303
+ for (size_t I = 0 ; I < Size; ++I)
304
+ Values[I] = I;
305
+
306
+ {
307
+ buffer<T, 3 > Buffer (Data, Range);
308
+ queue Queue;
309
+ Queue.submit ([&](handler &Cgh) {
310
+ accessor<T, 3 , access::mode::write, access::target::global_buffer>
311
+ Accessor (Buffer, Cgh, Range);
312
+ Cgh.copy (Values, Accessor);
313
+ });
314
+ }
315
+
316
+ for (int I = 0 ; I < Size; ++I)
317
+ assert (Data[I] == Values[I]);
318
+ }
319
+
280
320
template <typename T> void test_copy_acc_ptr () {
281
321
const size_t Size = 10 ;
282
322
T Data[Size] = {0 };
@@ -345,6 +385,28 @@ template <typename T> void test_copy_acc_ptr() {
345
385
assert (DstValue == 77 );
346
386
}
347
387
388
+ template <typename T> void test_3D_copy_acc_ptr () {
389
+ const range<3 > Range{2 , 3 , 4 };
390
+ const size_t Size = 2 * 3 * 4 ;
391
+ T Data[Size] = {0 };
392
+ T Values[Size] = {0 };
393
+ for (size_t I = 0 ; I < Size; ++I)
394
+ Data[I] = I;
395
+
396
+ {
397
+ buffer<T, 3 > Buffer (Data, Range);
398
+ queue Queue;
399
+ Queue.submit ([&](handler &Cgh) {
400
+ accessor<T, 3 , access::mode::read, access::target::global_buffer>
401
+ Accessor (Buffer, Cgh, Range);
402
+ Cgh.copy (Accessor, Values);
403
+ });
404
+ }
405
+
406
+ for (size_t I = 0 ; I < Size; ++I)
407
+ assert (Data[I] == Values[I]);
408
+ }
409
+
348
410
template <typename T> void test_copy_shared_ptr_acc () {
349
411
const size_t Size = 10 ;
350
412
T Data[Size] = {0 };
0 commit comments