Automatically Comparing Memory Consistency Models John Wickerson - - PowerPoint PPT Presentation

automatically comparing memory consistency models
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Automatically Comparing Memory Consistency Models

1

John Wickerson Imperial Mark Batty U Kent Tyler Sorensen Imperial George A. Constantinides Imperial

S-REPLS @ Imperial Tuesday 27 September 2016

C++

x86

slide-2
SLIDE 2

Contents

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

2

slide-3
SLIDE 3

Contents

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

3

slide-4
SLIDE 4

Relaxed-memory behaviours

4

x = 1; y = 1; x = y = 0; r0 = y; r1 = x;

slide-5
SLIDE 5

Relaxed-memory behaviours

5

x = 1; x = y = 0; r0 = y; y = 1; r1 = x; r0 = 0, r1 = 1

slide-6
SLIDE 6

Relaxed-memory behaviours

6

x = 1; x = y = 0; r0 = y; y = 1; r1 = x; r0 = 0, r1 = 1 r0 = 1, r1 = 1

slide-7
SLIDE 7

Relaxed-memory behaviours

7

x = 1; x = y = 0; r0 = y; y = 1; r1 = x; r0 = 0, r1 = 1 r0 = 1, r1 = 1 r0 = 1, r1 = 0

slide-8
SLIDE 8

Relaxed-memory behaviours

8

x = 1; y = 1; x = y = 0; r0 = y; r1 = x; r0 = 0, r1 = 1 r0 = 1, r1 = 1 r0 = 1, r1 = 0 r0 = 0, r1 = 0

slide-9
SLIDE 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

slide-10
SLIDE 10

Axiomatic models

10

x = 1; y = 1; r0 = y; r1 = x;

slide-11
SLIDE 11

Axiomatic models

11

x = 1; y = 1; r0 = y; r1 = x;

W x=1 R y=1 W y=1 R x=0 sb sb rf

slide-12
SLIDE 12

Axiomatic models

12

x = 1; y = 1; r0 = y; r1 = x;

W x=1 R y=1 W y=1 R x=0 sb sb rf W x=1 R y=0 W y=1 R x=1 rf sb sb

slide-13
SLIDE 13

Axiomatic models

13

x = 1; y = 1; r0 = y; r1 = x;

W x=1 R y=1 W y=1 R x=1 rf sb sb rf W x=1 R y=1 W y=1 R x=0 sb sb rf W x=1 R y=0 W y=1 R x=1 rf sb sb

slide-14
SLIDE 14

Axiomatic models

14

x = 1; y = 1; r0 = y; r1 = x;

W x=1 R y=1 W y=1 R x=1 rf sb sb rf W x=1 R y=1 W y=1 R x=0 sb sb rf W x=1 R y=0 W y=1 R x=1 rf sb sb W x=1 R y=0 W y=1 R x=0 sb sb

slide-15
SLIDE 15

Axiomatic models

15

x = 1; y = 1; r0 = y; r1 = x;

W x=1 R y=1 W y=1 R x=1 rf sb sb rf W x=1 R y=1 W y=1 R x=0 sb sb rf W x=1 R y=0 W y=1 R x=1 rf sb sb W x=1 R y=0 W y=1 R x=0 sb sb

SC ✓

slide-16
SLIDE 16

Axiomatic models

16

x = 1; y = 1; r0 = y; r1 = x;

W x=1 R y=1 W y=1 R x=1 rf sb sb rf W x=1 R y=1 W y=1 R x=0 sb sb rf W x=1 R y=0 W y=1 R x=1 rf sb sb W x=1 R y=0 W y=1 R x=0 sb sb

SC ✓ SC ✓

slide-17
SLIDE 17

Axiomatic models

17

x = 1; y = 1; r0 = y; r1 = x;

W x=1 R y=1 W y=1 R x=1 rf sb sb rf W x=1 R y=1 W y=1 R x=0 sb sb rf W x=1 R y=0 W y=1 R x=1 rf sb sb W x=1 R y=0 W y=1 R x=0 sb sb

SC ✓ SC ✓ SC ✓

slide-18
SLIDE 18

Axiomatic models

18

x = 1; y = 1; r0 = y; r1 = x;

W x=1 R y=1 W y=1 R x=1 rf sb sb rf W x=1 R y=1 W y=1 R x=0 sb sb rf W x=1 R y=0 W y=1 R x=1 rf sb sb W x=1 R y=0 W y=1 R x=0 sb sb

SC ✓ SC ✓ SC ✓ SC ×

slide-19
SLIDE 19

Axiomatic models

19

x = 1; y = 1; r0 = y; r1 = x;

W x=1 R y=1 W y=1 R x=1 rf sb sb rf W x=1 R y=1 W y=1 R x=0 sb sb rf W x=1 R y=0 W y=1 R x=1 rf sb sb W x=1 R y=0 W y=1 R x=0 sb sb

x86 ✓ SC ✓ SC ✓ SC ✓ SC ×

slide-20
SLIDE 20

Axiomatic models

20

x = 1; y = 1; r0 = y; r1 = x;

W x=1 R y=1 W y=1 R x=1 rf sb sb rf W x=1 R y=1 W y=1 R x=0 sb sb rf W x=1 R y=0 W y=1 R x=1 rf sb sb W x=1 R y=0 W y=1 R x=0 sb sb

x86 ✓ SC ✓ SC ✓ x86 ✓ SC ✓ SC ×

slide-21
SLIDE 21

Axiomatic models

21

x = 1; y = 1; r0 = y; r1 = x;

W x=1 R y=1 W y=1 R x=1 rf sb sb rf W x=1 R y=1 W y=1 R x=0 sb sb rf W x=1 R y=0 W y=1 R x=1 rf sb sb W x=1 R y=0 W y=1 R x=0 sb sb

x86 ✓ SC ✓ x86 ✓ SC ✓ x86 ✓ SC ✓ SC ×

slide-22
SLIDE 22

Axiomatic models

22

x = 1; y = 1; r0 = y; r1 = x;

W x=1 R y=1 W y=1 R x=1 rf sb sb rf W x=1 R y=1 W y=1 R x=0 sb sb rf W x=1 R y=0 W y=1 R x=1 rf sb sb W x=1 R y=0 W y=1 R x=0 sb sb

x86 ✓ SC ✓ x86 ✓ SC ✓ x86 ✓ SC ✓ x86 ✓ SC ×

slide-23
SLIDE 23

Contents

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

23

slide-24
SLIDE 24

Some challenges and current approaches to tackling them

24

Question Existing work

slide-25
SLIDE 25

Some challenges and current approaches to tackling them

25

Question Existing work Can a given litmus test pass under a given MCM?

slide-26
SLIDE 26

Some challenges and current approaches to tackling them

26

Question Existing work Can a given litmus test pass under a given MCM? CppMem, Herd, MemSAT, Nemos, ...

slide-27
SLIDE 27

Some challenges and current approaches to tackling them

27

Question Existing work Can a given litmus test pass under a given MCM? CppMem, Herd, MemSAT, Nemos, ... Which litmus tests can be run to check whether a machine conforms to a given MCM?

slide-28
SLIDE 28

Some challenges and current approaches to tackling them

28

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


slide-29
SLIDE 29

Some challenges and current approaches to tackling them

29

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

slide-30
SLIDE 30

Some challenges and current approaches to tackling them

30

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

slide-31
SLIDE 31

Some challenges and current approaches to tackling them

31

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

slide-32
SLIDE 32

Some challenges and current approaches to tackling them

32

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


slide-33
SLIDE 33

Some challenges and current approaches to tackling them

33

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

slide-34
SLIDE 34

Some challenges and current approaches to tackling them

34

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


slide-35
SLIDE 35

Our contributions

35

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

slide-36
SLIDE 36

Our contributions

36

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

slide-37
SLIDE 37

Our contributions

37

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


slide-38
SLIDE 38

Our contributions

38

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


slide-39
SLIDE 39

Our contributions

39

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


slide-40
SLIDE 40

Contents

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

40

slide-41
SLIDE 41

Key Idea 1

slide-42
SLIDE 42

Key Idea 1

  • What are M's conformance tests?


Find (P,σ) where σ ∉ obsM(P) and σ ∈ obs0(P).

slide-43
SLIDE 43

Key Idea 1

  • What are M's conformance tests?


Find (P,σ) where σ ∉ obsM(P) and σ ∈ obs0(P).

  • Is M stronger than N?


No if ∃(P,σ) where σ ∉ obsN(P) and σ ∈ obsM(P).

slide-44
SLIDE 44

Key Idea 1

  • What are M's conformance tests?


Find (P,σ) where σ ∉ obsM(P) and σ ∈ obs0(P).

  • Is M stronger than N?


No if ∃(P,σ) where σ ∉ obsN(P) and σ ∈ obsM(P).

  • Does M allow my optimisation?


No if ∃(P,Q,σ) where σ ∉ obsM(P), σ ∈ obsM(Q) and P optimises to Q.

slide-45
SLIDE 45

Key Idea 1

  • What are M's conformance tests?


Find (P,σ) where σ ∉ obsM(P) and σ ∈ obs0(P).

  • Is M stronger than N?


No if ∃(P,σ) where σ ∉ obsN(P) and σ ∈ obsM(P).

  • Does M allow my optimisation?


No if ∃(P,Q,σ) where σ ∉ obsM(P), σ ∈ obsM(Q) and P optimises to Q.

  • Can M be implemented by my mapping to N?


No if ∃(P,Q,σ) where σ ∉ obsM(P), σ ∈ obsN(Q) and P compiles to Q.

slide-46
SLIDE 46

Key Idea 1

  • What are M's conformance tests?


Find (P,σ) where σ ∉ obsM(P) and σ ∈ obs0(P).

  • Is M stronger than N?


No if ∃(P,σ) where σ ∉ obsN(P) and σ ∈ obsM(P).

  • Does M allow my optimisation?


No if ∃(P,Q,σ) where σ ∉ obsM(P), σ ∈ obsM(Q) and P optimises to Q.

  • Can M be implemented by my mapping to N?


No if ∃(P,Q,σ) where σ ∉ obsM(P), σ ∈ obsN(Q) and P compiles to Q.

{(P,Q,σ) | σ ∉ obsM(P) ∧ σ ∈ obsN(Q) ∧ P ▸ Q}

slide-47
SLIDE 47

Key Idea 2

{(P,Q,σ) | σ ∉ obsM(P) ∧ σ ∈ obsN(Q) ∧ P ▸ Q}

slide-48
SLIDE 48

Key Idea 2

P {(P,Q,σ) | σ ∉ obsM(P) ∧ σ ∈ obsN(Q) ∧ P ▸ Q}

slide-49
SLIDE 49

Key Idea 2

P Q {(P,Q,σ) | σ ∉ obsM(P) ∧ σ ∈ obsN(Q) ∧ P ▸ Q}

slide-50
SLIDE 50

Key Idea 2

P Q ▸ {(P,Q,σ) | σ ∉ obsM(P) ∧ σ ∈ obsN(Q) ∧ P ▸ Q}

slide-51
SLIDE 51

Key Idea 2

P Q Y ▸ Y'

some (consistent)
 execution must reach σ

{

{(P,Q,σ) | σ ∉ obsM(P) ∧ σ ∈ obsN(Q) ∧ P ▸ Q}

slide-52
SLIDE 52

Key Idea 2

P Q X Y ▸ X' Y'

every (consistent) execution must 
 not reach σ some (consistent)
 execution must reach σ

{ {

{(P,Q,σ) | σ ∉ obsM(P) ∧ σ ∈ obsN(Q) ∧ P ▸ Q}

slide-53
SLIDE 53

Key Idea 2

X Y {(P,Q,σ) | σ ∉ obsM(P) ∧ σ ∈ obsN(Q) ∧ P ▸ Q}

slide-54
SLIDE 54

Key Idea 2

X Y ∈ consistentN {(P,Q,σ) | σ ∉ obsM(P) ∧ σ ∈ obsN(Q) ∧ P ▸ Q}

slide-55
SLIDE 55

∉ consistentM

Key Idea 2

X Y ∈ consistentN {(P,Q,σ) | σ ∉ obsM(P) ∧ σ ∈ obsN(Q) ∧ P ▸ Q}

slide-56
SLIDE 56

∉ consistentM

Key Idea 2

P Q X Y ∈ consistentN {(P,Q,σ) | σ ∉ obsM(P) ∧ σ ∈ obsN(Q) ∧ P ▸ Q}

slide-57
SLIDE 57

∉ consistentM

Key Idea 2

P Q X Y ▹ ∈ consistentN {(P,Q,σ) | σ ∉ obsM(P) ∧ σ ∈ obsN(Q) ∧ P ▸ Q}

slide-58
SLIDE 58

∉ consistentM

Key Idea 2

P Q X Y ▸ ▹ ∈ consistentN {(P,Q,σ) | σ ∉ obsM(P) ∧ σ ∈ obsN(Q) ∧ P ▸ Q}

slide-59
SLIDE 59

∉ consistentM

Key Idea 2

P Q X Y ▸ Y' ▹ ∈ consistentN {(P,Q,σ) | σ ∉ obsM(P) ∧ σ ∈ obsN(Q) ∧ P ▸ Q}

slide-60
SLIDE 60

∉ consistentM

Key Idea 2

P Q X Y ▸ X' Y' ▹ ∈ consistentN {(P,Q,σ) | σ ∉ obsM(P) ∧ σ ∈ obsN(Q) ∧ P ▸ Q}

slide-61
SLIDE 61

∉ consistentM

Key Idea 2

P Q X Y ▸ X' Y' ▹ ∈ consistentN ∈ deadM {(P,Q,σ) | σ ∉ obsM(P) ∧ σ ∈ obsN(Q) ∧ P ▸ Q}

slide-62
SLIDE 62

The Alloy Constraint Solver

slide-63
SLIDE 63

Contents

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

63

slide-64
SLIDE 64

Comparing "strong release-acquire" 
 to original release-acquire

slide-65
SLIDE 65

Comparing "strong release-acquire" 
 to original release-acquire

WREL x 1 WREL y 2 RACQ y 1 WREL y 1 WREL x 2 RACQ x 1 co co rf rf sb sb sb sb

atomic_int x=0,y=0; x.store(1,REL); y.store(2,REL); r0=y.load(ACQ); y.store(1,REL); x.store(2,REL); r1=x.load(ACQ); r0==1 && r1==1

which we confirmed with Lahav et al. to be sufficient.

slide-66
SLIDE 66
  • Cf. Nienhuis et al. (OOPSLA '16):

Comparing Nienhuis et al.'s 
 C++ variant to the original

slide-67
SLIDE 67
  • Cf. Nienhuis et al. (OOPSLA '16):

Comparing Nienhuis et al.'s 
 C++ variant to the original

solution requiring 12 events and 6 threads

CRLX y 4/5 FREL WRLX x 1 CREL y 2/3 WRLX y 4 CACQ x 1/2 CREL x 2/3 WSC x 4 CSC y 1/2 CREL x 4/5 FAR WRLX y 1 sb sb sb sb sb sb co co co rf co rf co rf co rf co rf co rf

slide-68
SLIDE 68

Comparing Batty et al.'s 
 C++ variant to the original

slide-69
SLIDE 69

Comparing Batty et al.'s 
 C++ variant to the original

follows: WRLX x 1 CSC x 1/2 RSC y 0 WSC y 1 RSC x 1 S S sb sb S co rf rf

atomic_int x=0,y=0; x.store(1,RLX); r0=x.cas(1,2,SC,RLX); r1=y.load(SC); y.store(1,SC); r2=x.load(SC); r0==true && r1==0 && r2==1

slide-70
SLIDE 70

Does C++ allow "linearisation"?

slide-71
SLIDE 71

Does C++ allow "linearisation"?

RRLX x 1 Rna a 1 WSC y 1 RRLX y 1 WRLX x 1 Wna a 1 RRLX x 1 Rna a 1 WSC y 1 RRLX y 1 WRLX x 1 Wna a 1 sb cd sb cd sb cd sb cd sb cd sb cd sb rf rf rf rf rf rf π π π π π π

slide-72
SLIDE 72

Is AMD's OpenCL 
 compiler mapping sound?

slide-73
SLIDE 73

Is AMD's OpenCL 
 compiler mapping sound?

a: CAR,WG x 0/1 b: WREL,DV,REM x 2 co ⇣x 7!vd 2

x 7!L 0

⌘ InvA ⇣x 7!vd 2

x 7!L 0

⌘ ⇣

x 7!L 0

⌘ W x 2 ⇣x 7!vd 2

x 7!L 0

⌘ ⇣

x 7!L 0

⌘ Flu ⇣

x 7!L 0

⌘ ⇣

x 7! 0

⌘ Lk x ⇣

x 7!L 0

⌘ ⇣x 7!vd 2

x 7!L 0

⌘ Uk x ⇣x 7!vd 2

x 7! 0

⌘ ⇣

x 7! 0

⌘ fet x ⇣x 7!vc 0

x 7! 0

⌘ ⇣x 7!vc 0

x 7! 0

⌘ C x 0/1 ⇣x 7!vd 1

x 7! 0

⌘ ⇣x 7!vd 2

x 7! 0

⌘ flu x ⇣x 7!vc 2

x 7! 2

⌘ ⇣x 7!vd 1

x 7! 2

⌘ flu x ⇣x 7!vc 1

x 7! 1

⌘ co π π

slide-74
SLIDE 74

Checking and fixing an OpenCL/PTX compiler mapping

  • PTX MCM proposed by Alglave et al. (ASPLOS '15)
  • "Obvious" OpenCL/PTX mapping is invalid
  • Manually revise PTX MCM (to obtain "PTX2")
  • Now mapping is valid
  • Run litmus tests that distinguish PTX/PTX2 against

GPU hardware to validate PTX2

slide-75
SLIDE 75

Contents

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

75

slide-76
SLIDE 76

Automatically Comparing Memory Consistency Models

76

John Wickerson Imperial Mark Batty U Kent Tyler Sorensen Imperial George A. Constantinides Imperial

Newcastle University Wednesday 31 August 2016

C++

x86