SYCL Explicit Data Movement from Image to Host

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);


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.

It doesn’t look like there is an explicit copy method included in the spec. It could be a good suggestion to make to the SYCL working group though. You could raise an issue here to kick off the discussion GitHub - KhronosGroup/SYCL-Docs: SYCL Open Source Specification

I’ve created an issue here: sycl::image explicit data movement · Issue #414 · KhronosGroup/SYCL-Docs · GitHub