23
It Is Better to Run It Is Better to Run Iterative Resynthesis on Iterative Resynthesis on Parts of the Circuit Parts of the Circuit Petr Fišer , Jan Schmidt Faculty of Information Technology Czech Technical University in Prague [email protected], [email protected]

It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

Embed Size (px)

Citation preview

Page 1: It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

It Is Better to Run Iterative It Is Better to Run Iterative Resynthesis on Parts of the Resynthesis on Parts of the

CircuitCircuit

Petr Fišer, Jan Schmidt

Faculty of Information TechnologyCzech Technical University in Prague

[email protected], [email protected]

Page 2: It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

IWLS’10IWLS’10 22

OutlineOutline

Preliminaries

Iterative resynthesis

Motivation

Circuit resynthesis by parts

Experiments

Conclusions

Page 3: It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

IWLS’10IWLS’10 33

PreliminariesPreliminaries

Synthesis (optimization) of circuits (networks) will be discussed

Just for simplicity: Combinational circuits are assumed Mapping into arbitrary 2-input gates

Cost (optimality criterion, quality) = # of gates

Page 4: It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

IWLS’10IWLS’10 44

Iterative ResynthesisIterative Resynthesis

Iterative resynthesis = improving the result quality by repetitive application of a single synthesis process, in order to improve the result quality

Possible assumption: the synthesis process cannot make the circuit worseNeeds not be always true

Page 5: It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

IWLS’10IWLS’10 55

Iterative Resynthesis in ABCIterative Resynthesis in ABC

ABC naturally supports iterative resynthesis

Emphasized by “choices”

Many possible processes

Suggested: repeating {choice; map}

Superchoice:fraig_store; resynfraig_store; resyn2fraig_store; resyn2rsfraig_store; sharefraig_store; fraig_restore

Page 6: It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

IWLS’10IWLS’10 66

Iterative Resynthesis in ABCIterative Resynthesis in ABC

0 200 400 600 800 10000

500

1000

1500

2000

2500

3000

3500

4000

too_large

Gat

es

Iteration

Page 7: It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

IWLS’10IWLS’10 77

How Many Iterations suffice?How Many Iterations suffice?228 of IWLS’93 benchmarks examined

Iterations to converge # of cases

< 20 194

20 – 100 27

100 – 500 4

500 – 1000 1 (t481)

> 1000 2 (seq, too_large)

Page 8: It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

IWLS’10IWLS’10 88

MotivationMotivationImagine:

e64 IWLS’93 circuit (65 inputs, 65 outputs, 649 2-input gates)

Case 1 – synthesis of the circuit, as it is:Case 1 – synthesis of the circuit, as it is: 530 gates 2.33s runtime

Case 2 – split the circuit into two halves, synthesize Case 2 – split the circuit into two halves, synthesize them separately, then merge the resultsthem separately, then merge the results

522 gates 1.73s total runtime

Where is the problem?What’s wrong?

Page 9: It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

IWLS’10IWLS’10 99

Circuit Resynthesis by PartsCircuit Resynthesis by Parts

Resynthesize(Network N, opt) {do {

(W, NR) = Extract_Window(N, opt);W’ = resynthesize_by_ABC(W);N’ = NR W’;if (cost(N’) ≤ cost(N)) N = N’;

} while (!end());}

Page 10: It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

IWLS’10IWLS’10 1010

Window ExtractionWindow Extraction

PI1

PI2

PI5

PI4

PI3

PO1

PO3PO2

PO4

W

Page 11: It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

IWLS’10IWLS’10 1111

Window ExtractionWindow ExtractionConnected circuits are always extractedMethod 0 – Random selection

1. Randomly select one “pivot” gate2. Incrementally add randomly selected adjoining gates

Method 1 – Minimize_fanin1. Randomly select one “pivot” gate2. Incrementally add adjoining gates, so that the number of window primary

inputs is minimized (in a greedy way)Method 2 – Minimize_fanout

1. Randomly select one “pivot” gate2. Incrementally add adjoining gates, so that the number of window primary

outputs is minimized (in a greedy way)Method 3 – Minimize_fanin+fanout

1. Randomly select one “pivot” gate2. Incrementally add adjoining gates, so that the sum of numbers of window

primary inputs and outputs is minimized (in a greedy way)

These methods allow for arbitrary window size scaling

Page 12: It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

IWLS’10IWLS’10 1212

Window ExtractionWindow ExtractionMethod 4 – RadiusSelect

1. Randomly select one “pivot” gate2. Add all adjoining gates (i.e., all fan-in and fan-out gates)3. For each gate in the window, do (2.), up to the given radius

Method 5 – Windowing-like selectionSimilar to the window selection algorithm in the resubstitution process in

ABC1. Randomly select one “pivot” gate2. Find the minimum level of its transitive fan-in to a given depth3. Generate transitive fan-out of the pivot, to a given depth4. For these fan-out nodes, include all transitive fan-in nodes up to the

computed level into the window

The window size is partially determined by the circuit structure

Page 13: It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

IWLS’10IWLS’10 1313

Experimental SetupExperimental Setup

228 of IWLS’93 benchmarks processed

Resynthesis using ABC, using the “superchoice” script, followed by technology mapping into 2-input gates

Iterated 1000-times (recall – this should be more than enough)

100% circuit resynthesis yielded 19.97% improvement in the average

Page 14: It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

IWLS’10IWLS’10 1414

Comparison of MethodsComparison of Methods

Gates (size 20%)

Time (size 20%)

Method 0 Method 1 Method 2 Method 3100

105

110

115

120

125

Gat

es

Method 0 Method 1 Method 2 Method 30

20

40

60

80

100

120

Tim

e [s

]

Page 15: It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

IWLS’10IWLS’10 1515

Comparison of MethodsComparison of Methods

M. 4, radius 3

M. 4, radius 4

M. 4, radius 5

M. 4, radius 6

M. 4, radius 7

M. 4, radius 8

M. 4, radius 9

M. 5, depth 3

M. 5, depth 4

M. 5, depth 5

M. 5, depth 6

M. 5, depth 7

M. 5, depth 8

M. 5, depth 9

80

90

100

110

120

Gat

es

M. 4, radius 3

M. 4, radius 4

M. 4, radius 5

M. 4, radius 6

M. 4, radius 7

M. 4, radius 8

M. 4, radius 9

M. 5, depth 3

M. 5, depth 4

M. 5, depth 5

M. 5, depth 6

M. 5, depth 7

M. 5, depth 8

M. 5, depth 9

0

2

4

6

8

10

12

14

Tim

e [s

]

Page 16: It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

IWLS’10IWLS’10 1616

ResultsResults

Method 0 (Random select), improvement vs. ABC iterated 1000-times

10% 30% 50% 70% 90%

-6,0

-4,0

-2,0

0,0

2,0

4,0

6,0

8,0

10,0

Imp

rove

men

t vs

. AB

C [

%]

Window size

Page 17: It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

IWLS’10IWLS’10 1717

ResultsResults

Method 4 (Radius select), improvement vs. ABC iterated 1000-times

3 4 5 6 7 8 9 10 11

-6,0

-4,0

-2,0

0,0

2,0

4,0

6,0

8,0Im

pro

vem

ent

vs. A

BC

[%]

Radius

Page 18: It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

IWLS’10IWLS’10 1818

Why This Happens - Example CasesWhy This Happens - Example Cases

Behavior of one of the “good for us” circuits (e64)

Method 0 (random selection)

0 100 200 300 400 500 6000

100

200

300

400

500

600

e64

Gat

es

Window size

Page 19: It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

IWLS’10IWLS’10 1919

Why This Happens - Example CasesWhy This Happens - Example Cases

Behavior of one of the “bad for us” circuits (clip)

Method 0 (random selection)

0 50 100 150 200 250 300 3500

50

100

150

200

250

300

350

clip

Gat

es

Window size

Page 20: It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

IWLS’10IWLS’10 2020

Convergence, Maybe?Convergence, Maybe?

0 200 400 600 800 10000

100

200

300

400

500

600

700

e64

Resynthesis of 50%

Resynthesis of 100%

Gat

es

Iteration

Page 21: It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

IWLS’10IWLS’10 2121

Convergence, Maybe?Convergence, Maybe?

0 200 400 600 800 10000

50

100

150

200

250

300

350

clip

Resynthesis of 50%

Resynthesis of 100%

Gat

es

Iteration

Page 22: It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

IWLS’10IWLS’10 2222

ConclusionsConclusions

Sometimes it is better to resynthesize circuits by parts, rather than as whole

In cases where not, probably it is due to random fluctuations caused by random part selections

Resynthesis by parts converges slower, but yields better results

Why?

Page 23: It Is Better to Run Iterative Resynthesis on Parts of the Circuit Petr Fišer, Jan Schmidt Faculty of Information Technology Czech Technical University

IWLS’10IWLS’10 2323

Questions

Discussion

Stoning to death…