scieee AI-readable full text Open interactive document viewer

A general model for performance optimization of sequential systems

Bufistov, Dmitry,Cortadella, Jordi,Kishinevsky, Michael,Sapatnekar, Sachin S.

Abstract

Retiming, c-slow retiming and recycling are different transformations for the performance optimization of sequential circuits. For retiming and c-slow retiming, different models that provide exact solutions have already been proposed. An exact model for recycling was yet unknown. This paper presents a general formulation that covers the combination of the three schemes for performance optimization. It provides an exact model based on integer linear programming that resorts to the structural theory of marked graphs. A set of experiments has been designed to show the benefits in performance obtained by combining retiming and recycling. The results also show the applicability of the method in large circuits.

Full text

A general model for performance optimization of sequential systems Dmitry Bufistov Univ. Polit` ecnica de Catalunya Barcelona, Spain Jordi Cortadella Univ. Polit` ecnica de Catalunya Barcelona, Spain Mike Kishinevsky Strategic CAD Lab, Intel Corp. Hillsboro, OR, USA Sachin Sapatnekar University of Minnesota Minneapolis, MN 55455 Abstract— Retiming, c-slow retiming and recycling are different transformations for the performance optimization of sequential circuits. For retiming and c-slow retiming, different models that provide exact solutions have already been proposed. An exact model for recycling was yet unknown. This paper presents a general formulation that covers the combination of the three schemes for performance optimization. It provides an exact model based on integer linear programming that resorts to the structural theory of marked graphs. A set of experiments has been designed to show the benefits in performance obtained by combining retiming and recycling. The results also show the applicability of the method in large circuits. I. INTRODUCTION A. Retiming Retiming [1] has been the traditional technique for sequential optimization. Retiming can explore different configurations of sequential circuits by moving flip-flops across combinational logic without changing their functionality. In this way, solutions trading-off area, delay and power can be explored using this flexibility. Different approaches have been used to efficiently solve retiming [2]. The analogy between the skew optimization and the retiming problems has also been exploited to propose efficient algorithms for large circuits [3]. As interconnect delays become more dominant, some global wires may have long delays that degrade the overall system performance. Under these conditions, retiming can be combined with wire pipelining [4]. However, since the number of flip-flops between inputs and outputs must remain unchanged, retiming is not always capable of meeting the intended clock period. B. C-slow retiming C-slow retiming [1] was proposed as a technique to accommodate the frequency of a circuit to its environment at the expense of reducing the input issue rate, i.e., number of cycles between consecutive input data. By c-slowing a circuit, the throughput (number of input data processed per cycle) is reduced to 1/c. The main advantage of c-slow retiming is the low control overhead associated to the enabling of the flip-flops. However, extra registers must be inserted to equalize the input rate of all the cycles in the circuit. This often results in a tangible area overhead. A method to find the optimal value for cand minimize the extra flip-flops added to the circuit was presented in [5]. C. Recycling Latency insensitivity (LI) [6] was proposed as a paradigm to design systems that are tolerant to the variability of communication and computation delays. A common strategy to design LI systems is to include a wrapper around each component that encapsulates its functionality. The wrapper contains buffers that synchronize the inputs and propagate the outputs in such a way that the functionality of the system is preserved regardless the computation and communication delays of its components. LI design enables the automatic insertion of empty buffers to improve the performance of the system. The transformation for inserting empty buffers (also known as relay stations in LI terminology) is called recycling [7]. Intuitively, in LI systems every data item has an associated valid bit. When the valid bit associated to a register is not asserted, the data stored in the register is assumed to be noninformative. LI design can be viewed as a discretized asynchronous design. The concept of inserting empty buffers for optimizing system performance were long known in the asynchronous design under different names of bubble insertion and slack matching [8], [9]. In [10], [11], exact algorithms for slack matching on choice-free asynchronous systems were presented. This problem is similar to solving the recycling problem in isolation. These papers however did not deal with the combined retiming and recycling problem. Recycling requires more complex control but provides an additional degree of flexibility for adapting clock period and throughput to the requirements of the environment. Unlike c-slow, recycling does not require all cycles to be equalized to the same input rate. However, the control must explicitly take care of the back-pressure when not all inputs are available at one of the computational blocks of the circuit. For this reason, a FIFO-based communication using a handshake protocol is required to handle this flexibility. However, some recent techniques for LI design have been able to propose schemes that require very low extra overhead. In particular, by using a static scheduling, the logic for the handshake protocol and the area occupied by the sequential elements can be drastically reduced [12]. The scheme presented in [13] also proposed a latchbased implementation for the storage elements that make the datapath overhead negligible with regard to a conventional implementation with flip-flops. D. Retiming and recycling Retiming and recycling (R&R) can join their efforts to find configurations with better performance than the ones that would be obtained by using only each one of them individually [14]. Figure 1 shows an example on how retiming and recycling can collaborate. The nodes (circles) of the figure are labeled with their delays. The boxes (holding a dot) represent the registers. Figure 1(a) depicts an optimal retiming of the circuit, with a cycle time of 16 time units. Figure 1(b) shows a configuration obtained by 2-slowing the circuit. The empty boxes represent registers with non-valid data. Henceforth, we will distinguish between dots and bubbles to denote registers with valid and non-valid data, respectively. The 2-slow solution can achieve a cycle of 10 time units. However, the throughput is degraded to 1/2, i.e., one data item is processed every two cycles. This gives an effective cycle time of 20. It means that a dot is processed every 20 time units, compared to the 16 time 1-4244-1382-6/07/$25.00 ©2007 IEEE 362 10 9 8 6 4 39 44 10 9 8 6 4 39 44 (b) (c) 10 9 8 6 4 39 44 (a) Fig. 1. (a) Retiming, (b) 2-slow retiming, (c) recycling and retiming. units of the original design. In this case, the 2-slow solution can increase the frequency of the circuit at the expense of reducing the overall performance of the system. Note that every cycle in the circuit has doubled the number of registers in the original circuit. Figure 1(c) shows an optimal configuration after combining retiming and recycling with a cycle time of 12 units. In this case, the throughput is determined by the bottom cycle in which a bubble has been inserted (4 dots in 5 registers). We can also say that the processing rate, i.e., the average number of cycles to process a dot, is now 5/4. This gives an effective cycle time of 15 time units (15 = 12 ·5/4). It means that a dot is processed every 15 time units on average, compared to the 16 time units of the original design. This examples illustrates the extra flexibility provided by R&R with regard to other performance optimization techniques. E. Contributions This paper presents an exact formulation of the R&R problem that can be specified with mixed ILP models. Even having a worst-case exponential complexity, the model can be practically solved for large systems. The presented formulation can be seen as a general model for a variety of problems. Retiming is the particular case in which no bubbles are created. Recycling (without retiming) is reduced to finding a solution in which the original registers of the circuit are not moved, i.e., only bubbles are inserted to break long combinational cycles. Finally, the model also accepts an interpretation for the c-slow retiming problem. The model presented in the paper resorts to the structural theory of marked graphs, which provides the support of linear algebraic techniques for the analysis of these systems. The analogy of the retiming problem with the reachability problem in marked graphs also brings a new result in the area, that is explained in the interpretation of theorem 2.2. As expected, the combined formulation of the R&R problem provides a new space of solutions that cannot be explored when solving each of the above problems individually. This paper is not dealing with the calculation of the initial state of the circuit. Techniques similar to those used for retiming [15] should be studied and adapted for this new type of problems. The model presented in this paper assumes that back-pressure will never be constraining the performance of the system. This assumption can always be met by properly sizing the capacity of the registers inserted between the combinational blocks [16]. II. MARKED GRAPHS AND RETIMING Retiming has a strong analogy with the reachability problem in marked graphs (MG). In this section we will reformulate the retiming and R&R problems as reachability problems in MGs. This n1 n2 n3 n4 n1n2n3n4 e12 : e13 : e23 : e24 : e34 : e41 : 2 6 6 6 6 6 4 0 1 2 1 0 0 3 7 7 7 7 7 5 = 2 6 6 6 6 6 4 1 0 0 0 1 0 3 7 7 7 7 7 5 + 2 6 6 6 6 6 4 1−100 1 0 −1 0 0 1 −1 0 010−1 001−1 −1001 3 7 7 7 7 7 5 2 6 4 1 2 0 1 3 7 5 M=M0+A σ Fig. 2. Marked graph and its corresponding marking equation. reformulation is not capricious. Some of the results in the theory of MGs can be reused in our context, thus providing an essential support to make new contributions in this area. A. Marked graphs Marked graphs are a special class of Petri nets [17] in which places have exactly one input and one output transition. The notation used in this paper is next presented. Definition 2.1 (Marked graph (MG)): Amarked graph is a triple (N, E, M0), where Nis a set of nodes, Eis a set of edges and M0:E→Nis a marking that assigns an initial number of tokens to each arc. Given a node n, the notation •nand n•is used to denote the set of incoming and outgoing edges of n, respectively. Given a subset φ⊆E, the total number of tokens of the edges in φat a given marking Mis denoted by M(φ). A node nis enabled at a marking Mif M(e)>0for every e∈•n. An enabled node ncan fire producing a new marking M0such that M0(e) = 8 > < > : M(e)−1if e∈•n\n• M(e) + 1 if e∈n•\•n M(e)otherwise (1)  An example of MG is depicted in Fig. 2. Retiming interpretation. The retiming graph of a circuit is isomorphic to a marked graph. Each combinational block corresponds to a node. Each connection corresponds to an edge. The registers in the retiming graph are represented by tokens in the MG. The firing rules of a MG coincide with the backward retiming rules: each time a node is retimed, registers are removed from the input edges and added to the output edges.  Without loss of generality, we will focus on strongly connected marked graphs (SCMG). In terms of retiming, a circuit can always be converted into strongly connected by adding a node Xthat represents the environment, and edges X→iand o→Xfor all inputs iand outputs o, respectively. Definition 2.2 (Reachability and liveness): A marking Mis called reachable if there is a firing sequence of transitions that leads from the initial marking M0to M. An MG is said to be live if every node can eventually fire from any reachable marking.  363 We next review two important properties of MGs and give their interpretation for the retiming problem. Theorem 2.1 (Liveness [18]): An MG is live if every cycle φis marked positively at M0, i.e., M(φ)>0. Retiming interpretation. Every cycle should have at least one register to avoid combinational cycles in the circuit netlist.  Next, a crucial result from MG theory that will be the basis of the ILP models presented in this paper. Theorem 2.2 (Reachability [19]): A live marking Mof an SCMG is reachable iff M(φ) = M0(φ)for every cycle φ. Retiming interpretation. This property has two directions. The ⇒direction corresponds to a well-known result in retiming: a valid retiming preserves the number of registers at each cycle. The important direction is ⇐that provides a new result for the theory of retiming: if an assignment of registers has the same number of registers at each cycle as the initial circuit, then the assignment is a valid retiming. This result will be the basis of the ILP models proposed to solve the R&R problem. Implicitly, this duality also supports the fact that any solution obtained by retiming can also be obtained by a sequence of backward retiming steps. Thus, we can reduce the retiming problem to a reachability problem in MGs. B. The marking equation The incidence matrix Aof an MG is an |E|×|N|matrix defined as follows. For every edge e= (ni, nj):A[e, ni]=1,A[e, nj] = −1 and A[e, nk]=0for k6=iand k6=j. A marking Mis a |E|-vector that represents the number of tokens at every edge. A firing vector σis an |N|-vector that represents the number of times each node is fired in a firing sequence. Another important theorem follows. Theorem 2.3 ( [19]): A nonnegative marking Mis reachable iff the following marking equation holds: M=M0+Aσ (2) Retiming interpretation.M0is the initial assignment of registers to edges, Mis the assignment after retiming, Ais the retiming matrix and σis the retiming vector. An example on how to solve the marking equation is shown in Fig. 2. The marking equation is the basis for the well-known LP formulation of the retiming problem. The fact that Ais totally unimodular guarantees a polynomial-time complexity even under the constraint that Mmust be integer. C. Retiming and Recycling Graph We now present the graph representation of an LI circuit. Definition 2.3 (Retiming and Recycling Graph): ARetiming and Recycling Graph (RRG) is a four-tuple (N, E, R0, δ), where (N, E, R0)represents the underlying MG of the circuit and δ:N→ R+is a function that assigns a positive real number (delay) to every node.  R0represents an initial assignment of registers with informative data (dots) to the edges of the graph. Throughout the paper and without loss of generality, we will implicitly assume that all RRGs are strongly connected. An important question is: what is a valid R&R configuration of a circuit? The answer is easy: let us take any valid retiming of the circuit and let us add any arbitrary number of registers (bubbles) to every edge. The new circuit is a valid R&R configuration. Therefore, any integer solution for Rand b Rthat fulfils the following expression: R≥b R=R0+Aσ ≥0(3) is a valid R&R solution. b Rrepresents the retiming subset of the solution (the registers containing only dots; see theorem 2.3). R represents the R&R configuration (registers containing dots and bubbles). The difference between both vectors, R−b R, represents the vector of registers containing the bubbles introduced by recycling. III. TIMING AND PERFORMANCE We now define some concepts related to timing and performance in RRGs. Definition 3.1 (Combinational paths and cycle time): Given a register vector Rof an RRG, a combinational path Pis a sequence of edges n0 e1 −→ n1 e1 −→ ··· ek −→ nksuch that R(ei)=0for all edges in the path. The delay of the combinational path is δ(P) = X ni∈P δ(ni). The cycle time associated to R,τ(R), is the maximum delay of all combinational paths.  Definition 3.2 (Cycle ratio and throughput): Given an RRG, a cycle Cand a register vector R, its cycle ratio ΘC(R)is defined as ΘC(R) = X e∈C R0(e) X e∈C R(e) The throughput Θ(R)achieved by a register assignment Ris the minimum cycle ratio over all cycles in the RRG [20], i.e., Θ(R) = min ∀CΘC(R),  The throughput is the number of dots that can be processed by a node at each cycle. If a register assignment has no bubbles, then Θ(R)=1, as in Fig. 1(a). In Fig. 1(c) we have τ= 12. The cycle ratios for the top and bottom cycles are 1 and 4/5, respectively. Therefore Θ(R) = 4/5. In general, retiming always produces solutions with Θ(R)=1, whereas recycling produces solutions with Θ(R)<1. In case of c-slow retiming, the solutions have Θ(R)=1/c. We now relate throughput and cycle time. Definition 3.3 (Effective cycle time): Given a register assignment R, the effective cycle time is defined as C(R) = τ(R)/Θ(R). The effective cycle time would be the cycle time of a conventional circuit that could process data at the same rate as the LI circuit. In the example of Fig. 1(c), C= 12 ·5/4 = 15. The inverse of Cis what is known as processing rate. The main goal of this paper is to propose methods that minimize C, i.e., maximize the processing rate. Lemma 3.1 (Effective cycle time lower bound): Given an RRG and a register assignment R, then C(R)≥max c∈CP v∈c δ(v) P e∈c R0(e),(4) 364 where Cis the set of all cycles of the RRG. Proof: A known result from [21] indicates that for any cycle c τ(R)≥P v∈c δ(v) P e∈c R(e) We also know that Θ(R)≤Θc(R) = P e∈c R0(e) P e∈c R(e) By using the previous inequalities, C(R) = τ(R) Θ(R)≥P v∈c δ(v) P e∈c R0(e) Therefore, inequality (4) holds. The lower bound for the effective cycle time coincides with the lower bound for min-delay retiming [21]. However, R&R offers more opportunities than retiming to approach this bound. For example, the lower bound on Cin Fig. 1(a) is 12.25 time units. With min-period retiming, a cycle time of 16 can be achieved, while R&R can find a configuration with C= 15. The impact of this bound on the potential benefits of R&R will be discussed in Section V-A. A. Combinational path constraints In order for an LI circuit to meet a cycle time τ, all combinational paths must be shorter than τ. In the retiming problem, these constraints are formulated by using the matrices W(minimum latency) and D(maximum delay) [1]. Unfortunately, this formulation is not valid for the R&R problem, since the number of registers between any pair of nodes can be changed by inserting any arbitrary number of bubbles. We next propose a different set of linear inequalities to formulate the combinational path constraints. For every edge e= (u, v)of the RRG, we define two variables, tin(e)and tout(e). The variable tin(e)represents the longest delay from any register to the entry of edge e, including the delay of the source node u. The variable tout(e)represents the longest delay from any register to the exit of edge e. If ehas no registers, then tout(e) = tin(e), otherwise tout(e)=0, since the exit of edge erepresents the beginning of a combinational path. This definition of tin and tout, for every edge e= (u, v), can be represented by the following constraints: tin(e)≥tout(e0) + δ(u)∀e0= (w, u)(5) tout(e)≥tin(e)−τ∗R(e)(6) tout(e)≥0, tin(e)≤τ(7) The constraint (5) indicates that the length of the path arriving at edge eis longer than the path exiting from a predecessor edge (e0) plus the delay of the source node of e. The constraint (6) transfers the length of the path to the exit of the edge. In case the edge has some register (R(e)>0), a new combinational path starts at edge eand tout(e) = 0.τ∗is a constant large enough to guarantee its value to be larger than any possible value of τ. It is sufficient for τ∗to take the value of the cycle time in the original circuit. With τ∗being constant, all the inequalities are linear. For the previous system of constraints, only the tin variables are essential. The tout variables can be eliminated by substitution. Register delays. The previous constraints can be modified to account for the register delays in the combinational paths. If we call dRthe delay of a register, we can add dRto the delay of each combinational path by assigning this delay to the beginning of the path. This is achieved by simply adding the constraint tout(e)≥dR, for all edges of the graph. Henceforth, the constraints (5-7) for a given register assignment Rand cycle time τwill be represented by the predicate Path Constraints(R, τ). Lemma 3.2: Given an RRG with a register assignment R,τ(R)≤ τiff Path Constraints(R, τ)is feasible. Proof: ⇒Assume that τ(R) = τ. For each edge e= (u, v)∈E, we define tin(e)and tout(e)as follows: tin(e) = δ(u) + delay of the longest combinational path arriving at u tout(e) = (tin if R(e) = 0 0otherwise. It is easy to check that the inequalities in (5-7) hold. ⇐Assume that the set of constraints (5-7) has a feasible solution (tin 1,...,tin m, tout 1,...,tout m)for some τ. Let P=v1, v2,...,vk−1, vkbe a combinational path with delay δ(P). Then the following chain of inequalities holds: tin (v1,v2)≥δ(v1)(constraint (5)) tout (v1,v2)≥tin (v1,v2)≥δ(v1)(constraint (6)) tin (v2,v3)≥tout (v1,v2)+δ(v2)≥δ(v1) + δ(v2)(constraint (5)) ... tin (vk−1,vk)≥ k−1 P i=1 δ(vi) tin (vk,vj)≥ k P i=1 δ(vi) = δ(P)for any vjsuccessor of vk Since tin(e)≤τ, for any e, we can conclude that δ(P)≤τfor any path P. B. Throughput constraints We next present a constraint guaranteeing that a specific R&R configuration has at least throughput Θ. The throughput constraint is as follows: R≤(R0+Aσ)/Θ(8) Lemma 3.3: Let Rbe a valid R&R register assignment. There is a nonnegative real vector σthat fulfils inequality (8) iff Θ(R)≥Θ. Proof: Let us call R0=Aσ and R0(e)the component of R0 associated to edge e. Therefore, the constraint (8) can be rewritten as ΘR≤R0+R0. (⇒)We will prove that every cycle Chas a cycle ratio ΘC(R)≥Θ. Thus, using inequality (8) in the denominator: ΘC(R) = X e∈C R0(e) X e∈C R(e)≥ Θ·X e∈C R0(e) X e∈C (R0(e) + R0(e)) Since Cis a cycle, the number of tokens in Cremains invariant after any firing sequence (see theorem 2.2). Therefore, X e∈C R0(e) = 0 365 and consequently ΘC(R)≥Θ. (⇐)This part of the proof is easy but tedious. We give a sketch based on the results of previous authors. First of all, for results about throughput (dots per cycle), delays must be interpreted as unit delays coming from the registers (combinational logic has zero delay). For a timed marked graph (N, E, M0, δ)with incidence matrix B and throughput Θ, in which each node nhas a delay δ(n), there exist an average marking (nonnegative real) and real vector σ0, such that M=M0+Bσ0and the following property holds for any n∈N[22]: δ(n)·Θ≤M(e)∀e∈•n. (9) In our case, the delays are associated to the registers on the edges (each register has unit delay). The previous result can be extended to marked graphs with delays on the edges1. From the average marking Mit is easy to construct a nonnegative real marking b Rsuch that R·Θ≤b R=R0+Aσ, thus completing the proof. IV. ILP MODELS FOR RETIMING AND RECYCLING This section presents ILP models for different variations of the R&R problem. The main result that can be derived from the previous sections is the following: Theorem 4.1: Given a cycle time τand a throughput Θ,Ris a valid R&R register assignment of an RRG (N, E, R0, δ)with τ(R)≤τand Θ(R)≥Θiff there exists a feasible solution of the ILP RR(τ, Θ) ≡8 > > > < > > > : R≥R0+Aσ1≥0 R≤(R0+Aσ2)/Θ Path Constraints(R, τ) Rand σ1are integer vectors. (10) Proof: It immediately follows from expression (3) and lemmas 3.2 and 3.3. Note that the model does not include the vector b Rfrom expression (3). To guarantee that b Ris integer, the constraint of σ1being integer is included. After that, the value of b Ris irrelevant to obtain a solution for R. Henceforth, we will use RR(τ, Θ) to denote the ILP model (10). This notation will also be used to denote a function that returns a register assignment, e.g., R:= RR(τ, Θ). A. Min-period R&R The min-period R&R problem can be formulated as follows: Given an RRG and a throughput Θ>0, find a register assignment Rthat minimizes the cycle time and has throughput Θ(R)≥Θ. From theorem 4.1, it immediately follows that Ris the optimal solution of the following ILP, where Θis a constant: MIN PER(Θ) ≡(min τ subject to RR(τ, Θ).(11) Similarly as before, MIN PER(Θ) will also denote a function that returns the register assignment Rwith minimum period. 1It is easy to see that each edge u→vcan be transformed into two edges u→w→v. In this way, the delay of the edge can be associated to the node w, thus having a marked graph with delays on the transitions only. B. Max-throughput R&R The formulation of the problem is as follows: Given an RRG and a cycle period τ, find a register assignment Rwith τ(R)≤τthat maximizes the throughput Θ(R). The problem can also be solved by using a model derived from theorem 4.1, in which τis a constant: MAX THR NL(τ)≡(max Θ subject to RR(τ, Θ).(12) However, the model MAX THR NL(τ)is not linear since Θis now a variable of the model and the second constraint of RR(τ, Θ) is not linear. Unfortunately, the model is not convex either, thus discarding the possibility of using a solver for convex problems. 1) Binary search for max-throughput: An option to solve the previous problem is to perform a search on the possible values of Θ. With this approach, the model becomes linear when Θis a constant value. In this paper we propose to perform a binary search for Θ over the interval (0,1]. A binary search always explores values of Θin an interval [ΘL,ΘU]where a feasible solution exists for ΘLbut not for ΘU. An important question to answer is the following: what is the size of the interval that guarantees ΘLto be the optimal solution? Theorem 4.2: Let ΘL=nL/mLand ΘU=nU/mUbe two possible values of the throughput for an RRG such that ΘL6= ΘU. Then, |ΘL−ΘU| ≥ 1 (|R0|+|E|)2 where |R0|represents the number of initial registers and |E|is the number of edges in the graph. Proof: Let n1 m1and n2 m2be two different rational numbers with denominators not larger than m. Then ˛˛˛˛ n1 m1−n2 m2˛˛˛˛=˛˛˛˛ n1m2−n2m1 m1m2˛˛˛˛≥1 m2. We also know that the maximum number of registers we can have in a cycle for a configuration with maximum throughput is not larger than the number of initial registers plus the number of edges (bubbles than can be inserted in the graph)2. The proof of the theorem immediately follows from this observation. A tighter bound could be calculated by finding the longest simple cycle in the graph. However, this problem is NP-complete [23]. 2) Min-area max-throughput R&R: Since the binary search for Θ converts the model (12) into a linear form, the cost function can be customized to minimize area (number of registers) in the following way: MAX THR(τ)≡8 > > < > > : min P e∈E R(e) subject to RR(τ, Θ) Binary search on Θ. (13) C. Minimum effective cycle time The formulation of the problem is the following: Given an RRG, find a register assignment Rmin such that the effective cycle time C(Rmin)is minimized. 2Putting more than one bubble in an edge degrades the throughput without improving the cycle period. For this reason, only configurations with at most one bubble per edge must be considered. 366 τ=τrt dmax / rt retiming solution Θ=0 Θ=1 τ=0 +ε +ε +ε +ε MP MP MP MP MP MT MT MT MT MT τ MP = MIN_PER MT = MAX_THR Fig. 3. Search for minimum effective cycle time. We will show how the ILP models MIN PER and MAX THR can be combined to find Rmin. We first start by a preliminary result required to make the search efficient. Theorem 4.3: Θ(Rmin)≥dmax τrt , where dmax is the maximum delay of a node and τrt is the cycle period obtained by min-delay retiming. Proof: Every retiming configuration is also a valid R&R assignment. Therefore C(Rmin)≤τrt. By the definition of C(see Def. 3.3), and using the fact that τ(Rmin)≥dmax, Θ(Rmin) = τ(Rmin) C(Rmin)≥dmax τrt Then search for the optimal Ccan be performed by interleaving MIN PER and MAX THR. MIN EFF CYC STEP(Θ): R1:= MIN PER(Θ); R2:= MAX THR(τ(R1)); return R2; The intuition behind this strategy is the following. Given a target Θ, a register assignment R1with minimum period is obtained by MIN PER(Θ).R1has a throughput not smaller than Θ. After that, another register assignment R2maximizing the throughput is obtained by MAX THR(τ(R1)).R2is guaranteed to have a clock period not larger than τ(R1). This process can be iteratively executed until the retiming solution is found (Θ = 1,τ=τrt). For every explored solution R, the effective cycle time C(R)can be calculated. At the end of the process, the solution with minimum Cis returned. Formally, the procedure to find C(Rmin)is described by the following algorithm: MIN EFF CYC(RRG): C:= τrt;{τfrom min-period retiming} Θ := dmax τrt ;{from theorem 4.3} ε:= 1 (|R0|+|E|)2;{from theorem 4.2} while (Θ <1) R:= MIN EFF CYC STEP(Θ); if (C(R)<C)then C:= C(R); Θ := Θ(R) + ε; return C; Experimental results show that this search never makes more then 10 iterations for graphs with up to 1000 edges. Figure 3 illustrates the search for the optimum Cthrough a diagram that represents Θin the x-axis and τin the y-axis. The MP and MT labels indicate the progress performed by MIN PER and MAX THR, respectively. The search teminates when the retiming solution is found. In some cases, MAX THR does not make any progress (e.g., see the loop with label MT in the diagram). In those cases, the ε increase guarantees the termination. The next theorem guarantees that the search does not miss any solution that could provide a better effective cycle time. Theorem 4.4: Let R1be a solution of MIN PER(Θ) and R2the register assignment obtained by MAX THR(τ(R1)). Let R0be any other arbitrary register assignment such that Θ≤Θ(R0)≤Θ(R2). Then, C(R0)≥C(R2). Proof: By contradiction. Let us assume that R0satisfies the conditions of the theorem and C(R0)<C(R2), or equivalently τ(R0) Θ(R0)<τ(R2) Θ(R2). Since Θ(R0)<Θ(R2)it follows that τ(R0)< τ(R2). But R2 is the solution of the MAX THR(τ(R1)) and hence τ(R2)≤τ(R1). Therefore, τ(R0)< τ(R1), but this contradicts the fact that MIN PER(Θ) produces R1, which has the minimum cycle time from all the assignments with throughput at least Θ. Therefore, the register assignments obtained by solving MAX THR are the only ones that must be considered during the search. They correspond to the black circles in Fig. 3. D. C-slow retiming For completeness, a mode for c-slow retiming is presented. C SLOW(τ)≡8 > > > > < > > > > : min αc +P e∈E R(e) R=cR0+Aσ ≥0 Path Constraints(R, τ) σand care integer (14) The new constraint is R=cR0+Aσ, which substitutes the initial register assignment R0by cR0, indicating that each register in the original circuit is substituted by cregisters (one dot and c−1bubbles). The cost function minimizes cassuming that αis a large constant. After that, the register count is minimized. V. EXPERIMENTAL RESULTS The first consideration for R&R is that it will mostly be applied to coarse levels of granularity, e.g., at the level of 16-, 32- or 64- bit registers in medium and large systems having few dozens or hundreds of computational blocks. Unfortunately, there is no set of benchmarks usable by academia that keep hierarchical information and can be effectively used for realistic experiments. For this reason, we designed synthetic experiments based on the underlying graphs of the sequential ISCAS circuits. For every circuit, the following transformations were performed: •The original latches were removed, and every gate was considered to be a large combinational block. Edges were considered to be n-bit channels. Each combinational block was assigned a delay generated randomly from a uniform distribution in the interval (0,20]. •The largest strongly connected component of the graph was kept in the graph. The rest of nodes and edges were removed3. 3An alternative way to ensure strongly connectedness would have been to connect the inputs and the outputs with a fake node. However, we found this approach unrealistic due to the fact that an artificially congested node appeared for each example. 367 TABLE I EXPERIMENTAL RESULTS. Initial Retiming Recycling (τ≤0.75τrt) Retiming+Recycling (τ≤0.75τrt) |V| |E|R0τC∗R τrt R τ ΘCR τ ΘCCPU s27 14 24 14 58.20 58.20 5 58.20 12 30.32 0.50 60.64 12 30.32 0.50 60.64 00:00:01 s208 8 9 2 87.58 87.58 2 87.58 3 51.00 0.50 102.00 3 49.86 0.50 99.72 00:00:01 s344 135 176 76 72.52 39.75 72 41.53 106 26.15 0.50 52.30 101 23.90 0.50 47.80 00:00:16 s349 135 176 76 134.70 46.25 78 48.64 114 27.46 0.50 54.92 95 27.46 0.50 54.92 00:12:00 s382 42 60 23 66.00 38.14 29 41.32 41 24.39 0.50 48.78 34 24.39 0.50 48.78 00:00:02 s386 48 131 64 49.30 43.75 40 46.02 84 25.12 0.50 50.24 76 25.12 0.50 50.24 00:00:04 s400 46 66 29 66.24 50.42 34 52.43 42 33.24 0.50 66.48 39 24.88 0.43 58.05 00:21:26 s420 8 9 2 76.70 76.70 2 76.70 3 40.59 0.50 81.18 3 40.59 0.50 81.18 00:00:01 s444 58 82 41 80.47 52.69 35 55.02 44 31.37 0.50 62.74 38 39.73 0.67 59.60 00:00:09 s510 103 407 197 69.72 64.48 36 64.48 145 34.65 0.50 69.30 132 34.65 0.50 69.30 00:26:27 s526 50 71 31 80.66 80.66 23 80.66 29 45.38 0.50 90.76 30 41.44 0.50 82.88 00:00:01 s641 221 270 133 123.09 40.85 117 43.97 178 25.83 0.50 51.66 137 30.90 0.67 46.35 00:05:19 s713 256 341 158 171.65 40.21 143 49.93 252 23.57 0.42 56.57 240 36.72 0.75 48.96 00:18:25 s820 110 424 205 53.61 53.23 283 53.46 288 31.04 0.50 62.08 122 31.04 0.50 62.08 00:10:09 s832 117 462 226 61.84 49.04 329 50.39 354 30.45 0.50 60.90 231 27.40 0.50 54.80 00:21:42 s838 8 9 2 68.40 68.40 2 68.40 4 38.33 0.50 76.66 3 35.03 0.50 70.06 00:00:01 s953 268 371 172 90.93 50.69 131 57.47 234 25.99 0.40 64.98 158 35.88 0.67 53.82 01:29:40 s1488 133 572 284 72.52 58.05 123 63.39 194 37.05 0.50 74.10 196 36.01 0.50 72.02 00:03:58 s1494 136 572 275 71.10 58.22 306 60.29 393 33.13 0.50 66.26 231 33.13 0.50 66.26 01:48:08 •Each channel was assigned an n-bit register with a certain probability. The probability was chosen to be 0.5. Thus, about half of the channels were assigned a register, whereas the other half were just wires. For each example, several solutions were obtained using the optimization techniques presented in the paper. After satisfying the performance constraints of the model, all solutions were optimized for minimum register count. Table I reports the experimental results. The “Initial” columns report the parameters of the example. The column C∗shows the lower bound on the effective cycle time (see lemma 3.1). The results obtained by min-period retiming are reported in the next two columns. The configurations for “Recycling” and “Retiming and recycling” were obtained by imposing the constraint τ≤0.75τrt, i.e., the target cycle period was required to be smaller than 3/4 of the one obtained by retiming. As an example, the target cycle period for s27 was defined to be τ≤0.75 ·58.20 = 43.65. The obtained results had the optimum effective cycle time (C) satisfying the cycle period constraint. The “Recycling” solution was obtained by only inserting bubbles in the circuit and not touching the registers defined by the min-period retiming4. You can observe that the period is often smaller than the target period 0.75τrt. The increase in number of registers is strictly associated to the bubbles inserted by recycling. The R&R solutions (“Retiming+recycling”) were obtained by MIN EFF CYC, as explained in Section IV-C. The results show the benefits in performance and area (register count) when combining retiming and recycling in the same model. In some cases, the reduction of effective cycle time is significant e.g., s526,s641 and s953. In other cases, the performance improvement is not so relevant but the reduction in register count is important, e.g., s820,s832 and s1494. An interesting case is s400, in which the throughput of the R&R solution (0.43) is smaller than the one of the recycling solution (0.50). However, the reduction in cycle time (from 33.24 to 24.88) results in a superior performance. This is a clear example of the diversity of solutions that can be explored by R&R. The CPU time (hh:mm:ss) is only reported for the R&R solutions, which corresponds to the most complex optimization model. 4This was achieved by adding constraints that fix the location of dots in ILP RR(τ, Θ). CPLEX [24] was used as ILP solver. To make the computations affordable, a timeout of 600 seconds was defined for each ILP model. It is important to recall that MIN EFF CYC generates several ILP models for each search, coming from the while loop of the algorithm and the binary search performed by MAX THR. Even with this limitation of CPU time, the results show that significant improvements in performance can still be obtained, even without guaranteeing optimality. Results from 2-slow retiming were also obtained, for completeness. All of them were worse than the R&R configurations. Given their irrelevance for the main conclusions of the paper, they are not shown in the table. A. Minimum effective cycle time The same experiments were run without imposing the constraint τ≤0.75τrt on the cycle period, thus obtaining the optimum effective cycle time. As it was expected, the optimum effective cycle time was achieved by min-period retiming (C=τrt) in almost all cases. Only in two cases, s713 and s953, the insertion of bubbles contributed to slightly improve the performance. In these two cases, the solutions coincided with the ones obtained with the τ≤0.75τrt constraint, and reported in Table I. The reason for these results is easy to explain. The only potential margin for improvement is the difference τrt −C∗(see Table I), which was usually small in our examples. Even with the existence of the margin, the degradation in throughput produced by the insertion of bubbles reduces the chances for improvement significantly. The two successful cases are the ones in which the difference τrt −C∗ is larger. The potential performance improvements of R&R requires a more profound study in the future. A simple study for rings was presented in [14]. However, it is difficult to extend those conclusions for more complex circuits. A preliminary intuition indicates that only graphs with long cycles and unbalanced delays can increase the chances for optimization. VI. CONCLUSIONS A general ILP model for retiming and recycling has been presented. It covers previous models for sequential logic synthesis and allows to combine them in a collaborative way to explore a new space of solutions. 368 This approach opens the door to new optimization engines targetting at delay, throughput or area. The recent approaches for latencyinsensitive design that reduce data and control overhead may provide efficient implementations of sequential circuits that can contribute to improve the performance of nanoelectronic systems. Acknowledgements. This research has been funded by a grant from Intel Corp., CICYT TIN 2004-07925, the FPU grant AP2005-4866, a Distinction for the Promotion of Research by the Generalitat de Catalunya and a grant from AGAUR (2005PIV1-59). REFERENCES [1] C. E. Leiserson and J. B. Saxe, “Retiming synchronous circuitry,” Algorithmica, vol. 6, no. 1, pp. 5–35, 1991. [2] N. V. Shenoy, “Retiming: Theory and practice.” Integration, the VLSI Journal, vol. 22, no. 1, pp. 1–21, 1997. [3] S. S. Sapatnekar and R. B. Deokar, “Utilizing the timing skew equivalence in a practical algorithm for retiming large circuits,” IEEE Transactions on Computer-Aided Design, vol. 15, no. 10, pp. 1237–1248, Oct. 1996. [4] C. Lin and H. Zhou, “Retiming for wire pipelining in systems-on-chip,” in Proc. International Conf. Computer-Aided Design (ICCAD), Nov. 2003, pp. 215–220. [5] V. Nookala and S. S. Sapatnekar, “A method for correcting the functionality of a wire-pipelined circuit,” in Proc. ACM/IEEE Design Automation Conference, June 2004, pp. 570–575. [6] L. P. Carloni, K. L. McMillan, A. Saldanha, and A. L. Sagiovanni- Vincentelli, “A methodology for correct-by-construction latency insensitive design,” in Proc. International Conf. Computer-Aided Design (ICCAD), Nov. 1999, pp. 309–315. [7] L. P. Carloni and A. L. Sangiovanni-Vincentelli, “Performance analysis and optimization of latency insensitive systems,” in Proc. ACM/IEEE Design Automation Conference, June 2000, pp. 361–367. [8] T. E. Williams, “Performance of iterative computation in self-timed rings,” Journal of VLSI Signal Processing, vol. 7, no. 1/2, pp. 17–31, Feb. 1994. [9] R. Manohar and A. J. Martin, “Slack elasticity in concurrent computing,” in Proc. 4th International Conference on the Mathematics of Program Construction, ser. Lecture Notes in Computer Science, J. Jeuring, Ed., vol. 1422, 1998, pp. 272–285. [10] P. A. Beerel, N.-H. Kim, A. Lines, and M. Davies, “Slack matching asynchronous designs,” in Proc. of the 12th Int. Symp. on Asynchronous Circuits and Systems, 2006. [11] P. Prakash and A. J. Martin, “Slack matching quasi delay-insensitive circuits,” in Proc. of the 12th Int. Symp. on Asynchronous Circuits and Systems, 2006. [12] M. R. Casu and L. Macchiarulo, “A new approach to latency insensitive design,” in Proc. Digital Automation Conference (DAC), June 2004, pp. 576–581. [13] J. Cortadella, M. Kishinevsky, and B. Grundmann, “Synthesis of synchronous elastic architectures,” in Proc. ACM/IEEE Design Automation Conference, July 2006, pp. 657–662. [14] L. P. Carloni and A. L. Sangiovanni-Vincentelli, “Combining retiming and recycling to optimize the performance of synchronous circuits,” in 16th Symp. on Integrated Circuits and System Design (SBCCI), Sept. 2003, pp. 47–52. [15] H. J. Touati and R. K. Brayton, “Computing the initial states of retimed circuits.” IEEE Trans. on CAD of Integrated Circuits and Systems, vol. 12, no. 1, pp. 157–162, 1993. [16] R. Lu and C.-K. Koh, “Performance analysis of latency-insensitive systems,” IEEE Transactions on Computer-Aided Design, vol. 25, no. 3, pp. 469–483, 2006. [17] T. Murata, “Petri Nets: Properties, analysis and applications,” Proceedings of the IEEE, pp. 541–580, Apr. 1989. [18] F. Commoner, A. W. Holt, S. Even, and A. Pnueli, “Marked directed graphs,” Journal of Computer and System Sciences, vol. 5, pp. 511–523, 1971. [19] T. Murata, “Circuit theoretic analysis and synthesis of marked graphs,” IEEE Trans. Circuits and Systems, vol. CAS-24, no. 7, pp. 400–405, July 1977. [20] C. Ramchandani, “Analysis of asynchronous concurrent systems by Petri nets,” Project MAC, TR-120, M.I.T., Cambridge, MA, 1974. [21] M. C. Papaefthymiou, “Understanding retiming through maximum average-delay cycles,” Mathematical Systems Theory, vol. 27, no. 1, pp. 65–84, 1994. [22] J. Campos, G. Chiola, and M. Silva, “Ergodicity and throughput bounds for petri nets with unique consistent firing count vector,” IEEE Transactions on Software Engineering, vol. 17, no. 2, pp. 117–125, 1991. [23] C. Papadimitriou, Computational Complexity. Addison-Wesley, 1995. [24] “CPLEX,” http://www.ilog.com/products/cplex. 369