0 Correct Programming Compiler Compiler Hardware Language P - - PowerPoint PPT Presentation

0
SMART_READER_LITE
LIVE PREVIEW

0 Correct Programming Compiler Compiler Hardware Language P - - PowerPoint PPT Presentation

Bridging the Gap between Programming Languages and Hardware Weak Memory Models Anton Podkopaev Ori Lahav Viktor Vafeiadis 0 Correct Programming Compiler Compiler Hardware Language P Syntax PL compile P P PL HW PL HW is Memory Model


slide-1
SLIDE 1

Bridging the Gap between Programming Languages and Hardware Weak Memory Models

Anton Podkopaev Ori Lahav Viktor Vafeiadis

slide-2
SLIDE 2

1

Bridging the Gap between PL and Hardware Weak MMs Programming Language Hardware Compiler Correct Compiler P Syntax PL P PL compile P

HW PL HW is Memory Model

slide-3
SLIDE 3

1

Bridging the Gap between PL and Hardware Weak MMs Programming Language Hardware Compiler Correct Compiler P Syntax PL P PL compile P

HW PL HW is Memory Model

slide-4
SLIDE 4

1

Bridging the Gap between PL and Hardware Weak MMs Programming Language Hardware Compiler Correct Compiler P Syntax PL P PL compile P

HW PL HW is Memory Model

slide-5
SLIDE 5

1

Bridging the Gap between PL and Hardware Weak MMs Programming Language Hardware Compiler Correct Compiler P Syntax PL P PL compile P

HW PL HW is Memory Model

slide-6
SLIDE 6

1

Bridging the Gap between PL and Hardware Weak MMs Programming Language Hardware Compiler Correct Compiler ∀P ∈ Syntax(PL). PPL compile(P)HW

PL HW is Memory Model

slide-7
SLIDE 7

1

Bridging the Gap between PL and Hardware Weak MMs Programming Language Hardware Compiler Correct Compiler ∀P ∈ Syntax(PL). PPL compile(P)HW −{PL,HW} is Memory Model

slide-8
SLIDE 8

1

Bridging the Gap between PL and Hardware Weak MMs Programming Language Hardware Compiler Correct Compiler ∀P ∈ Syntax(PL). PPL compile(P)HW −{PL,HW} is Memory Model

slide-9
SLIDE 9

2 Strong (SC) MM disallows a b 1

Memory ; [x] ← 0 [y] ← 0 Values ; a = ⊥ b = ⊥ a := [x]; [y] := 1; b := [y]; [x] := b; ARM and POWER weak MMs allow a b 1!

slide-10
SLIDE 10

2 Strong (SC) MM disallows a b 1

Memory ; [x] ← 0 [y] ← 0 Values ; a = ⊥ b = ⊥ a := [x]; [y] := 1; b := [y]; [x] := b; ARM and POWER weak MMs allow a b 1!

slide-11
SLIDE 11

2 Strong (SC) MM disallows a b 1

Memory ; [x] ← 0 [y] ← 0 Values ; a = 0 b = ⊥ a := [x]; [y] := 1; b := [y]; [x] := b; ARM and POWER weak MMs allow a b 1!

slide-12
SLIDE 12

2 Strong (SC) MM disallows a b 1

Memory ; [x] ← 0 [y] ← 1 Values ; a = 0 b = ⊥ a := [x]; [y] := 1; b := [y]; [x] := b; ARM and POWER weak MMs allow a b 1!

slide-13
SLIDE 13

2 Strong (SC) MM disallows a b 1

Memory ; [x] ← 0 [y] ← 1 Values ; a = 0 b = 1 a := [x]; [y] := 1; b := [y]; [x] := b; ARM and POWER weak MMs allow a b 1!

slide-14
SLIDE 14

2 Strong (SC) MM disallows a b 1

Memory ; [x] ← 1 [y] ← 1 Values ; a = 0 b = 1 a := [x]; [y] := 1; b := [y]; [x] := b; ARM and POWER weak MMs allow a b 1!

slide-15
SLIDE 15

2 Strong (SC) MM disallows a b 1

Memory ; [x] ← 1 [y] ← 1 Values ; a = 0 b = 1 a := [x]; [y] := 1; b := [y]; [x] := b; ARM and POWER weak MMs allow a b 1!

slide-16
SLIDE 16

2 Strong (SC) MM disallows a = b = 1

Memory ; [x] ← 1 [y] ← 1 Values ; a = 0 b = 1 a := [x]; [y] := 1; b := [y]; [x] := b; ARM and POWER weak MMs allow a b 1!

slide-17
SLIDE 17

2 Strong (SC) MM disallows a = b = 1

Memory ; [x] ← 1 [y] ← 1 Values ; a = 0 b = 1 a := [x]; [y] := 1; b := [y]; [x] := b; ARM and POWER weak MMs allow a = b = 1!

slide-18
SLIDE 18

3

Bridging the Gap between PL and Hardware Weak MMs Promise (R)C11 WeakestMO

[Chakraborty and Vafeiadis, 2019]

IMM x86-TSO ARMv7 ARMv8.3 RISC-V POWER

CompCert Weak MMs

  • 1. Declarative
  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 4. Non-multicopy-atomic

w/o mutually recursive relations

plv.mpi-sws.org/imm/ Thank you!

slide-19
SLIDE 19

3

Bridging the Gap between PL and Hardware Weak MMs Promise (R)C11 WeakestMO

[Chakraborty and Vafeiadis, 2019]

IMM x86-TSO ARMv7 ARMv8.3 RISC-V POWER

CompCert Weak MMs

  • 1. Declarative
  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 4. Non-multicopy-atomic

w/o mutually recursive relations

plv.mpi-sws.org/imm/ Thank you!

slide-20
SLIDE 20

3

Bridging the Gap between PL and Hardware Weak MMs Promise (R)C11 WeakestMO

[Chakraborty and Vafeiadis, 2019]

IMM x86-TSO ARMv7 ARMv8.3 RISC-V POWER

CompCert Weak MMs

  • 1. Declarative
  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 4. Non-multicopy-atomic

w/o mutually recursive relations

plv.mpi-sws.org/imm/ Thank you!

slide-21
SLIDE 21

3

Bridging the Gap between PL and Hardware Weak MMs Promise (R)C11 WeakestMO

[Chakraborty and Vafeiadis, 2019]

IMM x86-TSO ARMv7 ARMv8.3 RISC-V POWER

CompCert Weak MMs

  • 1. Declarative
  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 4. Non-multicopy-atomic

w/o mutually recursive relations

plv.mpi-sws.org/imm/ Thank you!

slide-22
SLIDE 22

3

Bridging the Gap between PL and Hardware Weak MMs Promise (R)C11 WeakestMO

[Chakraborty and Vafeiadis, 2019]

IMM x86-TSO ARMv7 ARMv8.3 RISC-V POWER

CompCert Weak MMs

  • 1. Declarative
  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 4. Non-multicopy-atomic

w/o mutually recursive relations

plv.mpi-sws.org/imm/ Thank you!

slide-23
SLIDE 23

3

Bridging the Gap between PL and Hardware Weak MMs Promise (R)C11 WeakestMO

[Chakraborty and Vafeiadis, 2019]

IMM x86-TSO ARMv7 ARMv8.3 RISC-V POWER

CompCert Weak MMs

  • 1. Declarative
  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 4. Non-multicopy-atomic

w/o mutually recursive relations

plv.mpi-sws.org/imm/ Thank you!

slide-24
SLIDE 24

3

Bridging the Gap between PL and Hardware Weak MMs Promise (R)C11 WeakestMO

[Chakraborty and Vafeiadis, 2019]

IMM x86-TSO ARMv7 ARMv8.3 RISC-V POWER

CompCert Weak MMs

  • 1. Declarative
  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 4. Non-multicopy-atomic

w/o mutually recursive relations

plv.mpi-sws.org/imm/ Thank you!

slide-25
SLIDE 25

3

Bridging the Gap between PL and Hardware Weak MMs Promise (R)C11 WeakestMO

[Chakraborty and Vafeiadis, 2019]

IMM x86-TSO ARMv7 ARMv8.3 RISC-V POWER

CompCert Weak MMs

  • 1. Declarative
  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 4. Non-multicopy-atomic

w/o mutually recursive relations

plv.mpi-sws.org/imm/ Thank you!

slide-26
SLIDE 26

3

Bridging the Gap between PL and Hardware Weak MMs Promise (R)C11 WeakestMO

[Chakraborty and Vafeiadis, 2019]

IMM x86-TSO ARMv7 ARMv8.3 RISC-V POWER

CompCert Weak MMs

  • 1. Declarative
  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 4. Non-multicopy-atomic

w/o mutually recursive relations

plv.mpi-sws.org/imm/ Thank you!

slide-27
SLIDE 27

4 (Declarative) Executions in IMM

a := [x]; [y] := 1; b := [y]; [x] := b;

Rx0 Wy1 Ry0 Wx0

fr

,

Rx0 Wy1 Ry1 Wx1

data fr rf

,

Rx1 Wy1 Ry1 Wx1

data rf

Rx1 Wy1 Ry1 Wx1

po data rf

Axioms:

  • 1. data

rf is acyclic …

slide-28
SLIDE 28

4 (Declarative) Executions in IMM

a := [x]; [y] := 1; b := [y]; [x] := b;

Rx0 Wy1 Ry0 Wx0

fr

,

Rx0 Wy1 Ry1 Wx1

data fr rf

,

Rx1 Wy1 Ry1 Wx1

data rf

Rx1 Wy1 Ry1 Wx1

po data rf

Axioms:

  • 1. data

rf is acyclic …

slide-29
SLIDE 29

4 (Declarative) Executions in IMM

a := [x]; [y] := 1; b := [y]; [x] := b;

Rx0 Wy1 Ry0 Wx0

fr

,

Rx0 Wy1 Ry1 Wx1

data fr rf

,

Rx1 Wy1 Ry1 Wx1

data rf

Rx1 Wy1 Ry1 Wx1

po data rf

Axioms:

  • 1. data

rf is acyclic …

slide-30
SLIDE 30

4 (Declarative) Executions in IMM

a := [x]; [y] := 1; b := [y]; [x] := b;

Rx0 Wy1 Ry0 Wx0

fr

,

Rx0 Wy1 Ry1 Wx1

data fr rf

,

Rx1 Wy1 Ry1 Wx1

data rf

Rx1 Wy1 Ry1 Wx1

po data rf

Axioms:

  • 1. data ∪ rf is acyclic

slide-31
SLIDE 31

5

Bridging the Gap between PL and Hardware Weak MMs Promise (R)C11 WeakestMO

[Chakraborty and Vafeiadis, 2019]

IMM x86-TSO ARMv7 ARMv8.3 RISC-V POWER

CompCert Weak MMs

  • 1. Declarative
  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 4. Non-multicopy-atomic

w/o mutually recursive relations

plv.mpi-sws.org/imm/ Thank you!

slide-32
SLIDE 32

5

Bridging the Gap between PL and Hardware Weak MMs Promise (R)C11 WeakestMO

[Chakraborty and Vafeiadis, 2019]

IMM x86-TSO ARMv7 ARMv8.3 RISC-V POWER

CompCert Weak MMs

  • 1. Declarative
  • 1. Declarative
  • 2. Preserves syntactic dependencies

(deps ∪ rf is acyclic)

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 4. Non-multicopy-atomic

w/o mutually recursive relations

plv.mpi-sws.org/imm/ Thank you!

slide-33
SLIDE 33

5

Bridging the Gap between PL and Hardware Weak MMs Promise (R)C11 WeakestMO

[Chakraborty and Vafeiadis, 2019]

IMM x86-TSO ARMv7 ARMv8.3 RISC-V POWER

CompCert Weak MMs

  • 1. Declarative
  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 1. Declarative
  • 2. Preserves syntactic dependencies

(deps ∪ rf is acyclic)

  • 3. Uses C11-style coherence

(hb; eco? is irreflexive)

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 4. Non-multicopy-atomic

w/o mutually recursive relations

plv.mpi-sws.org/imm/ Thank you!

slide-34
SLIDE 34

5

Bridging the Gap between PL and Hardware Weak MMs Promise (R)C11 WeakestMO

[Chakraborty and Vafeiadis, 2019]

IMM x86-TSO ARMv7 ARMv8.3 RISC-V POWER

CompCert Weak MMs

  • 1. Declarative
  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 1. Declarative
  • 2. Preserves syntactic dependencies

(deps ∪ rf is acyclic)

  • 3. Uses C11-style coherence

(hb; eco? is irreflexive)

  • 4. Non-multicopy-atomic

w/o mutually recursive relations

plv.mpi-sws.org/imm/ Thank you!

slide-35
SLIDE 35

5

Bridging the Gap between PL and Hardware Weak MMs Promise (R)C11 WeakestMO

[Chakraborty and Vafeiadis, 2019]

IMM x86-TSO ARMv7 ARMv8.3 RISC-V POWER

CompCert Weak MMs

  • 1. Declarative
  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 4. Non-multicopy-atomic

w/o mutually recursive relations

plv.mpi-sws.org/imm/ Thank you!

slide-36
SLIDE 36

5

Bridging the Gap between PL and Hardware Weak MMs Promise (R)C11 WeakestMO

[Chakraborty and Vafeiadis, 2019]

IMM x86-TSO ARMv7 ARMv8.3 RISC-V POWER

CompCert Weak MMs

  • 1. Declarative
  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 4. Non-multicopy-atomic

w/o mutually recursive relations

plv.mpi-sws.org/imm/ Thank you!

slide-37
SLIDE 37

5

Bridging the Gap between PL and Hardware Weak MMs Promise (R)C11 WeakestMO

[Chakraborty and Vafeiadis, 2019]

IMM x86-TSO ARMv7 ARMv8.3 RISC-V POWER

CompCert Weak MMs

  • 1. Declarative
  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 4. Non-multicopy-atomic

w/o mutually recursive relations

plv.mpi-sws.org/imm/ Thank you!

slide-38
SLIDE 38

6 (Operational) Execution in Promise

Promised a := [x]; [y] := 1; b := [y]; [x] := b; Requires certification Values ; a = ⊥ b = ⊥

slide-39
SLIDE 39

6 (Operational) Execution in Promise

Promised a := [x]; [y] := 1; b := [y]; [x] := b; Requires certification Values ; a = ⊥ b = ⊥

slide-40
SLIDE 40

6 (Operational) Execution in Promise

Promised a := [x]; [y] := 1; b := [y]; [x] := b; Requires certification Values ; a = ⊥ b = ⊥

slide-41
SLIDE 41

6 (Operational) Execution in Promise

Promised a := [x]; [y] := 1; b := [y]; [x] := b; Requires certification Values ; a = ⊥ b = ⊥

slide-42
SLIDE 42

6 (Operational) Execution in Promise

Promised a := [x]; [y] := 1; b := [y]; [x] := b; Requires certification Values ; a = ⊥ b = 1

slide-43
SLIDE 43

6 (Operational) Execution in Promise

Promised a := [x]; [y] := 1; b := [y]; [x] := b; Requires certification Values ; a = ⊥ b = 1

slide-44
SLIDE 44

6 (Operational) Execution in Promise

Promised a := [x]; [y] := 1; b := [y]; [x] := b; Requires certification Values ; a = 1 b = 1

slide-45
SLIDE 45

6 (Operational) Execution in Promise

Promised a := [x]; [y] := 1; b := [y]; [x] := b; Requires certification Values ; a = 1 b = 1

slide-46
SLIDE 46

7

Bridging the Gap between PL and Hardware Weak MMs Promise (R)C11 WeakestMO

[Chakraborty and Vafeiadis, 2019]

IMM x86-TSO ARMv7 ARMv8.3 RISC-V POWER

CompCert Weak MMs

  • 1. Declarative
  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 4. Non-multicopy-atomic

w/o mutually recursive relations

plv.mpi-sws.org/imm/ Thank you!

slide-47
SLIDE 47

8

How to prove correctness of compilation? Simulation How to simulate graphs? Traverse in proper order!

slide-48
SLIDE 48

8

How to prove correctness of compilation? Simulation How to simulate graphs? Traverse in proper order!

slide-49
SLIDE 49

8

How to prove correctness of compilation? Simulation How to simulate graphs? Traverse in proper order!

slide-50
SLIDE 50

8

How to prove correctness of compilation? Simulation How to simulate graphs? Traverse in proper order!

slide-51
SLIDE 51

9 Traversal of IMM execution

a := [x]; [y] := 1; b := [y]; [x] := b; Promised Promised

Rx1 Wy1 Ry1 Wx1

Covered Issued

slide-52
SLIDE 52

10

Promise → IMM compilation correctness proof

  • 1. Operational semantics of IMM’s traversal:

G ⊢ ⟨C, I⟩ → ⟨C ′, I ′⟩

  • 2. Completeness of traversal:

G P IMM G initTraverse G Events G Writes

  • 3. Simulation theorems:

initTraverse initPromise

simulated by

traverse traverse promise promise

simulated by simulated by

Promise’s certification Promise’s certification via traversal of certification graph

slide-53
SLIDE 53

10

Promise → IMM compilation correctness proof

  • 1. Operational semantics of IMM’s traversal:

G ⊢ ⟨C, I⟩ → ⟨C ′, I ′⟩

  • 2. Completeness of traversal:

∀G ∈ PIMM. G ⊢ initTraverse →∗ ⟨G.Events, G.Writes⟩

  • 3. Simulation theorems:

initTraverse initPromise

simulated by

traverse traverse promise promise

simulated by simulated by

Promise’s certification Promise’s certification via traversal of certification graph

slide-54
SLIDE 54

10

Promise → IMM compilation correctness proof

  • 1. Operational semantics of IMM’s traversal:

G ⊢ ⟨C, I⟩ → ⟨C ′, I ′⟩

  • 2. Completeness of traversal:

∀G ∈ PIMM. G ⊢ initTraverse →∗ ⟨G.Events, G.Writes⟩

  • 3. Simulation theorems:

initTraverse initPromise

simulated by

traverse traverse′ promise ∃ promise′

simulated by simulated by

Promise’s certification Promise’s certification via traversal of certification graph

slide-55
SLIDE 55

10

Promise → IMM compilation correctness proof

  • 1. Operational semantics of IMM’s traversal:

G ⊢ ⟨C, I⟩ → ⟨C ′, I ′⟩

  • 2. Completeness of traversal:

∀G ∈ PIMM. G ⊢ initTraverse →∗ ⟨G.Events, G.Writes⟩

  • 3. Simulation theorems:

initTraverse initPromise

simulated by

traverse traverse′ promise ∃ promise′

simulated by simulated by

Promise’s certification Promise’s certification via traversal of certification graph

slide-56
SLIDE 56

10

Promise → IMM compilation correctness proof

  • 1. Operational semantics of IMM’s traversal:

G ⊢ ⟨C, I⟩ → ⟨C ′, I ′⟩

  • 2. Completeness of traversal:

∀G ∈ PIMM. G ⊢ initTraverse →∗ ⟨G.Events, G.Writes⟩

  • 3. Simulation theorems:

initTraverse initPromise

simulated by

traverse traverse′ promise ∃ promise′

simulated by simulated by

Promise’s certification Promise’s certification via traversal of certification graph

slide-57
SLIDE 57

10

Promise → IMM compilation correctness proof

  • 1. Operational semantics of IMM’s traversal:

G ⊢ ⟨C, I⟩ → ⟨C ′, I ′⟩

  • 2. Completeness of traversal:

∀G ∈ PIMM. G ⊢ initTraverse →∗ ⟨G.Events, G.Writes⟩

  • 3. Simulation theorems:

initTraverse initPromise

simulated by

traverse traverse′ promise ∃ promise′

simulated by simulated by

Promise’s certification Promise’s certification via traversal of certification graph

slide-58
SLIDE 58

11 Traversal of IMM execution

a := [x]; [y] := 1; b := [y]; [x] := b; Promised Promised

Rx1 Wy1 Ry1 Wx1

Covered Issued

slide-59
SLIDE 59

11 Traversal of IMM execution

a := [x]; [y] := 1; b := [y]; [x] := b; Promised Promised

Rx1 Wy1 Ry1 Wx1

Covered Issued

slide-60
SLIDE 60

11 Traversal of IMM execution

a := [x]; [y] := 1; b := [y]; [x] := b; Promised Promised

Rx1 Wy1 Ry1 Wx1

Covered Issued

slide-61
SLIDE 61

11 Traversal of IMM execution

a := [x]; [y] := 1; b := [y]; [x] := b; Promised Promised

Rx1 Wy1 Ry1 Wx1

Covered Issued

slide-62
SLIDE 62

11 Traversal of IMM execution

a := [x]; [y] := 1; b := [y]; [x] := b; Promised Promised

Rx1 Wy1 Ry1 Wx1

Covered Issued

slide-63
SLIDE 63

11 Traversal of IMM execution

a := [x]; [y] := 1; b := [y]; [x] := b; Promised Promised

Rx1 Wy1 Ry1 Wx1

Covered Issued

slide-64
SLIDE 64

11 Traversal of IMM execution

a := [x]; [y] := 1; b := [y]; [x] := b; Promised Promised

Rx1 Wy1 Ry1 Wx1

Covered Issued

slide-65
SLIDE 65

12

Bridging the Gap between PL and Hardware Weak MMs Promise (R)C11 WeakestMO

[Chakraborty and Vafeiadis, 2019]

IMM x86-TSO ARMv7 ARMv8.3 RISC-V POWER

CompCert Weak MMs

  • 1. Declarative
  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 4. Non-multicopy-atomic

w/o mutually recursive relations

plv.mpi-sws.org/imm/ Thank you!

slide-66
SLIDE 66

12

Bridging the Gap between PL and Hardware Weak MMs Promise (R)C11 WeakestMO

[Chakraborty and Vafeiadis, 2019]

IMM x86-TSO ARMv7 ARMv8.3 RISC-V POWER

CompCert Weak MMs

  • 1. Declarative
  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 4. Non-multicopy-atomic

w/o mutually recursive relations

plv.mpi-sws.org/imm/ Thank you!

slide-67
SLIDE 67

12

Bridging the Gap between PL and Hardware Weak MMs Promise (R)C11 WeakestMO

[Chakraborty and Vafeiadis, 2019]

IMM x86-TSO ARMv7 ARMv8.3 RISC-V POWER

CompCert Weak MMs

  • 1. Declarative
  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 4. Non-multicopy-atomic

w/o mutually recursive relations

plv.mpi-sws.org/imm/ Thank you!

slide-68
SLIDE 68

12

Bridging the Gap between PL and Hardware Weak MMs Promise (R)C11 WeakestMO

[Chakraborty and Vafeiadis, 2019]

IMM x86-TSO ARMv7 ARMv8.3 RISC-V POWER

CompCert Weak MMs

  • 1. Declarative
  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 1. Declarative
  • 2. Preserves syntactic dependencies

deps rf is acyclic

  • 3. Uses C11-style coherence

hb eco is irreflexive

  • 4. Non-multicopy-atomic

w/o mutually recursive relations

plv.mpi-sws.org/imm/ Thank you!

slide-69
SLIDE 69

13

Links I

Chakraborty, S. and Vafeiadis, V. (2019). Grounding thin-air reads with event structures. In POPL 2019. ACM. Kang, J., Hur, C.-K., Lahav, O., Vafeiadis, V., and Dreyer, D. (2017). A promising semantics for relaxed-memory concurrency. In POPL 2017. ACM.

slide-70
SLIDE 70

14

Backup slides

slide-71
SLIDE 71

15

IMM definition

  • Def. G is called IMM-consistent if the following hold:
  • codom(G.rf) = G.R.
  • For every location ℓ ∈ Loc, G.co totally orders G.Wℓ.
  • G.rmw ∩ (G.fre ; G.coe) = ∅.
  • G.hb ; G.eco? is irreflexive.
  • G.ar is acyclic.

ar ≜ rfe ∪ bob ∪ ppo ∪ detour ∪ psc ∪ [Wstrong] ; po ; [W] bob ≜ po ; [Wrel] ∪ [Racq] ; po ∪ po ; [F] ∪ [F] ; po ∪ [Wrel] ; po|loc ; [W] ppo ≜ [R] ; (deps ∪ rfi)+ ; [W] deps ≜ data ∪ ctrl ∪ addr ; po? ∪ casdep ∪ [Rex] ; po

slide-72
SLIDE 72

16

Traversal definition

a ∈ Next(G, C) ∩ Coverable(G, C, I) G ⊢ ⟨C, I⟩ → ⟨C ∪ {a}, I⟩ w ∈ Issuable(G, C, I) \ I G ⊢ ⟨C, I⟩ → ⟨C, I ∪ {w}⟩

  • Def. w ∈ Issuable(G, C, I) iff w ∈ G.W and the following hold:
  • dom(([G.Wrel] ; G.po|G.loc ∪ [G.F] ; G.po) ; [w]) ⊆ C
  • dom((G.detour ∪ G.rfe) ; G.ppo ; [w]) ⊆ I
  • dom((G.detour ∪ G.rfe) ; [G.Racq] ; G.po ; [w]) ⊆ I
  • dom([G.Wstrong] ; G.po ; [w]) ⊆ I
  • Def. e ∈ Coverable(G, C, I) iff e ∈ G.E, dom(G.po ; [e]) ⊆ C and either

(i) e ∈ G.W ∩ I; (ii) e ∈ G.R and dom(G.rf ; [e]) ⊆ I; (iii) e ∈ G.Fsc;

  • r (iv) e ∈ G.Fsc and dom(G.sc ; [e]) ⊆ C.
slide-73
SLIDE 73

17

Mistake in Kang et al.17’s compilation to POWER correctness proof

Rrlxz1 Fsc Wrlxx1 Wrlxx2 Fsc Wrlxy1 Rrlxy1 Wrlxz1

rf co rf Consistent in Strong-POWER. Not consistent in the promise-free declarative model of [Kang et al., 2017].

slide-74
SLIDE 74

18

Promise → IMM compilation of RMWs

a := [y]rlx / / 1 [z]rlx := a b := [z]rlx / / 1 c := FADDrlx,rel

strong (x, 1) /

/ 0 [y]rlx := c + 1

Rrlxy1 Wrlxz1 Rrlxz1 Rrlxx0 Wrel

strongx1

Wrlxy1

data rmw data bob rfe