0

I'm having trouble trying to figure out how to do explicit data transfer to/from host when using sycl::image. I'm familiar with sycl::handler.copy when using buffers:

float* host_ptr;
sycl::buffer<float, 1> buf;
sycl::queue& q
q.submit([&](sycl::handler& cgh) {
  auto acc = buf.get_access<sycl::access::mode::read>(cgh);
  cgh.copy(acc, host_ptr);
});

q.wait_and_throw();

but I can't quite find the equivalent code when dealing with sycl::image. If I pass an image accessor to .copy it complains that the accessor doesn't have a subscipt operator. Does anyone know the correct method for this?

My previous OpenCL code had clEnqueueReadImage and clEnqueueWriteImage for this sort of data image transfer. Is there a sycl equivalent?

note: I'm aware of the implicit copy back to host on sycl::image deconstruction, but I want to know the explicit solution, rather than the implicit one.

Biggy Smith
  • 910
  • 7
  • 14

0 Answers0