EECS 583 Class 18: Iterative Modulo Scheduling – University of Michigan - Prof. Scott Mahl, Study notes of Electrical and Electronics Engineering

The schedule for the remaining lectures in eecs 583 at the university of michigan, focusing on iterative modulo scheduling. It includes information on reading material, lecture topics, and the modulo scheduling algorithm. The document also provides an example of modulo scheduling for a loop and covers what to do when hardware support is not available.

Typology: Study notes

Pre 2010

Uploaded on 09/02/2009

koofers-user-zyl
koofers-user-zyl 🇺🇸

10 documents

1 / 23

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
EECS 583 – Class 18
Iterative Modulo Scheduling
Part II
University of Michigan
March 21, 2005
Note: The Msched example slides from the last lecture
were wrong, use the ones from these notes
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17

Partial preview of the text

Download EECS 583 Class 18: Iterative Modulo Scheduling – University of Michigan - Prof. Scott Mahl and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

EECS 583 – Class 18 Iterative Modulo Scheduling Part II^ University of Michigan^ March 21, 2005^ Note: The Msched example slides from the last lecturewere wrong, use the ones from these notes

  • 1 -

Schedule for the Rest of the Semester^ Y^ 4 more lectures^ »^ 3/21 (today) – Finish modulo scheduling^ »^ 3/23 – Partitioning for multicluster processors (Kevin Fan)^ »^ 3/28 – Compiler-controlled data prefetching (Manjunath Kudlur)^ »^ 3/30 – Register allocation^ Y^ Exam – Monday, April 4^ Y^ Paper presentations by you guys^ »^ 4/6 – Memory group^ »^ 4/11 – Code generation group^ »^ 4/13 – Opti group (part I)^ »^ 4/18 – Opti group (part II)^ Y^ Final project demos^ »^ 4/20 or 4/25-4/27^ Y^ SIG meetings this week – same time as last week

  • 3 -

Modulo Scheduling - Driver^ Y^ compute MII^ Y^ II = MII^ Y^ budget = BUDGET_RATIO * number of ops^ Y^ while (schedule is not found) do^ »^ iterative_schedule(II, budget)^ »^ II++^ Y^ Budget_ratio is a measure of the amount of backtracking that can beperformed before giving up and trying a higher II

  • 4 -

Modulo Scheduling – Iterative Scheduler^ Y^ iterative_schedule(II, budget)^ »^ compute op priorities^ »^ while (there are unscheduled ops and budget > 0) do^ y

op = unscheduled op with the highest priority y min = early time for op (E(Y)) y max = min + II – 1 y t = find_slot(op, min, max) y schedule op at time t^ X^ /* Backtracking phase – undo previous scheduling decisions */^ X^ Unschedule all previously scheduled ops that conflict with op y budget--

  • 6 -

Modulo Scheduling Example^ resources: 4 issue, 2 alu, 1 mem, 1 br^ latencies: add=1, mpy=3, ld = 2, st = 1, br = 1

Step1: Compute to loop into form that uses LC

for (j=0; j<100; j++)^ b[j] = a[j] * 26

LC = 99 1: r3 = load(r1) Loop:2: r4 = r3 * 263: store (r2, r4)4: r1 = r1 + 45: r2 = r2 + 47: brlc Loop

Loop:^ 1: r3 = load(r1)2: r4 = r3 * 263: store (r2, r4)4: r1 = r1 + 45: r2 = r2 + 46: p1 = cmpp (r1 < r9)7: brct p1 Loop

  • 7 -

Example – Step 2^ resources: 4 issue, 2 alu, 1 mem, 1 br^ latencies: add=1, mpy=3, ld = 2, st = 1, br = 1

Step 2: DSA convert LC = 99^

LC = 99

1: r3 = load(r1)2: r4 = r3 * 263: store (r2, r4)4: r1 = r1 + 45: r2 = r2 + 47: brlc Loop

1: r3[-1] = load(r1[0])2: r4[-1] = r3[-1] * 263: store (r2[0], r4[-1])4: r1[-1] = r1[0] + 45: r2[-1] = r2[0] + 4remap r1, r2, r3, r47: brlc Loop

Loop:^

Loop:

  • 9 -

Example – Step 4

Step 4 – Calculate priorities (MAX height to pseudo stop node) 1,1 0,0 1 2,00,0 2 3,0 0,0 (^3) 0,01,11,1 0,0 (^4) 0,0 1,1 (^5) 0,0 1,1 7

Iter^

Iter 1: H = 5 2: H = 3 3: H = 0 4: H = 0 5: H = 0 7: H = 0

1: H = 5 2: H = 3 3: H = 0 4: H = 4 5: H = 0 7: H = 0

  • 10 -

Example – Step 5

Schedule brlc at time II - 1

resources: 4 issue, 2 alu, 1 mem, 1 br latencies: add=1, mpy=3, ld = 2, st = 1, br = 1

Unrolled Schedule Rolled Schedule

LC = 99^

1: r3[-1] = load(r1[0]) Loop:2: r4[-1] = r3[-1] * 263: store (r2[0], r4[-1])4: r1[-1] = r1[0] + 45: r2[-1] = r2[0] + 4remap r1, r2, r3, r47: brlc Loop

4 5 6 brmemalu1alu 0

MRT

X

  • 12 -

Example – Step 7^ Step7: Schedule the highest priority op^ Op4: E = 0, L = 1^ Place at time 0 (0 % 2)

Unrolled Schedule Rolled Schedule

LC = 99^

1: r3[-1] = load(r1[0]) Loop:2: r4[-1] = r3[-1] * 263: store (r2[0], r4[-1])4: r1[-1] = r1[0] + 45: r2[-1] = r2[0] + 4remap r1, r2, r3, r47: brlc Loop

4 5 6 brmemalu1alu0 X X 0

MRT

X

  • 13 -

Example – Step 8^ Step8: Schedule the highest priority op^ Op2: E = 2, L = 3^ Place at time 2 (2 % 2)

Unrolled Schedule Rolled Schedule

LC = 99^

1: r3[-1] = load(r1[0]) Loop:2: r4[-1] = r3[-1] * 263: store (r2[0], r4[-1])4: r1[-1] = r1[0] + 45: r2[-1] = r2[0] + 4remap r1, r2, r3, r47: brlc Loop

4 5 6 brmemalu1alu0 X XX 0

MRT

X

  • 15 -

Example – Step 10^ Step10: Schedule the highest priority op^ Op5: E = 0, L = 1^ Place at time 1 (1 % 2)

Unrolled Schedule Rolled Schedule

LC = 99^

1: r3[-1] = load(r1[0]) Loop:2: r4[-1] = r3[-1] * 263: store (r2[0], r4[-1])4: r1[-1] = r1[0] + 45: r2[-1] = r2[0] + 4remap r1, r2, r3, r47: brlc Loop

4 5 6 brmemalu1alu0 XX X XX 0

MRT

X

  • 16 -

Example – Step 11^ Step11: calculate ESC, SC = max unrolled sched length / ii^ unrolled sched time of branch = rolled sched time of br + (iiesc)^ SC = 6 / 2 = 3, ESC = SC – 1^ time of br = 1 + 22 = 5

Unrolled Schedule Rolled Schedule

LC = 99^

1: r3[-1] = load(r1[0]) Loop:2: r4[-1] = r3[-1] * 263: store (r2[0], r4[-1])4: r1[-1] = r1[0] + 45: r2[-1] = r2[0] + 4remap r1, r2, r3, r47: brlc Loop

4 5 6 brmemalu1alu0 XX X XX 0

MRT

X

  • 18 -

Example – Dynamic Execution of the Code

time: ops executed

LC = 99 ESC = 2 p1[0] = 1

Loop:^ 1: r3[-1] = load(r1[0]) if p1[0]^ 2: r4[-1] = r3[-1] * 26 if p1[1]^ 4: r1[-1] = r1[0] + 4 if p1[0]^ 3: store (r2[0], r4[-1]) if p1[2]^ 5: r2[-1] = r2[0] + 4 if p1[0]^ 7: brlc Loop if p1[2]

  • 19 -

Class Problem^ latencies: add=1, mpy=3, ld = 2, st = 1, br = 1

How many resources of each type are required to achieve an II=1 schedule? If the resources are non-pipelined, how many resources of each type are required to achieve II=1 Assuming pipelined resources, generate the II=1 modulo schedule. for (j=0; j<100; j++)^ b[j] = a[j] * 26^ LC = 99^ 1: r3 = load(r1) Loop:2: r4 = r3 * 263: store (r2, r4)4: r1 = r1 + 45: r2 = r2 + 47: brlc Loop