PARTIAL-COHERENCE ABSTRACTIONS FOR RELAXED MEMORY MODELS Presented by Michael Kuperstein, Technion Joint work with Martin Vechev, IBM Research and Eran.

Slides:



Advertisements
Similar presentations
Bounded Model Checking of Concurrent Data Types on Relaxed Memory Models: A Case Study Sebastian Burckhardt Rajeev Alur Milo M. K. Martin Department of.
Advertisements

Symmetric Multiprocessors: Synchronization and Sequential Consistency.
CS 267: Automated Verification Lecture 8: Automata Theoretic Model Checking Instructor: Tevfik Bultan.
Greta YorshEran YahavMartin Vechev IBM Research. { ……………… …… …………………. ……………………. ………………………… } T1() Challenge: Correct and Efficient Synchronization { ……………………………
Synchronization. How to synchronize processes? – Need to protect access to shared data to avoid problems like race conditions – Typical example: Updating.
Memory Consistency Models Kevin Boos. Two Papers Shared Memory Consistency Models: A Tutorial – Sarita V. Adve & Kourosh Gharachorloo – September 1995.
Memory Models (1) Xinyu Feng University of Science and Technology of China.
Exploring Memory Consistency for Massively Threaded Throughput- Oriented Processors Blake Hechtman Daniel J. Sorin 0.
Architecture-aware Analysis of Concurrent Software Rajeev Alur University of Pennsylvania Amir Pnueli Memorial Symposium New York University, May 2010.
CSE 490/590, Spring 2011 CSE 490/590 Computer Architecture Snoopy Caches I Steve Ko Computer Sciences and Engineering University at Buffalo.
CS 162 Memory Consistency Models. Memory operations are reordered to improve performance Hardware (e.g., store buffer, reorder buffer) Compiler (e.g.,
“FENDER” AUTOMATIC MEMORY FENCE INFERENCE Presented by Michael Kuperstein, Technion Joint work with Martin Vechev and Eran Yahav, IBM Research 1.
© Krste Asanovic, 2014CS252, Spring 2014, Lecture 12 CS252 Graduate Computer Architecture Spring 2014 Lecture 12: Synchronization and Memory Models Krste.
D u k e S y s t e m s Time, clocks, and consistency and the JMM Jeff Chase Duke University.
1 Eran Yahav Technion Joint work with Martin Vechev (ETH), Greta Yorsh (ARM), Michael Kuperstein (Technion), Veselin Raychev (ETH)
CS492B Analysis of Concurrent Programs Consistency Jaehyuk Huh Computer Science, KAIST Part of slides are based on CS:App from CMU.
Concurrent Executions on Relaxed Memory Models Challenges & Opportunities for Software Model Checking Rajeev Alur University of Pennsylvania Joint work.
Martin Vechev IBM Research Michael Kuperstein Technion Eran Yahav Technion (FMCAD’10, PLDI’11) 1.
Martin Vechev IBM Research Michael Kuperstein Technion Eran Yahav Technion (FMCAD’10, PLDI’11) 1.
By Sarita Adve & Kourosh Gharachorloo Review by Jim Larson Shared Memory Consistency Models: A Tutorial.
Formalisms and Verification for Transactional Memories Vasu Singh EPFL Switzerland.
1 Lecture 09 – Synthesis of Synchronization Eran Yahav.
1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael.
1 Eran Yahav and Mooly Sagiv School of Computer Science Tel-Aviv University Verifying Safety Properties.
Computer Architecture II 1 Computer architecture II Lecture 9.
Comparison Under Abstraction for Verifying Linearizability Daphna Amit Noam Rinetzky Mooly Sagiv Tom RepsEran Yahav Tel Aviv UniversityUniversity of Wisconsin.
Memory Consistency Models Some material borrowed from Sarita Adve’s (UIUC) tutorial on memory consistency models.
Maria-Cristina Marinescu Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology A Synthesis Algorithm for Modular Design of.
Evaluation of Memory Consistency Models in Titanium.
Shared Memory Consistency Models: A Tutorial Sarita V. Adve Kouroush Ghrachorloo Western Research Laboratory September 1995.
Memory Consistency Models Alistair Rendell See “Shared Memory Consistency Models: A Tutorial”, S.V. Adve and K. Gharachorloo Chapter 8 pp of Wilkinson.
By Sarita Adve & Kourosh Gharachorloo Slides by Jim Larson Shared Memory Consistency Models: A Tutorial.
Shared Memory Consistency Models. SMP systems support shared memory abstraction: all processors see the whole memory and can perform memory operations.
Fence Scoping Changhui Lin †, Vijay Nagarajan*, Rajiv Gupta † † University of California, Riverside * University of Edinburgh.
Memory Consistency Models. Outline Review of multi-threaded program execution on uniprocessor Need for memory consistency models Sequential consistency.
1 CSEP590 – Model Checking and Automated Verification Lecture outline for August 6, 2003.
Pattern-based Synthesis of Synchronization for the C++ Memory Model Yuri Meshman, Noam Rinetzky, Eran Yahav 1.
CS 295 – Memory Models Harry Xu Oct 1, Multi-core Architecture Core-local L1 cache L2 cache shared by cores in a processor All processors share.
Complexity Implications of Memory Models. Out-of-Order Execution Avoid with fences (and atomic operations) Shared memory processes reordering buffer Hagit.
ICFEM 2002, Shanghai Reasoning about Hardware and Software Memory Models Abhik Roychoudhury School of Computing National University of Singapore.
Getting Rid of Store-Buffers in TSO Analysis Mohamed Faouzi Atig Uppsala University, Sweden Ahmed Bouajjani LIAFA, University of Paris 7, France LIAFA,
CS533 Concepts of Operating Systems Jonathan Walpole.
CSV 889: Concurrent Software Verification Subodh Sharma Indian Institute of Technology Delhi Relaxed Memory Effects and its Verification.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
CISC 879 : Advanced Parallel Programming Rahul Deore Dept. of Computer & Information Sciences University of Delaware Exploring Memory Consistency for Massively-Threaded.
/ PSWLAB Thread Modular Model Checking by Cormac Flanagan and Shaz Qadeer (published in Spin’03) Hong,Shin Thread Modular Model.
Abstractions for Relaxed Memory Models Andrei Dan, Yuri Meshman, Martin Vechev, Eran Yahav 1.
Introduction to distributed systems description relation to practice variables and communication primitives instructions states, actions and programs synchrony.
Fundamentals of Memory Consistency Smruti R. Sarangi Prereq: Slides for Chapter 11 (Multiprocessor Systems), Computer Organisation and Architecture, Smruti.
740: Computer Architecture Memory Consistency Prof. Onur Mutlu Carnegie Mellon University.
Symmetric Multiprocessors: Synchronization and Sequential Consistency
An Operational Approach to Relaxed Memory Models
Memory Consistency Models
Memory Consistency Models
Abstraction-Guided Synthesis
Threads and Memory Models Hal Perkins Autumn 2011
Symmetric Multiprocessors: Synchronization and Sequential Consistency
Shared Memory Consistency Models: A Tutorial
Symmetric Multiprocessors: Synchronization and Sequential Consistency
Threads and Memory Models Hal Perkins Autumn 2009
Shared Memory Consistency Models: A Tutorial
Synthesis of Memory Fences via Refinement Propagation
Memory Consistency Models
Amir Kamil and Katherine Yelick
Xinyu Feng University of Science and Technology of China
CSE 153 Design of Operating Systems Winter 19
Relaxed Consistency Part 2
Relaxed Consistency Finale
CS 152 Computer Architecture and Engineering CS252 Graduate Computer Architecture Lecture 19 Memory Consistency Models Krste Asanovic Electrical Engineering.
Abstraction-Guided Synthesis of synchronization
Presentation transcript:

PARTIAL-COHERENCE ABSTRACTIONS FOR RELAXED MEMORY MODELS Presented by Michael Kuperstein, Technion Joint work with Martin Vechev, IBM Research and Eran Yahav, Technion 1

Sequential Consistency  We expect our programs to have  “Interleaving semantics”  Consistent with program order “The result of any execution is the same as if the operations of all the processors were executed in some sequential order, and the operations of each individual processor appear in this sequence in the order specified by its program.” – Leslie Lamport,

Process 0: flag[0] := true while flag[1] = true { if turn ≠ 0 { flag[0] := false while turn ≠ 0 { } flag[0] := true } // critical section turn := 1 flag[0] := false Process 1: flag[1] := true while flag[0] = true { if turn ≠ 1 { flag[1] := false while turn ≠ 1 { } flag[1] := true } // critical section turn := 0 flag[1] := false 3 Dekker’s Algorithm for Mutual Exclusion Specification: mutual exclusion over critical section

… P0 Main Memory … P1 … … … … X Y Z X Y Z 123 Store Buffer Based Models 4  TSO & PSO  x86 ~ TSO  Memory Fences  Restore order  Every store before the fence becomes globally visible before anything after the fence executes storeflush load fence

Process 0: flag[0] := true fence while flag[1] = true { if turn ≠ 0 { flag[0] := false fence while turn ≠ 0 { } flag[0] := true fence } // critical section turn := 1 fence flag[0] := false fence 5 Memory Fences  Fences are expensive  10s-100s of cycles  Practical Significance  Data structures  Linux Kernel spinlocks  Placing fences manually  Overfencing: hurts performance  Underfencing: subtle bugs

Process 0: flag[0] := true fence while flag[1] = true { if turn ≠ 0 { flag[0] := false while turn ≠ 0 { } flag[0] := true } // critical section turn := 1 flag[0] := false 6 Memory Fences  Fences are expensive  10s-100s of cycles  Practical Significance  Data structures  Linux Kernel spinlocks  Placing fences manually  Overfencing: hurts performance  Underfencing: subtle bugs

Automatic Solutions  Equivalence to Sequential Consistency  Reduce program behaviors to sequentially consistent (SC) runs  High-level specifications are ignored  Goes back to Shasha & Snir [TOPLAS ’88]  Place fences to satisfy provided specification  Using specification may forbid less executions  May require fewer fences 7 Safe SC PSO

Goal  P’ satisfies the specification S under M Finite-State Program P Finite-State Program P Safety Specification S Safety Specification S Memory Model M Memory Model M Program P’ with Fences 8

General Recipe 1. Compute reachable states 2. Compute weakest constraints that guarantee all “bad states” are avoided 3. Implement the constraints with fences 9

Constraints 10  Constraint language  Not every transition can be prevented using a fence 10 P 2 : (D) LOAD R1 = X P 1 : (D) LOAD R1 = X P1:P1: P2:P2: 123 ABC X X P1:P1: P2:P2: 123 ABC X X P1:P1: P2:P2: 123 ABC X X P1:P1: P2:P2: 123 ABC X X Unavoidable [A < D]  [B < D]  [C < D]

Concrete Transition System 11  Building transition system under TSO/PSO is hard  No a-priori bound on buffer length  Unbounded state-space Even for programs that were finite-state under SC  Reachability has non-primitive recursive complexity [Atig et al., POPL ’10]

Abstract Memory Models (AMM) 12  Bounded approximation of unbounded buffers  Strictly weaker than concrete TSO/PSO  Finite-state programs remain finite-state  Reachability becomes effectively computable  Construct finite (abstract) transition system Apply fence inference Can also be used for verification Safe SC PSO AMM

Partial Coherence Abstractions 13 … P0 Main Memory … P1 … … … … X Y Z X Y X P0 Main Memory P1 X Z X Y Z Recent value Bounded length k Unordered elements Y Allows precise fence semantics Allows precise loads from buffer Keeps the analysis precise for “well behaved” programs Record what values appeared (without order or number)

Partial Coherence Abstractions {2,3,4,5} Concrete Abstract

Abstract Fence Inference 1. Compute reachable abstract states 2. Compute constraints. Precision depends on abstraction. 3. Implement the constraints with fences 15

Fence Inference Results 16  Benchmarks are mutual exclusion primitives  k - the bound on the FIFO part of the abstract buffer  PD more “aggressive” than FD ProgramFD k=0FD k=1FD k=2PD k=0PD k=1PD k=2 Sense0   Pet0  Dek0  Lam0    Fast0  Fast1a   Fast1b    Fast1c  

Summary  Partial-coherence abstractions  Verification without arbitrary bounds  Abstraction precision affects quality of results  Synthesis of fences  Can infer optimal fences for mutual exclusion primitives 17 P P S S M M P’

Questions 18

Related Work  Under-approximation  CheckFence [Burckhardt et al., PLDI ’07]  Fender [KVY, FMCAD ’10]  And more…  Over-approximation  Equivalence to SC Very imprecise Goes back to Shasha & Snir [TOPLAS ‘88]  Abstract Interpretation Varying precision Regular Abstraction [Linden et al., SPIN ’10] Partial-Coherence [KVY, PLDI ’11] 19