Synthesizing memory models from framework sketches and Litmus tests
Authors:
Open Access
- 14 June 2017
- conference paper
- Published by Association for Computing Machinery (ACM)
- p. 467-481
Abstract
A memory consistency model specifies which writes to shared memory a given read may see. Ambiguities or errors in these specifications can lead to bugs in both compilers and applications. Yet architectures usually define their memory models with prose and litmus tests—small concurrent programs that demonstrate allowed and forbidden outcomes. Recent work has formalized the memory models of common architectures through substantial manual effort, but as new architectures emerge, there is a growing need for tools to aid these efforts. This paper presents MemSynth, a synthesis-aided system for reasoning about axiomatic specifications of memory models. MemSynth takes as input a set of litmus tests and a framework sketch that defines a class of memory models. The sketch comprises a set of axioms with missing expressions (or holes). Given these inputs, MemSynth synthesizes a completion of the axioms—i.e., a memory model—that gives the desired outcome on all tests. The MemSynth engine employs a novel embedding of bounded relational logic in a solver-aided programming language, which enables it to tackle complex synthesis queries intractable to existing relational solvers. This design also enables it to solve new kinds of queries, such as checking if a set of litmus tests unambiguously defines a memory model within a framework sketch. We show that MemSynth can synthesize specifications for x86 in under two seconds, and for PowerPC in 12 seconds from 768 litmus tests. Our ambiguity check identifies missing tests from both the Intel x86 documentation and the validation suite of a previous PowerPC formalization. We also used MemSynth to reproduce, debug, and automatically repair a paper on comparing memory models in just two days.Keywords
Funding Information
- Defense Advanced Research Projects Agency (FA8750-16-2-0032)
This publication has 39 references indexed in Scilit:
- A formal hierarchy of weak memory modelsFormal Methods in System Design, 2012
- Sound and Complete Monitoring of Sequential Consistency for Relaxed Memory Models2011
- x86-TSOCommunications of the ACM, 2010
- The semantics of power and ARM multiprocessor machine code (abstract only)ACM SIGPLAN Notices, 2009
- The semantics of x86-CC multiprocessor machine codeACM SIGPLAN Notices, 2009
- A Better x86 Memory Model: x86-TSO2009
- Effective Program Verification for Relaxed Memory Models2008
- Z3: An Efficient SMT Solver2008
- Kodkod: A Relational Model Finder2007
- Time, clocks, and the ordering of events in a distributed systemCommunications of the ACM, 1978