Affiliation:
1. Imperial College London, UK
2. University of Kent, UK
Abstract
A
memory consistency model
(MCM) is the part of a programming language or computer architecture specification that defines which values can legally be read from shared memory locations. Because MCMs take into account various optimisations employed by architectures and compilers, they are often complex and counterintuitive, which makes them challenging to design and to understand.
We identify four tasks involved in designing and understanding MCMs: generating conformance tests, distinguishing two MCMs, checking compiler optimisations, and checking compiler mappings. We show that all four tasks are instances of a general constraint-satisfaction problem to which the solution is either a program or a pair of programs. Although this problem is intractable for automatic solvers when phrased over programs directly, we show how to solve analogous constraints over program
executions
, and then construct programs that satisfy the original constraints.
Our technique, which is implemented in the Alloy modelling framework, is illustrated on several software- and architecture-level MCMs, both axiomatically and operationally defined. We automatically recreate several known results, often in a simpler form, including: distinctions between variants of the C11 MCM; a failure of the "SC-DRF guarantee" in an early C11 draft; that x86 is "multi-copy atomic" and Power is not; bugs in common C11 compiler optimisations; and bugs in a compiler mapping from OpenCL to AMD-style GPUs. We also use our technique to develop and validate a new MCM for NVIDIA GPUs that supports a natural mapping from OpenCL.
Funder
Lloyd's Register Foundation
Royal Academy of Engineering
Intel Corporation
Engineering and Physical Sciences Research Council
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Reference80 articles.
1. Supplementary material for this paper is available in the ACM digital library and in the following GitHub repository. Supplementary material for this paper is available in the ACM digital library and in the following GitHub repository.
2. Rodin: an open toolset for modelling and reasoning in Event-B;Abrial Jean-Raymond;Int. J. Softw. Tools Technol. Transfer,2010
3. Shared memory consistency models: a tutorial
4. Weak ordering---a new definition
5. The power of processor consistency
Cited by
55 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Compiler Testing with Relaxed Memory Models;2024 IEEE/ACM International Symposium on Code Generation and Optimization (CGO);2024-03-02
2. How Hard Is Weak-Memory Testing?;Proceedings of the ACM on Programming Languages;2024-01-05
3. Simulating Operational Memory Models Using Off-the-Shelf Program Analysis Tools;IEEE Transactions on Software Engineering;2023-12
4. Static Analysis of Memory Models for SMT Encodings;Proceedings of the ACM on Programming Languages;2023-10-16
5. Crucible: Graphical Test Cases for Alloy Models;2023 IEEE 34th International Symposium on Software Reliability Engineering (ISSRE);2023-10-09