Presentation is loading. Please wait.

Presentation is loading. Please wait.

Penn ESE535 Spring 2015 -- DeHon 1 ESE535: Electronic Design Automation Day 8: February 11, 2015 Scheduling Introduction.

Similar presentations

Presentation on theme: "Penn ESE535 Spring 2015 -- DeHon 1 ESE535: Electronic Design Automation Day 8: February 11, 2015 Scheduling Introduction."— Presentation transcript:

1 Penn ESE535 Spring DeHon 1 ESE535: Electronic Design Automation Day 8: February 11, 2015 Scheduling Introduction

2 Penn ESE535 Spring DeHon 2 Today Scheduling –Basic problem –Variants –List scheduling approximation Behavioral (C, MATLAB, …) RTL Gate Netlist Layout Masks Arch. Select Schedule FSM assign Two-level, Multilevel opt. Covering Retiming Placement Routing

3 Penn ESE535 Spring DeHon 3 General Problem Resources are not free –Wires, io ports –Functional units LUTs, ALUs, Multipliers, …. –Memory access ports –State elements memory locations Registers –Flip-flop –loadable master-slave latch –Multiplexers (mux) select i0 i1 o=i0*/select+ i1*select

4 Penn ESE535 Spring DeHon 4 Trick/Technique Resources can be shared (reused) in time Sharing resources can reduce –instantaneous resource requirements –total costs (area) Pattern: scheduled operator sharing

5 Penn ESE535 Spring DeHon 5 Example Assume unit delay operators. How many operators do I need to evaluate this computation in ~5 time units?

6 Penn ESE535 Spring DeHon 6 Sharing Does not have to increase delay –w/ careful time assignment –can often reduce peak resource requirements –while obtaining original (unshared) delay Alternately: Minimize delay given fixed resources

7 Penn ESE535 Spring DeHon 7 Schedule Examples time resource

8 Penn ESE535 Spring DeHon 8 More Schedule Examples

9 Penn ESE535 Spring DeHon 9 Scheduling Task: assign time slots (and resources) to operations –time-constrained: minimizing peak resource requirements n.b. time-constrained, not always constrained to minimum execution time –resource-constrained: minimizing execution time

10 Penn ESE535 Spring DeHon 10 Resource-Time Example Time Constraint: <5  -- 5  4 6,7  2 >7  1 Time Area

11 Penn ESE535 Spring DeHon 11 Scheduling Use Very general problem formulation –HDL/Behavioral  RTL –Register/Memory allocation/scheduling –Instruction/Functional Unit scheduling –Processor tasks –Time-Switched Routing TDMA, bus scheduling, static routing –Routing (share channel)

12 Preclass 2 Schedule onto two adders Does the number of cycles depend on i[7], i[6], … i[0] ? How many cycles? Penn ESE535 Spring DeHon 12

13 Preclass 3 Schedule onto: –2 adders (+) –2 incrementer (++) –2 comparator (>) Does the number of cycles depend on i[7], i[6], … i[0] ? How many cycles? sum=0; for(j=0;i[j]>0;j++) sum+=i[j]; Penn ESE535 Spring DeHon 13

14 Penn ESE535 Spring DeHon 14 Two Types (1) Data independent –graph static –resource requirements and execution time independent of data –schedule staticly –maybe bounded-time guarantees –typical ECAD problem

15 Penn ESE535 Spring DeHon 15 Two Types (2) Data Dependent –execution time of operators variable depend on data –flow/requirement of operators data dependent –if cannot bound range of variation must schedule online/dynamically cannot guarantee bounded-time general case (I.e. halting problem) –typical “General-Purpose” (non-real-time) OS problem

16 Penn ESE535 Spring DeHon 16 Unbounded Resource Problem Easy: –compute ASAP schedule I.e. schedule everything as soon as predecessors allow –will achieve minimum time –won’t achieve minimum area (meet resource bounds)

17 Penn ESE535 Spring DeHon 17 ASAP Schedule As Soon As Possible (ASAP) For each input –mark input on successor –if successor has all inputs marked, put in visit queue While visit queue not empty –pick node –update time-slot based on latest input Time-slot = max(time-slot-of-inputs)+1 –mark inputs of all successors, adding to visit queue when all inputs marked

18 Penn ESE535 Spring DeHon 18 ASAP Example Work Example

19 Penn ESE535 Spring DeHon 19 ASAP Example

20 Penn ESE535 Spring DeHon 20 Also Useful to Define ALAP As Late As Possible Work backward from outputs of DAG Also achieve minimum time w/ unbounded resources Rework Example

21 Penn ESE535 Spring DeHon 21 ALAP Example

22 Penn ESE535 Spring DeHon 22 ALAP and ASAP Difference in labeling between ASAP and ALAP is slack of node –Freedom to select timeslot –Class theme: exploit freedom to reduce costs If ASAP=ALAP, no freedom to schedule Compute Slack

23 Penn ESE535 Spring DeHon 23 ASAP, ALAP, Difference ASAP ALAP

24 Penn ESE535 Spring DeHon 24 Two Bounds

25 Penn ESE535 Spring DeHon 25 Bounds Useful to have bounds on solution Two: –CP: Critical Path Sometimes call it “Latency Bound” –RB: Resource Bound Sometimes call it “Throughput Bound” or “Compute Bound”

26 Penn ESE535 Spring DeHon 26 Critical Path Lower Bound ASAP schedule ignoring resource constraints –(look at length of remaining critical path) Certainly cannot finish any faster than that

27 Penn ESE535 Spring DeHon 27 Resource Capacity Lower Bound Sum up all capacity required per resource Divide by total resource (for type) Lower bound on remaining schedule time –(best can do is pack all use densely) –Ignores schedule constraints

28 Penn ESE535 Spring DeHon 28 Example Critical Path Resource Bound (2 resources) Resource Bound (4 resources)

29 Penn ESE535 Spring DeHon 29 Example Critical Path Resource Bound (2 resources) Resource Bound (4 resources) 3 7/2=4 7/4=2

30 Penn ESE535 Spring DeHon 30 Why hard? 3 units Schedule on: 1 Red Resource 1 Green Resource Start with Critical Path?

31 Penn ESE535 Spring DeHon 31 General When selecting, don’t know –need to tackle critical path –need to run task to enable work (parallelism) Can generalize example to single resource case 3 units

32 Penn ESE535 Spring DeHon 32 Single Resource Hard (1) A7A8 B11 A9 B2 B3 B4 A1 A2 A3 A4 A5 A6 A10A11A13A12 B5 B1 B6 B7 B8 B9 B10 Crit. Path: A1 A2 A3 A4 A5 A6 A7 B1 A8 B2 A9 B3 A10 B4 A11 B5 A12 B6 A13 B7 B8 B9 B10 B11

33 Penn ESE535 Spring DeHon 33 Single Resource Hard (2) A7A8 B11 A9 B2 B3 B4 A1 A2 A3 A4 A5 A6 A10A11A13A12 B5 B1 B6 B7 B8 B9 B10 PFirst A1 B1 B2 B3 B4 B5 B6 B7 B8 B9 A2 B10 A3 A4 A5 A6 A7 B11 A8 A9 A10 A11 A12 A13

34 Penn ESE535 Spring DeHon 34 Single Resource Hard (4) A7A8 B11 A9 B2 B3 B4 A1 A2 A3 A4 A5 A6 A10A11A13A12 B5 B1 B6 B7 B8 B9 B10 Balance1 A1 B1 A2 B2 A3 B3 A4 B4 A5 B5 A6 B6 A7 B7 A8 B8 A9 B9 A10 B10 B11 A12 A13

35 Penn ESE535 Spring DeHon 35 List Scheduling Greedy Algorithm  Approximation

36 Penn ESE535 Spring DeHon 36 List Scheduling (basic algorithm flow) Keep a ready list of “available” nodes –(one whose predecessors have already been scheduled) –Like ASAP queue But won’t necessary process in FIFO order While there are unscheduled tasks –Pick an unscheduled task and schedule on first available resource after its predecessors –Put any tasks enabled by this one on ready list

37 Penn ESE535 Spring DeHon 37 List Scheduling Greedy heuristic Key Question: How prioritize ready list? –What is dominant constraint? least slack (worst critical path)  LPT –LPT = Longest Processing Time first enables work utilize most precious (limited) resource So far: –seen that no single priority scheme would be optimal

38 Penn ESE535 Spring DeHon 38 List Schedule by LPT A7A8 B11 A9 B2 B3 B4 A1 A2 A3 A4 A5 A6 A10A11A13A12 B5 B1 B6 B7 B8 B9 B10 Work example compute ALAP then use to order ReadyQ

39 Penn ESE535 Spring DeHon 39 LPT Schedule A7A8 B11 A9 B2 B3 B4 A1 A2 A3 A4 A5 A6 A10A11A13A12 B5 B1 B6 B7 B8 B9 B10 LPT: A1 A2 A3 A4 A5 A6 A7 B1 A8 B2 A9 B3 A10 B4 A11 B5 B6 B7 B8 B9 A12 B10 A13 B11

40 Penn ESE535 Spring DeHon 40 List Scheduling Use for –resource constrained –time-constrained give resource target and search for minimum resource set Fast: O(N)  O(Nlog(N)) depending on prioritization Simple, general Good for upper bound – results is achievable Not always optimal How good?

41 Penn ESE535 Spring DeHon 41 Approximation Can we say how close an algorithm comes to achieving the optimal result? Technically: –If can show Heuristic(Prob)/Optimal(Prob)   Prob –Then the Heuristic is an  -approximation

42 Penn ESE535 Spring DeHon 42 Scheduled Example Without Precedence time resource How bad is this schedule?

43 Penn ESE535 Spring DeHon 43 Observe  optimal length L No idle time up to start of last job to finish start time of last job  L last job length  L Total LS length  2L What can say about optimality?  Algorithm is within factor of 2 of optimum

44 Penn ESE535 Spring DeHon 44 Results Scheduling of identical parallel machines has a 2-approximation –i.e. we have a polynomial time algorithm which is guaranteed to achieve a result within a factor of two of the optimal solution. In fact, for precedence unconstrained there is a 4/3-approximation –i.e. schedule Longest Processing Time first

45 Penn ESE535 Spring DeHon 45 Recover Precedence With precedence we may have idle times, so need to generalize Work back from last completed job –two cases: entire machine busy some predecessor in critical path is running Divide into two sets –whole machine busy times –critical path chain for this operator

46 Penn ESE535 Spring DeHon 46 Precedence RB CP

47 Penn ESE535 Spring DeHon 47 Precedence Constrained Optimal Length > All busy times –Optimal Length  Resource Bound –Resource Bound  All busy Optimal Length>This Path –Optimal Length  Critical Path –Critical Path  This Path List Schedule = This path + All busy times List Schedule  2 *(Optimal Length)

48 Penn ESE535 Spring DeHon 48 Conclude Scheduling of identical parallel machines with precedence constraints has a 2-approximation.

49 Tightening How could we do better? What is particularly pessimistic about the previous cases? –List Schedule = This path + All busy times –List Schedule  2 *(Optimal Length) Penn ESE535 Spring DeHon 49

50 Penn ESE535 Spring DeHon 50 Tighten LS schedule  Critical Path+Resource Bound LS schedule  Min(CP,RB)+Max(CP,RB) Optimal schedule  Max(CP,RB) LS/Opt  1+Min(CP,RB)/Max(CP,RB) The more one constraint dominates  the closer the approximate solution to optimal  (EEs think about 3dB point in frequency response)

51 Penn ESE535 Spring DeHon 51 Tightening Example of –More information about problem –More internal variables –…allow us to state a tighter result 2-approx for any graph –Since CP may = RB Tighter approx as CP and RB diverge

52 Penn ESE535 Spring DeHon 52 Multiple Resource Previous result for homogeneous functional units For heterogeneous resources: –also a 2-approximation Lenstra+Shmoys+Tardos, Math. Programming v46p259 (not online, no precedence constraints)

53 Penn ESE535 Spring DeHon 53 Bounds Precedence case, Identical machines –no polynomial approximation algorithm can achieve better than 4/3 bound (unless P=NP) Heterogeneous machines (no precedence) –no polynomial approximation algorithm can achieve better than 3/2 bound

54 Penn ESE535 Spring DeHon 54 Summary Resource sharing saves area –allows us to fit in fixed area Requires that we schedule tasks onto resources General kind of problem arises We can, sometimes, bound the “badness” of a heuristic –get a tighter result based on gross properties of the problem –approximation algorithms often a viable alternative to finding optimum –play role in knowing “goodness” of solution

55 Relate HMC How does this relate to our mapping for Heterogeneous multicontext computing array? Penn ESE535 Spring DeHon 55

56 Penn ESE535 Spring DeHon 56 Big Ideas: Exploit freedom in problem to reduce costs –(slack in schedules) Use dominating effects –(constrained resources) –the more an effect dominates, the “easier” the problem Technique: Approximation

57 Penn ESE535 Spring DeHon 57 Admin Reading on web for Monday –Same reading for today and Monday Assignment 4 Due Thursday

Download ppt "Penn ESE535 Spring 2015 -- DeHon 1 ESE535: Electronic Design Automation Day 8: February 11, 2015 Scheduling Introduction."

Similar presentations

Ads by Google