automatically comparing memory consistency models
play

Automatically Comparing Memory Consistency Models John Wickerson - PowerPoint PPT Presentation

C++ x86 Automatically Comparing Memory Consistency Models John Wickerson Mark Batty Tyler Sorensen George A. Constantinides Imperial U Kent Imperial Imperial S-REPLS @ Imperial Tuesday 27 September 2016 1 Contents Context: memory


  1. C++ x86 Automatically Comparing Memory Consistency Models John Wickerson Mark Batty Tyler Sorensen George A. Constantinides Imperial U Kent Imperial Imperial S-REPLS @ Imperial Tuesday 27 September 2016 1

  2. Contents • Context: memory consistency models (MCMs) • Where our work fits in • Key Ideas • Applications 2

  3. Contents • Context: memory consistency models (MCMs) • Where our work fits in • Key Ideas • Applications 3

  4. Relaxed-memory behaviours x = y = 0; x = 1; y = 1; r0 = y; r1 = x; 4

  5. Relaxed-memory behaviours x = y = 0; x = 1; r0 = y; y = 1; r1 = x; r0 = 0, r1 = 1 5

  6. Relaxed-memory behaviours x = y = 0; x = 1; y = 1; r0 = y; r1 = x; r0 = 0, r1 = 1 r0 = 1, r1 = 1 6

  7. Relaxed-memory behaviours x = y = 0; y = 1; r1 = x; x = 1; r0 = y; r0 = 0, r1 = 1 r0 = 1, r1 = 1 r0 = 1, r1 = 0 7

  8. Relaxed-memory behaviours x = y = 0; x = 1; y = 1; r0 = y; r1 = x; r0 = 0, r1 = 0 r0 = 0, r1 = 1 r0 = 1, r1 = 1 r0 = 1, r1 = 0 8

  9. Much confusion! Subtleties related to relaxed memory have led to bugs in... • programming language specifications 
 [Batty+ POPL'11, Batty+ ESOP'13] , • deployed processors [Alglave+ CAV'10] ; • compilers [Morisset+ PLDI'13, Sevcik+ ECOOP'08] , and • vendor-endorsed programming guides 
 [Alglave+ ASPLOS'15] . 9

  10. Axiomatic models x = 1; y = 1; r0 = y; r1 = x; 10

  11. Axiomatic models W x=1 W y=1 sb rf sb R y=1 R x=0 x = 1; y = 1; r0 = y; r1 = x; 11

  12. Axiomatic models W x=1 W y=1 W x=1 W y=1 sb rf sb sb rf sb R y=1 R x=0 R y=0 R x=1 x = 1; y = 1; r0 = y; r1 = x; 12

  13. Axiomatic models W x=1 W y=1 W x=1 W y=1 sb rf sb sb rf sb R y=1 R x=0 R y=0 R x=1 x = 1; y = 1; r0 = y; r1 = x; W x=1 W y=1 sb rf rf sb R y=1 R x=1 13

  14. Axiomatic models W x=1 W y=1 W x=1 W y=1 sb rf sb sb rf sb R y=1 R x=0 R y=0 R x=1 x = 1; y = 1; r0 = y; r1 = x; W x=1 W y=1 W x=1 W y=1 sb rf rf sb sb sb R y=1 R x=1 R y=0 R x=0 14

  15. Axiomatic models W x=1 W y=1 W x=1 W y=1 sb rf sb sb rf sb R y=1 R x=0 R y=0 R x=1 SC ✓ x = 1; y = 1; r0 = y; r1 = x; W x=1 W y=1 W x=1 W y=1 sb rf rf sb sb sb R y=1 R x=1 R y=0 R x=0 15

  16. Axiomatic models W x=1 W y=1 W x=1 W y=1 sb rf sb sb rf sb R y=1 R x=0 R y=0 R x=1 SC ✓ SC ✓ x = 1; y = 1; r0 = y; r1 = x; W x=1 W y=1 W x=1 W y=1 sb rf rf sb sb sb R y=1 R x=1 R y=0 R x=0 16

  17. Axiomatic models W x=1 W y=1 W x=1 W y=1 sb rf sb sb rf sb R y=1 R x=0 R y=0 R x=1 SC ✓ SC ✓ x = 1; y = 1; r0 = y; r1 = x; W x=1 W y=1 W x=1 W y=1 sb rf rf sb sb sb R y=1 R x=1 R y=0 R x=0 SC ✓ 17

  18. Axiomatic models W x=1 W y=1 W x=1 W y=1 sb rf sb sb rf sb R y=1 R x=0 R y=0 R x=1 SC ✓ SC ✓ x = 1; y = 1; r0 = y; r1 = x; W x=1 W y=1 W x=1 W y=1 sb rf rf sb sb sb R y=1 R x=1 R y=0 R x=0 SC ✓ SC × 18

  19. Axiomatic models W x=1 W y=1 W x=1 W y=1 sb rf sb sb rf sb R y=1 R x=0 R y=0 R x=1 x86 ✓ SC ✓ SC ✓ x = 1; y = 1; r0 = y; r1 = x; W x=1 W y=1 W x=1 W y=1 sb rf rf sb sb sb R y=1 R x=1 R y=0 R x=0 SC ✓ SC × 19

  20. Axiomatic models W x=1 W y=1 W x=1 W y=1 sb rf sb sb rf sb R y=1 R x=0 R y=0 R x=1 x86 ✓ SC ✓ x86 ✓ SC ✓ x = 1; y = 1; r0 = y; r1 = x; W x=1 W y=1 W x=1 W y=1 sb rf rf sb sb sb R y=1 R x=1 R y=0 R x=0 SC ✓ SC × 20

  21. Axiomatic models W x=1 W y=1 W x=1 W y=1 sb rf sb sb rf sb R y=1 R x=0 R y=0 R x=1 x86 ✓ SC ✓ x86 ✓ SC ✓ x = 1; y = 1; r0 = y; r1 = x; W x=1 W y=1 W x=1 W y=1 sb rf rf sb sb sb R y=1 R x=1 R y=0 R x=0 x86 ✓ SC ✓ SC × 21

  22. Axiomatic models W x=1 W y=1 W x=1 W y=1 sb rf sb sb rf sb R y=1 R x=0 R y=0 R x=1 x86 ✓ SC ✓ x86 ✓ SC ✓ x = 1; y = 1; r0 = y; r1 = x; W x=1 W y=1 W x=1 W y=1 sb rf rf sb sb sb R y=1 R x=1 R y=0 R x=0 x86 ✓ SC ✓ x86 ✓ SC × 22

  23. Contents • Context: memory consistency models (MCMs) • Where our work fits in • Key Ideas • Applications 23

  24. Some challenges and current approaches to tackling them Question Existing work 24

  25. Some challenges and current approaches to tackling them Question Existing work Can a given litmus test pass under a given MCM? 25

  26. Some challenges and current approaches to tackling them Question Existing work Can a given litmus test pass CppMem, Herd, MemSAT, Nemos, ... under a given MCM? 26

  27. Some challenges and current approaches to tackling them Question Existing work Can a given litmus test pass CppMem, Herd, MemSAT, Nemos, ... under a given MCM? Which litmus tests can be run to check whether a machine conforms to a given MCM? 27

  28. Some challenges and current approaches to tackling them Question Existing work Can a given litmus test pass CppMem, Herd, MemSAT, Nemos, ... under a given MCM? Which litmus tests can be run semi-automatic generation 
 to check whether a machine with DIY [Alglave+ CAV'10]; 
 conforms to a given MCM? 28

  29. Some challenges and current approaches to tackling them Question Existing work Can a given litmus test pass CppMem, Herd, MemSAT, Nemos, ... under a given MCM? Which litmus tests can be run semi-automatic generation 
 to check whether a machine with DIY [Alglave+ CAV'10]; 
 conforms to a given MCM? Is one MCM more permissive than another? 29

  30. Some challenges and current approaches to tackling them Question Existing work Can a given litmus test pass CppMem, Herd, MemSAT, Nemos, ... under a given MCM? Which litmus tests can be run semi-automatic generation 
 to check whether a machine with DIY [Alglave+ CAV'10]; 
 conforms to a given MCM? manual proof; manual examples [Batty+ POPL'16] ; 
 Is one MCM more permissive semi-automatic checking with DIY+Herd; than another? 30

  31. Some challenges and current approaches to tackling them Question Existing work Can a given litmus test pass CppMem, Herd, MemSAT, Nemos, ... under a given MCM? Which litmus tests can be run semi-automatic generation 
 to check whether a machine with DIY [Alglave+ CAV'10]; 
 conforms to a given MCM? manual proof; manual examples [Batty+ POPL'16] ; 
 Is one MCM more permissive semi-automatic checking with DIY+Herd; than another? Does my MCM allow a given compiler optimisation? 31

  32. Some challenges and current approaches to tackling them Question Existing work Can a given litmus test pass CppMem, Herd, MemSAT, Nemos, ... under a given MCM? Which litmus tests can be run semi-automatic generation 
 to check whether a machine with DIY [Alglave+ CAV'10]; 
 conforms to a given MCM? manual proof; manual examples [Batty+ POPL'16] ; 
 Is one MCM more permissive semi-automatic checking with DIY+Herd; than another? manual c'examples [Vafeiaidis+ POPL'15] ; 
 Does my MCM allow a given manual proof [Sevcik PLDI'11]; 
 compiler optimisation? 32

  33. Some challenges and current approaches to tackling them Question Existing work Can a given litmus test pass CppMem, Herd, MemSAT, Nemos, ... under a given MCM? Which litmus tests can be run semi-automatic generation 
 to check whether a machine with DIY [Alglave+ CAV'10]; 
 conforms to a given MCM? manual proof; manual examples [Batty+ POPL'16] ; 
 Is one MCM more permissive semi-automatic checking with DIY+Herd; than another? manual c'examples [Vafeiaidis+ POPL'15] ; 
 Does my MCM allow a given manual proof [Sevcik PLDI'11]; 
 compiler optimisation? Does my MCM allow a given compiler mapping? 33

  34. Some challenges and current approaches to tackling them Question Existing work Can a given litmus test pass CppMem, Herd, MemSAT, Nemos, ... under a given MCM? Which litmus tests can be run semi-automatic generation 
 to check whether a machine with DIY [Alglave+ CAV'10]; 
 conforms to a given MCM? manual proof; manual examples [Batty+ POPL'16] ; 
 Is one MCM more permissive semi-automatic checking with DIY+Herd; than another? manual c'examples [Vafeiaidis+ POPL'15] ; 
 Does my MCM allow a given manual proof [Sevcik PLDI'11]; 
 compiler optimisation? manual c'examples [Wickerson+ OOPSLA'15] ; 
 Does my MCM allow a given manual proof [Batty+ POPL'11, Batty+ POPL'12]; 
 compiler mapping? 34

  35. Our contributions Question Existing work Can a given litmus test pass CppMem, Herd, MemSAT, Nemos, ... under a given MCM? Which litmus tests can be run semi-automatic generation 
 to check whether a machine with DIY [Alglave+ CAV'10]; 
 conforms to a given MCM? manual proof; manual examples [Batty+ POPL'16] ; 
 Is one MCM more permissive semi-automatic checking with DIY+Herd; than another? manual c'examples [Vafeiaidis+ POPL'15] ; 
 Does my MCM allow a given manual proof [Sevcik PLDI'11]; compiler optimisation? manual c'examples [Wickerson+ OOPSLA'15] ; 
 Does my MCM allow a given manual proof [Batty+ POPL'11, Batty+ POPL'12]; compiler mapping? 35

Recommend


More recommend