1 / 53

ENGG3190 Logic Synthesis HLS: Allocation & Binding

ENGG3190 Logic Synthesis HLS: Allocation & Binding. Winter 2014 S. Areibi School of Engineering University of Guelph. Outline. Allocation & Binding Definition Examples Algorithms and Heuristics Clique Partitioning (Compatibility Graphs) Graph Coloring (Conflicting Graphs)

amelie
Download Presentation

ENGG3190 Logic Synthesis HLS: Allocation & Binding

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ENGG3190Logic SynthesisHLS: Allocation & Binding Winter 2014 S. Areibi School of Engineering University of Guelph

  2. Outline • Allocation & Binding • Definition • Examples • Algorithms and Heuristics • Clique Partitioning (Compatibility Graphs) • Graph Coloring (Conflicting Graphs) • Left Edge Algorithm • ILP Formulation

  3. Binding • During scheduling, we determined: • When ops will execute • How many resources are needed • We still need to decide which ops execute on which resources • => Binding • If multiple ops use the same resource • =>Resource Sharing

  4. Allocation (Binding) • Allocation = resource binding • Spatial mapping between operations and resources • Operators can be dedicated or generic (shared) • Operators and registers need to be allocated • Sharing • Assignment of a resource to more than one operation • Constrained resource binding • Resource-dominated circuits • Fixed number and type of resources available • NP-complete problem – need heuristics

  5. Binding • Basic Idea - Map operations onto resources such that operations in same cycle don’t use same resource 2 ALUs (+/-), 2 Multipliers + Cycle1 2 3 * + 1 4 - Cycle2 * 6 * 5 Cycle3 + 7 - Cycle4 8 ALU2 Mult2 ALU1 Mult1

  6. Binding • Many possibilities • Bad binding may increase resources, require huge steering logic, reduce clock, etc. 2 ALUs (+/-), 2 Multipliers + Cycle1 2 3 * + 1 4 - Cycle2 * 6 * 5 Cycle3 + 7 - Cycle4 8 ALU2 Mult2 ALU1 Mult1

  7. Binding • Can’t do this • 1 resource can’t perform multiple ops simultaneously! 2 ALUs (+/-), 2 Multipliers + Cycle1 2 3 * + 1 4 - Cycle2 * 6 * 5 Cycle3 + 7 - Cycle4 8

  8. Binding and Sharing Problem • Given: scheduled sequencing graph • Operation concurrency well defined • Consider operation types independently • Problem decomposition (ALU, Multiplier, Dividers, …) • Perform analysis for each resource type • Compatible Operations • Same type • Non-concurrent • Conflicting Operations • Concurrent, different types • Dual to compatibility

  9. Binding: Algorithms • Algorithms? • Using Graph Theory • Clique Partitioning • Graph Coloring • Left Edge Algorithm

  10. Clique • A clique is a subset of vertices that are all connected • For graph G = (V, E), a subset S of the vertices is a clique if every pair of vertices in S are adjacent. • S={2,3} is a clique. S={1,2,3,4} is not a clique. 1 2 3 5 4 6 7

  11. A B G D C E F Cliques 1 AGC ABD 2 2 ADC 1 1 2 CDE 1 EF

  12. Resource Compatibility Graph  G+(V,E) V represents operations E represents compatible operation pairs Compatibleoperations (vi, vj) are compatible if they are not concurrent and can be implemented by resources of same type i.e., Ops that use same type of resource (ALU, etc.) and are scheduled at different cycles Partition the graph into minimum number of cliques in G+(V,E) Clique = maximal complete subgraph Partition the graph into minimum number of cliques, or Clique cover number, (G+(V,E)) Clique Partitioning: Use G+(V,E)

  13. Heuristic algorithm CLIQUE_PARTITION( G( V, E) ) { Y =; while ( G( V, E) not empty ) do { compute Max_CliqueC in G( V, E) ; Y = Y  C; delete C from G( V, E) ; } } Max_CLIQUE( G( V, E) ) { C = seed vertex; repeat { select vertex v V , vC and adjacent to all vertices of C; if (no such vertex is found) return C = C  {v} ; } }

  14. Compatibility Graph: Example + Cycle1 2 3 * + 1 4 - Cycle2 * 6 * 5 Cycle3 + 7 - Cycle4 8 Mults ALUs 1 6 2 8 5 and 6 not compatible (same cycle) 5 7 4 2 and 3 not compatible (same cycle) 3

  15. Possible Solutions? + Cycle1 2 3 * + 1 4 - Cycle2 * 6 * 5 Cycle3 + 7 - Cycle4 8 Mults ALUs 1 6 2 8 5 7 4 Note - Fully connected subgraphs can share a resource (all involved nodes are compatible) 3

  16. Solutions #1 + Cycle1 2 3 * + 1 4 - Cycle2 * 6 * 5 Cycle3 + 7 - Cycle4 8 Mults ALUs 1 6 2 8 5 7 4 Note - Fully connected subgraphs can share a resource (all involved nodes are compatible) 3

  17. Compatibility Graph • Final Binding: + Cycle1 2 3 * + 1 4 - Cycle2 * 6 * 5 Cycle3 + 7 - Cycle4 8 Mults ALUs 1 6 2 8 5 7 4 3

  18. Solution #2 + Cycle1 2 3 * + 1 4 - Cycle2 * 6 * 5 Cycle3 + 7 - Cycle4 8 Mults ALUs 1 6 2 8 5 7 4 Note - Fully connected subgraphs can share a resource (all involved nodes are compatible) 3

  19. Compatibility Graph • Binding: Find minimum number of fully connected sub graphs that cover entire graph • Well-known problem: Clique partitioning (NP-complete) • Cliques = { {2,8,7,4},{3},{1,5},{6} } • ALU1 executes 2,8,7,4 • ALU2 executes 3 • MULT1 executes 1,5 • MULT2 executes 6 1 6 2 8 5 7 4 3

  20. Compatibility Graph • Final Binding: + Cycle1 2 3 * + 1 4 - Cycle2 * 6 * 5 Cycle3 + 7 - Cycle4 8 Mults ALUs 1 6 2 8 5 7 4 3

  21. Translation to Datapath a b c d e f g h i + Cycle1 2 3 * + 1 4 - Cycle2 * 6 * 5 Cycle3 + 7 - Cycle4 8 Add resources and registers Add mux for each input Add input to left mux for each left input in DFG Do same for right mux If only 1 input, remove mux f a e g b d e i h c Mux Mux Mux Mux Mult(1,5) ALU(2,7,8,4) Mult(6) ALU(3) Reg Reg Reg Reg

  22. NOP NOP 3 1 8 + + < * * * * * * 7 6 2 9 8 9 11 10 4 5 Building the Compatibility Graph G+(V,E) • Minimum Clique covers in G+(V,E) 2 1 10 6 11 3 4 7 MULT ALU (G+(V,E)) = 2 (G+(V,E)) = 2 5

  23. Algorithm II: Graph coloring • Vertex labeling (coloring) of a graph G(V,E): • is a labeling of the vertices such that no edge in E has two end-points with the same label. • Chromatic number: • the smallest number of labels for a coloring of a graph • The vertex coloring decision problem is: • to determine if a given graph G(V,E) has a chromatic number smaller than a given integer. • The corresponding optimization problem: • Is the search for a vertex coloring with a minimum number of colors

  24. Graph Coloring The chromatic number X(G+(V,E)) of the problem is 3.

  25. Why Graph Coloring? • Many problems can be formulated as a graph coloring problem including: • Time Tabling, • Scheduling, • Register Allocation, • Channel Assignment • A lot of research has been done in this area so much is already known about the problem space.

  26. Graph coloring heuristic algorithm VERTEX_COLOR(G(V, E)) { for (i =1 to |V| ) { c =1 while ( a vertex adjacent to vI with color c) do { c = c +1; } Label v iwith color c ; } }

  27. Resource Conflict Graph G-(V,E) V represents operations E represents conflicting operation pairs Conflicting operations Two operations are conflicting if they are not compatible Complementary to compatibility graph Find independent set of G-(V,E) A set of mutually compatible operations Coloring with minimum number of colors Chromatic number (G-(V,E)) Graph Coloring: Conflict Graph G-(V,E)

  28. NOP NOP 3 3 1 1 8 8 + + < * * * * * * 7 7 6 6 2 2 9 8 9 11 11 10 10 4 5 4 5 9 MULT ALU Compatibility Graph G+(V,E) versusConflict Graph G-(V,E) • Minimum Clique covers in G+(V,E) 2 1 10 6 11 3 (G+(V,E)) = 2 (G+(V,E)) = 2 4 7 MULT ALU • Chromatic numbers in G-(V,E) 5 (G-(V,E)) = 2 (G-(V,E)) = 2

  29. Clique vs Coloring - Example

  30. Left-Edge Algorithm • Input • Set of intervals sorted with left and right edge coordinates • Algorithm • Sort intervals by their left edge coordinates • Assign non-overlapping intervals to first track (color) using the sorted list • When possible intervals are exhausted, increase track (color) counter and repeat. • Efficiency • Simple, polynomial time algorithm

  31. Left-Edge Algorithm

  32. Left-Edge Algorithm - Example • The edges in the graph correspond to intersection of intervals • Vertices that have no edges between them can be colored with the same color Input Solution

  33. a e f j b g k c d + Cycle1 3 2 * + 1 Cycle2 * 4 6 Cycle3 * 5 Cycle4 * Cycle5 Cycle6 + 7 Cycle7 - 8 Left Edge Algorithm • Alternative to clique partitioning • Take scheduled DFG, rotate it 90 degrees 2 ALUs (+/-), 2 Multipliers

  34. Left Edge Algorithm 2 ALUs (+/-), 2 Multipliers * 4 Initialize right_edge to 0 Find a node N whose left edge is >= right_edge Bind N to a particular resource Update right_edge to the right edge of N Repeat from 2) for nodes using the same resource type until right_edge passes all nodes Repeat from 1) until all nodes bound right_edge * 6 + 3 - 8 + + 7 2 * 5 * 1 Cycle7 Cycle4 Cycle6 Cycle5 Cycle1 Cycle3 Cycle2

  35. Left Edge Algorithm 2 ALUs (+/-), 2 Multipliers * 4 Initialize right_edge to 0 Find a node N whose left edge is >= right_edge Bind N to a particular resource Update right_edge to the right edge of N Repeat from 2) for nodes using the same resource type until right_edge passes all nodes Repeat from 1) until all nodes bound right_edge * 6 + 3 - 8 + + 7 2 * 5 * 1 Cycle7 Cycle4 Cycle6 Cycle5 Cycle1 Cycle3 Cycle2

  36. Left Edge Algorithm 2 ALUs (+/-), 2 Multipliers * 4 Initialize right_edge to 0 Find a node N whose left edge is >= right_edge Bind N to a particular resource Update right_edge to the right edge of N Repeat from 2) for nodes using the same resource type until right_edge passes all nodes Repeat from 1) until all nodes bound right_edge * 6 + 3 - 8 + + 7 2 * 5 * 1 Cycle7 Cycle4 Cycle6 Cycle5 Cycle1 Cycle3 Cycle2

  37. Left Edge Algorithm 2 ALUs (+/-), 2 Multipliers * 4 Initialize right_edge to 0 Find a node N whose left edge is >= right_edge Bind N to a particular resource Update right_edge to the right edge of N Repeat from 2) for nodes using the same resource type until right_edge passes all nodes Repeat from 1) until all nodes bound right_edge * 6 + 3 - 8 + + 7 2 * 5 * 1 Cycle7 Cycle4 Cycle6 Cycle5 Cycle1 Cycle3 Cycle2

  38. Left Edge Algorithm 2 ALUs (+/-), 2 Multipliers * 4 Initialize right_edge to 0 Find a node N whose left edge is >= right_edge Bind N to a particular resource Update right_edge to the right edge of N Repeat from 2) for nodes using the same resource type until right_edge passes all nodes Repeat from 1) until all nodes bound right_edge * 6 + 3 - 8 + + 7 2 * 5 * 1 Cycle7 Cycle4 Cycle6 Cycle5 Cycle1 Cycle3 Cycle2

  39. Left Edge Algorithm 2 ALUs (+/-), 2 Multipliers * 4 Initialize right_edge to 0 Find a node N whose left edge is >= right_edge Bind N to a particular resource Update right_edge to the right edge of N Repeat from 2) for nodes using the same resource type until right_edge passes all nodes Repeat from 1) until all nodes bound right_edge * 6 + 3 - 8 + + 7 2 * 5 * 1 Cycle7 Cycle4 Cycle6 Cycle5 Cycle1 Cycle3 Cycle2

  40. Left Edge Algorithm 2 ALUs (+/-), 2 Multipliers * 4 Initialize right_edge to 0 Find a node N whose left edge is >= right_edge Bind N to a particular resource Update right_edge to the right edge of N Repeat from 2) for nodes using the same resource type until right_edge passes all nodes Repeat from 1) until all nodes bound right_edge * 6 + 3 - 8 + + 7 2 * 5 * 1 Cycle7 Cycle4 Cycle6 Cycle5 Cycle1 Cycle3 Cycle2

  41. Left Edge Algorithm 2 ALUs (+/-), 2 Multipliers * 4 Initialize right_edge to 0 Find a node N whose left edge is >= right_edge Bind N to a particular resource Update right_edge to the right edge of N Repeat from 2) for nodes using the same resource type until right_edge passes all nodes Repeat from 1) until all nodes bound right_edge * 6 + 3 - 8 + + 7 2 * 5 * 1 Cycle7 Cycle4 Cycle6 Cycle5 Cycle1 Cycle3 Cycle2

  42. Left Edge Algorithm 2 ALUs (+/-), 2 Multipliers * 4 Initialize right_edge to 0 Find a node N whose left edge is >= right_edge Bind N to a particular resource Update right_edge to the right edge of N Repeat from 2) for nodes using the same resource type until right_edge passes all nodes Repeat from 1) until all nodes bound right_edge * 6 + 3 - 8 + + 7 2 * 5 * 1 Cycle7 Cycle4 Cycle6 Cycle5 Cycle1 Cycle3 Cycle2

  43. Binding Formulation UsingInteger Linear Programming

  44. ILP Formulation of Operation Binding • The binding problem can be formulated with an ILP model. • For the sake of simplicity, we assume first that all operations and resources have the same type (i.e., one type of Multiplier, one type of ALU, …) • We will first define the decision variables. • Next define the constraints.

  45. ILP Formulation of Operation Binding • Boolean variables bir bir = 1 if operation Vi is bound to resource r 0 otherwise • Boolean variables xil xil = 1 if operation Viis scheduled to start at step l • Each operation is bound to one resource (a = limit on resource r) • At each step l, at most one operation can be executing for a given resource (horizontal constraint)

  46. NOP NOP + + < * * * * * * 8 9 Operation Binding - Example • Consider again the scheduled sequencing graph shown in the figure. • The operations have two types: • Multipliers: Multiplication • ALU: addition/Subtraction/Comparator • The available resources: • Two Multipliers available (same type) • Two ALUs available • Create an ILP model. 2 1 10 6 11 3 4 7 5

  47. MULT 1: i={1,2,3,6,7,8}bi1xil 1, l =1,2,…,5 MULT 2: i={1,2,3,6,7,8}bi2xil 1, l =1,2,…,5 Operation Binding - Solution • Equations for two multipliers: bi1 + bi2 = 1, i={1,2,3,6,7,8} • Solution: b11 = b31 = b71 = 1 b22 = b62 = b82 = 1 all other bij =0

  48. Summary • Resource sharing and binding is reducible to • Graph coloring, or • Clique covering • Simple for flat (non-hierarchical) graphs • Intractable in general case, but still easy in practice for other graphs • More complicated for non resource-dominated circuits • Extension: module selection

  49. End Slides

  50. NOP NOP 3 1 8 + + < * * * * * * 7 6 2 2 1 10 8 6 11 3 9 11 10 4 5 4 7 9 5 MULT ALU Conflict Graph G-(V,E) - Example • Chromatic numbers in G-(V,E) (G-(V,E)) = 2 (G-(V,E)) = 2

More Related