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 Bridging the Gap between PL and Hardware Weak MMs 1
Correct Compiler Compiler P Syntax PL compile P P PL HW PL HW is Memory Model Bridging the Gap between PL and Hardware Weak MMs Programming Hardware Language 1
Correct Compiler P Syntax PL compile P P PL HW PL HW is Memory Model Bridging the Gap between PL and Hardware Weak MMs Programming Compiler Hardware Language 1
Compiler P Syntax PL compile P P PL HW PL HW is Memory Model Bridging the Gap between PL and Hardware Weak MMs Correct Programming Compiler Hardware Language 1
Compiler PL HW is Memory Model Bridging the Gap between PL and Hardware Weak MMs Correct Programming Compiler Hardware Language ∀ P ∈ Syntax ( PL ) . � compile ( P ) � HW � P � PL 1
Compiler Bridging the Gap between PL and Hardware Weak MMs Correct Programming Compiler Hardware Language ∀ P ∈ Syntax ( PL ) . � compile ( P ) � HW � P � PL � − � { PL , HW } is Memory Model 1
Compiler Bridging the Gap between PL and Hardware Weak MMs Correct Programming Compiler Hardware Language ∀ P ∈ Syntax ( PL ) . � compile ( P ) � HW � P � PL � − � { PL , HW } is Memory Model 1
Strong (SC) MM disallows a b 1 ARM and POWER weak MMs allow a b 1! a := [ x ]; b := [ y ]; [ y ] := 1 ; [ x ] := b ; Values Memory [ x ] ← 0 [ y ] ← 0 a = ⊥ b = ⊥ ; ; 2
Strong (SC) MM disallows a b 1 ARM and POWER weak MMs allow a b 1! a := [ x ]; b := [ y ]; [ y ] := 1 ; [ x ] := b ; Values Memory [ x ] ← 0 [ y ] ← 0 a = ⊥ b = ⊥ ; ; 2
Strong (SC) MM disallows a b 1 ARM and POWER weak MMs allow a b 1! a := [ x ]; b := [ y ]; [ y ] := 1 ; [ x ] := b ; Values Memory [ x ] ← 0 [ y ] ← 0 a = 0 b = ⊥ ; ; 2
Strong (SC) MM disallows a b 1 ARM and POWER weak MMs allow a b 1! a := [ x ]; b := [ y ]; [ y ] := 1 ; [ x ] := b ; Values Memory [ x ] ← 0 [ y ] ← 1 a = 0 b = ⊥ ; ; 2
Strong (SC) MM disallows a b 1 ARM and POWER weak MMs allow a b 1! a := [ x ]; b := [ y ]; [ y ] := 1 ; [ x ] := b ; Values Memory [ x ] ← 0 [ y ] ← 1 a = 0 b = 1 ; ; 2
Strong (SC) MM disallows a b 1 ARM and POWER weak MMs allow a b 1! a := [ x ]; b := [ y ]; [ y ] := 1 ; [ x ] := b ; Values Memory [ x ] ← 1 [ y ] ← 1 a = 0 b = 1 ; ; 2
disallows a b 1 ARM and POWER weak MMs allow a b 1! Strong (SC) MM a := [ x ]; b := [ y ]; [ y ] := 1 ; [ x ] := b ; Values Memory [ x ] ← 1 [ y ] ← 1 a = 0 b = 1 ; ; 2
ARM and POWER weak MMs allow a b 1! Strong (SC) MM disallows a = b = 1 a := [ x ]; b := [ y ]; [ y ] := 1 ; [ x ] := b ; Values Memory [ x ] ← 1 [ y ] ← 1 a = 0 b = 1 ; ; 2
Strong (SC) MM disallows a = b = 1 a := [ x ]; b := [ y ]; [ y ] := 1 ; [ x ] := b ; ARM and POWER weak MMs allow a = b = 1! Values Memory [ x ] ← 1 [ y ] ← 1 a = 0 b = 1 ; ; 2
1. Declarative 1. Declarative 1. Declarative 1. Declarative CompCert Weak MMs 2. Preserves syntactic dependencies 2. Preserves syntactic dependencies 2. Preserves syntactic dependencies rf is acyclic rf is acyclic rf is acyclic 3. Uses C11-style coherence 3. Uses C11-style coherence hb eco is irreflexive hb eco is irreflexive 4. Non-multicopy-atomic w/o mutually recursive relations WeakestMO IMM [Chakraborty and Vafeiadis, 2019] plv.mpi-sws.org/imm/ Thank you! deps deps deps Bridging the Gap between PL and Hardware Weak MMs x86-TSO Promise ARMv7 ARMv8.3 RISC-V (R)C11 POWER 3
1. Declarative 1. Declarative 1. Declarative 1. Declarative CompCert Weak MMs 2. Preserves syntactic dependencies 2. Preserves syntactic dependencies 2. Preserves syntactic dependencies rf is acyclic rf is acyclic rf is acyclic 3. Uses C11-style coherence 3. Uses C11-style coherence hb eco is irreflexive hb eco is irreflexive 4. Non-multicopy-atomic w/o mutually recursive relations WeakestMO IMM [Chakraborty and Vafeiadis, 2019] plv.mpi-sws.org/imm/ Thank you! deps deps deps Bridging the Gap between PL and Hardware Weak MMs x86-TSO Promise ARMv7 ARMv8.3 RISC-V (R)C11 POWER 3
1. Declarative 1. Declarative 1. Declarative 1. Declarative CompCert Weak MMs 2. Preserves syntactic dependencies 2. Preserves syntactic dependencies 2. Preserves syntactic dependencies rf is acyclic rf is acyclic rf is acyclic 3. Uses C11-style coherence 3. Uses C11-style coherence hb eco is irreflexive hb eco is irreflexive 4. Non-multicopy-atomic w/o mutually recursive relations WeakestMO IMM [Chakraborty and Vafeiadis, 2019] plv.mpi-sws.org/imm/ Thank you! deps deps deps Bridging the Gap between PL and Hardware Weak MMs x86-TSO Promise ARMv7 ARMv8.3 RISC-V (R)C11 POWER 3
1. Declarative 1. Declarative 1. Declarative 1. Declarative CompCert Weak MMs 2. Preserves syntactic dependencies 2. Preserves syntactic dependencies 2. Preserves syntactic dependencies rf is acyclic rf is acyclic rf is acyclic 3. Uses C11-style coherence 3. Uses C11-style coherence hb eco is irreflexive hb eco is irreflexive 4. Non-multicopy-atomic w/o mutually recursive relations WeakestMO IMM [Chakraborty and Vafeiadis, 2019] plv.mpi-sws.org/imm/ Thank you! deps deps deps Bridging the Gap between PL and Hardware Weak MMs x86-TSO Promise ARMv7 ARMv8.3 RISC-V (R)C11 POWER 3
1. Declarative 1. Declarative 1. Declarative 1. Declarative CompCert Weak MMs 2. Preserves syntactic dependencies 2. Preserves syntactic dependencies 2. Preserves syntactic dependencies rf is acyclic rf is acyclic rf is acyclic 3. Uses C11-style coherence 3. Uses C11-style coherence hb eco is irreflexive hb eco is irreflexive 4. Non-multicopy-atomic w/o mutually recursive relations WeakestMO IMM [Chakraborty and Vafeiadis, 2019] plv.mpi-sws.org/imm/ Thank you! deps deps deps Bridging the Gap between PL and Hardware Weak MMs x86-TSO Promise ARMv7 ARMv8.3 RISC-V (R)C11 POWER 3
1. Declarative 1. Declarative 1. Declarative 1. Declarative CompCert Weak MMs 2. Preserves syntactic dependencies 2. Preserves syntactic dependencies 2. Preserves syntactic dependencies rf is acyclic rf is acyclic rf is acyclic 3. Uses C11-style coherence 3. Uses C11-style coherence hb eco is irreflexive hb eco is irreflexive 4. Non-multicopy-atomic w/o mutually recursive relations WeakestMO [Chakraborty and Vafeiadis, 2019] plv.mpi-sws.org/imm/ Thank you! deps deps deps Bridging the Gap between PL and Hardware Weak MMs x86-TSO Promise ARMv7 IMM ARMv8.3 RISC-V (R)C11 POWER 3
1. Declarative 1. Declarative 1. Declarative 1. Declarative CompCert Weak MMs 2. Preserves syntactic dependencies 2. Preserves syntactic dependencies 2. Preserves syntactic dependencies rf is acyclic rf is acyclic rf is acyclic 3. Uses C11-style coherence 3. Uses C11-style coherence hb eco is irreflexive hb eco is irreflexive 4. Non-multicopy-atomic w/o mutually recursive relations WeakestMO [Chakraborty and Vafeiadis, 2019] plv.mpi-sws.org/imm/ Thank you! deps deps deps Bridging the Gap between PL and Hardware Weak MMs x86-TSO Promise ARMv7 IMM ARMv8.3 RISC-V (R)C11 POWER 3
1. Declarative 1. Declarative 1. Declarative 1. Declarative CompCert Weak MMs 2. Preserves syntactic dependencies 2. Preserves syntactic dependencies 2. Preserves syntactic dependencies rf is acyclic rf is acyclic rf is acyclic 3. Uses C11-style coherence 3. Uses C11-style coherence hb eco is irreflexive hb eco is irreflexive 4. Non-multicopy-atomic w/o mutually recursive relations WeakestMO [Chakraborty and Vafeiadis, 2019] plv.mpi-sws.org/imm/ Thank you! deps deps deps Bridging the Gap between PL and Hardware Weak MMs x86-TSO Promise ARMv7 IMM ARMv8.3 RISC-V (R)C11 POWER 3
1. Declarative 1. Declarative 1. Declarative CompCert Weak MMs 2. Preserves syntactic dependencies 2. Preserves syntactic dependencies 2. Preserves syntactic dependencies rf is acyclic rf is acyclic rf is acyclic 3. Uses C11-style coherence 3. Uses C11-style coherence hb eco is irreflexive hb eco is irreflexive 4. Non-multicopy-atomic w/o mutually recursive relations WeakestMO [Chakraborty and Vafeiadis, 2019] plv.mpi-sws.org/imm/ Thank you! deps deps deps Bridging the Gap between PL and Hardware Weak MMs 1. Declarative x86-TSO Promise ARMv7 IMM ARMv8.3 RISC-V (R)C11 POWER 3
R x 1 R y 1 Axioms: rf is acyclic 1. data W y 1 W x 1 … data rf data po rf data fr rf fr (Declarative) Executions in IMM a := [ x ]; b := [ y ]; [ y ] := 1 ; [ x ] := b ; R x 0 R y 0 R x 0 R y 1 R x 1 R y 1 , , W y 1 W x 0 W y 1 W x 1 W y 1 W x 1 4
R x 1 R y 1 Axioms: rf is acyclic 1. data W y 1 W x 1 … data rf data po rf data fr rf fr (Declarative) Executions in IMM a := [ x ]; b := [ y ]; [ y ] := 1 ; [ x ] := b ; R x 0 R y 0 R x 0 R y 1 R x 1 R y 1 , , W y 1 W x 0 W y 1 W x 1 W y 1 W x 1 4
Axioms: rf is acyclic 1. data R x 0 R y 0 R x 0 R y 1 R x 1 R y 1 , , … W y 1 W x 0 W y 1 W x 1 W y 1 W x 1 data po rf data rf rf data fr fr (Declarative) Executions in IMM a := [ x ]; b := [ y ]; [ y ] := 1 ; [ x ] := b ; R x 1 R y 1 W y 1 W x 1 4
Recommend
More recommend