Accessors provide access to buffers and images in the host or inside the kernel and also communicate data dependencies between the application and different kernels. The accessor communicates the data type, size, target, and access mode. To enable good performance, pay particular attention to the target because the accessor specifies the memory type from the choices in the SYCL memory model.
The targets associated with buffers are:
The targets associated with images are:
Image access must also specify a channel order to communicate the format
of the data being read. For example, an image may be specified as a
float4, but accessed with a channel order of RGBA.
The access mode impacts correctness as well as performance and is one
atomic. Mismatches in access mode and
actual memory operations such as a
write to a
read can result in compiler diagnostics as well as
erroneous program state. The
discard_read_write access modes can provide performance benefits
for some implementations. For further details on accessors, see the