Hardware-Software Codesign 4. System Partitioning Lothar Thiele Swiss Federal Computer Engineering 4 - 1 Institute of Technology and Networks Laboratory
System Design specification system synthesis estimation SW-compilation instruction set HW-synthesis intellectual intellectual prop. code prop. block machine code net lists Swiss Federal Computer Engineering 4 - 2 Institute of Technology and Networks Laboratory
Mapping Mapping transforms behavior into structure and execution: allocation : select components partitioning binding : assign functions to components mapping scheduling : determine execution order … finally, synthesis results into implementation Swiss Federal Computer Engineering 4 - 3 Institute of Technology and Networks Laboratory
Levels of Abstractions Mapping can be done at low level: register transfer level (RTL) or netlist level e.g., split a digital circuit and map it to several devices (FPGAs, ASICs) system parameters (e.g., area, delay) relatively easy to determine p0 p3 p1 p2 at high level: system level CPU0 CPU2 CPU1 CPU3 comparison of design alternatives for optimality (design space exploration) bus … OR ? system parameters are unknown and difficult to determine p0 p3 p1 p2 to be estimated via analysis, simulation, (rapid) prototyping CPU0 CPU2 CPU1 CPU3 Swiss Federal Computer Engineering bus 4 - 4 Institute of Technology and Networks Laboratory
Model-Based Synthesis – Example optimal C: N:1 mapping p0 p3 p1 p2 optimal L: 1:1 mapping CPU0 CPU1 CPU2 CPU3 bus considered performance cost C: cost of allocated components, e.g., sum latency L: due to scheduling (resource sharing) conflicting design goals and constraints feasible schedule L ≤ Lmax feasible allocation C ≤ Cmax Swiss Federal Computer Engineering 4 - 5 Institute of Technology and Networks Laboratory
Example – Alternatives p0 p3 p1 p2 CPU0 p0 p1 p2 p3 latency CPU0 CPU2 CPU1 CPU3 L MAX bus optimal C: N:1 mapping optimal L: 1:1 mapping CPU0 p0 p0 p3 p1 p2 p1 CPU1 CPU2 p2 CPU0 CPU2 CPU1 CPU3 CPU3 p3 bus latency L MAX Swiss Federal Computer Engineering 4 - 6 Institute of Technology and Networks Laboratory
Cost Functions Quantitatively measure performance of a design point system cost C[$] latency L[sec] power consumption P[W] … Estimation is required to find C,L,P values, for each design point example: linear cost (preference) function with penalty f(C,L,P)= k 1 ·h C (C,C max )+ k 2 ·h L (L,L max )+ k 3 ·h P (P,P max ) h C , h L , h P … denote how strong C, L, P violate design constraints C max , L max , P max k 1 , k 2 , k 3 … weighting and normalization Swiss Federal Computer Engineering 4 - 7 Institute of Technology and Networks Laboratory
The Formal Partitioning Problem assign n objects O={o 1 ,...,o n } to m blocks (also called partitions) P={p 1 ,...,p m } , such that p 1 p 2 ... p m =O (all objects are assigned –mapped) p i p j ={ } i,j:i j (an object is not assigned or “mapped” twice) and costs c(P) are minimized note: in system synthesis (simple model) objects O p0 p3 p1 p2 objects = process network graph nodes partitions p blocks = architecture graph nodes cost = measured/estimated with blocks m dedicated cost functions (e.g., latency, CPU0 CPU1 power, hardware cost) bus Swiss Federal Computer Engineering 4 - 8 Institute of Technology and Networks Laboratory
Partitioning Methods Exact methods enumeration integer linear programs (ILP) ( see next slides) Heuristic methods constructive methods • random mapping • hierarchical clustering iterative methods • Kernighan-Lin algorithm • simulated annealing • evolutionary algorithms Swiss Federal Computer Engineering 4 - 9 Institute of Technology and Networks Laboratory
Integer Programming Model Ingredients: objective function (cost) involving linear expressions of integer variables from a set X constraints objective C a x with a R , x N ( 1 ) i i i i x X i j J : b x c with b , c R ( 2 ) constraints i , j i j i , j j x X i Integer programming (IP) problem: minimize objective function (1) subject to constraints (2) note: if all x i are constrained to be either 0 or 1 , the IP problem is said to be a 0/1 integer programming problem Swiss Federal Computer Engineering 4 - 10 Institute of Technology and Networks Laboratory
Small Example of 0/1 IP C 5 x 6 x 4 x minimize: 1 2 3 x x x 2 subject to: 1 2 3 x , x , x { 0 , 1 } 1 2 3 C optimal (minimal) Swiss Federal Computer Engineering 4 - 11 Institute of Technology and Networks Laboratory
Integer Linear Program for Partitioning Binary variables x i,k x i,k = 1: object o i in block p k x i,k = 0: object o i not in block p k Cost c i,k , if object o i is in block p k Integer linear program: x 0 , 1 1 i n , 1 k m i , k m x 1 1 i n i , k k 1 m n minimize x c 1 k m , 1 i n i , k i , k k 1 i 1 Swiss Federal Computer Engineering 4 - 12 Institute of Technology and Networks Laboratory
Example – Partitioning t0 t3 t1 t2 task t0 t1 t2 t3 PE PE0 1 1 0 0 PE1 0 0 1 1 PE0 PE1 bus e.g., optimized for a load balanced system load balancing: exe. t0 t1 t2 t3 time load PE0 = 5+15 PE0 5 15 10 30 load PE1 = 10+10 PE1 10 20 10 10 Swiss Federal Computer Engineering 4 - 13 Institute of Technology and Networks Laboratory
Variations in ILP Additional constraints: e.g., maximum h k objects in block k n x h 1 k m i , k k i 1 Maximizing the cost function: can be done by setting C’= -C in a minimization problem Swiss Federal Computer Engineering 4 - 14 Institute of Technology and Networks Laboratory
ILP for synthesis Solving the synthesis problem with ILP is very popular: If not solving to optimality, runtimes are acceptable and a solution with guaranteed quality can be determined. Scheduling can be integrated. Various additional constraints can be added. However, finding the right equations to model the constraints is an art. Swiss Federal Computer Engineering 4 - 15 Institute of Technology and Networks Laboratory
Remarks on Integer Programming Integer programming is NP-complete In practice, runtimes can increase exponentially with the size of the problem. But problems of some thousands of variables can still be solved with commercial solvers (depending on the size/structure of the problem) or approximation algorithms (heuristics). IP models can be a good starting point for designing heuristic optimization methods. Swiss Federal Computer Engineering 4 - 16 Institute of Technology and Networks Laboratory
Partitioning Methods exact methods enumeration integer linear programs (ILP) heuristic methods constructive methods ( see next slides) • random mapping • hierarchical clustering iterative methods • Kernighan-Lin algorithm • simulated annealing • evolutionary algorithms Swiss Federal Computer Engineering 4 - 17 Institute of Technology and Networks Laboratory
Constructive Methods Examples random mapping • each object is assigned to a block randomly hierarchical clustering • stepwise grouping of (e.g., two) objects • and evaluate closeness function (how desirable it is to group objects) Constructive methods are often used to generate a starting partition for iterative methods Swiss Federal Computer Engineering 4 - 18 Institute of Technology and Networks Laboratory
Hierarchical Clustering Example (1) v 5 = v 1 v 3 v 1 v 5 20 10 10 8 10 7 v 2 v 2 v 3 4 4 6 v 4 v 4 closeness function: arithmetic mean of weights Swiss Federal Computer Engineering 4 - 19 Institute of Technology and Networks Laboratory
Hierarchical Clustering Example (2) v 6 = v 2 v 5 v 5 v 6 10 7 5.5 v 2 4 v 4 v 4 Swiss Federal Computer Engineering 4 - 20 Institute of Technology and Networks Laboratory
Hierarchical Clustering Example (3) v 6 v 7 = v 6 v 4 v 7 5.5 v 4 Swiss Federal Computer Engineering 4 - 21 Institute of Technology and Networks Laboratory
Hierarchical Clustering – Summary cut lines step 3: v 7 {v 7 } v 7 = v 6 v 4 (partitions) {v 4 ,v 6 } v 6 step 2: v 6 = v 2 v 5 {v 2 ,v 4 ,v 5 } step 1: v 5 v 5 = v 1 v 3 {v 1 ,v 2 ,v 3 ,v 4 } v 1 v 2 v 3 v 4 step 0: Swiss Federal Computer Engineering 4 - 22 Institute of Technology and Networks Laboratory
Partitioning Methods exact methods enumeration integer linear programs (ILP) heuristic methods constructive methods • random mapping • hierarchical clustering iterative methods ( see next slides) • Kernighan-Lin algorithm • simulated annealing • evolutionary algorithms Swiss Federal Computer Engineering 4 - 23 Institute of Technology and Networks Laboratory
Recommend
More recommend