• Keine Ergebnisse gefunden

Optimum Depths of Adder Circuits

5.6 Computational Results

5.6.2 Optimum Depths of Adder Circuits

Our algorithm can solve all instances with up to 64 inputs. Note that our im-plementation uses64-bit bit sets to encode the generalizedAnd-Orpath instances, hence, we currently cannot consider larger instances. By adjusting the bit sets used, this technicality can be overcome. However, we do not expect to solve an instance with110inputs, where the next change in depth is likely, see Table 5.6.

In order to examine the quality of our various speed-up techniques, we define 5 scenarios: in scenario 1, we run the basic algorithm without any enhancements; in scenario 5, we enable all speed-up techniques from Section 5.5. The intermediate scenarios all add a selection of speed-ups to the previous scenario:

• Scenario 1: No speed-ups.

• Scenario 2: Add depth normalization.

• Scenario 3: Add upper bound propagation, basic lower bound.

• Scenario 4: Add cross-partition Huffman bound, subset enumeration pruning.

• Scenario5: Add reducing lower bounds, lower bound propagation, delay prob-ing.

For each scenario, we ran the algorithm with all depth optimization instances with at least 21 inputs – we only state results for an instance-scenario pair if the running time is at most8hours. For each run, we store the numberEof table entries for which the partitioning process has been started at least once and the numberP of partitions considered. In Table 5.5, we show the logarithms of these numbers, rounded to the nearest integer, and the running times.

In general, for fixed m, the number of entries and partitions and the running time reduces significantly with increasing scenario number. From scenario 3 on, we can solve the instance with 34 inputs within the running time limit of 8 hours, which is the first instance with an optimum depth of7. Using all pruning techniques in scenario 5, we can solve any instance with up to 64 inputs within 3 hours. In particular, note that in contrast to scenarios1 - 4, in scenario 5, the running time does not necessarily increase with increasing m. In a range of inputs where the optimum depth does not increase (e.g., from34 up to60inputs), our reducing lower bounds have a high impact.

Note that, as estimated by Theorem 5.3.1, for each number m of inputs, for scenario1, we have E ≈2m, and the running time increases by a factor of roughly

√6 when m increases by 1. For scenario 2, we have checked that – as proven in Theorem 5.4.1 – the exact number of entries form inputs is exactly the Fibonacci numberFm+1. Note that frommtom+1, the running time grows roughly by a factor ofα= 2.02, which matches the running time guarantee shown in Theorem 5.4.6.

156Chapter5.ExactDelayOptimizationAlgorithm

m log2E log2P T [s] log2E log2P T [s] log2E log2P T [s] log2E log2P T [s] log2E log2P T [s]

21 21 29 35.4 14 23 1.6 10 19 0.1 10 15 0.0 9 13 0.0

22 22 30 94.6 15 24 3.5 11 19 0.1 10 16 0.0 9 14 0.0

23 23 31 237.9 16 25 6.9 11 20 0.2 11 16 0.0 9 14 0.0

24 24 32 630.6 16 26 15.4 11 20 0.2 11 16 0.0 9 14 0.0

25 25 34 1540.4 17 27 32.1 11 20 0.2 11 16 0.0 9 14 0.0

26 26 35 4055.7 18 28 69.7 11 20 0.2 11 16 0.0 9 14 0.0

27 27 36 10034.2 18 29 142.4 11 21 0.3 11 17 0.0 9 14 0.0

28 28 38 25055.1 19 30 315.9 11 21 0.4 11 17 0.0 9 14 0.0

29 20 31 642.0 12 22 0.8 11 17 0.0 9 14 0.0

30 20 32 1406.2 12 23 1.4 11 17 0.0 9 14 0.0

31 21 33 2939.7 12 24 2.6 11 17 0.0 9 14 0.0

32 22 34 6445.6 12 25 6.8 11 17 0.0 9 14 0.0

33 22 35 13062.4 12 26 14.3 11 17 0.0 9 14 0.0

34 17 31 623.0 16 26 14.1 11 19 0.3

35 18 33 1666.7 17 27 34.2 12 21 0.9

36 19 33 3066.7 18 27 45.4 12 21 1.0

37 19 34 6013.4 18 28 60.9 12 21 1.0

38 20 35 9211.6 19 28 75.8 12 21 1.0

39 20 36 15861.5 19 28 92.2 12 21 1.0

40 21 36 22140.3 19 29 109.8 12 21 1.0

41 20 29 135.7 12 21 1.0

42 20 29 145.1 12 21 0.9

· · · · · · · · ·

59 21 29 224.7 12 22 1.4

60 21 29 226.6 12 22 1.4

61 18 32 4574.9

62 18 33 8468.1

63 18 33 9729.8

64 18 33 9037.3

Table 5.5: Comparison of speed-up scenarios. The number of table entries computed is denoted byE, the number of partitions computed byP, and the running time in seconds byT. Dashed lines separate ranges of instances with the same optimum depth.

Lower bound Old upper bound New upper bound d [Gri13] [Heg18] and Cor. 5.2.10 Alg. 5.1 and Cor. 5.2.10

0 1 1 1

1 2 2 2

2 3 3 3

3 6 6 6

4 10 10 10

5 19 19 19

6 33 38 33

7 60 76 60

8 109 152 120

9 202 304 240

10 375 608 480

11 698 1216 960

12 1311 2432 1920

13 2466 4864 3840

14 4645 9728 7680

15 8782 19456 15360

16 16627 38912 30720

17 31548 77824 61440

18 60059 155648 122880

Table 5.6: Lower and upper bounds onm(d,0)for d∈ {0, . . . ,18}.

upper bounds on m(d,0) for small d as shown in the third column of Table 5.6.

Applying the same with the results by Hegerfeld [Heg18] yields the second column.

In the first column of Table 5.6, we show the best available lower bounds on m(d,0)as computed by the heuristics from Grinchuk [Gri13], i.e., for each din the table, we report the maximum valuemfor which anAnd-Orpath circuit with depth dis known.

Comparing the first and the third column, we directly see that up to 60 inputs, the circuits from [Gri13] are optimum. Butm(7,0)≤60 implies that for m≥61, a depth of at least8is needed, so Grinchuk’s circuits are actually optimum for up to109 inputs. Moreover,m(8,0)≤120implies that for121≤m≤202, Grinchuk’s circuits also have optimum depth, and so on. The ranges of inputsmfor which we know an optimumAnd-Orpath realization resulting from this are shown in Table 5.7. Here, in the left column, we show the ranges of inputs for which an optimum solution is known as derived from the results of Hegerfeld [Heg18], Grinchuk [Gri13], and Corollary 5.2.10; and in the right column, we exchange Hegerfeld’s results by ours.

Recall from Equation (2.18) that the final carry cn bit of an n-bit adder is an And-Or path on 2n−1 inputs and that – when circuit size and fanout are not regarded – optimum adder circuits on n bits yield optimum And-Or path circuits on2n−1 inputs, and vice versa. Hence, in particular, Tables 5.4 and 5.7 yield the optimum depths of all adder circuits with 2k inputs for k ≤ 13. We show these in Table 5.8.

d [Gri13],[Heg18], Cor. 5.2.10 [Gri13], Alg. 5.1, Cor. 5.2.10

0 1 ≤m≤ 1 1 ≤m≤ 1

1 2 ≤m≤ 2 2 ≤m≤ 2

2 3 ≤m≤ 3 3 ≤m≤ 3

3 4 ≤m≤ 6 4 ≤m≤ 6

4 7 ≤m≤ 10 7 ≤m≤ 10

5 11 ≤m≤ 19 11 ≤m≤ 19

6 20 ≤m≤ 33 20 ≤m≤ 33

7 39 ≤m≤ 60 34 ≤m≤ 60

8 77 ≤m≤ 109 61 ≤m≤ 109

9 153 ≤m≤ 202 121 ≤m≤ 202

10 305 ≤m≤ 375 241 ≤m≤ 375

11 609 ≤m≤ 698 481 ≤m≤ 698

12 1217 ≤m≤ 1311 961 ≤m≤ 1311

13 2433 ≤m≤ 2466 1921 ≤m≤ 2466

14 3841 ≤m≤ 4645

15 7681 ≤m≤ 8782

16 15361 ≤m≤ 16627

17 30721 ≤m≤ 31548

Table 5.7: Numbers m of inputs for which we can show that the optimum depth of anAnd-Orpath circuit on minputs is d.

n 2n−1 d

1 1 0

2 3 2

4 7 4

8 15 5

16 31 6

32 63 8

64 127 9

128 255 10

256 511 11

512 1023 12

1024 2047 13 2048 4095 14 4096 8191 15 8192 16383 16

Table 5.8: Optimum depths of adder circuits forninput pairs, where n is a power of2. The middle column shows the number of inputs of theAnd-Orpath computing the most significant carry bit.

And-Or Path Optimization in Practice

In this chapter, we develop a delay optimization algorithm for And-Orpaths that is used for logic optimization in the IBM VLSI design flow, see also Chapter 7.

Our exact delay optimization algorithm from Chapter 5 is not suitable for this purpose: In practice, circuit size as an important secondary criterion. Our exact algorithm computes only strongly delay-optimum formula circuits, which is a disad-vantage for size. Moreover, already our current size optimization mode has too high average running times (e.g.,2.2seconds for20inputs, see Table 5.3), with significant outliers (e.g., more than9hours for one instance with 30 inputs).

Instead, we now describe a polynomial-time algorithm which computes very good solutions in practice, as we will demonstrate. The key idea of our algorithm is to compute the best possible circuit over Ωmon = {And2,Or2} resulting from a recursive application of the recursion strategies described in Section 2.6.2 in a dynamic program. The algorithm has been published in concise form in Brenner and Hermann [BH20].

In Section 6.1, we describe and analyze our algorithm, which has a running time of O(m4) and allows an effective size reduction technique. We will show that our algorithm fulfills the best known asymptotic delay guarantee of Theorem 4.2.4, see Theorem 6.1.14.

In Section 6.3, we explain the differences of our algorithm to the exact algorithm from Chapter 5. We conjecture that in the special case of uniform arrival times, our dynamic programming algorithm always computes optimum solutions.

In Section 6.2, we show experimental results: On a testbed containing25000And -Orpath instances with 4 up to28 inputs, we will demonstrate that our algorithm from Section 6.1 yields significantly better results on small instances compared to the previously best implemented algorithms, i.e., the methods of Held and Spirkl [HS17b]

and Rautenbach, Szegedy, and Werber [RSW06]. Even more, we will show that the delays of our circuits are now much closer to the optimum delays computed by the exact algorithm from Chapter 5. We find delay-optimum solutions on more than 95% of the considered instances with integral arrival times, the average difference from the optimum delay is roughly0.04 and the maximum difference1. For the best delay among the circuits computed by Held and Spirkl [HS17b] and Rautenbach, Szegedy, and Werber [RSW06], the average difference to the optimum is 1.64, the maximum difference is4, and only10% of their circuits are delay-optimum.

159

6.1 Dynamic Program for Delay Optimization

As in Chapter 4, we in fact present an algorithm for the optimization of extended And-Orpaths (cf. Definition 2.6.14), not only forAnd-Orpaths. This is motivated by the fact that extended And-Or paths allow a more flexible recursive circuit construction, see Section 2.6.2. Hence, let symmetric inputs s= (s0, . . . , sn1) and alternating inputs t = (t0, . . . , tm−1) be given. We are interested in computing circuits for the extended And-Or paths f(s, t) and f(s, t). Using the notation from Section 2.6.2, there are three recursive ways to compute f(s, t) from circuits for smaller extendedAnd-Orpaths which have been introduced in Corollary 2.6.17, Corollary 2.6.18 and Observation 2.6.20:

f(s, t) =f s, t0

∧f tb0, t00

for a prefix t0 of twith|t0|< modd (6.1) f(s, t) =f s, t0

∨f

s++tb0, t00

for a prefixt0 of twith|t0|< meven (6.2) f(s, t) = sym (s0, . . . , sk−1)

∧f (sk, . . . , sn1), t

for k < n (6.3) By applying any of these splits, we reduce the problem of optimizing an extended And-Orpathf(s, t)to two problems on instances with strictly fewer inputs: Either, we split off a prefix of the alternating inputs and construct a circuit forf(s, t)based on circuits for two smaller extended And-Orpaths (cf. Equations (6.1) and (6.2));

or we split off a prefix of the symmetric inputs, for which we build an optimum binary tree, construct an extended And-Or path on the remaining symmetric inputs and t, and combine these two circuits to a circuit for f(s, t)(cf. Equation (6.3)).

Recall that by Corollary 2.5.3, a circuit forf(s, t)can be obtained from a circuit for f(s, t) by dualization.

Our algorithm is a dynamic program that, given s and t, computes a delay-optimum circuit forf(s, t) that can be obtained using the recursion formulas Equa-tions (6.1) to (6.3). Regarding instances with integral arrival times, as a preparation, we present a straight-forward algorithm in Section 6.1.1 and our final algorithm in Section 6.1.2. An extension of both algorithms to fractional arrival times is shown in Section 6.1.3; and in Section 6.1.4, we describe how we heuristically improve the number of gates of our circuits.

As a common preparation, we now introduce notation allowing to describe our algorithms in a dynamic-programming fashion.

Notation 6.1.1. Given Boolean input variables t = (t0, . . . , tm1) and indices i, j, k ∈ {0, . . . , m−1} withi≤j≤kand j−ieven, we write

fi,j,k=f

ti, ti+2, . . . , tj4, tj2

, tj, . . . , tk and

fi,j,k =f

ti, ti+2, . . . , tj−4, tj−2

, tj, . . . , tk . We denote the number of inputs of fi,j,k by N(fi,j,k)∈N. Note that

N(fi,j,k) = j−i

2 +k−j+ 1.

In other words, the functions fi,j,k are extended And-Orpaths on exactly those subsets of the inputst0, . . . , tm1 that have a consecutive range of alternating inputs and, preceding this range, symmetric inputs that contain every second input. Note

that in particular f0,0,m1 = g(t) is the And-Or path on all inputs t. We can now rewrite the three splits (6.1) to (6.3) using this notation. For odd prefix length l= 2λ+ 1∈N with1≤l≤k−j and thusλ∈N,0≤λ≤ k2j1, we have

fi,j,k =fi,j,j+2λ∧fj+1,j+2λ+1,k , (6.4) for even prefix length l= 2λwith 2≤ l≤k−j and thusλ∈N, 1≤λ≤ k−j2 , we have

fi,j,k =fi,j,j+2λ−1∨fi,j+2λ,k, (6.5)

and for1≤λ≤ j2i, we have

fi,j,k =fi,i+2λ2,i+2λ2∧fi+2λ,j,k. (6.6) Note that oncej−i is even, in each of these splits, the difference of the “j” and “i”

indices is even for any occurring sub-function. Thus, every split in (6.1) to (6.3) can be represented using the functionsfi,j,k for indicesi, j, kwithj−ieven as defined in Notation 6.1.1. Furthermore, note that indeed, each sub-formula occurring in (6.4) to (6.6) has strictly fewer inputs thatfi,j,k.