Escaping Local Minima In Logic Synthesis Eugene Goldberg Cadence Berkeley Labs (USA) IWLS-2007, San...

14
Escaping Local Minima In Logic Synthesis Eugene Goldberg Cadence Berkeley Labs (USA) IWLS-2007, San Diego, USA paper is available at http:/eigold.tripod.com/papers/iwls-2007-locm full version is at http:/eigold.tripod.com/papers/loc_min.pdf

description

Motivation Usually, a logic optimization algorithm monotonically minimizes a cost function (there are a few exceptions, that are not very successful though) Such an algorithm quickly gets stuck in a local minimum. Unfortunately, local minima of hard optimization problems (like logic synthesis) can be arbitrarily deep. This means that to get out of such a local minimum one has to make an unbounded number of local transformations increasing the cost function. In this paper, we consider LSPS as a way to address the problem of escaping local minima in logic synthesis.

Transcript of Escaping Local Minima In Logic Synthesis Eugene Goldberg Cadence Berkeley Labs (USA) IWLS-2007, San...

Page 1: Escaping Local Minima In Logic Synthesis Eugene Goldberg Cadence Berkeley Labs (USA) IWLS-2007, San Diego, USA This paper is available at

Escaping Local Minima In Logic Synthesis

Eugene GoldbergCadence Berkeley Labs (USA)

IWLS-2007, San Diego, USA

This paper is available at http:/eigold.tripod.com/papers/iwls-2007-locmin.pdf

The full version is at http:/eigold.tripod.com/papers/loc_min.pdf

Page 2: Escaping Local Minima In Logic Synthesis Eugene Goldberg Cadence Berkeley Labs (USA) IWLS-2007, San Diego, USA This paper is available at

Summary• Motivation• Logic Synthesis Preserving

common Specification (LSPS)• Recent developments in LSPS• LSPS from optimization point of

view• Horizontal and vertical optimization• Why should it work?

Page 3: Escaping Local Minima In Logic Synthesis Eugene Goldberg Cadence Berkeley Labs (USA) IWLS-2007, San Diego, USA This paper is available at

MotivationUsually, a logic optimization algorithm monotonically minimizes a cost function (there are a few exceptions, that are not very successful though)

Such an algorithm quickly gets stuck in a local minimum. Unfortunately, local minima of hard optimization problems (like logic synthesis) can be arbitrarily deep.

This means that to get out of such a local minimum one has to make an unbounded number of local transformations increasing the cost function.

In this paper, we consider LSPS as a way to address the problem of escaping local minima in logic synthesis.

Page 4: Escaping Local Minima In Logic Synthesis Eugene Goldberg Cadence Berkeley Labs (USA) IWLS-2007, San Diego, USA This paper is available at

Logic Synthesis Preserving common Specification (LSPS)

Let N be a single-output combinational circuit to be optimized. Let specification Spec(N) of N be N1,…,Nk. (Spec(N) is just a partition of N into subcircuits N1,…,Nk.)

LSPS is to produce a new circuit N* by replacing each subcircuit Ni with an optimized toggle equivalent counterpart N*i.

Since toggle equivalence of single-output subcircuits means functional equivalence (modulo negation), N and N* are functionally equivalent (modulo negation)

Multi-output subcircuits M(p1,..,pk) and M*(p1,..,pk) are called toggle equivalent if M(p ) M(p ) M*(p ) M*(p ).

Definition of toggle equivalence can be easily extended to the case when M and M* have different input variables but there is a one-to-one mapping between “allowed” input assignments.

Page 5: Escaping Local Minima In Logic Synthesis Eugene Goldberg Cadence Berkeley Labs (USA) IWLS-2007, San Diego, USA This paper is available at

Example

…x1 xn

N1N*1

Circuit N

square(x)

Circuit N*

abs(x)

…x1 xn

…y1 y2n …y*1 y*n

y < 100 y* < 10N2N*2

z z

Subcircuit N1 is toggle equivalent to N*1. Subcircuit N2 is toggle equivalent to N*2 (under “allowable” input assignments)

square(x) < 100 abs(x) < 10

Page 6: Escaping Local Minima In Logic Synthesis Eugene Goldberg Cadence Berkeley Labs (USA) IWLS-2007, San Diego, USA This paper is available at

Recent Developments in LSPS

Let N1,..,Nk be a specification Spec(N) of N. Complexity of LSPS is linear in the number k of subcircuits and exponential in the granu-larity of Spec(N) (the latter is the size of the largest subcircuit Ni).

It can be shown that complexity of LSPS is exponential “only” in the width of Spec(N). (The latter is determined by the largest width of Ni and the largest number of outputs among Ni.)

Better parametrization of Spec(N)

Let N1,…,Nk be a specification of N. One can build an optimized circuit N* from N by replacing subcircuit Ni,i=1,.,k-1 with a subcircuit N*i whose toggling is implied by Ni. (That is N*i toggles every time Ni does. The opposite may not be true.) Toggle equivalence is a special case of toggle implication.

Toggle implication instead of toggle equivalence

Page 7: Escaping Local Minima In Logic Synthesis Eugene Goldberg Cadence Berkeley Labs (USA) IWLS-2007, San Diego, USA This paper is available at

Recent Developments in LSPS (continued)

The key procedure of LSPS is to replace a subcircuit Ni of Spec(N) with subcircuit N*i that is toggle equivalent to (or toggle implied by) Ni. Such a procedure has been formulated and tested in practice

Formulation of the key procedure of LSPS

Finding a good specification Spec(N) of a circuit of large width by an efficient algorithm is, most probably, infeasible. However, we showed that a narrow circuit N has a trivial specification Spec(N) which is a cascade of subcircuits of N. So, for narrow circuits, there may exist practical algorithms for finding good specifications.

Finding a good specification

Page 8: Escaping Local Minima In Logic Synthesis Eugene Goldberg Cadence Berkeley Labs (USA) IWLS-2007, San Diego, USA This paper is available at

LSPS from optimization point of view

Let N1,..,Nk be a specification of N. Let N* be an optimized circuit build by LSPS. Let |N*i| < |Ni| for every i=1,..,k . (That is LSPS managed to replaced each subcircuit Ni with a smaller counter-part N*i.) Then, obviously, |N*| < |N|.

Replacing Ni with say toggle equivalent subcircuit N*i is not an equivalent transformation. To make it equivalent one needs to add a re-encoder R*i such that R*i(N*i) is functionally equivalent to Ni. However, even though |N*i| < |Ni|, it may be the case that |N*i| + |R*i| > |Ni|

So from the viewpoint of “traditional” logic synthesis performing equivalent transformations, LSPS may make steps that may temporarily increase the cost function.

Page 9: Escaping Local Minima In Logic Synthesis Eugene Goldberg Cadence Berkeley Labs (USA) IWLS-2007, San Diego, USA This paper is available at

LSPS in Terms of Equivalent Transformations

…x1 xn

N1 square(x)

…y1 y2n

y < 100N2

abs(x)

…x1 xn

…y*1 y*n

R*1

N*1abs(x)

…x1 xn

…y*1 y*n

y* < 10N*2

N*1

Re-encoder

…y1 y2n

y < 100N2

z

zz

z*Re-encoderR*2

Page 10: Escaping Local Minima In Logic Synthesis Eugene Goldberg Cadence Berkeley Labs (USA) IWLS-2007, San Diego, USA This paper is available at

Escaping Local Minima by LSPS

Let N1,..,Nk be a specification of N. Let N be trapped in a local minimum. Since LSPS makes moves that increase the cost function, it can get N out of this minimum.

Intuitively, the depth of the minimum LSPS can escape depends on the granularity (or width) of Spec(N). The larger the granu-larity of Spec(N) is, the deeper minima can be escaped (but the complexity of such an escape is exponential in granularity of Spec(N)).

In particular, if Spec(N) consists of N itself, it is within the power of LSPS to build an optimal circuit N* and so escape an arbitrarily deep minimum. (Of course, the complexity of such an escape is, in general, prohibitively high.)

Page 11: Escaping Local Minima In Logic Synthesis Eugene Goldberg Cadence Berkeley Labs (USA) IWLS-2007, San Diego, USA This paper is available at

Vertical Optimization

…x1 xn

N1N*1

Circuit N

square(x)

Circuit N*

abs(x)

…x1 xn

…y1 y2n …y*1 y*n

y < 100 y* < 10N2N*2

z zVertical optimization is to redistribute comp-lexity between topo-logically dependent subcircuits. (Outputs of subcircuit N1 feed inputs of subcircuit N2.)

Page 12: Escaping Local Minima In Logic Synthesis Eugene Goldberg Cadence Berkeley Labs (USA) IWLS-2007, San Diego, USA This paper is available at

Horizontal Optimization

Horizontal optimization is to redistribute comp-lexity between topo-logically independent subcircuits (such as subcircuits N1 and N2.)

Page 13: Escaping Local Minima In Logic Synthesis Eugene Goldberg Cadence Berkeley Labs (USA) IWLS-2007, San Diego, USA This paper is available at

Why Should It Work?

When optimizing the expression square(x) < 100, LSPS works well because N has only one output and so loses a lot of information. When replacing N1 (implementing square(x)) with N*1 (implementing abs(x)), LSPS runs up a large “re-encoding debt”. However, since N2 loses information, this debt is not paid “in full”. These arguments can be applied to any circuit with a global or local loss of information.

Vertical optimization

Suppose subcircuits Ni and Nj of Spec(N), implement combinational blocks that tightly interact with each other. That is when outputs of Ni change, the outputs of Nj most likely change too and vice versa. So Ni and Nj are “almost” toggle equivalent. Then Ni and Nj can be replaced with toggle equivalent counterparts N*i and N*j that share a great deal of logic.

Horizontal optimization

Page 14: Escaping Local Minima In Logic Synthesis Eugene Goldberg Cadence Berkeley Labs (USA) IWLS-2007, San Diego, USA This paper is available at

Conclusions

• We show that logic synthesis preserving specification (LSPS) can be viewed as a method for escaping of local minima.

• The depth of the minimum that can be escaped by LSPS depends on the granularity of specification.

• We introduce the two basic “modes” of LSPS (vertical and horizontal optimization) and discuss ways to make them successful.