Benedict R. Gaster, Derek Hower, and Lee Howes.
Computer Sciences Technical Report 2014-01
Memory consistency models, or memory models, allow both programmers and program language implementers to reason about concurrent accesses to one or more memory locations. Memory model specifications balance the often conflicting needs for precise
semantics, implementation flexibility, and ease of understanding. Towards that end, popular programming languages like Java, C, and C++ have adopted memory models built on the conceptual foundation of Sequential Consistency for Data-Race-Free
(SC for DRF). These SC for DRF languages were created with general-purpose homogeneous CPU systems in mind, and all assume a single, global memory address space. Such a uniform address space is usually power and performance prohibitive in heterogeneous SoCs, and for that reason most heterogeneous languages have
adopted split address spaces and operations with non-global
There have recently been two attempts to bridge the disconnect between the CPU-centric assumptions of the SC for DRF framework and the realities of heterogeneous SoC architectures. Hower, et al. proposed a class of Heterogeneous-Race-Free (HRF) memory
models that provide a foundation for understanding many of the issues in heterogeneous memory models. At the same time, the Khronos Group developed the OpenCL 2.0 memory model that builds on the C++ memory model. The OpenCL 2.0 model includes features not addressed by HRF, including support for relaxed atomics and a
property referred to as scope inclusion. In this paper, we generalize HRF to allow formalization of and reasoning about more complicated models using OpenCL 2.0 as a point of reference. With that generalization, we (1) make the OpenCL 2.0 memory model more accessible by introducing a platform for feature comparisons to other models, (2) consider a number of shortcomings in the current OpenCL 2.0 model and (3) propose changes that could be adopted by future OpenCL 2.0 revisions or by other, related, models.