• 2019 Update 4
  • 03/20/2019
  • Public Content

Using Buffers and Images Appropriately

On both CPU and Intel® Graphics devices, buffers usually perform better than images: more data transfers per read or write operation for buffers with much lower latency.
If your algorithm does not require linear data interpolation or specific border modes, consider using buffers instead of images. Still, if your legacy code uses images, or if you want to use the linear interpolation ability of the sampler, consider using the
extension which offers creating zero copy image aliases for the buffers.
To improve performance on the Intel Graphics, do the following:
  • Consider using images if you need linear interpolation between pixel values.
  • Consider using images for irregular access patterns. For example, use buffers when processing in memory (in row-major) order. Yet prefer image2D and texture sampling your access pattern is other than simple linear. For example, a kernel that reads diagonally or generally irregular positions.
  • Use local memory for explicit caching of data values rather than relying on sampler’s caches, as the caches do not support image
  • Notice however, that for (even mildly large) look-up tables the regular global memory is preferable over local memory.
  • Use constant samplers to be able to specify and optimize the sampling behavior in compile time.
  • Consider using the
    as it is the fastest addressing mode, and use
    rather than
In general, image2D sampling on the Intel Graphics offers:
  • Free type conversions. For example,
    (unavailable on CPU).
  • Automatic handling image boundaries (slower on the CPU).
  • Fast bilinear sampling (works slow on CPU; may vary between devices).
Notice that images are software-emulated on a CPU. So, make sure to choose the fastest interpolation mode that meets your needs. Specifically:
  • Nearest-neighbor filtering works well for most (interpolating) kernels.
  • Linear filtering might decrease CPU device performance.
See Also

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.