3.7.2 Memory types in OpenCL

OpenCL supports these memory types: Private memory, local memory, constant memory, and global memory.

Private memory
  • Private memory is specific to a work-item.
  • It is not visible to other work-items.
Local memory
  • Local memory is local to a work-group.
  • It is accessible by the work-items in the work-group.
  • It is accessed with the __local keyword.
  • It is consistent to all work-items in the work-group.

    Note

    Work-items execute in an undefined order. This means you cannot guarantee the order that work-items write data in. If you want a work-item to read data that are written by another work-item, you must use a barrier to ensure that they execute in the correct order.
Constant memory
  • Constant memory is a memory region used for objects allocated and initialized by the host.
  • It is accessible as read-only by all work-items.
Global memory
  • Global memory is accessible to all work-items executing in a context.
  • It is accessible to the host using read, write, and map commands.
  • It is consistent across work-items in a single work-group.

    Note

    • Work-items execute in an undefined order. This means you cannot guarantee the order that work-items write data in.
    • If you want a work-item to read data that are written by another work-item, you must use a barrier to ensure that they execute in the correct order.
  • It implements a relaxed consistency, shared memory model.
  • It is accessed with the __global keyword.
  • There is no guarantee of memory consistency between different work-groups.
Non-ConfidentialPDF file icon PDF versionARM 100614_0300_00_en
Copyright © 2012, 2013, 2015, 2016 ARM. All rights reserved.