View
7
Download
0
Category
Preview:
Citation preview
Roderick Bloem Synthesis of Concurrency Constructs with UIFs 1
Synthesis of Concurrency
Constructs using Uninterpreted
FunctionsWork by: Georg Hofferek, Bettina Koenighofer
Roland Jiang, Ashutosh Gupta
Roderick Bloem
Roderick Bloem Synthesis of Concurrency Constructs with UIFs 2
1. Problem
Roderick Bloem Synthesis of Concurrency Constructs with UIFs 3
Concurrency: RSA in Software
RSA decryption: Compute
𝑐𝑑mod 𝑝𝑞 =crt( 𝑐𝑑mod 𝑝, 𝑐𝑑mod 𝑞)
T2::
1. mq = 𝒄𝒅𝐦𝐨𝐝 𝐪
2. finished2 = true
3. if !merged && finished1
4. merged = true
5. mp = 𝐜𝐫𝐭(𝒎𝒑,𝒎𝒒)
T1::
1. mp = 𝒄𝒅𝐦𝐨𝐝 𝐩
2. finished1 = true
3. if !merged && finished2
4. merged = true
5. mp = 𝐜𝐫𝐭(𝒎𝒑,𝒎𝒒)
Roderick Bloem Synthesis of Concurrency Constructs with UIFs 4
T2::
1. mq = 𝒄𝒅𝐦𝐨𝐝 𝐪
2. finished2 = true
3. if !merged && finished1
4. merged = true
5. mp = 𝐜𝐫𝐭(𝒎𝒑,𝒎𝒒)
T1::
1. mp = 𝒄𝒅𝐦𝐨𝐝 𝐩
2. finished1 = true
3. if !merged && finished2
4. merged = true
5. mp = 𝐜𝐫𝐭(𝒎𝒑,𝒎𝒒)
Hard to program, easy to specify:
T1||T2 = T1;T2 T2;T1
Concurrency: RSA in Software
Roderick Bloem Synthesis of Concurrency Constructs with UIFs 5
Complex system:
64-bit datapath
very complex arithmetic logic unit
IF DE EX MEM WB
MEM
REG
ALU
How do I pipeline that?
Concurrency: RSA in Software
Roderick Bloem Synthesis of Concurrency Constructs with UIFs 6
IF DE EX MEM WB
MEM
REG
ALU
That’s trivial!
Concurrency: Pipelined Processor
Roderick Bloem Synthesis of Concurrency Constructs with UIFs 7
IF DE EX MEM WB
MEM
REG
ALU
r1 := mem[1]r2 := r1 + r2
r1 = 1r2 = 2
r1 := mem[1] r1 := mem[1] r1 := mem[1] r1 := 15
mem[1] = 15
r1 = 15r2 = 2
r2 := r1 + r2
stall
15
15
r2 := 15 + 2 r2 := 17 r2 := 17
r1 = 15r2 = 17
forward
Concurrency: Pipelined Processor
Roderick Bloem Synthesis of Concurrency Constructs with UIFs 8
Not so trivial!
IF DE EX MEM WB
MEM
REG
ALU
stall
forward
Concurrency: Pipelined Processor
Roderick Bloem Synthesis of Concurrency Constructs with UIFs 9
=ISA
Pipeline
Concurrency: Pipelined Processor
Specification
Roderick Bloem Synthesis of Concurrency Constructs with UIFs 10
Easy & HardSpecification Implementation
sequential, data hard easy
parallel easy hard
perfect application area for synthesis:
construct synchronization automatically
Cf. ClarkeEmerson82; VechevYahavYorsh10,…
Focus today:
Uninterpreted functions for complex systems
Roderick Bloem Synthesis of Concurrency Constructs with UIFs 11
2. A Solution
Roderick Bloem Synthesis of Concurrency Constructs with UIFs 12
Uninterpreted Functions
Thread1()1. m1= 𝒄𝒅 𝒎𝒐𝒅 𝒑2. 𝑓𝑖𝑛𝑖𝑠ℎ𝑒𝑑1 = 𝑡𝑟𝑢𝑒3. 𝑰𝑭 !𝑚𝑒𝑟𝑔𝑒𝑑 𝑨𝑵𝑫 𝑓𝑖𝑛𝑖𝑠ℎ𝑒𝑑24. 𝑚𝑒𝑟𝑔𝑒𝑑 = 𝑡𝑟𝑢𝑒5. 𝑚1= 𝒄𝒓𝒕(𝒎𝟏, 𝒎𝟐)
Thread2()1. m2= 𝒄𝒅 𝒎𝒐𝒅 𝒒2. 𝑓𝑖𝑛𝑖𝑠ℎ𝑒𝑑2 = 𝑡𝑟𝑢𝑒3. 𝑰𝑭 !𝑚𝑒𝑟𝑔𝑒𝑑 𝑨𝑵𝑫 𝑓𝑖𝑛𝑖𝑠ℎ𝑒𝑑14. 𝑚𝑒𝑟𝑔𝑒𝑑 = 𝑡𝑟𝑢𝑒5. 𝑚1= 𝒄𝒓𝒕(𝒎𝟏, 𝒎𝟐)
Correctness is independent of
semantic of functions
Useuninterpreted
functions
𝒇𝟏(𝒄, 𝒅, 𝒑) 𝒇𝟏(𝒄, 𝒅, 𝒒)
𝒇𝟐(𝒎𝒑, 𝒎𝒒) 𝒇𝟐(𝒎𝒑, 𝒎𝒒)
Spec: 𝑇1 || 𝑇2 = 𝑇1; 𝑇2 ∪ 𝑇2; 𝑇1
Roderick Bloem Synthesis of Concurrency Constructs with UIFs 13
=ISA
Pipeline
Concurrency: Pipelined Processor
Specification
Roderick Bloem Synthesis of Concurrency Constructs with UIFs 14
Synthesis = Solving a Quantified Formula
Lock Synthesis
𝜓 = ∃ 𝑎. ∀ 𝑖𝑛, 𝑜𝑢𝑡. Φ
𝑎 fixes atomic sections
𝑎: Boolean
𝑖, 𝑜 : uninterpreted domain
Pipeline Controller
𝜓 = ∀𝑚𝑒𝑚, 𝑟𝑒𝑔 . ∃𝑠𝑡𝑎𝑙𝑙,𝑓𝑤𝑑 . ∀ 𝑚𝑒𝑚′, 𝑟𝑒𝑔′. Φ
𝑠𝑡𝑎𝑙𝑙, 𝑓𝑤𝑑 fix concurrency
𝑠𝑡𝑎𝑙𝑙, 𝑓𝑤𝑑: Boolean
𝑚𝑒𝑚, 𝑟𝑒𝑔 : uninterpreted
domain
Φ in Quantifier Free FOL with uninterpreted functions
Clearly decidable
Problem: Efficiently find certificates
Roderick Bloem Synthesis of Concurrency Constructs with UIFs 16
Options:
1. Reduce to propositional logic
2. Expand and use interpolation
3. Build a “QBF MT” solver
4. ?
Insert Real Work here
Roderick Bloem Synthesis of Concurrency Constructs with UIFs 17
Simple processors
Lock synthesis for programs without loops
And what we cannot do
Temporal aspects, loops
Combinations with other abstraction techniques?
More examples… Other logics?
What we can do
Roderick Bloem Synthesis of Concurrency Constructs with UIFs 18
Ras’ Ten Commandments
1. Extend the Language
2. Don’t reinvent the wheel
3. Just Say It
4. Don’t assume knowledge of spec language
5. Expect the Unexpected
6. Embrace Ambiguity
7. Interact
8. Invent a Calculus ~
9. Divide and conquer. Abstract and refine.
10. Talk to Ras
Recommended