Faster Algorithms for Weighted Recursive State Machines Krishnendu - - PowerPoint PPT Presentation
Faster Algorithms for Weighted Recursive State Machines Krishnendu - - PowerPoint PPT Presentation
Faster Algorithms for Weighted Recursive State Machines Krishnendu Chatterjee Bernhard Kragl Samarth Mishra Andreas Pavlogiannis Recursive State Machines (RSMs) 1 Formal model of recursive computation B Linearly equivalent to pushdown
Recursive State Machines (RSMs)
Formal model of recursive computation Linearly equivalent to pushdown systems (PDSs) Advantages:
- Natural modeling
- Many parameters
β Number of modules π β Entry bound ππ = max
π
πΉππ β Exit bound ππ¦ = max
π
|πΉπ¦π| β π = max
π
min( πΉππ , |πΉπ¦π|) β β¦
2
A B C π1: β³2 D F G π2: β³
1
E β³
1
β³2 π΅, π β πΉ, π1 β π΅, π2π1 β πΆ, π2π1 β π2, π· , π1 β β© π1, π» , πβͺ
RSMs over Semirings
Label RSM transitions with weights from idempotent semiring β©π,β,β, 0,1βͺ weight of computation: β weight of computation set: β
3
πΏ β β 1 Reachability πΊ β¨ β§ β₯ β€ Shortest path β+ βͺ {β} min + β Most probable path [0,1] max β 1 IFDS 2πΈ
π 2πΈ
β β ππ¦. β€ ππ¦. π¦
Canonical partial order π β€ π β π β π = π Monotonicity π β€ π β π β π β€ π β π Finite-height: πΌ β β longest descending chain in β€
Distance Problems
Given a set of initial configurations π
- Configuration distance
π π, π£, π1 β― bπ
- Superconfiguration distance
π π, π£, β³
1 β― β³π
- Node distance
π π, π£
4
Our Solution
- 1. Configuration automata
Representation structures for sets of RSM configurations [BEMβ97] Initial automaton π·, s.t. β π· = π
- 2. Dynamic programming algorithm
Compute π·β, representing reachable configurations and distances Key: Entry-to-Exit summaries [ABEGRYβ05]
- 3. Distance extraction algorithms
Query configuration/superconfiguration/node distances from π·β
5
Configuration Automata
6
π£ π π|π€1 β― π£β² π|π€4 πβ² π|π€2 π states correspond to RSM nodes run assembles a stack
β©π£, π β― βͺ is an accepted configuration Weight of configuration is β¨ over all accepting runs
Relaxation Steps
7
π£ π π|π€1 Internal transition: π£
π€2 π£β²
π£β² π| β¦ β¨(π€1β v2) π£ π π|π€1 Call transition: π£
π€2 π, πβ²
πβ² π| β¦ β (π€1 β π€2) π£ πβ² π|π€ Exit transition: π£ π¦ β©π, π¦βͺ π β¦ β (π€2β π‘π£π π, π¦ π π|π€2 π‘π£π π, π¦ : = β― β π€ πβ² π π|π€ Using summary: π‘π£π πβ², π¦ β©π, π¦βͺ π| β¦ β π€ β π‘π£π πβ², π¦
Reachability Example
8
A B C π1: β³2 D F G π2: β³
1
E β³
1
β³2 A B π D E π1 π1 Summaries: π΅ β π· F π π2 β©π2, π·βͺ π πΉ β π» β©π1, π»βͺ π πΈ β π»
Correctness and Complexity
9
For every configuration π: π β π· , π = π·β(π) π·β is constructed in time π« πΌ β β β ππ + ππ β ππ¦ β π·πππ Compared to PDS algorithm π« πΌ β β β ππ β ππ¦ β π Factor
β β π
|β| ππ¦+ π·πππ improvement
Empirical Evaluation
RSM-based algorithm vs. PDS-based algorithm Our tool jMoped
- 1. Scaling on artificial examples
- 2. Interprocedural program analysis problems
10
A Family of Dense RSMs
β3
11
β β π
|β| ππ¦ + π·πππ = π2 β 1 π2 π +π
= π
Boolean Programs from SLAM/SDV
Absolute runtime (seconds) Relative speedup
12
Our Solution
- 1. Configuration automata
Representation structures for sets of RSM configurations [BEMβ97] Initial automaton π·, s.t. β π· = π
- 2. Dynamic programming algorithm
Compute π·β, representing reachable configurations and distances Key: Entry-to-Exit summaries [ABEGRYβ05]
- 3. Distance extraction algorithms
Query configuration/superconfiguration/node distances from π·β
13
Distance Extraction
- Configuration distance for β©π£, π1 β― ππβͺ
Dynamic programming: π« π β ππ
2
- Superconfiguration distance for β©π£, β³
1 β― β³πβͺ
Replace π
π πβ² with π β³ πβ² where β³ is module of πβ²
- Node distance
Traditional single-source distance problem
14
u π0π‘ π1π‘ πππ‘ β― π1 ππ π
Distances over Small Semirings
15
1ππ β π΅π£ β π΅π1 β― π΅ππ β 1ππ
π
πππΓππ matrix π·β transitions labeled ππ πππ vector π·β transitions π£
π π
- Constant size semiring (Mailmanβs speedup)
π« π β
ππ
2
log ππ
- Size π semiring (Williamβs speedup)
for π > 0, π« π β
ππ 2 π2log2 ππ
(some preprocessing)
- Binary semiring (Four-Russians speedup)
π« β β ππ β
π log π
Summary
- Faster interprocedural analysis (RSM > PDS)
- Configuration automata
ο Saturation algorithm (summaries) ο Distance extraction
- More in the paper
β Further distance extraction speedups β Implications for context-bounded analysis (concurrency)
16
17
18