ics 252 introduction to computer design fall 2007 eli bozorgzadeh computer science department-uci

Post on 21-Dec-2015

223 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

ICS 252 Introduction to Computer Design

Fall 2007

Eli BozorgzadehComputer Science Department-UCI

2Fall 2007 ICS 252-Intro to Computer Design

References

• Lecture notes by Kia Bazargan on High level Synthesis [©Bazargan]

– http://www.ece.umn.edu/users/kia/Courses/EE5301

• Lecture note by Rajesh Gupta on scheduling [©Gupta]

– http://www.ics.uci.edu/~rgupta/ics280.html

• Chapter 4 of the textbook

3Fall 2007 ICS 252-Intro to Computer Design

Architectural Synthesis• Abstract model data path (structural) and

control unit (logic-level) • Constructing macroscopic structure of digital

circuit• Data path: interconnection of hardware

resources (arithmetic or logic), steering logic circuits, registers/memory arrays

• Objectives:– Area, latency, clock cycle time, throughput ( for

pipelined data path)

4Fall 2007 ICS 252-Intro to Computer Design

Design specification for architectural synthesis

• Resources– Functional resources

• Primitive• Application-specific

– Memory• Examples: registers, ROM, RAM

– Interface• Internal: buses• External: I/O pads

5Fall 2007 ICS 252-Intro to Computer Design

Design specification for architectural synthesis

• Constraints– Interface constraints

• Format and timing of the I/O data transfers

– Implementation constraints• Area• Latency, cycle time

6Fall 2007 ICS 252-Intro to Computer Design

Fundamental architectural synthesis problems

• Input: – sequencing graph– a set of functional units– a set of constraints

• Assumption:– Storage by registers– Interconnection by wires– Non-hierarchical graph with operations having bounded and

known execution delay

• Two tasks: – Placing operations in time and space

– Determining the detailed interconnection of data path and control unit

7Fall 2007 ICS 252-Intro to Computer Design

Temporal Domain: Scheduling

• Given – Sequencing graph

– Operations D={di,i=0,1,2,…,n}

– Start time at each operation T={ti, i=1,2…,n}

• Scheduling: task of determining the start time of each operation

• Subject to – Precedence constraint by sequencing graph

8Fall 2007 ICS 252-Intro to Computer Design

Scheduling

• Latency of a scheduled graph:– Difference between the start time of source and sink

NOP

* * * *

* *

+

+ <

-

-

NOP

1 2

3

4

5

6

7

8

9

10

11

Time 1

Time 2

Time 3

Time 4

9Fall 2007 ICS 252-Intro to Computer Design

Scheduling under resource constraints

NOP

* +

*

*

*

-

<

*

-

1 10

2

3

46

7

Time 1

Time 2

Time 3

Time 4

Time 5

Time 6

Time 7

*

+

8

9

5

10Fall 2007 ICS 252-Intro to Computer Design

Spatial Domain: Binding• A resource binding is a mapping such that

operation vi with type T is implemented with rth resource

• One-to-one function, many-to-one functions (resource sharing), one-to-many functions (module selection)

• On a scheduled graph

11Fall 2007 ICS 252-Intro to Computer Design

Resource binding on a scheduled graph

NOP

* * * *

* *

+

+ <

-

-

NOP

1 2

3

4

5

6

7

8

9

10

11

Time 1

Time 2

Time 3

Time 4

12Fall 2007 ICS 252-Intro to Computer Design

Area and performance estimation

• Latency– By scheduling

• Area– Resource-dominated– General circuit

• Registers• Steering logics• Wiring• Control unit

13Fall 2007 ICS 252-Intro to Computer Design

Strategies • Area/latency optimization

• Cycle-time/area optimization

• cycle-time/latency optimization

14Fall 2007 ICS 252-Intro to Computer Design

Scheduling

• Without resource constraint– Unconstrained Scheduling: ASAP– Latency-constrained scheduling :ALAP– Scheduling under timing constraint

• With resource constraint– Exact: ILP model– Heuristic: List scheduling, force-directed

scheduling, etc.

15Fall 2007 ICS 252-Intro to Computer Design

ASAP Scheduling

• Schedule each operation as-soon-as-possible

NOP

* * * *

* *

+

+ <

-

-

NOP

1 2

3

4

5

6

7

8

9

10

11

Time 1

Time 2

Time 3

Time 4

16Fall 2007 ICS 252-Intro to Computer Design

ALAP scheduling

• Schedule each operation as late as possible under given latency

NOP

* *

*

*

*

* +

+ <

-

-

NOP

1 2

3

4

5

6

7 8

9

10

11

Time 1

Time 2

Time 3

Time 4

17Fall 2007 ICS 252-Intro to Computer Design

Quick overview

• Tasks in high-level synthesis– Scheduling √– Allocation– Binding

• Scheduling– Without resource constraint √– With resource constraint (next)

• ILP model: exact solution• List scheduling, force-directed scheduling: heuristic

18Fall 2007 ICS 252-Intro to Computer Design

Resource Constraint Scheduling• Constrained scheduling

– General case NP-complete– Minimize latency given constraints on area or

the resources (ML-RCS)– Minimize resources subject to bound on latency (MR-

LCS)

• Exact solution methods: – Integer linear programming (ILP) model– Hu’s algorithm

• Heuristics:– List scheduling– Force-directed scheduling

[©Bazargan]

19Fall 2007 ICS 252-Intro to Computer Design

ILP model for scheduling problem

• Binary variable xil

– xil=1 if start time of operation i is at time l

– xil=0 otherwise

• Constraints: set of linear inequalities– Uniqueness of start time for each operation

• How to compute ti , start time of operation i?

– Sequencing relation

Evv,...,n,i,jdxlxl ijjl l

jlil ),( 21

1,2,...,ni 1 xl

il

20Fall 2007 ICS 252-Intro to Computer Design

Start Time vs. Execution Time• For each operation vi , only one start time

• If di=1, then the following questions are the same:

– Does operation vi start at step l?

– Is operation vi running at step l?

• But if di>1, then the two questions should be formulated

as:– Does operation vi start at step l?

• Does xil = 1 hold?

– Is operation vi running at step l?

• Does the following hold? 11

l

dlmim

i

x ?

[©Bazargan]

21Fall 2007 ICS 252-Intro to Computer Design

Operation vi Still Running at Step l ?• Is v9 running at step 6?

– Is x9,6 + x9,5 + x9,4 = 1 ?

• Note:– Only one (if any) of the above three cases can happen– To meet resource constraints, we have to ask the same question

for ALL steps, and ALL operations of that type

v9

4

5

6

x9,4=1

v9

4

5

6

x9,5=1

v9

4

5

6

x9,6=1

[©Bazargan]

22Fall 2007 ICS 252-Intro to Computer Design

Operation vi Still Running at Step l ?• Is vi running at step l ?

– Is xi,l + xi,l-1 + ... + xi,l-di+1 = 1 ?

vi

l

l-1

l-di+1...

xi,l-di+1=1

vil

l-1

l-di+1

...

xi,l-1=1

vi

l

l-1

l-di+1

...

xi,l=1

. . .

[©Bazargan]

23Fall 2007 ICS 252-Intro to Computer Design

ILP Model (cont’d)

• Constraints (cont’d)– Resource bound at each time step of scheduling

• Objective– Minimize cTt

– t = vector of start time of operations

1...,2,1 ...,2,1 )(:

1

lnkax reskvTi

l

dlm kim

ii

24Fall 2007 ICS 252-Intro to Computer Design

ILP Example• Assume = 4• First, perform ASAP and ALAP

– (we can write the ILP without ASAP and ALAP, but using ASAP and ALAP will simplify the inequalities)

+

NOP

+ <

-

-

NOP

1

2

3

4

+

NOP

+ <

-

-

NOP

1

2

3

4

v2v1

v3

v4

v5

vn

v6

v7

v8

v9

v10

v11

v2v1

v3

v4

v5

vn

v6

v7 v8

v9

v10

v11

[©Bazargan]

25Fall 2007 ICS 252-Intro to Computer Design

ILP Example: Unique Start Times Constraint

• Without using ASAP and ALAP values:

• Using ASAP and ALAP:

1

...

...

...

1

1

4,113,112,111,11

4,23,22,21,2

4,13,12,11,1

xxxx

xxxx

xxxx

....

1

1

1

1

1

1

1

1

1

4,93,92,9

3,82,81,8

3,72,7

2,61,6

4,5

3,4

2,3

1,2

1,1

xxx

xxx

xx

xx

x

x

x

x

x

[©Bazargan]

26Fall 2007 ICS 252-Intro to Computer Design

ILP Example: Dependency Constraints

• Using ASAP and ALAP, the non-trivial inequalities are: (assuming unit delay for + and *)

01.4.3.2.5

01.4.3.2.5

01.3.2.4

01.3.2.4.3.2

01.3.2.4.3.2

01.2.3.2

4,113,112,115,

4,93,92,95,

3,72,74,5

3,102,101,104,113,112,11

3,82,81,84,93,92,9

2,61,63,72,7

xxxx

xxxx

xxx

xxxxxx

xxxxxx

xxxx

n

n

[©Bazargan]

27Fall 2007 ICS 252-Intro to Computer Design

ILP Example: Resource Constraints

• Resource constraints (assuming 2 adders and 2 multipliers)

• Objective:– Since =4 and sink has no mobility, any feasible solution is

optimum, but we can use the following anyway:

2

2

2

2

2

2

2

4,114,94,5

3,113,103,93,4

2,112,102,9

1,10

3,83,7

2,82,72,62,3

1,81,61,21,1

xxx

xxxx

xxx

x

xx

xxxx

xxxx

4,3,2,1, .4.3.2 nnnn xxxxMin [©Bazargan]

28Fall 2007 ICS 252-Intro to Computer Design

ILP Formulation of MR-LCS

• Dual problem to ML-RCS• Objective:

– Goal is to optimize total resource usage, a.– Objective function is cTa , where entries in c

are respective area costs of resources

• Constraints:– Same as ML-RCS constraints, plus:– Latency constraint added:

– Note: unknown ak appears in constraints.

1. nll

xl

[©Gupta]

29Fall 2007 ICS 252-Intro to Computer Design

Hu’s Algorithm• Simple case of the scheduling problem

– Operations of unit delay– Operations (and resources) of the same type

• Hu’s algorithm– Greedy– Polynomial AND optimal– Computes lower bound on number of resources for a given

latencyOR: computes lower bound on latency subject to resource constraints

• Basic idea:– Label operations based on their distances from the sink– Try to schedule nodes with higher labels first

(i.e., most “critical” operations have priority)[©Gupta]

30Fall 2007 ICS 252-Intro to Computer Design

Hu’s AlgorithmHU (G(V,E), a) {

Label the vertices // label = length of longest pathpassing through the vertex

l = 1repeat {

U = unscheduled vertices in V whose predecessors have been scheduled

(or have no predecessors)

Select S U such that |S| a and labels in S are maximalSchedule the S operations at step l by setting ti=l, i: vi S.

l = l + 1

} until vn is scheduled.

}[©Bazargan]

31Fall 2007 ICS 252-Intro to Computer Design

Hu’s Algorithm: Example

[©Gupta]

32Fall 2007 ICS 252-Intro to Computer Design

List Scheduling• Greedy algorithm for ML-RCS and MR-LCS

– Does NOT guarantee optimum solution

• Similar to Hu’s algorithm– Operation selection decided by criticality– O(n) time complexity

• More general input– Resource constraints on different resource types

[©Bazargan]

33Fall 2007 ICS 252-Intro to Computer Design

List Scheduling Algorithm: ML-RCS

LIST_L (G(V,E), a) {l = 1repeat {

for each resource type k {

Ul,k = available vertices in V.

Tl,k = operations in progress.

Select Sk Ul,k such that |Sk| + |Tl,k| ak

Schedule the Sk operations at step l

}l = l + 1

} until vn is scheduled.

} [©Bazargan]

34Fall 2007 ICS 252-Intro to Computer Design

List Scheduling Example

[©Gupta]

35Fall 2007 ICS 252-Intro to Computer Design

List Scheduling Algorithm: MR-LCSLIST_R (G(V,E), ’) {

a = 1, l = 1

Compute the ALAP times tL.

if t0L < 0

return (not feasible)repeat {

for each resource type k {

Ul,k = available vertices in V.

Compute the slacks { si = tiL - l, vi Ul,k }.

Schedule operations with zero slack, update a

Schedule additional Sk Ul,k under a constraints}l = l + 1

} until vn is scheduled.}

[©Bazargan]

36Fall 2007 ICS 252-Intro to Computer Design

Force-Directed Scheduling• Similar to list scheduling

– Can handle ML-RCS and MR-LCS– For ML-RCS, schedules step-by-step– BUT, selection of the operations tries to find the globally best set

of operations

• Idea:– Find the mobility i = ti

L – tiS of operations

– Look at the operation type probability distributions– Try to flatten the operation type distributions

• Definition: operation probability density– pi ( l ) = Pr { vi starts at step l }.– Assume uniform distribution:

],[1

1)( L

iSi

ii ttlforlp

[©Gupta]

37Fall 2007 ICS 252-Intro to Computer Design

Force-Directed Scheduling: Definitions• Operation-type distribution (NOT normalized to 1)

• Operation probabilities over control steps:

• Distribution graph of type k over all steps:

– qk ( l ) can be thought of as expected operator cost

for implementing operations of type k at step l.

kvTi

ik

i

lplq)(:

)()(

)}(,),1(),0({ npppp iiii

)}(,),1(),0({ nqqq kkk

[©Bazargan]

38Fall 2007 ICS 252-Intro to Computer Design

Example

+

NOP

+ <-

-NOP

1

23

4

0)4(

83.03

1

2

1)3(

33.23

1

2

1

2

11)2(

83.23

1

2

111)1(

mult

mult

mult

mult

q

q

q

q

2.83

2.33

.83

66.13

1

3

11)4(

23

1

3

1

3

11)3(

13

1

3

1

3

1)2(

33.03

1)1(

add

add

add

add

q

q

q

q

0

1

2

1.66

0.33

[©Bazargan]

39Fall 2007 ICS 252-Intro to Computer Design

Force-Directed Scheduling Algorithm: Idea

• Very similar to LIST_L(G(V,E), a)– Compute mobility of operations using ASAP and ALAP– Computer operation probabilities and type distributions– Select and schedule operations– Update operation probabilities and type distributions– Go to next control step

• Difference with list scheduling in selecting operations– Select operations with least force– Consider the effect on the type distribution– Consider the effect on successor nodes and their type

distributions

[©Bazargan]

40Fall 2007 ICS 252-Intro to Computer Design

Summary• Architectural Synthesis

– Scheduling– Binding and resource allocation– Challenge: Area/performance trade-off

• Scheduling– Without resource constraints– With resource constraints

• Exact solution• Heuristics

• Next: Resource sharing and binding

top related