reducing interpolant circuit size by ad-hoc logic synthesis and … · 3 motivations & related...

51
1 Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and SAT-Based Weakening Gianpiero Cabodi Paolo Camurati Paolo Pasini Marco Palena Danilo Vendraminetto Politecnico di Torino Torino, Italy

Upload: others

Post on 30-Jul-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

1

Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and SAT-Based Weakening

Gianpiero Cabodi

Paolo Camurati Paolo Pasini

Marco Palena Danilo Vendraminetto

Politecnico di Torino

Torino, Italy

Page 2: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

2

Outline l  Motivations & background

l  Craig interpolation in MC => Size bottleneck (>105 gates) l  Highly redundant circuits, missing ad hoc reduction

l  Contribution l  Ad HOC (fast) logic synthesis (based on known

techniques) l  SAT-based Weakening (and strenthening) with high

compaction potential (strength/time for size)

l  Experimental results & Conclusions

Page 3: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

3

Motivations & related works l  Interpolation (ITP) still a major engine in UMC

portfolio [McMillan CAV’03] l  Other ITP usages

l  Formula/constraint synthesis in predicate abstr. l  Scalability problem

l  ITPs are large and highly redundant l  Previous efforts [Marques-Silva CHARME’05, D’Silva et al.

VMCAI’08, Cabodi et al. FMSD’15, Rollini et al LPAR’13 (PeRIPLO)] l  Proof reduction l  Interpolant compaction

Page 4: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Rk,bwd

F

Background: Craig Interpolant for IMG in Unbounded MC

From T T T T

To

T

To+

Unrollk

4

Page 5: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Interpolant: set view

5

∧ A(x,y) B(y,z) ∩

Page 6: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Interpolant: set view

6

∧ A(x,y) B(y,z)

I(y)

Page 7: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

7

Craig Interpolant from refutation proof

A B

CNF clauses

UNSAT problem (A∧B = 0)

Page 8: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

8

Craig Interpolant from refutation proof

A B

Resolution graph

Null clause

Page 9: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

9

Craig Interpolant from refutation proof

A B

Resolution graph

Null clause

Unsatisfiable core

resolution (A ∨ p) (¬p ∨ B)

(A ∨ B)

Page 10: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

10

Craig Interpolant from refutation proof

A B

Resolution graph

Null clause

AND-OR circuit

1

I(Y) = Interpolant (A(X,Y),B(Y,Z))

Page 11: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

11

Craig Interpolant from refutation proof

A B

Resolution graph

Null clause

AND-OR circuit

1

I(Y) = Interpolant (A(X,Y),B(Y,Z))

A gate for each resolution node

Page 12: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

12

Redundancy / Compaction |Interpolant| = O(|proof|) highly redundant => compaction

l  Reduce proof l  Recycle-pivots, local transformations, proof restructure

l  Combinational logic synthesis l  BDD/SAT-sweeping l  Rewriting l  Refactoring

l  Ad hoc logic synthesis l  Logic synthesis using proof graph l  ITE-based decompose & compact

Page 13: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Contributions

l  AD-hoc logic synthesis (rewrite/refactor) l  Implemented/tuned for interpolants l  Interpolant strength unchanged l  Trade-off speed for optimality

l  Compaction by strenghtening/weakening l  Gate Level Abstraction l  Proof (core) based l  Expensive (SAT needed) l  Trade-off strength for size 13

Page 14: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Circuit graph decomposition

14

y1

yN

I 1

Page 15: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Circuit graph decomposition

15

1

Page 16: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Circuit graph decomposition

16

1

Macrogates

Page 17: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Circuit graph decomposition

17

1

Macrogates

Page 18: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Circuit graph decomposition

18

1

Cluster

Page 19: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Circuit graph decomposition

19

1

Cut

Page 20: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Circuit graph decomposition

20

1

Dominators

Page 21: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

d dominates n

Circuit graph decomposition

21

1 dn

Page 22: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Rewrite: direct ODC removal

22

a f

y1

yN

Page 23: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Rewrite: direct ODC removal

23

1

a

g

F(Y,a) = a∧g(Y,a) = a∧g(Y,1)

f

y1

yN

Page 24: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Rewrite: direct ODC removal

24

a f

y1

yN

1

Page 25: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Algorithm

25

DirectOdcSimplify()

forall clusters CL

find node v ∈ cut(CL) with fanout(v) >1 in CL

take u,t ∈ fanout(v) ∩ CL

if (domG(t) dominates u)

u <= constant // u is redundant

Page 26: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Rewrite: transitive ODC

26

a f

y1

yN

a

Page 27: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Rewrite: transitive ODC

27

1 f

y1

yN

a

Page 28: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Refactor: search sharable term

28

a b c d c

Page 29: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Refactor: search sharable term

29

a b c d c

Page 30: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Refactor: search sharable term

30

a c b d c

Page 31: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Refactor: search sharable term

31

a b d c

Page 32: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Algorithm

32

MacrogateRefactor()

forall macrogates G

forall nodes v ∈ cut(G)

find AND(u,v) ∉ G such that u ∈ cut(G)

refactor G using AND(u,v)

Page 33: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

33

Experimental results

l  Implementation on PdTrav tool l  HWMCC ’07 to ‘15

l  ITPs stored on files from MC runs l  Picked 87 instances l  experiments also on ITPs from PeRIPLO

(Sharygina’s group, Lugano)

Page 34: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

•  Benchmark set (87 ITPs) • Size range: 4·105 – 8,5 ·106 gates • Average size: 2 ·106 gates

•  Experimental set-up • Time limit: 900 seconds • Memory limit: 8 GB

Completed Benchmarks

Average compaction rate

Average execution time

Balance 87 61.31 % 25.27 s

ITP Simplify 68 83.06 % 421.06 s

No Direct ODC 68 80.83 % 505.89 s

No Refactoring 86 69.28 % 84.80 s

No Transitive ODC 72 80.93 % 310.46 s

ABC 31 94.96 % 568.98 s

Logic synthesis

Page 35: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Cumulative size

Page 36: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Cumulative time

Page 37: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

ITP weakening by SAT GLA

l  GLA: Gate Level Abstraction l  used here to abstract combinational circuit

l  SAT-based abstraction (PBA) l  SAT(I∧B) => UNSAT CORE => abstract

l  Given cut var, monotonicity => existential quantification by constant substitution

l  NNF encoding l  monotone w.r.t. all circuit nodes except Pis.

37

Page 38: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Interpolant weakening

38

∧ I(y) B(y,z)

Page 39: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Interpolant weakening

39

I(y) B(y,z)

IW(y)

Page 40: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Interpolant weakening

40

I(y) B(y,z) 1 ∧

Page 41: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Interpolant weakening

41

I(y) B(y,z) 1 ∧

UNSAT => CORE

Page 42: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Interpolant weakening

42

I(y) B(y,z) 1 ∧

N out of CORE

N

Page 43: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Interpolant weakening

43

I(y) B(y,z) 1 ∧

ABSTRACT

N

Page 44: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Interpolant weakening

44

I(y,N)

B(y,z) 1 ∧

EXTRA VARIABLE

N

Page 45: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Existential quantification

NNF encoding NNF circuit monotone w.r.t. internal nodes Quantification by constant substitution

∃NI(Y,N) = I(Y,1) 1.  I(Y) => INNF(Y) 2.  SAT(INNF(Y) ∧ B(Y,Z)) 3.  INNF => (uns. core, abstract, inject 1) => INNF,weak

4.  INNF,weak => Iweak

45

Page 46: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Interpolant strengthening

46

∧ ¬I(y) A(x,y)

Strengthening by weakening complement of interpolant w.r.t. A

Page 47: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

•  Benchmark set (87 circuits) • Size range: 4·105 – 8,5 ·106 gates • Average size: 2 ·106 gates

•  Experimental set-up • Time limit: 3600 seconds • Memory limit: 8 GB

Completed Benchmarks

Average compaction rate

Average execution time

A 72 82.24 % 902.33 s

AB 63 97.99 % 1495.78 s

ABAB 57 99.59 % 1649.79 s

B 68 97.53 % 1324.51 s

BA 67 98.03 % 1371.30 s

BABA 60 99.56 % 1470.84 s

SAT-based weakening

Page 48: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Cumulative size

Page 49: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Cumulative time

Page 50: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Conclusions

l  Contributions: l  Adapting logic synthesis for fast/scalable ITP

compaction l  More expensive SAT-based compaction

(weakening/strengthening) l  Evaluation

l  Fast synthesis always used l  Expensive weakening/strengthening

l  Avoid memory explosion (or time not critical) l  Strength may impact on quality of result

50

Page 51: Reducing Interpolant Circuit Size by Ad-Hoc Logic Synthesis and … · 3 Motivations & related works l Interpolation (ITP) still a major engine in UMC portfolio [McMillan CAV’03]

Thank you!

51