CS137: Today Electronic Design Automation • Placement • Improving Quality – Avoiding local minima Day 17: November 11, 2005 • Techniques: Placement – Simulated Annealing (Simulated Annealing…) – Exhaustive (Branch-and-bound) 1 2 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Simulated Annealing Key Benefit • Physically motivated approach • Avoid Local Minima • Physical world has similar problems – Allowed to take locally non-improving – objects/atoms seeking minimum cost arrangement moves in order to avoid being stuck – at high temperature (energy) can move around – at low temperature, no free energy to move – cool quickly � freeze in defects (weak structure) – cool slowly � allow to find minimum cost 3 4 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Design Optimization Simulated Annealing Components: • At high temperature can move around 1. “Energy” (Cost) function to minimize – not trapped to only make “improving” moves – represent entire state, drives system forward – free energy from temperature allows exploration of 2. Moves non-minimum states – local rearrangement/transformation of solution – avoid being trapped in local minima 3. Cooling schedule • As temperature lowers – initial temperature – less energy to take big, non-minimizing moves – temperature steps (sequence) – more local / greedy moves – time at each temperature 5 6 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon 1
Details Basic Algorithm Sketch • Initial Temperature • Pick an initial solution – T 0 = Δ avg/ln(P accept ) • Set temperature (T) to initial value • Cooling schedule • while (T>T min ) – fixed ratio: T= λ T • ( e.g. λ =0.85) – for time at T – temperature dependent • pick a move at random • compute Δ cost – function of both temperature and acceptance rate • example to come • if less than zero, accept • else if (RND<e - Δ cost/T ), accept • Time at each temperature – update T – fixed number of moves? – fixed number of rejected moves? – fixed fraction of rejected moves? 7 8 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Cost Function Example Cost Functions bb x • Can be very general • Total Wire Length bb y – Combine area, timing, energy, routability… – Linear, quadratic… • Should drive entire solution in right • Bounding Box (semi-perimeter) direction – Surrogate for routed net length – reward each good move • Channel widths • Should be cheap to compute delta costs – probably wants to be more than just width – e.g. FM • Cut width – Ideally O(1) 9 10 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Bad Cost Functions VPR Wire Costs • VPR Bounding Box [ ] • Update cost ( ) ( ) ( ) ( ) ∑ = = Nets × + Cost q i bb i bb i – rerun maze route on every move x y i 1 – rerun timing analysis – recalculate critical path delay • Drive toward solution: Swartz, Betz, & Rose FPGA 1998 – size < threshold ? – Critical path delay Original table: Cheng ICCAD 1994 11 12 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon 2
VPR Balance VPR Timing Costs Wire and Time Cost • Criticality(e)=1-Slack(e)/Dmax • TCost(e)=Delay(e)*Criticality(e) CriticalityExp • Keep all edge delays in a table • Recompute Net Criticality at each Temperature ⎛ Δ ⎛ Δ ⎞ ⎞ TCost ( ) WCost Δ = λ + − λ ⎜ ⎟ ⎜ ⎟ 1 Cost ⎝ ⎠ ⎝ ⎠ OldTCost OldWCost Marquardt, Betz, & Rose Marquardt, Betz, & Rose FPGA2000 FPGA2000 13 14 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Initial Solution Moves • Spectral Placement • Swap two cells – Within some distance limit? (ex. to come) • Random • swap regions • Constructive Placement – …rows, columns, subtrees – Fast placers start at lower temperature; assume constructive got global right. • rotate cell (when feasible) • flip (mirror) cell • permute cell inputs (equivalent inputs) 15 16 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Variant Variant: “Rejectionless” • Order moves by cost • Allow non-legal solutions – compare FM – capture badness in cost function • Pick random number first – E.g . -- allow cells to overlap • Use random to define range of move costs • Just make sure cost function makes will currently accept very expensive as cool • Pick randomly within this range – settle out to legal solutions • Idea: never pick a costly move which will be rejected 17 18 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon 3
Theory Practice • If stay long enough at each cooling • Good results stage – ultimately, what most commercial tools use...what vpr uses… – will achieve tight error bound • Slow convergence • If cool long enough – will find optimum • Tricky to pick schedules to accelerate convergence 19 20 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Range Limit VPR Cooling Schedule • Moves at Temperature = cN 4/3 • Want to tune so accepting 44% of the moves – Lam and Delosme DAC 1988 • Temperature Update • VPR – Tnew=Told× γ – Define Rlimit – defines maximum Δ x and Δ y accepted – Idea: advance slowly in good α range – Tune Rlimit to maintain acceptance rate – Rlimit new =Rlimit old ×(1-0.44+ α ) Betz, Rose, & Marquardt α is measured acceptance rate Kluwer 1999 21 22 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Range Limiting Range Limiting? • Eguro alternate [DAC 2005] – define P=D -M – Tune M to control α Eurgo, Hauck, & Sharma DAC 2005 23 24 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon 4
Big Hammer • Costly, but general • Works for most all problems – (part, placement, route, retime, schedule…) Optimal/Exhaustive • Can have hybrid/mixed cost functions – as long as weight to single potential – ( e.g. wire/time from VPR) • With care, can attack multiple levels – place and route • Ignores structure of problem – resignation to finding/understanding structure 25 26 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Brute Force? • If you run simulated annealing long • If you are really going to give up on enough…. structure and explore the entire space – It should converge to optimum – …there are more efficient ways to do it • If you have enough monkeys typing at • …and maybe they’re not terrible keyboards keyboards long enough – For small/modest problems – They’ll eventually produce the works of – As our computers get faster Shakespeare…. 27 28 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Optimum Placement Improving • Simplest case: • Prune off symmetry cases – Gate/array (FPGA) w/ fixed cell locations – Rotate 90, 180, 270 – Mirror X, Y, XY • N locations • Reject provably bad starts • M cells – (return to in a minute) • Try all permutations of N choose M N!/M! cases 29 30 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon 5
Exhaustive Placement Branch-and-Bound • More general: • Consider dense 1D placement – Modules have variable size – Search space of all placements – Modules can be rotated/flipped… – Tree branch is choice of logical cell for physical cell position • To explore all cases: – Keep track of best solution so far as reach – For each module leaves • For each orientation – If partial solution worse than best solution, prune branch 31 32 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Pruning: 1D example Viable • Reducing channel width • Only on small problems – Have solution with width=10 – But “small” growing with machine speed – When find a partial solution with width>=10 • Use for end-case in constructive • Can abort that branch – Flatten bottom of hierarchy • Reducing Delay – Maybe even in iteration/overlap relaxation – Have solution with delay=20 – When find a partial solution with delay>=20 • Can abort branch 33 34 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Runtime Caldwell et. al. Results 35 36 [TRCAD v19n11p1304-13] [TRCAD v19n11p1304-13] CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon 6
Runtime Faster? • Accounting and gain complexity – Make it linear time – But does make each update somewhat complex – Exhaustive case less bookkeeping • Not an atypical result… 37 38 [TRCAD v19n11p1304-13] CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Summary Admin • Simulated Annealing • Class Monday – use randomness to explore space • …but not W, F (finish assignment) – accept “bad” moves to avoid local minima – decrease tolerance over time • General purpose solution – costly in runtime • Small (sub)problems – May solve exhaustively – Can prune to accelerate… 39 40 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Big Ideas: • Use randomness to explore large (non- convex) space – Simulated Annealing • Use dominance to quickly skip over obviously bad solutions – Branch and Bound 41 CALTECH CS137 Fall2005 -- DeHon 7
Recommend
More recommend