OpenCL™ Developer Guide for Intel® Processor Graphics
2019 Update 4
Sharing Resources Efficiently
Objects, allocated at the context level, are shared between devices in the context. For example, buffers and images are effectively shared by default. Other resources that are shared automatically across all devices, include program and kernel objects.
Shared memory objects cannot be written concurrently by different command queues. Use explicit synchronization of the write access with OpenCL™ synchronization objects, such as events. Consider using sub-buffers, which enables you to simultaneously write to the non-overlapping regions.
You can also avoid implicit copying when you share data with the host, as explained in the “Mapping Memory Objects” section.
To avoid potential inefficiencies, especially associated with improper alignment, use 4k alignment for the host pointers in scenarios when the Intel® Graphics device is involved. Also align the allocation sizes to the cache line boundaries (64 bytes). Refer to the “Mapping Memory Objects” section for more details.