| 513 | |
| 514 | template<typename T> |
| 515 | void writeDeviceDataArray(Array<T> &arr, const void *const data, |
| 516 | const size_t bytes) { |
| 517 | if (!arr.isOwner()) { arr = copyArray<T>(arr); } |
| 518 | |
| 519 | sycl::buffer<T> *dataptr = |
| 520 | static_cast<sycl::buffer<T> *>(const_cast<void *>(data)); |
| 521 | auto arr_get = arr.get(); |
| 522 | getQueue().submit([&](sycl::handler &h) { |
| 523 | auto src_acc = dataptr->template get_access<sycl::access_mode::read>( |
| 524 | h, sycl::range(bytes / sizeof(T))); |
| 525 | auto dst_acc = arr_get->template get_access<sycl::access_mode::write>( |
| 526 | h, sycl::range(bytes / sizeof(T)), arr.getOffset()); |
| 527 | h.copy(src_acc, dst_acc); |
| 528 | }); |
| 529 | } |
| 530 | |
| 531 | template<typename T> |
| 532 | void Array<T>::setDataDims(const dim4 &new_dims) { |