Docsity

Instruction Scheduling - Compiler Design | Assignment 3 | CS 6241, Assignments of Computer Science

Partial preview of the text

Download Instruction Scheduling - Compiler Design | Assignment 3 | CS 6241 and more Assignments Computer Science in PDF only on Docsity!

CS 6241 – Class 13Instruction Scheduling

Georgia Tech.Feb 19, 2008

Class stuff

Sandeep Sheshadri (1) & Darren Hoffman (3)

Project meeting

Random stuff

Midterm

Overflow/Review

Modulo Scheduling

HW3 due

Modulo Scheduling

Register Allocation

Scheduling

Sample Projects^ 

Class project

»^

1-3 people per team

»^

Design, implement, and evaluate something interesting

»^

New idea, small extension to a paper, implement compiler feature

^

Analysis/optimization^ »

Compiler switch spacewalking » New hyperblock formation algorithm » Control flow redundancy elimination via a BDD

^

Code generation^ »

Register allocation in software pipelined loops » Buffer overflow protection » TI C6x code generator

Sample Projects (continued)^ 

Memory

»^

Data layout optimization

»^

Correlation-based prefetching, software-controlled run-aheadprefetching

»^

Structure field reorganization (Impact)

^

Energy^ »

Compiler-directed voltage scaling/power-off state » Dynamic mapping of instructions/data to low power scratch pad » Energy-aware instruction encoding – minimizing bit flips

^

Multiple cores/clusters^ »

Instruction scheduling for multiple threads » Control/data thread decomposition » New partitioning algorithm for multicluster VLIW

Lstart^ 

Lstart = latest start time, ALAP

»^

Latest time a node can be scheduled s.t. sched length notincreased beyond infinite resource schedule length

»^

Lstart = Estart if node has no successors

»^

Lstart = MIN(Lstart(succ) - latency) for each successor node

»^

Example

Slack^ 

Slack = measure of the scheduling freedom

»^

Slack = Lstart – Estart for each node

»^

Larger slack means more mobility

»^

Example

Class Problem

Node

Estart

Lstart

Slack

Critical path(s) =

Operation Priority^ 

Priority – Need a mechanism to decide which ops toschedule first (when you have multiple choices)  Common priority functions

»^

Height – Distance from exit node^ ^

Give priority to amount of work left to do

»^

Slackness – inversely proportional to slack^ ^

Give priority to ops on the critical path

»^

Register use – priority to nodes with more source operands andfewer destination operands^ ^

Reduces number of live registers

»^

Uncover – high priority to nodes with many children^ ^

Frees up more nodes

»^

Original order – when all else fails

List Scheduling (Cycle Scheduler)^ 

Build dependence graph, calculate priority  Add all ops to UNSCHEDULED set  time = -1  while (UNSCHEDULED is not empty)

»^

time++

»^

READY = UNSCHEDULED ops whose incoming dependenceshave been satisfied

»^

Sort READY using priority function

»^

For each op in READY (highest to lowest priority)^ ^

op can be scheduled at current time? (are the resources free?)^ 

Yes, schedule it, op.issue_time = time
^
Mark resources busy in RU_map relative to issue time
^
Remove op from UNSCHEDULED/READY sets

^

No, continue

Cycle Scheduling Example

RU_map

time ALU MEM 0 1 2 3 4 5 6 7 8 9

op^

priority 1

2m 3m

(^4) 5m^6

0, 0^12

7m

Machine: 2 issue, 1 memory port, 1 ALUMemory port = 2 cycles, non-pipelinedALU = 1 cycle

Class Problem

1m^2

Machine: 2 issue, 1 memory port, 1 ALUMemory port = 2 cycles, pipelinedALU = 1 cycle

2m 4m^7

3 6 5

2 2 1 9m

1 1 1 1

1.^

Calculate height-based priorities

2.^

Schedule using cycle scheduler

List Scheduling (Operation Scheduler)^ 

Build dependence graph, calculate priority  Add all ops to UNSCHEDULED set  while (UNSCHEDULED not empty)

»^

op = operation in UNSCHEDULED with highest priority

»^

For time = estart to some deadline^ ^

Op can be scheduled at current time? (are resources free?)^ 

Yes, schedule it, op.issue_time = time
^
Mark resources busy in RU_map relative to issue time
^
Remove op from UNSCHEDULED

^

No, continue

»^

Deadline reached w/o scheduling op? (could not be scheduled)

^

Yes, unplace all conflicting ops at op.estart, add them toUNSCHEDULED

^

Schedule op at estart^ 
Mark resources busy in RU_map relative to issue time  Remove op from UNSCHEDULED

Operation Scheduling Example (2) op^

pr 1

2m 3m

(^4) 5m^6

0, 0^12

7m

Schedule

time Placed 0

HW Problem

1m^2

Machine: 2 issue, 1 memory port, 1 ALUMemory port = 2 cycles, pipelinedALU = 1 cycle

2m 4m^7

3 6 5

2 2 1 9m

1 1 1 1

1.^

Calculate height-based priorities

2.^

Schedule using operation scheduler