The semantics of transactions and weak memory in x86, Power, ARM, and C++

Weak memory models provide a complex, system-centric semantics for concurrent programs, while transactional memory (TM) provides a simpler, programmer-centric semantics. Both have been studied in detail, but their combined semantics is not well understood. This is problematic because such widely-used architectures and languages as x86, Power, and C++ all support TM, and all have weak memory models. Our work aims to clarify the interplay between weak memory and TM by extending existing axiomatic weak memory models (x86, Power, ARMv8, and C++) with new rules for TM. Our formal models are backed by automated tooling that enables (1) the synthesis of tests for validating our models against existing implementations and (2) the model-checking of TM-related transformations, such as lock elision and compiling C++ transactions to hardware. A key finding is that a proposed TM extension to ARMv8 currently being considered within ARM Research is incompatible with lock elision without sacrificing portability or performance.

[1]  Arvind,et al.  Store Atomicity for Transactional Memory , 2007, Electron. Notes Theor. Comput. Sci..

[2]  Dan Grossman,et al.  What do high-level memory models mean for transactions? , 2006, MSPC '06.

[3]  Viktor Vafeiadis,et al.  Common Compiler Optimisations are Invalid in the C11 Memory Model and what we can do about it , 2015, POPL.

[4]  Alexey Gotsman,et al.  A Framework for Transactional Consistency Models with Atomic Visibility , 2015, CONCUR.

[5]  Patrick Valduriez,et al.  Transaction chopping: algorithms and performance studies , 1995, TODS.

[6]  Kunle Olukotun,et al.  Testing implementations of transactional memory , 2006, 2006 International Conference on Parallel Architectures and Compilation Techniques (PACT).

[7]  James R. Goodman,et al.  Speculative lock elision: enabling highly concurrent multithreaded execution , 2001, MICRO.

[8]  Dan Grossman,et al.  Enforcing isolation and ordering in STM , 2007, PLDI '07.

[9]  Hongseok Yang,et al.  Algebraic Laws for Weak Consistency , 2017, CONCUR.

[10]  Peter Sewell,et al.  A Better x86 Memory Model: x86-TSO , 2009, TPHOLs.

[11]  Jade Alglave,et al.  Fences in Weak Memory Models , 2010, CAV.

[12]  Peter Sewell,et al.  Mathematizing C++ concurrency , 2011, POPL '11.

[13]  Maurice Herlihy,et al.  Transactional Memory: Architectural Support For Lock-free Data Structures , 1993, Proceedings of the 20th Annual International Symposium on Computer Architecture.

[14]  Daniel Jackson,et al.  Software Abstractions - Logic, Language, and Analysis , 2006 .

[15]  Alastair David Reid,et al.  Trustworthy specifications of ARM® v8-A and v8-M system level architecture , 2016, 2016 Formal Methods in Computer-Aided Design (FMCAD).

[16]  Jeehoon Kang,et al.  Repairing sequential consistency in C/C++11 , 2017, PLDI.

[17]  Luke Dalessandro Michael,et al.  Strong Isolation is a Weak Idea , 2009 .

[18]  Ori Lahav,et al.  Effective stateless model checking for C/C++ concurrency , 2017, Proc. ACM Program. Lang..

[19]  Leslie Lamport,et al.  How to Make a Multiprocessor Computer That Correctly Executes Multiprocess Programs , 2016, IEEE Transactions on Computers.

[20]  Jade Alglave,et al.  Litmus: Running Tests against Hardware , 2011, TACAS.

[21]  Daniel Lustig,et al.  Automated Synthesis of Comprehensive Memory Model Litmus Test Suites , 2017, ASPLOS.

[22]  Jade Alglave,et al.  Understanding POWER multiprocessors , 2011, PLDI '11.

[23]  Mark Moir,et al.  Early experience with a commercial hardware transactional memory implementation , 2009, ASPLOS.

[24]  Justin Emile Gottschlich,et al.  Transactional Language Constructs for C + + , 2012 .

[25]  Armin Biere Lingeling, Plingeling, PicoSAT and PrecoSAT at SAT Race 2010 , 2010 .

[26]  Krste Asanovic,et al.  The RISC-V Instruction Set Manual Volume 2: Privileged Architecture Version 1.7 , 2015 .

[27]  Michael F. Spear,et al.  Transactions as the Foundation of a Memory Consistency Model , 2010, DISC.

[28]  No License,et al.  Intel ® 64 and IA-32 Architectures Software Developer ’ s Manual Volume 3 A : System Programming Guide , Part 1 , 2006 .

[29]  Ali Sezgin,et al.  Modelling the ARMv8 architecture, operationally: concurrency and ISA , 2016, POPL.

[30]  Hans-Juergen Boehm,et al.  Foundations of the C++ concurrency memory model , 2008, PLDI '08.

[31]  Mark Moir,et al.  Towards formally specifying and verifying transactional memory , 2009, Formal Aspects of Computing.

[32]  Alexey Gotsman,et al.  Library abstraction for C/C++ concurrency , 2013, POPL.

[33]  Radha Jagadeesan,et al.  Transactions in relaxed memory architectures , 2018, Proc. ACM Program. Lang..

[34]  Shaked Flur,et al.  Simplifying ARM concurrency: multicopy-atomic axiomatic and operational models for ARMv8 , 2017, Proc. ACM Program. Lang..

[35]  Christoforos E. Kozyrakis,et al.  Thread-safe dynamic binary translation using transactional memory , 2008, 2008 IEEE 14th International Symposium on High Performance Computer Architecture.

[36]  Peter Sewell,et al.  An operational semantics for C/C++11 concurrency , 2016, OOPSLA.

[37]  William W. Collier,et al.  Reasoning about parallel architectures , 1992 .

[38]  John Wickerson,et al.  Overhauling SC atomics in C11 and OpenCL , 2016, POPL.

[39]  Dennis Shasha,et al.  Efficient and correct execution of parallel programs that share memory , 1988, TOPL.

[40]  Milo M. K. Martin,et al.  Subtleties of transactional memory atomicity semantics , 2006, IEEE Computer Architecture Letters.

[41]  George A. Constantinides,et al.  Automatically comparing memory consistency models , 2017, POPL.

[42]  M. Hill,et al.  Weak ordering-a new definition , 1990, [1990] Proceedings. The 17th Annual International Symposium on Computer Architecture.

[43]  Ganesh Gopalakrishnan,et al.  Portable inter-workgroup barrier synchronisation for GPUs , 2016, OOPSLA.

[44]  Peter Sewell,et al.  The Problem of Programming Language Concurrency Semantics , 2015, ESOP.

[45]  Maged M. Michael,et al.  Robust architectural support for transactional memory in the power architecture , 2013, ISCA.

[46]  Jade Alglave,et al.  Herding cats: modelling, simulation, testing, and data-mining for weak memory , 2014, PLDI 2014.

[47]  Elena Tsanko,et al.  Verification of transactional memory in POWER8 , 2014, 2014 51st ACM/EDAC/IEEE Design Automation Conference (DAC).

[48]  Adam Welc,et al.  Towards transactional memory semantics for C++ , 2009, SPAA '09.

[49]  David Seal,et al.  ARM Architecture Reference Manual , 2001 .

[50]  Ganesh Gopalakrishnan,et al.  GPU Concurrency: Weak Behaviours and Programming Assumptions , 2015, ASPLOS.

[51]  Margaret Martonosi,et al.  TriCheck: Memory Model Verification at the Trisection of Software, Hardware, and ISA , 2016, ASPLOS.

[52]  Mateo Valero,et al.  Profile-guided transaction coalescing—lowering transactional overheads by merging transactions , 2013, TACO.

[53]  Jade Alglave,et al.  Synchronising C/C++ and POWER , 2012, PLDI.

[54]  Taesoo Kim,et al.  Breaking Kernel Address Space Layout Randomization with Intel TSX , 2016, CCS.

[55]  Emina Torlak,et al.  Synthesizing memory models from framework sketches and Litmus tests , 2017, PLDI 2017.

[56]  Serdar Tasiran,et al.  Verifying Programs under Snapshot Isolation and Similar Relaxed Consistency Models , 2014 .