Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019....
Transcript of Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019....
![Page 1: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/1.jpg)
Yatin A. Manerkar, Daniel Lustig*,
Margaret Martonosi, and Aarti Gupta
PipeProof:
Automated Memory Consistency Proofs for Microarchitectural Specifications
http://check.cs.princeton.edu/
Princeton University *NVIDIA
MICRO-51
![Page 2: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/2.jpg)
Memory Consistency Models (MCMs)▪ Specify rules governing values returned by loads in parallel programs
▪MCM must be correctly implemented for all possible programs
Compiler
Microarchitecture
![Page 3: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/3.jpg)
Memory Consistency Models (MCMs)
ISA-Level MCM (x86-TSO, Power, ARMv8, etc)
▪ Specify rules governing values returned by loads in parallel programs
▪MCM must be correctly implemented for all possible programs
Compiler
Microarchitecture
![Page 4: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/4.jpg)
Memory Consistency Models (MCMs)
ISA-Level MCM (x86-TSO, Power, ARMv8, etc)
▪ Specify rules governing values returned by loads in parallel programs
▪MCM must be correctly implemented for all possible programs
Target for compilers…
Compiler
Microarchitecture
![Page 5: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/5.jpg)
Memory Consistency Models (MCMs)
ISA-Level MCM (x86-TSO, Power, ARMv8, etc)
▪ Specify rules governing values returned by loads in parallel programs
▪MCM must be correctly implemented for all possible programs
Target for compilers…
Compiler
Microarchitecture
…and a specification that microarchitecture
must implement
![Page 6: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/6.jpg)
Memory Consistency Models (MCMs)▪ Specify rules governing values returned by loads in parallel programs
▪MCM must be correctly implemented for all possible programs
Target for compilers…
Compiler
Microarchitecture
…and a specification that microarchitecture
must implement???
![Page 7: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/7.jpg)
[Images: HeeWann Kim, tzblacktd, audino]
The Infinite Forest
![Page 8: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/8.jpg)
-∞ +∞
-∞
+∞
[Images: HeeWann Kim, tzblacktd, audino]
The Infinite Forest
Forest goes on forever (infinite number of possible programs)
![Page 9: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/9.jpg)
-∞ +∞
-∞
+∞
[Images: HeeWann Kim, tzblacktd, audino]
The Infinite Forest
Can check known hideouts (verify design
for test programs)
![Page 10: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/10.jpg)
-∞ +∞
-∞
+∞
[Images: HeeWann Kim, tzblacktd, audino]
The Infinite Forest
Are Pokemon lurking in unexplored areas? (Do
tested programs provide complete coverage?)
![Page 11: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/11.jpg)
-∞ +∞
-∞
+∞
[Images: HeeWann Kim, tzblacktd, audino]
The Infinite Forest
Have we caught all the Pokemon? (Are there any MCM bugs left in
the design?)
![Page 12: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/12.jpg)
PipeProof Overview
µarch and ISA MCM Specs
+Auxiliary
Inputs
All-Program MCM
Correctness Proof!
PipeProof
▪ First automated all-program microarchitectural MCM verification!
• Covers all possible addresses, values, numbers of cores
▪Proof methodology based on automatic abstraction refinement
▪Early-stage: Can be conducted before RTL is written!
![Page 13: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/13.jpg)
Outline▪Background
• ISA-level MCM specs
• Microarchitectural ordering specs
▪Microarchitectural Correctness Proof
• Transitive Chain (TC) Abstraction
▪Overall PipeProof Operation
• TC Abstraction Support Proof
• Chain Invariants
▪Results
![Page 14: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/14.jpg)
ISA-Level MCM Specifications▪Defined in terms of relational patterns [Alglave et al. TOPLAS 2014]
▪ ISA-level executions are graphs
• Nodes: instructions, edges: ISA-level relations between instrs
▪Correctness based on acyclicity, irreflexivity, etc of relational patterns
• Eg: SC is 𝑎𝑐𝑦𝑐𝑙𝑖𝑐(𝑝𝑜 ∪ 𝑐𝑜 ∪ 𝑟𝑓 ∪ 𝑓𝑟)
Message passing (mp) litmus testAn ISA-level execution of mp
[x] ← 1
fr
[y] ← 1
r1 ← [y]
r2 ← [x]
rfpo po
(i4)
(i3)(i1)
(i2)
![Page 15: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/15.jpg)
ISA-Level MCM Specifications▪Defined in terms of relational patterns [Alglave et al. TOPLAS 2014]
▪ ISA-level executions are graphs
• Nodes: instructions, edges: ISA-level relations between instrs
▪Correctness based on acyclicity, irreflexivity, etc of relational patterns
• Eg: SC is 𝑎𝑐𝑦𝑐𝑙𝑖𝑐(𝑝𝑜 ∪ 𝑐𝑜 ∪ 𝑟𝑓 ∪ 𝑓𝑟)
Message passing (mp) litmus testAn ISA-level execution of mp
[x] ← 1
fr
[y] ← 1
r1 ← [y]
r2 ← [x]
rfpo po
(i4)
(i3)(i1)
(i2)
![Page 16: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/16.jpg)
ISA-Level MCM Specifications▪Defined in terms of relational patterns [Alglave et al. TOPLAS 2014]
▪ ISA-level executions are graphs
• Nodes: instructions, edges: ISA-level relations between instrs
▪Correctness based on acyclicity, irreflexivity, etc of relational patterns
• Eg: SC is 𝑎𝑐𝑦𝑐𝑙𝑖𝑐(𝑝𝑜 ∪ 𝑐𝑜 ∪ 𝑟𝑓 ∪ 𝑓𝑟)
Message passing (mp) litmus testAn ISA-level execution of mp
[x] ← 1
fr
[y] ← 1
r1 ← [y]
r2 ← [x]
rfpo po
(i4)
(i3)(i1)
(i2)
![Page 17: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/17.jpg)
ISA-Level MCM Specifications▪Defined in terms of relational patterns [Alglave et al. TOPLAS 2014]
▪ ISA-level executions are graphs
• Nodes: instructions, edges: ISA-level relations between instrs
▪Correctness based on acyclicity, irreflexivity, etc of relational patterns
• Eg: SC is 𝑎𝑐𝑦𝑐𝑙𝑖𝑐(𝑝𝑜 ∪ 𝑐𝑜 ∪ 𝑟𝑓 ∪ 𝑓𝑟)
Message passing (mp) litmus testAn ISA-level execution of mp
[x] ← 1
fr
[y] ← 1
r1 ← [y]
r2 ← [x]
rfpo po
(i4)
(i3)(i1)
(i2)
![Page 18: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/18.jpg)
ISA-Level MCM Specifications▪Defined in terms of relational patterns [Alglave et al. TOPLAS 2014]
▪ ISA-level executions are graphs
• Nodes: instructions, edges: ISA-level relations between instrs
▪Correctness based on acyclicity, irreflexivity, etc of relational patterns
• Eg: SC is 𝑎𝑐𝑦𝑐𝑙𝑖𝑐(𝑝𝑜 ∪ 𝑐𝑜 ∪ 𝑟𝑓 ∪ 𝑓𝑟)
Message passing (mp) litmus testAn ISA-level execution of mp
[x] ← 1
fr
[y] ← 1
r1 ← [y]
r2 ← [x]
rfpo po
(i4)
(i3)(i1)
(i2)
![Page 19: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/19.jpg)
Microarchitectural Ordering Specifications▪ Set of axioms in µspec DSL [Lustig et al. ASPLOS 2016]
▪Used to generate microarchitectural executions as µhb graphs
• Nodes: instr. sub-events, edges: happens-before relations between instrs
▪Observability based on cyclicity of graphs
• Cyclic graph → Unobservable
• Acyclic graph → Observable
Message passing (mp) litmus test
A µhb graph of mp on simpleSC
(i1) (i2)
IF
EX
WB
po(i3) (i4)
fr
rf po
![Page 20: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/20.jpg)
Microarchitectural Ordering Specifications▪ Set of axioms in µspec DSL [Lustig et al. ASPLOS 2016]
▪Used to generate microarchitectural executions as µhb graphs
• Nodes: instr. sub-events, edges: happens-before relations between instrs
▪Observability based on cyclicity of graphs
• Cyclic graph → Unobservable
• Acyclic graph → Observable
Message passing (mp) litmus test
A µhb graph of mp on simpleSC
(i1) (i2)
IF
EX
WB
po(i3) (i4)
fr
rf po
![Page 21: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/21.jpg)
Microarchitectural Ordering Specifications▪ Set of axioms in µspec DSL [Lustig et al. ASPLOS 2016]
▪Used to generate microarchitectural executions as µhb graphs
• Nodes: instr. sub-events, edges: happens-before relations between instrs
▪Observability based on cyclicity of graphs
• Cyclic graph → Unobservable
• Acyclic graph → Observable
Message passing (mp) litmus test
A µhb graph of mp on simpleSC
(i1) (i2)
IF
EX
WB
po(i3) (i4)
fr
rf po
![Page 22: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/22.jpg)
Microarchitectural Ordering Specifications▪ Set of axioms in µspec DSL [Lustig et al. ASPLOS 2016]
▪Used to generate microarchitectural executions as µhb graphs
• Nodes: instr. sub-events, edges: happens-before relations between instrs
▪Observability based on cyclicity of graphs
• Cyclic graph → Unobservable
• Acyclic graph → Observable
Message passing (mp) litmus test
A µhb graph of mp on simpleSC
(i1) (i2)
IF
EX
WB
po(i3) (i4)
fr
rf po
![Page 23: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/23.jpg)
Microarchitectural Ordering Specifications▪ Set of axioms in µspec DSL [Lustig et al. ASPLOS 2016]
▪Used to generate microarchitectural executions as µhb graphs
• Nodes: instr. sub-events, edges: happens-before relations between instrs
▪Observability based on cyclicity of graphs
• Cyclic graph → Unobservable
• Acyclic graph → Observable
Message passing (mp) litmus test
A µhb graph of mp on simpleSC
(i1) (i2)
IF
EX
WB
po(i3) (i4)
fr
rf po
![Page 24: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/24.jpg)
Our Prior Work: Litmus Test-Based MCM Verification
Axiom “Decode_is_FIFO":... EdgeExists ((i1, Decode), (i2, Decode))
=> AddEdge ((i1, Execute), (i2, Execute))....Axiom "PO_Fetch":... SameCore i1 i2 /\ ProgramOrder i1 i2 =>
AddEdge ((i1, Fetch), (i2, Fetch)).
Microarchitecture
Litmus Test
in µspec DSL
[Lustig et al. MICRO-47, …]
![Page 25: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/25.jpg)
Our Prior Work: Litmus Test-Based MCM Verification
Microarchitectural happens-before (µhb) graphs
Axiom “Decode_is_FIFO":... EdgeExists ((i1, Decode), (i2, Decode))
=> AddEdge ((i1, Execute), (i2, Execute))....Axiom "PO_Fetch":... SameCore i1 i2 /\ ProgramOrder i1 i2 =>
AddEdge ((i1, Fetch), (i2, Fetch)).
Microarchitecture
Litmus Test
in µspec DSL
[Lustig et al. MICRO-47, …]
![Page 26: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/26.jpg)
Our Prior Work: Litmus Test-Based MCM Verification
Microarchitectural happens-before (µhb) graphs
Axiom “Decode_is_FIFO":... EdgeExists ((i1, Decode), (i2, Decode))
=> AddEdge ((i1, Execute), (i2, Execute))....Axiom "PO_Fetch":... SameCore i1 i2 /\ ProgramOrder i1 i2 =>
AddEdge ((i1, Fetch), (i2, Fetch)).
Microarchitecture
Litmus Test
in µspec DSL
ISA-Level Outcome
Observable(≥ 1 Graph Acyclic)
Not Observable(All Graphs Cyclic)
Allowed OKOK (stricter
than necessary)
Forbidden Consistency violation! OK
[Lustig et al. MICRO-47, …]
![Page 27: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/27.jpg)
Our Prior Work: Litmus Test-Based MCM Verification
Microarchitectural happens-before (µhb) graphs
Axiom “Decode_is_FIFO":... EdgeExists ((i1, Decode), (i2, Decode))
=> AddEdge ((i1, Execute), (i2, Execute))....Axiom "PO_Fetch":... SameCore i1 i2 /\ ProgramOrder i1 i2 =>
AddEdge ((i1, Fetch), (i2, Fetch)).
Microarchitecture
Litmus Test
in µspec DSL
ISA-Level Outcome
Observable(≥ 1 Graph Acyclic)
Not Observable(All Graphs Cyclic)
Allowed OKOK (stricter
than necessary)
Forbidden Consistency violation! OK
[Lustig et al. MICRO-47, …]
![Page 28: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/28.jpg)
Our Prior Work: Litmus Test-Based MCM Verification
Microarchitectural happens-before (µhb) graphs
Axiom “Decode_is_FIFO":... EdgeExists ((i1, Decode), (i2, Decode))
=> AddEdge ((i1, Execute), (i2, Execute))....Axiom "PO_Fetch":... SameCore i1 i2 /\ ProgramOrder i1 i2 =>
AddEdge ((i1, Fetch), (i2, Fetch)).
Microarchitecture
Litmus Test
in µspec DSL
ISA-Level Outcome
Observable(≥ 1 Graph Acyclic)
Not Observable(All Graphs Cyclic)
Allowed OKOK (stricter
than necessary)
Forbidden Consistency violation! OK
[Lustig et al. MICRO-47, …]
Perennial Question:
“Do your litmus tests cover all possible MCM bugs?”
How to automatically prove correctness for all programs?
![Page 29: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/29.jpg)
The Transitive Chain (TC) Abstraction
i1 inr1…n-1
fr
All non-unary cycles containing fr
i1
fr
i2po
i1 i3
fr
i2poco
po rfi1 i3
fr
i2 i4po
corfi1 i3
fr
i2 i4po
…
![Page 30: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/30.jpg)
The Transitive Chain (TC) Abstraction
i1 inr1…n-1
fr
All non-unary cycles containing fr
i1
fr
i2po
i1 i3
fr
i2poco
po rfi1 i3
fr
i2 i4po
corfi1 i3
fr
i2 i4po
…
Transitive chain (sequence) of ISA-level edges
![Page 31: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/31.jpg)
The Transitive Chain (TC) Abstraction
i1 inr1…n-1
fr
All non-unary cycles containing fr
i1
fr
i2po
i1 i3
fr
i2poco
po rfi1 i3
fr
i2 i4po
corfi1 i3
fr
i2 i4po
…
⟹Using TC
Abstractioni1 in
fr
Some µhbedge from
i1 to in(transitive
connection)
IF
EX
WB
i1 inIF
EX
WB
fri1 in
IF
EX
WB
fri1 in
IF
EX
WB
fr
…
![Page 32: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/32.jpg)
The Transitive Chain (TC) Abstraction
i1 inr1…n-1
fr
All non-unary cycles containing fr
i1
fr
i2po
i1 i3
fr
i2poco
po rfi1 i3
fr
i2 i4po
corfi1 i3
fr
i2 i4po
…
⟹Using TC
Abstractioni1 in
fr
Some µhbedge from
i1 to in(transitive
connection)
IF
EX
WB
i1 inIF
EX
WB
fri1 in
IF
EX
WB
fri1 in
IF
EX
WB
fr
…
![Page 33: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/33.jpg)
The Transitive Chain (TC) Abstraction
⟹Using TC Abstraction
Infinite
i1
fr
i2po
i1 i3
fr
i2poco
po rfi1 i3
fr
i2 i4po
corfi1 i3
fr
i2 i4po
…
![Page 34: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/34.jpg)
The Transitive Chain (TC) Abstraction
⟹Using TC Abstraction
Infinite
i1 inIF
EX
WB
fr
i1
fr
i2po
i1 i3
fr
i2poco
po rfi1 i3
fr
i2 i4po
corfi1 i3
fr
i2 i4po
…
Finite!
i1 inIF
EX
WB
fri1 in
IF
EX
WB
fr
i1 inIF
EX
WB
fri1 in
IF
EX
WB
fri1 in
IF
EX
WB
fr
i1 inIF
EX
WB
fri1 in
IF
EX
WB
fri1 in
IF
EX
WB
fr
![Page 35: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/35.jpg)
The Transitive Chain (TC) Abstraction
⟹Using TC Abstraction
Infinite
i1 inIF
EX
WB
fr
i1
fr
i2po
i1 i3
fr
i2poco
po rfi1 i3
fr
i2 i4po
corfi1 i3
fr
i2 i4po
…
Finite!
i1 inIF
EX
WB
fri1 in
IF
EX
WB
fr
i1 inIF
EX
WB
fri1 in
IF
EX
WB
fri1 in
IF
EX
WB
fr
i1 inIF
EX
WB
fri1 in
IF
EX
WB
fri1 in
IF
EX
WB
fr
Soundness verified as a supporting
proof!
![Page 36: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/36.jpg)
Microarchitectural Correctness Proof
i1 in
fr
Some µhbedge from i1
to in(transitive
connection)
All possible
tran. conns.
Other ISA-level cycles…
i1 in
po
Some µhbedge from i1
to in(transitive
connection)
Cycles containing fr
Cycles containing po
![Page 37: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/37.jpg)
Microarchitectural Correctness Proof
i1 in
IF
EX
WB
fr✓NoDecomp
i1 in
fr
Some µhbedge from i1
to in(transitive
connection)
All possible
tran. conns.
Other transitive connections…
Other ISA-level cycles…
i1 in
po
Some µhbedge from i1
to in(transitive
connection)
Cycles containing fr
Cycles containing po
![Page 38: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/38.jpg)
Microarchitectural Correctness Proof
i1 inIF
EX
WB
fr
?AbsCounterX
i1 in
IF
EX
WB
fr✓NoDecomp
i1 in
fr
Some µhbedge from i1
to in(transitive
connection)
All possible
tran. conns.
Other transitive connections…
Other ISA-level cycles…
i1 in
po
Some µhbedge from i1
to in(transitive
connection)
Cycles containing fr
Cycles containing po
![Page 39: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/39.jpg)
Microarchitectural Correctness Proof
i1 inIF
EX
WB
fr
?AbsCounterX
i1 in
IF
EX
WB
fr✓NoDecomp
i1 in
fr
Some µhbedge from i1
to in(transitive
connection)
All possible
tran. conns.
Other transitive connections…
Other ISA-level cycles…
i1 in
po
Some µhbedge from i1
to in(transitive
connection)
Cycles containing fr
Cycles containing po
Acyclic graph with
transitive connection =>
Abstract Counterexample
(i.e. possible bug)
![Page 40: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/40.jpg)
Microarchitectural Correctness Proof
i1 inIF
EX
WB
fr
?AbsCounterX
i1 in
IF
EX
WB
fr✓NoDecomp
i1 in
fr
Some µhbedge from i1
to in(transitive
connection)
All possible
tran. conns.
Other transitive connections…
Other ISA-level cycles…
i1 in
po
Some µhbedge from i1
to in(transitive
connection)
Cycles containing fr
Cycles containing po
Transitive connection
may represent one or
multiple ISA-level edges
![Page 41: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/41.jpg)
Microarchitectural Correctness Proof
i1 inIF
EX
WB
fr
?AbsCounterX
i1 in
IF
EX
WB
fr✓NoDecomp
i1 in
fr
Some µhbedge from i1
to in(transitive
connection)
Try to Concretize (Replace transitive connection with
one ISA-level edge)
Microarch Buggy,Return Counterexample
Observable
All possible
tran. conns.
Other transitive connections…
Other ISA-level cycles…
i1 in
po
Some µhbedge from i1
to in(transitive
connection)
Cycles containing fr
Cycles containing po
![Page 42: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/42.jpg)
Microarchitectural Correctness Proof
i1 inIF
EX
WB
fr
?AbsCounterX
i1 in
IF
EX
WB
fr✓NoDecomp
i1 in
fr
Some µhbedge from i1
to in(transitive
connection)
Try to Concretize (Replace transitive connection with
one ISA-level edge)
Unobs.
Microarch Buggy,Return Counterexample
Observable
Consider all Decompositions
(Inductively break down Transitive Chain)
All possible
tran. conns.
Other transitive connections…
Other ISA-level cycles…
i1 in
po
Some µhbedge from i1
to in(transitive
connection)
Cycles containing fr
Cycles containing po
![Page 43: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/43.jpg)
Microarchitectural Correctness Proof
i1 inIF
EX
WB
fr
?AbsCounterX
i1 in
IF
EX
WB
fr✓NoDecomp
i1 in
fr
Some µhbedge from i1
to in(transitive
connection)
Try to Concretize (Replace transitive connection with
one ISA-level edge)
Unobs.
Microarch Buggy,Return Counterexample
Observable
Consider all Decompositions
(Inductively break down Transitive Chain)
All possible
tran. conns.
Other transitive connections…
Other ISA-level cycles…
“Refinement Loop”
i1 in
po
Some µhbedge from i1
to in(transitive
connection)
Cycles containing fr
Cycles containing po
![Page 44: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/44.jpg)
Concretization
Concretization:Replace transitive connection
with single ISA-level edgep
i1
r
q
in
IF
EX
WB
fr
?AbsCounterX
▪All concretizations must be unobservable
▪Observable concretizations are counterexamples
![Page 45: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/45.jpg)
Concretization
✓
p
i1
r
q
in
IF
EX
WB
frrf
p
i1
r
q
in
IF
EX
WB
frpo
Concretization:Replace transitive connection
with single ISA-level edge
…
✓
p
i1
r
q
in
IF
EX
WB
fr
?AbsCounterX
▪All concretizations must be unobservable
▪Observable concretizations are counterexamples
![Page 46: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/46.jpg)
Decomposition
p
i1
r
q
in
IF
EX
WB
fr
▪Additional instruction and ISA-level edge modelled => extra constraints
• May be enough to make execution unobservable
Decomposition:Inductively break down
transitive chain(Chain of length n == Chain of length
n-1 + single “peeled-off” edge)
?AbsCounterX
![Page 47: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/47.jpg)
Decomposition
…
p
i1 in-1
IF
EX
WB
rf
r
q
in
fr
p
i1 i2
IF
EX
WB
co
r
q
in
fr
p
i1
r
q
in
IF
EX
WB
fr
▪Additional instruction and ISA-level edge modelled => extra constraints
• May be enough to make execution unobservable
Decomposition:Inductively break down
transitive chain(Chain of length n == Chain of length
n-1 + single “peeled-off” edge)
?AbsCounterX
![Page 48: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/48.jpg)
Decomposition
…
p
i1 in-1
IF
EX
WB
rf
r
q
in
fr
p
i1 i2
IF
EX
WB
co
r
q
in
fr
✓
p
i1
r
q
in
IF
EX
WB
fr
▪Additional instruction and ISA-level edge modelled => extra constraints
• May be enough to make execution unobservable
Decomposition:Inductively break down
transitive chain(Chain of length n == Chain of length
n-1 + single “peeled-off” edge)
?AbsCounterX
![Page 49: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/49.jpg)
Decomposition
…
p
i1 in-1
IF
EX
WB
rf
r
q
in
fr
p
i1 i2
IF
EX
WB
co
r
q
in
fr
✓
?p
i1
r
q
in
IF
EX
WB
fr
▪Additional instruction and ISA-level edge modelled => extra constraints
• May be enough to make execution unobservable
Decomposition:Inductively break down
transitive chain(Chain of length n == Chain of length
n-1 + single “peeled-off” edge)
?AbsCounterX
![Page 50: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/50.jpg)
Decomposition
…
p
i1 in-1
IF
EX
WB
rf
r
q
in
fr
p
i1 i2
IF
EX
WB
co
r
q
in
fr
✓
?p
i1
r
q
in
IF
EX
WB
fr
▪Additional instruction and ISA-level edge modelled => extra constraints
• May be enough to make execution unobservable
Decomposition:Inductively break down
transitive chain(Chain of length n == Chain of length
n-1 + single “peeled-off” edge)
?AbsCounterX
![Page 51: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/51.jpg)
Outline▪Background
• ISA-level MCM specs
• Microarchitectural ordering specs
▪Microarchitectural Correctness Proof
• Transitive Chain (TC) Abstraction
▪Overall PipeProof Operation
• TC Abstraction Support Proof
• Chain Invariants
▪Results
![Page 52: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/52.jpg)
PipeProof Block DiagramMicroarchitecture
Ordering Spec.ISA-Level
MCM Spec.
PipeProof
ISA Edge -> Microarch. Mapping
Result: All-Program MCM Correctness Proof?Counterexample found?
Chain Invariants
Transitive Chain Abstraction
Support Proof
Microarch. Correctness
Proof
Cex. Generation
Proof of Chain Invariants
FailFail
PassPass
![Page 53: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/53.jpg)
PipeProof Block DiagramMicroarchitecture
Ordering Spec.ISA-Level
MCM Spec.
PipeProof
ISA Edge -> Microarch. Mapping
Result: All-Program MCM Correctness Proof?Counterexample found?
Chain Invariants
Transitive Chain Abstraction
Support Proof
Microarch. Correctness
Proof
Cex. Generation
Proof of Chain Invariants
FailFail
PassPass
![Page 54: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/54.jpg)
PipeProof Block DiagramMicroarchitecture
Ordering Spec.ISA-Level
MCM Spec.
PipeProof
ISA Edge -> Microarch. Mapping
Result: All-Program MCM Correctness Proof?Counterexample found?
Chain Invariants
Transitive Chain Abstraction
Support Proof
Microarch. Correctness
Proof
Cex. Generation
Proof of Chain Invariants
FailFail
PassPass
Links ISA-level and
µarch executions
![Page 55: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/55.jpg)
PipeProof Block DiagramMicroarchitecture
Ordering Spec.ISA-Level
MCM Spec.
PipeProof
ISA Edge -> Microarch. Mapping
Result: All-Program MCM Correctness Proof?Counterexample found?
Chain Invariants
Transitive Chain Abstraction
Support Proof
Microarch. Correctness
Proof
Cex. Generation
Proof of Chain Invariants
FailFail
PassPass
Represent repeated ISA-level patterns
![Page 56: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/56.jpg)
PipeProof Block DiagramMicroarchitecture
Ordering Spec.ISA-Level
MCM Spec.
PipeProof
ISA Edge -> Microarch. Mapping
Result: All-Program MCM Correctness Proof?Counterexample found?
Chain Invariants
Transitive Chain Abstraction
Support Proof
Microarch. Correctness
Proof
Cex. Generation
Proof of Chain Invariants
FailFail
PassPass
If design can’t be verified, a counterexample (a forbidden execution that is observable) is often returned
![Page 57: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/57.jpg)
PipeProof Block DiagramMicroarchitecture
Ordering Spec.ISA-Level
MCM Spec.
PipeProof
ISA Edge -> Microarch. Mapping
Result: All-Program MCM Correctness Proof?Counterexample found?
Chain Invariants
Transitive Chain Abstraction
Support Proof
Microarch. Correctness
Proof
Cex. Generation
Proof of Chain Invariants
FailFail
PassPassSupporting
proofs provide foundation for
correctness proof
![Page 58: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/58.jpg)
Transitive Chain (TC) Abstraction Support Proof▪Ensure that ISA-level pattern and µarch. support TC Abstraction
▪Base case: Do initial ISA-level edges guarantee connection?
▪ Inductive case: Extend transitive chain => extend transitive connection?
i1 i2
IF
EX
WB
poi1 i2
IF
EX
WB
rfi1 i2
IF
EX
WB
fri1 i2
IF
EX
WB
co
⟹i1 in
IF
EX
WB
rn in+1
Some Tran
Conn.
i1 in+1
IF
EX
WB
Some Transitive Connection
![Page 59: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/59.jpg)
Chain Invariants▪Abstractly represent repeated ISA-level patterns
▪ Sometimes needed for refinement loop to terminate
▪ Inductively proven by PipeProof before their use in proof algorithms
▪Example: checking for edge from i1 to i5 (TC abstraction support proof)
Abstract Counterexample
i1 i3 i4fr
i5po
![Page 60: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/60.jpg)
Chain Invariants▪Abstractly represent repeated ISA-level patterns
▪ Sometimes needed for refinement loop to terminate
▪ Inductively proven by PipeProof before their use in proof algorithms
▪Example: checking for edge from i1 to i5 (TC abstraction support proof)
Repeating ISA-Level Pattern
i1 i3 i4fr
i5po
i1 i3 i4fr
i2po
i5po
![Page 61: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/61.jpg)
Chain Invariants▪Abstractly represent repeated ISA-level patterns
▪ Sometimes needed for refinement loop to terminate
▪ Inductively proven by PipeProof before their use in proof algorithms
▪Example: checking for edge from i1 to i5 (TC abstraction support proof)
Repeating ISA-Level Pattern
i1 i3 i4fr
i5po
i1 i3 i4fr
i2po
i5po
Can continue decomposing
in this way forever!
![Page 62: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/62.jpg)
Chain Invariants▪Abstractly represent repeated ISA-level patterns
▪ Sometimes needed for refinement loop to terminate
▪ Inductively proven by PipeProof before their use in proof algorithms
▪Example: checking for edge from i1 to i5 (TC abstraction support proof)
Chain Invariant Applied
i1 i3 i4fr
i5po
i1 i3 i4fr
i2po
i5po
i1 i4fr
i2po_plus
i5
-po_plus = arbitrary number of repetitions of po-Next edge peeled off will be something other than po
![Page 63: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/63.jpg)
In the paper…▪Optimizations
• Covering Sets: Eliminate redundant transitive connections
• Memoization: Eliminate redundant ISA-level cycles
▪ Inductive ISA edge generation
▪Adequate Model Over-Approximation
• Needed to ensure soundness of PipeProof’s abstraction-based approach
▪…and more!
![Page 64: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/64.jpg)
simpleTSO simpleTSO(w/ Covering Sets + Memoization)
Total Time Timeout 2449.7 sec(≈ 41 mins)
Results▪Ran PipeProof on simpleSC (SC) and simpleTSO (TSO) µarches
• 3-stage in-order pipelines
▪Proved correctness of both microarchitectures for all programs
• With optimizations, runtimes < 1 hour!
simpleSC simpleSC(w/ Covering Sets + Memoization)
Total Time 225.9 sec 19.1 sec
![Page 65: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/65.jpg)
simpleTSO simpleTSO(w/ Covering Sets + Memoization)
Total Time Timeout 2449.7 sec(≈ 41 mins)
Results▪Ran PipeProof on simpleSC (SC) and simpleTSO (TSO) µarches
• 3-stage in-order pipelines
▪Proved correctness of both microarchitectures for all programs
• With optimizations, runtimes < 1 hour!
simpleSC simpleSC(w/ Covering Sets + Memoization)
Total Time 225.9 sec 19.1 sec
![Page 66: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/66.jpg)
simpleTSO simpleTSO(w/ Covering Sets + Memoization)
Total Time Timeout 2449.7 sec(≈ 41 mins)
Results▪Ran PipeProof on simpleSC (SC) and simpleTSO (TSO) µarches
• 3-stage in-order pipelines
▪Proved correctness of both microarchitectures for all programs
• With optimizations, runtimes < 1 hour!
simpleSC simpleSC(w/ Covering Sets + Memoization)
Total Time 225.9 sec 19.1 sec
![Page 67: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/67.jpg)
simpleTSO simpleTSO(w/ Covering Sets + Memoization)
Total Time Timeout 2449.7 sec(≈ 41 mins)
Results▪Ran PipeProof on simpleSC (SC) and simpleTSO (TSO) µarches
• 3-stage in-order pipelines
▪Proved correctness of both microarchitectures for all programs
• With optimizations, runtimes < 1 hour!
simpleSC simpleSC(w/ Covering Sets + Memoization)
Total Time 225.9 sec 19.1 sec
![Page 68: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/68.jpg)
simpleTSO simpleTSO(w/ Covering Sets + Memoization)
Total Time Timeout 2449.7 sec(≈ 41 mins)
Results▪Ran PipeProof on simpleSC (SC) and simpleTSO (TSO) µarches
• 3-stage in-order pipelines
▪Proved correctness of both microarchitectures for all programs
• With optimizations, runtimes < 1 hour!
simpleSC simpleSC(w/ Covering Sets + Memoization)
Total Time 225.9 sec 19.1 sec
![Page 69: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/69.jpg)
Conclusions▪PipeProof: Automated All-Program Microarchitectural MCM Verification
• Designers no longer need to choose between completeness and automation
▪Transitive Chain Abstraction allows inductive modelling and verification of the infinite set of all possible executions
• Abstraction is automatically refined as necessary to prove correctness
▪Verified simple microarchitectures implementing SC and TSO in < 1 hour!
Code available at https://github.com/ymanerka/pipeproof
[Image: Napish]
![Page 70: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/70.jpg)
Yatin A. Manerkar, Daniel Lustig*,
Margaret Martonosi, and Aarti Gupta
PipeProof: Automated Memory Consistency Proofs for
Microarchitectural Specifications
http://check.cs.princeton.edu/
Code available at https://github.com/ymanerka/pipeproof
![Page 71: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/71.jpg)
Covering Sets Optimization▪Must verify across all possible transitive connections
▪ Each decomposition creates a new set of transitive connections
• Can quickly lead to a case explosion
▪ The Covering Sets Optimization eliminates redundant transitive connections
x
y
i1
z
in
IF
EX
WB
fr
x
y
i1
z
in
IF
EX
WB
fr
BA
![Page 72: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/72.jpg)
Covering Sets Optimization▪Must verify across all possible transitive connections
▪ Each decomposition creates a new set of transitive connections
• Can quickly lead to a case explosion
▪ The Covering Sets Optimization eliminates redundant transitive connections
x
y
i1
z
in
IF
EX
WB
fr
x
y
i1
z
in
IF
EX
WB
fr
BA
Graph A has an edge from x→z (tran conn.)
![Page 73: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/73.jpg)
Covering Sets Optimization▪Must verify across all possible transitive connections
▪ Each decomposition creates a new set of transitive connections
• Can quickly lead to a case explosion
▪ The Covering Sets Optimization eliminates redundant transitive connections
x
y
i1
z
in
IF
EX
WB
fr
x
y
i1
z
in
IF
EX
WB
fr
BA
Graph B has edges from y→z (tran conn.) and x→z (by transitivity)
Graph A has an edge from x→z (tran conn.)
![Page 74: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/74.jpg)
Covering Sets Optimization▪Must verify across all possible transitive connections
▪ Each decomposition creates a new set of transitive connections
• Can quickly lead to a case explosion
▪ The Covering Sets Optimization eliminates redundant transitive connections
x
y
i1
z
in
IF
EX
WB
fr
x
y
i1
z
in
IF
EX
WB
fr
BA
Graph B has edges from y→z (tran conn.) and x→z (by transitivity)
Graph A has an edge from x→z (tran conn.)
Correctness of A => Correctness of B (since B contains A’s tran conn.)Checking B explicitly is redundant!
![Page 75: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/75.jpg)
Memoization Optimization▪Base PipeProof algorithm examines some cycles multiple times
▪Memoization eliminates redundant checks of cycles that have already been verified
i1
fr
i2
i3
i4
rf
po po
![Page 76: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/76.jpg)
Memoization Optimization▪Base PipeProof algorithm examines some cycles multiple times
▪Memoization eliminates redundant checks of cycles that have already been verified
i1 in
IF
EX
WB
fr
Some Tran.Conn.
i1
fr
i2
i3
i4
rf
po po
fr
![Page 77: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/77.jpg)
Memoization Optimization▪Base PipeProof algorithm examines some cycles multiple times
▪Memoization eliminates redundant checks of cycles that have already been verified
i1 in
IF
EX
WB
fr
Some Tran.Conn.
i1
fr
i2
i3
i4
rf
po po
i1 in
IF
EX
WB
po
Some Tran.Conn.
po po
![Page 78: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/78.jpg)
Memoization Optimization▪Base PipeProof algorithm examines some cycles multiple times
▪Memoization eliminates redundant checks of cycles that have already been verified
i1 in
IF
EX
WB
fr
Some Tran.Conn.
i1 in
IF
EX
WB
rf
Some Tran.Conn.
i1
fr
i2
i3
i4
rf
po po
i1 in
IF
EX
WB
po
Some Tran.Conn.rf
Same cycle is checked 3 times!
![Page 79: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/79.jpg)
Memoization Optimization▪Base PipeProof algorithm examines some cycles multiple times
▪Memoization eliminates redundant checks of cycles that have already been verified
i1 in
IF
EX
WB
fr
Some Tran.Conn.
i1 in
IF
EX
WB
rf
Some Tran.Conn.
i1
fr
i2
i3
i4
rf
po po
i1 in
IF
EX
WB
po
Some Tran.Conn.rf
Procedure: If all ISA-level cycles containing edge ri have been checked, do not peel off ri edges when checking subsequent cycles
Same cycle is checked 3 times!
![Page 80: Automated Memory Consistency Proofs for Microarchitectural …manerkar/slides/pipeproof... · 2019. 1. 8. · A µhb graph of mp on simpleSC (i1) (i2) IF EX WB po (i3) (i4) fr rf](https://reader035.fdocuments.net/reader035/viewer/2022071219/6054dbb2dba3dc726c4d3ffb/html5/thumbnails/80.jpg)
The Adequate Model Over-Approximation▪Addition of an instruction can make unobservable execution observable!
▪Need to work with over-approximation of microarchitectural constraints
▪PipeProof sets all exists clauses to true as its over-approximation
t
i1 i2
IF
EX
WB
fr
v
i3co
SubsetExec
u
t
i1 i2
IF
EX
WB
fr
v
i3
SubsetWithExternal
u
i4rf
co