Relaxed Memory Model Zoo

OpenCL 2.0 Memory Model
← Back to the map

OpenCL 2.0 Memory Model

2016 · Batty, Donaldson, Wickerson · language, gpu, formal, scoped · axiomatic formalism

A scoped extension of the C11 model for heterogeneous compute, adding memory scopes (work-item, work-group, device, all-SVM-devices) on top of C11's atomic orderings. At all-devices scope it coincides with C11; narrower scopes permit additional weak behaviours. Formalised and repaired alongside C11 by Batty, Donaldson & Wickerson (POPL 2016).

Properties

Property vector author-extrapolated — set only where the model’s definition pins the cell down (unknown cells are omitted); cells citing a specific source are marked.

Reordering sound
  • yes Store→Load
  • yes Store→Store
  • yes Load→Load
  • yes Load→Store
Reasoning guarantees
  • yes Coherence
  • no No undefined behaviour
  • no In-order execution
  • no No out-of-thin-air

Ordering relationships

Strictly weaker than
  • C11/C++11 Memory Model — OpenCL 2.0 extends C11 with memory scopes; at all-SVM-devices scope it coincides with C11, but narrower scopes (work-group, device) permit synchronisation-free weak behaviours that flat C11 forbids. See Batty, Donaldson & Wickerson (POPL 2016).
Compiles correctly to
  • NVIDIA PTX Memory Model — OpenCL kernels compile to PTX on NVIDIA GPUs. Verified sound by memalloy: no execution where the compiled PTX behaviour violates the source OpenCL semantics, up to 4 OpenCL / 6 PTX events (opencl_scoped -> ptx_orig via the opencl_ptx mapping); the known-buggy mapping variant yields a counterexample at 5 events, confirming the check discriminates. Reproduced via litmus/memalloy/ (Docker).
  • AMD GPU Memory Model — OpenCL kernels compile to AMD's GPU ISA via the HSA-based model.
Incomparable with
  • Vulkan Memory Model — Both are scoped GPU API models, but differ in scope sets and synchronisation primitives — Vulkan adds explicit availability/visibility operations that OpenCL lacks; neither contains the other.

References

  • Mark Batty, Alastair F. Donaldson, John Wickerson. Overhauling SC Atomics in C11 and OpenCL. POPL 2016, 2016. doi:10.1145/2837614.2837637
  • Jade Alglave, Mark Batty, Alastair F. Donaldson, Ganesh Gopalakrishnan, Jeroen Ketema, Daniel Poetzl, Tyler Sorensen, John Wickerson. GPU Concurrency: Weak Behaviours and Programming Assumptions. ASPLOS 2015, 2015. doi:10.1145/2694344.2694391