@@ -34,7 +34,9 @@ template <typename T> struct point {
3434
3535template <typename T> void test_fill (T Val);
3636template <typename T> void test_copy_ptr_acc ();
37+ template <typename T> void test_3D_copy_ptr_acc ();
3738template <typename T> void test_copy_acc_ptr ();
39+ template <typename T> void test_3D_copy_acc_ptr ();
3840template <typename T> void test_copy_shared_ptr_acc ();
3941template <typename T> void test_copy_shared_ptr_const_acc ();
4042template <typename T> void test_copy_acc_shared_ptr ();
@@ -72,6 +74,14 @@ int main() {
7274 test_copy_ptr_acc<point<int >>();
7375 test_copy_ptr_acc<point<float >>();
7476 }
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+ }
7585 // handler.copy(acc, ptr)
7686 {
7787 test_copy_acc_ptr<int >();
@@ -80,6 +90,14 @@ int main() {
8090 test_copy_acc_ptr<point<int >>();
8191 test_copy_acc_ptr<point<float >>();
8292 }
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+ }
83101 // handler.copy(shared_ptr, acc)
84102 {
85103 test_copy_shared_ptr_acc<int >();
@@ -277,6 +295,28 @@ template <typename T> void test_copy_ptr_acc() {
277295 assert (DstValue == 99 );
278296}
279297
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+
280320template <typename T> void test_copy_acc_ptr () {
281321 const size_t Size = 10 ;
282322 T Data[Size] = {0 };
@@ -345,6 +385,28 @@ template <typename T> void test_copy_acc_ptr() {
345385 assert (DstValue == 77 );
346386}
347387
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+
348410template <typename T> void test_copy_shared_ptr_acc () {
349411 const size_t Size = 10 ;
350412 T Data[Size] = {0 };
0 commit comments