task runtime response optimization using cost-based operation motion

18
EECS 249, Fall 1999 Task Runtime Response Task Runtime Response Optimization Using Cost-Based Optimization Using Cost-Based Operation Motion Operation Motion Abdallah Tabbara Bassam Abdallah Tabbara Bassam Tabbara Tabbara Alberto Sangiovanni-Vincentelli Alberto Sangiovanni-Vincentelli University of California at Berkeley

Upload: kieu

Post on 04-Feb-2016

37 views

Category:

Documents


0 download

DESCRIPTION

Task Runtime Response Optimization Using Cost-Based Operation Motion. Abdallah Tabbara Bassam Tabbara Alberto Sangiovanni-Vincentelli University of California at Berkeley. Embedded System. Electronic “brain” found in many applications e.g. Consumer electronics Telecommunications - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Task Runtime Response Optimization Using Cost-Based Operation Motion

EECS 249, Fall 1999

Task Runtime Response Optimization Task Runtime Response Optimization Using Cost-Based Operation Motion Using Cost-Based Operation Motion

Abdallah Tabbara Bassam Abdallah Tabbara Bassam TabbaraTabbara

Alberto Sangiovanni-VincentelliAlberto Sangiovanni-Vincentelli

University of California at Berkeley

Page 2: Task Runtime Response Optimization Using Cost-Based Operation Motion

EECS 249, Fall 19992© 1999 Tabbara et. al.

Embedded SystemEmbedded System

• Electronic “brain” found in many applications e.g.Consumer electronics Telecommunications

• Consists of:Software: flexibilityHardware: performance

• Application requirements on the system:Small EfficientPowerOther metrics

Page 3: Task Runtime Response Optimization Using Cost-Based Operation Motion

EECS 249, Fall 19993© 1999 Tabbara et. al.

Hardware/Software Co-designHardware/Software Co-design

SynthesisSynthesisSynthesisSynthesis

DesignDesignRepresentationRepresentation

DesignDesignRepresentationRepresentation

DesignSpecification

DesignSpecification

EvaluationEvaluationEvaluationEvaluation

ImplementationImplementationImplementationImplementation

HW/SW PartitioningHW/SW PartitioningHW/SW PartitioningHW/SW Partitioning

Micro-processor

ASIC

SW

HW

Page 4: Task Runtime Response Optimization Using Cost-Based Operation Motion

EECS 249, Fall 19994© 1999 Tabbara et. al.

Problem StatementProblem Statement

• Target: heterogeneous control-dominated embedded system applications Functional decomposition captures design as a network

of Finite State Machines extended with data computations (EFSMs) (e.g. Esterel front-end)

• Goal: run-time optimization for the synthesis of each individual task

• No assumptions on how tasks are composed in the whole system.

Page 5: Task Runtime Response Optimization Using Cost-Based Operation Motion

EECS 249, Fall 19995© 1999 Tabbara et. al.

Intermediate Design RepresentationIntermediate Design Representation

• Function Flow Graph (FFG) / C-Like Intermediate Format (CLIF) [Tabbara 99]Able to represent EFSM

Suitable for control and data flow analysis

EFSM FFGOptimized

FFGSW/HWSynthesis

Data Flow/ControlOptimizations

Page 6: Task Runtime Response Optimization Using Cost-Based Operation Motion

EECS 249, Fall 19996© 1999 Tabbara et. al.

Function Flow Graph (FFG)Function Flow Graph (FFG)

• is a triple G = (V, E, N0) where

V is a finite set of nodesE = (x,y), a subset of VV, is an edge from x to y where x

Pred(y), the set of predecessor nodes of y.N0 N is the start node corresponding to the EFSM initial state.

Operations are associated with each node N. TESTs performed on the EFSM inputs and internal variables

ASSIGNs of computations on the input alphabet (inputs/internal variables) to the EFSM output alphabet (outputs and internal (state) variables)

Page 7: Task Runtime Response Optimization Using Cost-Based Operation Motion

EECS 249, Fall 19997© 1999 Tabbara et. al.

EFSM in FFG FormEFSM in FFG Form(An Example in (An Example in State TreeState Tree Form) Form)

F0

F1

F2

F8

F7

F6

F5

F4

F3S0

S1

S2

Page 8: Task Runtime Response Optimization Using Cost-Based Operation Motion

EECS 249, Fall 19998© 1999 Tabbara et. al.

Previous Work (1)Previous Work (1)

• Code motion (hoisting) from the software (HLS) domain(s)Avoid unnecessary re-computations at runtime

Temporary variables (“registers”) at certain program pointsMust be safe: Main strategy

As early as possible [Morel 1979], [Knoop 1992]Practice: register pressure

Temporary lifetime minimzation [Knoop 1994]

• Limitations: not cost based, laborious and involves addition of “synthetic nodes” in the control structure

Page 9: Task Runtime Response Optimization Using Cost-Based Operation Motion

EECS 249, Fall 19999© 1999 Tabbara et. al.

Previous Work (2)Previous Work (2)

• [Hailperin 98]: “cost” extension to [Knoop 94]Metric based on individual operations (+, *, …)No concept of I/O preservation (Embedded Systems)

• We need task level runtime cost [Castellucia 96]: Probabilities of inputs/tests guides

ordering/restructuring of EFSM nodes in Esterel single automata

• Cost-guided Relaxed Operation MotionUse code motion techniques: safe (correct), fastGuidance from runtime (average/worst-case) statistics

Page 10: Task Runtime Response Optimization Using Cost-Based Operation Motion

EECS 249, Fall 199910© 1999 Tabbara et. al.

(Cost-guided) Relaxed Operation (Cost-guided) Relaxed Operation MotionMotion

• Our Approach (polynomial complexity in FFG nodes) consists of 4 steps:

1. Data Flow and Control Optimizations

2. Reverse Sweep (as early as possible/cost guided)a) Dead operation addition

b) Normalization

c) Available operation elimination

d) Copy propagation

e) Dead elimination

3. Forward Sweep (register lifetime minimization)

4. Final optimization pass

Page 11: Task Runtime Response Optimization Using Cost-Based Operation Motion

EECS 249, Fall 199911© 1999 Tabbara et. al.

Motivating Example [Knoop 94]Motivating Example [Knoop 94]

…S8: z = a + b; a = c; goto S9;S9: x = a + b; goto S10;S10: …

Page 12: Task Runtime Response Optimization Using Cost-Based Operation Motion

EECS 249, Fall 199912© 1999 Tabbara et. al.

Relaxed Operation MotionRelaxed Operation Motion

S8: _T30 = a + b; z = _T30; a = c; goto S9;S9: _T30 = a + b; x = _T30; goto S10;

Optimization Pass

S7: _T30 = a + b; y = _T30; _T30 = a + b; _T29 = c + b; _T30 = a + b; goto S8;S8: _T30 = a + b; z = _T30; a = c; _T30 = a + b; _T29 = c + b; _T30 = a + b; goto S9;

S9: _T30 = a + b; x = _T30; _T30 = a + b; a = c; _T29 = c + b; _T30 = a + b; a = c; goto S10;

Dead addition

Page 13: Task Runtime Response Optimization Using Cost-Based Operation Motion

EECS 249, Fall 199913© 1999 Tabbara et. al.

Relaxed Operation MotionRelaxed Operation Motion

_T30 = a + b;….S8: z = _T30; a = c; _T30 = c + b; goto S9;S9: x = _T30; a = c; _T30 = c + b; goto S10;

Copy Propagation

S1: _T31 = a + b; H = _T31; _T29 = c + b;…S8: z = H; H = _T29; goto S9;S9: x = H; goto S10;

Optimization Pass

S8: z = _T30; a = c; _T30 = a + b; goto S9;S9: x = _T30; a = c; _T30 = a + b; goto S10;

Available Elimination

Page 14: Task Runtime Response Optimization Using Cost-Based Operation Motion

EECS 249, Fall 199914© 1999 Tabbara et. al.

Optimization and Synthesis FlowOptimization and Synthesis Flow

CDFG(SHIFT)

SoftwareCompilation

ObjectCode (.o)

HardwareSynthesis

Netlist

Or

Cost Estimation DesignOptimization

HW/SWCo-Synthesis

User Input Profiling

InferenceEngine

AttributedFFG

Relaxed Relaxed Operation MotionOperation Motion

FFG(back-end)

Page 15: Task Runtime Response Optimization Using Cost-Based Operation Motion

EECS 249, Fall 199915© 1999 Tabbara et. al.

Work In ProgressWork In Progress

• Cost estimation methodology• Operation motion

GuidanceLifetime optimality (forward sweep)

• Results collection on motivating exampleWe already beat [Knoop 94]Evaluate with various cost scenariosCollect synthesis results

Page 16: Task Runtime Response Optimization Using Cost-Based Operation Motion

EECS 249, Fall 199916© 1999 Tabbara et. al.

Cost Estimation Using Cost Estimation Using Bayesian Belief Networks (1)Bayesian Belief Networks (1)

Page 17: Task Runtime Response Optimization Using Cost-Based Operation Motion

EECS 249, Fall 199917© 1999 Tabbara et. al.

Cost Estimation Using Cost Estimation Using Bayesian Belief Networks (2)Bayesian Belief Networks (2)

Page 18: Task Runtime Response Optimization Using Cost-Based Operation Motion

EECS 249, Fall 199918© 1999 Tabbara et. al.

ConclusionsConclusions

• Novel approach for task runtime response optimization:Code motion from software domain limited mostly to loop

invariants, no real task runtime cost guidance

• Our approach: Relaxed Code Motion Is “natural” in a control/data flow optimization frameworkSpecialize to embedded domain tasks e.g. I/O preservation

across invocationsApply application/environment driven costs to optimization