Fundamental Algoithms fo System Modeling, Analysis, and Optimization Edwad A. Lee, Jaijeet Roychowdhuy, Sanjit A. Seshia UC Bekeley EECS 44/44 Fall With thanks to R. K. Bayton, K. Keutze, N. Shenoy, and A. Kuehlmann Copyight -, E. A. Lee, J. Roydhowdhuy, S. A. Seshia, All ights eseed Lectue N: Retiming Retiming Tadeoffs a" b" " " " " " " clock peiod =" # egistes =" 6" 4" [Shenoy, 997] EECS 44/44, UC Bekeley: l
Retiming Tadeoffs a" b" " " " " " " clock peiod =" 5" # egistes =" 4" [Shenoy, 997] EECS 44/44, UC Bekeley: Retiming Tadeoffs a" b" " " " " " " clock peiod =" # egistes =" 4" " [Shenoy, 997] EECS 44/44, UC Bekeley: 4 l
Retiming Tadeoffs a" b" " " " " " " clock peiod =" # egistes =" " 4" [Shenoy, 997] EECS 44/44, UC Bekeley: 5 Goals of Retiming Possible goals: Minimize clock peiod min-peiod etiming Minimize numbe of egistes min-aea etiming Minimize numbe of egistes fo a taget clock peiod constained min-aea etiming a b clock peiod = 6 5 4 # egistes = 4 4 4 [Shenoy, 997] EECS 44/44, UC Bekeley: 6 l
Abstaction a" b" " " " " " " clock peiod =" # egistes =" 6" 4" EECS 44/44, UC Bekeley: 7 Abstaction - Gaph Nodes: cicuit elements Node weights: delay Dummy node fo fanout EECS 44/44, UC Bekeley: 8 l 4
Abstaction - Registes Nodes: cicuit elements Node weights: delay Dummy node fo fanout EECS 44/44, UC Bekeley: 9 Abstaction - Registes Ac weights indicate egistes EECS 44/44, UC Bekeley: l 5
Abstaction - Enionment EECS 44/44, UC Bekeley: Cutset Diides the Gaph in Two EECS 44/44, UC Bekeley: l 6
Retiming: Add a egiste on all acs cossing the cutset in one diection, and subtact a egiste fom all acs cossing the cutset in the othe diection. += += -= -= EECS 44/44, UC Bekeley: Recall: Retiming Tadeoffs a" b" " " " " " " clock peiod =" # egistes =" 6" 4" [Shenoy, 997] EECS 44/44, UC Bekeley: 4 l 7
Recall: Retiming Tadeoffs a" b" " " " " " " clock peiod =" 5" # egistes =" 4" [Shenoy, 997] EECS 44/44, UC Bekeley: 5 Simplest cutset suounds one node -= -= += EECS 44/44, UC Bekeley: 6 l 8
Recall: Retiming Tadeoffs a" b" " " " " " " clock peiod =" 5" # egistes =" 4" [Shenoy, 997] EECS 44/44, UC Bekeley: 7 Recall: Retiming Tadeoffs a" b" " " " " " " clock peiod =" # egistes =" 4" " [Shenoy, 997] EECS 44/44, UC Bekeley: 8 l 9
Fo each node, define = # of egistes moed fom the outputs to the inputs. -= = - -= += A etiming is now an assignment fo eey node such that the weight of eey ac is non-negatie. EECS 44/44, UC Bekeley: 9 Poblem Setup Fo a path p: k, e i = i, i+ d p = w p = Clock cycle c = k i= k i= d i w e i max { d p} p : w p = Fo example on ight: c =? includes endpoints 7 EECS 44/44, UC Bekeley: l
Poblem Setup Fo a path p: k, e i = i, i+ d p = w p = Clock cycle c = k i= k i= d i w e i max { d p} p : w p = delay of longest path without egistes Fo example on ight: c = includes endpoints 7 Path with wp= EECS 44/44, UC Bekeley: Basic Opeation Thus in the example, u = -, = - esults in 7 u 7 u Fo a path p: s t, W p = wp + t - s Retiming : V Z, an intege etex labeling w e = we + - u fo edge e = u, A etiming is legal if w e, e E EECS 44/44, UC Bekeley: l
Retiming - Assumptions Each loop in cicuit contains at least one egiste Cicuit uses single clock and edge-tiggeed elements identical skew Gate delay is constant and non-negatie Registes ae ideal set-up, die independent of load Any powe-up state of the design can be safely handled by the enionment initial state assumption EECS 44/44, UC Bekeley: Retiming - Fomulation Come up with alues: Assign integes to each etex so that objectie is met Valid etiming constaints a" b" p" a" b" e" w " e = we" + b" - a" > " a" b" w p = wp + b - a" " EECS 44/44, UC Bekeley: 4 l
Retiming fo Minimum Clock Cycle Poblem Statement: Minimum cycle time Gien GV, E, d, w, find a Legal etiming so that c = is minimized impotant matices Registe weight matix Delay matix max { d p} p: W p = A p W u, = min{ w p : u } p D u, = max{ d p : u, w p = W u, } D u, > c W u, B EECS 44/44, UC Bekeley: 5 Retiming fo Minimum Clock Peiod V 7 V W egiste path weight matix, min # of egistes on all paths between u and D path delay matix, max delay among all paths between u and with Wu, minimum egistes W V V V V D V V V V V V V V 6 6 7 7 V V V V Note that the D matix indicates that the least possible clock peiod is 7, and a peiod of will obiously wok, so the minimum clock peiod is between 7 and, inclusie. Binay seach of these possibilities will wok. EECS 44/44, UC Bekeley: 6 l
Conditions fo Retiming Suppose we need to check if a etiming exists fo a clock cycle α Legal etiming: w e fo all e. Hence w e = we + - u o u - w e Fo all paths p: u such that dp α, we equie w p Thus k w p = w e i k i= = [w e i + i+ i ] i= = w p + k = w p + u O take the least wp tightest constaint u- Wu,- i.e. thee ae many paths p, choose the p that gies tightest constaint Note: we just need to apply it to u, such that Du, > α EECS 44/44, UC Bekeley: 7 Soling the Constaints All constaints in diffeence of aiables fom How to sole? Conside ou example fo α = 7 Legal: u-we Notice that these constaints ae unaffected by adding o subtacting any constant to/ fom all i. Why? D>7: u-wu,- V V V V W V V V V V 7 D V V V V 6 6 7 7 V EECS 44/44, UC Bekeley: 8 V V V V l 4
l 5 EECS 44/44, UC Bekeley: 9 Constaint gaph has one ac fo each diffeence-of-two-aiables inequality. Soling the Constaints: Constuct a Constaint Gaph Legal: u-we D>7: u-wu,- -,-,- - EECS 44/44, UC Bekeley: A solution to the constaints, if it exists: i is the minimum path weight fom the dummy node to node i. No solution exists if thee ae cycles with negatie weight. Why? Soling the Constaints: Add a dummy stat node to the constaint gaph Legal: u-we D>7: u-wu,- -,-,- -
Soling the Constaints: Use the Bellman-Fod Algoithm: O V Cannot use Dijksta s algoithm, which woks to find minimum path weights only if the weights all hae the same sign. Bellman-Fod can detect whee thee ae cycles with negatie weight. Legal: u-we Notice that this algoithm will only yield nonpositie alues of i. Why is this OK? D>7: u-wu,- - - -,- -,- A solution is = =, = = - EECS 44/44, UC Bekeley: Retiming Solution To find the minimum cycle time, do a binay seach among the enties of the D matix V log V Clock peiod = ++7= 7 V V Retime V V V V W V V V V D V V V V 6 6 7 7 V V V V 7 V Clock peiod= 7 V EECS 44/44, UC Bekeley: l 6
Dawbacks of this Algoithm l Requies W/D matix computation l O V clock peiod constaints, most of which ae edundant l Aeage case is wost case Fotunately, thee s anothe algoithm we can use: l elaxation-based algoithm called FEAS l See: [Shenoy, 997] EECS 44/44, UC Bekeley: Applications beyond cicuits In a dataflow gaph, nodes epesent actos, which fie when input tokens ae aailable. Fiing pefoms a computation that takes time. Weights epesent initial tokens. Retiming can be intepeted as a peamble to a peiodic schedule, and may hae the goal of maximizing paallelism so that the dataflow gaph executes fast on a multicoe machine. EECS 44/44, UC Bekeley: 4 l 7
Applications beyond cicuits In a dataflow gaph, nodes epesent actos, which fie when input tokens ae aailable. Fiing pefoms a computation that takes time. Weights epesent initial tokens. Retiming can be intepeted as a peamble to a peiodic schedule, and may hae the goal of maximizing paallelism so that the dataflow gaph executes fast on a multicoe machine. Fie! EECS 44/44, UC Bekeley: 5 Applications beyond cicuits In a dataflow gaph, nodes epesent actos, which fie when input tokens ae aailable. Fiing pefoms a computation that takes time. Weights epesent initial tokens. Retiming can be intepeted as a peamble to a peiodic schedule, and may hae the goal of maximizing paallelism so that the dataflow gaph executes fast on a multicoe machine. EECS 44/44, UC Bekeley: 6 l 8
Applications beyond cicuits In a dataflow gaph, nodes epesent actos, which fie when input tokens ae aailable. Fiing pefoms a computation that takes time. Weights epesent initial tokens. Retiming can be intepeted as a peamble to a peiodic schedule, and may hae the goal of maximizing paallelism so that the dataflow gaph executes fast on a multicoe machine. Fie! EECS 44/44, UC Bekeley: 7 Applications beyond cicuits In a dataflow gaph, nodes epesent actos, which fie when input tokens ae aailable. Fiing pefoms a computation that takes time. Weights epesent initial tokens. Retiming can be intepeted as a peamble to a peiodic schedule, and may hae the goal of maximizing paallelism so that the dataflow gaph executes fast on a multicoe machine. EECS 44/44, UC Bekeley: 8 l 9
Applications beyond cicuits In a dataflow gaph, nodes epesent actos, which fie when input tokens ae aailable. Fiing pefoms a computation that takes time. Weights epesent initial tokens. Retiming can be intepeted as a peamble to a peiodic schedule, and may hae the goal of maximizing paallelism so that the dataflow gaph executes fast on a multicoe machine. Fie! EECS 44/44, UC Bekeley: 9 Afte etiming Afte etiming the gaph, may be able to constuct a bette faste paallel schedule that will be executed peiodically. EECS 44/44, UC Bekeley: 4 l
Refeences. Leiseson, C. E. and J. B. Saxe 98. "Optimizing synchonous systems." Jounal of VLSI and Compute Systems: pp. 4-67.. Leiseson, C. E. and J. B. Saxe 99. "Retiming synchonous cicuity." Algoithmica 6: pp. 5-5.. Shenoy, N. 997. "Retiming: Theoy and pactice." Integation, the VLSI Jounal : pp. -. EECS 44/44, UC Bekeley: 4 l