0% found this document useful (0 votes)
21 views36 pages

6-Resource Sharing

This document discusses resource sharing and optimization techniques. It introduces concepts like allocation, binding, sharing, and the optimum binding/sharing problem. The document describes compatibility graphs, conflict graphs, and how to model operation compatibility and conflicts using these graphs. It also presents the left-edge algorithm for solving the interval graph coloring problem that arises in optimally sharing resources. The algorithm sorts intervals by left edge and assigns non-overlapping intervals to colors sequentially to find the minimum number of colors needed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views36 pages

6-Resource Sharing

This document discusses resource sharing and optimization techniques. It introduces concepts like allocation, binding, sharing, and the optimum binding/sharing problem. The document describes compatibility graphs, conflict graphs, and how to model operation compatibility and conflicts using these graphs. It also presents the left-edge algorithm for solving the interval graph coloring problem that arises in optimally sharing resources. The algorithm sorts intervals by left edge and assigns non-overlapping intervals to colors sequentially to find the minimum number of colors needed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 36

Resource sharing

This presentation can be used for non-commercial purposes as long as this note and the copyright footers are not removed
© Giovanni De Micheli – All rights reserved
Module 1
 Objectives
 Motivation and problem formulation
 Flat and hierarchical graphs
 Functional and memory resources
 Extension to module selection

(c) Giovanni De Micheli 2


Allocation and binding

 Allocation:
 Number of resources available
 Binding:
 Relation between operations and resources
 Sharing:
 Many-to-one relation
 Optimum binding/sharing:
 Minimize the resource usage

(c) Giovanni De Micheli 3


Binding

 Limiting cases:
 Dedicated resources
 One resource per operation
 No sharing

 One multi-task resource


 ALU

 One resource per type

(c) Giovanni De Micheli 4


Optimum sharing problem
 Scheduled sequencing graphs
 Operation concurrency is well defined
 Consider operation types independently
 Problem decomposition
 Perform analysis for each resource type

(c) Giovanni De Micheli 5


Compatibly and conflicts
 Operation compatibility: t1 x=a+b y=c+d 1 2

 Same type t2 s=x+y t=x-y 3 4

 Non concurrent t3 z=a+t 5

Compatibility graph
 Compatibility graph:
1 2
 Vertices: operations
 Edges: compatibility relation 5

3 4

 Conflict graph:
 Complement of compatibility graph Conflict graph
1 2

3 4

(c) Giovanni De Micheli 6


Example
t1 x=a+b y=c+d 1 2

t2 s=x+y t=x-y 3 4

t3 z=a+t 5

Conflict Compatibility
1 2 1 2

5 5

3 4 3 4

Coloring Partitioning

ALU1: 1,3,5
ALU2: 2,4

(c) Giovanni De Micheli 7


Compatibility and conflicts
 Compatibility graph:
 Partition the graph into a minimum number of cliques
 Find clique cover number k ( G+ )
 Conflict graph:
 Color the vertices by a minimum number of colors.
 Find the chromatic number х ( G_ )
 NP-complete problems:
 Heuristic algorithms

(c) Giovanni De Micheli 8


Data-flow graphs
(flat sequencing graphs)

 The compatibility/conflict graphs have special properties:


 Compatibility
 Comparability graph
 Conflict
 Interval graph

 Polynomial time solutions:


 Golumbic’s algorithm
 Left-edge algorithm

(c) Giovanni De Micheli 9


Perfect graphs
 Comparability graph:
 Graph G (V, E ) has an orientation G ( V, F ) with the transitive property
(vi, vj) є F and (vj, vk) є F → (vi, vk) є F
 Interval graph:
 Vertices correspond to intervals
 Edges correspond to interval intersection
 Subset of chordal graphs
 Every loop with more than three edges has a chord

(c) Giovanni De Micheli 10


Example
NOP 0

1 2 10
TIME 1 * * +

3 6 11
TIME 2 * * <

4 7 8
TIME 3 - * *

5 9
TIME 4 - +

NOP
9

3 1 8
4 10

7 6 2
5 11

(c) Giovanni De Micheli 11


Example

NOP 0

1 2 10
* * + 10
TIME 1 1 2
3 6 11
* 11
TIME 2 * < 3 6

4 7 8
- * *
TIME 3 4 7 8
5 9
TIME 4 - +
5 9
n

NOP

(c) Giovanni De Micheli 12


Left-edge algorithm
 Input:
 Set of intervals with left and right edge
 Start and Stop times
 A set of colors (initially one color)
 Rationale:
 Sort intervals in a list by left edge
 Assign non overlapping intervals to first color using the list
 When possible intervals are exhausted,
increase color counter and repeat

(c) Giovanni De Micheli 13


Example
0 1 2 3 4 5 6 7 8

1 6 1

4
7 4 3
7

3
2 5
5

Conflict graph
Intervals

1 6

0 1 2 3 4 5 6 7 8
7 4 3 1 2 3

6 7 5

2 5 4

Colored conflict Coloring


graph
(c) Giovanni De Micheli 14
Left-edge algorithm

LEFT_EDGE(I) {
Sort elements of I in a list L in ascending order of li;
c = 0;
while (some interval has not been colored) do {
S = Ø;
r = 0;
while ( exists s є L such that ls > r ) do {
s = First element in the list L with ls > r;
S = S U {s};
r = rs;
Delete s from L;
}
c = c + 1;
Label elements of S with color c;
}
}

(c) Giovanni De Micheli 15


Hierarchical sequencing graphs

 Hierarchical conflict/compatibility graphs:


 Easy to compute
 Prevent sharing across hierarchy
 Flatten hierarchy:
 Bigger graphs
 Destroy nice properties

(c) Giovanni De Micheli 17


Example

a
+
TIME 1 a a
* a 2
TIME 2
2
TIME 3 2 *
*
3 3
TIME 4 * *
4 3
TIME 5 a 4 a 4
*
+ *
TIME 6 a
*
TIME 7

(a) (b) (c)

(c) Giovanni De Micheli 18


Example

NOP NOP a
TIME 1 a a

TIME 2 BR c d c d c d
TIME 3 b b
TIME 4 b
NOP NOP

(a) (b) (c)

(c) Giovanni De Micheli 19


Register binding problem
 Given a schedule:
 Lifetime intervals for variables
 Lifetime overlaps
 Conflict graph (interval graph):
 Vertices ↔ variables
 Edges ↔ overlaps
 Interval graph
 Compatibility graph (comparability graph):
 Complement of conflict graph

(c) Giovanni De Micheli 20


Register sharing in data-flow graphs

 Given:
 Variable lifetime conflict graph

 Find:
 Minimum number of registers storing all the variables
 Key point:
 Interval graph
 Left-edge algorithm (polynomial-time complexity)

(c) Giovanni De Micheli 21


Example

1 2 z1 z2
TIME 1 * * z1 z2
z1 z2
3 6
TIME 2 * * z3 z4
z3 z4
z4
z3 4 7
TIME 3 - *
z5 z6 z5 z6
z6
z5
TIME 4 5
-

(a) (b) (c)

(c) Giovanni De Micheli 22


Register sharing
general case
 Iterative conflicts:
 Preserve values across iterations
 Circular-arc conflict graph
 Coloring is intractable
 Hierarchical graphs:
 General conflict graphs
 Coloring is intractable
 Heuristic algorithms

(c) Giovanni De Micheli 23


Example

u
y
x
u 3 x u dx y u dx x dx x
1 2 10
TIME 1 * * +

z1 z2 3 a z1 z2 u y x
6
TIME 2 3 11
* * <
dx z3 z4
z3 z4 8
4
7 c
TIME 3 *
- *
y z7
z5 z6 z7
z5 z6
TIME 4 - 5 + 9

u y
y
u

(a) (b)

(c) Giovanni De Micheli 24


Example
Variable-lifetimes and circular-arc conflict graph

z1
z2 u

x
z1 z2
1

u y 4 2 z4 z3
x z3 z4 y

z5 z6
z7
z6
z5
z7

(c) Giovanni De Micheli 25


Bus sharing and binding

 Find the minimum number of busses to accommodate all data


transfer
 Find the maximum number of data transfers for a fixed number
of busses
 Similar to memory binding problem

(c) Giovanni De Micheli 30


Example
1 2 z1 z2
TIME 1 * * z1 z2
z1 z2
3 6
TIME 2 * * z3 z4
z3 z4
z4
z3 4
7
TIME 3 - *
z5 z6 z5 z6
z6
z5
TIME 4 5
-

(a) (b) (c)

 One bus:
 3 variables can be transferred
 Two busses:
 All variables can be transferred
(c) Giovanni De Micheli 31
Module selection problem
 Extension of resource sharing
 Library of resources:
 More than one resource per type

 Example:
 Ripple-carry adder (small and slow)
 Carry look-ahead adder (big and fast)

 Resource modeling:
 Resource subtypes with
( area, delay ) parameters

(c) Giovanni De Micheli 32


Module selection solution
 ILP formulation:
 Decision variables
 Selectresource sub-type
 Determine ( area, delay )

 Heuristic algorithm
 Determine minimum latency with fastest resource subtypes
 Recover area by using slower resources on non-critical paths

(c) Giovanni De Micheli 33


Example
NOP 0
(1,1) Slow multipliers
TIME 1 *
1 6
(1,2)
(2,1) save area
*

2 10
TIME 2 * +

3 8 11
* * <
TIME 3

4 7
TIME 4 - *

5 (2,2) 9
TIME 5 - +

n
NOP

 Multipliers with:
 ( Area, delay ) = ( 5,1 ) and ( 2,2 )
 Latency bound of 5

(c) Giovanni De Micheli 34


Example 2
NOP 0

(1,1)
1 (1,2) (2,1) 10
* 2 +
TIME 1 *

3 6 11
TIME 2 * * <

4 7 * 8
TIME 3 - *

(2,2)
5
TIME 4 - + 9

n
NOP
 Latency bound of 4
 Fast multipliers for { v1 , v2 , v3 }
 Slower multiplier can be used elsewhere
 Less sharing
 Minimum-latency design uses fast multipliers only
 Impossible to use slow multipliers

(c) Giovanni De Micheli 35


Module 2
 Objectives
 Data path generation
 Control synthesis

(c) Giovanni De Micheli 36


Data path synthesis
 Applied after resource binding
 Connectivity synthesis:
 Connection of resources to multiplexers busses and registers
 Control unit interface
 I/O ports
 Physical data path synthesis
 Specific techniques for regular datapath design
 Regularity extraction

(c) Giovanni De Micheli 37


Example
REGISTERS
a
3
d
x enable
y
u
r
1r
2
Mux control

ALU control (+,-,<)


AL
*

c
U

DATA-PATH CONTROL-UNIT

(c) Giovanni De Micheli 38


Control synthesis

 Synthesis of the control unit

 Logic model:
 Synchronous FSM
 Physical implementation:
 Hard-wired or distributed FSM
 Microcode

(c) Giovanni De Micheli 39


Example
0
NOP

1 2 6 8 1
TIME 1
* * * * + 0

7 9 1
TIME 2 3
* * + < 1
4
TIME 3 -
TIME 4 5
-
reset reset

NOP n
1,2,6,8,10 reset’ 3,7,9,11
s1 s2
reset
reset’

5
s4 reset’ 4
s3

(c) Giovanni De Micheli 40


Summary
 Resource sharing is reducible to vertex coloring or to clique
covering:
 Simple for flat graphs
 Intractable, but still easy in practice, for other graphs

 Resource sharing has several extensions:


 Module selection
 Data path design and control synthesis are conceptually simple
but still important steps in synthesis
 Generated data path is an interconnection of blocks
 Control is one or more finite-state machines

(c) Giovanni De Micheli 41

You might also like