Aestimo : A Feedback-Directed Optimization Evaluation Tool A - - PowerPoint PPT Presentation

aestimo a feedback directed optimization evaluation tool
SMART_READER_LITE
LIVE PREVIEW

Aestimo : A Feedback-Directed Optimization Evaluation Tool A - - PowerPoint PPT Presentation

Aestimo : A Feedback-Directed Optimization Evaluation Tool A Compiler Perspective on Input Characterization Paul Berube Compiler Design and Optimization Laboratory University of Alberta March 21, 2006 Paul Berube, ISPASS 2006 1 Outline


slide-1
SLIDE 1

March 21, 2006 Paul Berube, ISPASS 2006 1

Aestimo: A Feedback-Directed Optimization Evaluation Tool

A Compiler Perspective on Input Characterization

Paul Berube Compiler Design and Optimization Laboratory University of Alberta

slide-2
SLIDE 2

March 21, 2006 Paul Berube, ISPASS 2006 2

Outline

  • Background
  • Brief Overview of Aestimo
  • Difference Metric
  • Alignment Metric
slide-3
SLIDE 3

March 21, 2006 Paul Berube, ISPASS 2006 3

What Is FDO?

compile train Feedback-Directed Optimization: compile evaluate training input profile eval input

slide-4
SLIDE 4

March 21, 2006 Paul Berube, ISPASS 2006 4

What Is A Profile?

  • Frequency counts for program elements that

determine program behavior:

– Block/Edge/Path profiles – Branch probabilities – Loop iteration counts – Function call counts – Function invocation counts – Value profiles – ...and more every year...

slide-5
SLIDE 5

March 21, 2006 Paul Berube, ISPASS 2006 5

Performance Evaluation Space

Programs Evaluation Inputs Static optimization

slide-6
SLIDE 6

March 21, 2006 Paul Berube, ISPASS 2006 6

Performance Evaluation Space

Programs Evaluation Inputs Training Inputs FDO

slide-7
SLIDE 7

March 21, 2006 Paul Berube, ISPASS 2006 7

Performance Evaluation Space

Programs Evaluation Inputs Training Inputs Often 1 Ref input SPEC

slide-8
SLIDE 8

March 21, 2006 Paul Berube, ISPASS 2006 8

Performance Evaluation Space

Programs Evaluation Inputs Training Inputs Only 1 Train input SPEC Often 1 Ref input

slide-9
SLIDE 9

March 21, 2006 Paul Berube, ISPASS 2006 9

Input Characterization

  • Desired to help deal with the

{training input X evaluation input} space

  • Determine algorithmically and quantitatively

the similarity between inputs

  • If several inputs are similar, pick a

representative

– Otherwise, we need to consider all of them

  • Previous work from a architecture/design-

space exploration perspective

slide-10
SLIDE 10

March 21, 2006 Paul Berube, ISPASS 2006 10

Aestimo

  • An FDO evaluation tool
  • Automates training and evaluating on a

large number of inputs

  • Isolates individual transformations

– Fewer experiment variables – Results vary by transformation

  • Measures:

– Differences in transformation decisions – Performance differences

slide-11
SLIDE 11

March 21, 2006 Paul Berube, ISPASS 2006 11

Aestimo

  • An FDO evaluation tool
  • Automates training and evaluating on a

large number of inputs

  • Isolates individual transformations

– Fewer experiment variables – Results vary by transformation

  • Measures:

– Differences in transformation decisions – Performance differences

slide-12
SLIDE 12

March 21, 2006 Paul Berube, ISPASS 2006 12

Inputs for SPEC CINT2000

  • Several additional inputs for SPEC CPU2000

integer benchmarks at:

– http://www.cs.ualberta.ca/~berube/compiler/fdo/inputs.shtml

  • Goal: > 20 real program inputs per

benchmark that span the space of typical usage

slide-13
SLIDE 13

March 21, 2006 Paul Berube, ISPASS 2006 13

Input Characterization: Naive

  • Are two inputs different?
  • “diff” them!
  • But this tells us nothing!

– Inputs might still cause the code to behave identically

slide-14
SLIDE 14

March 21, 2006 Paul Berube, ISPASS 2006 14

Inputs: Human Expert

  • "Does the same kind of thing", “They're

quite different”

  • Can intuition/experience be made explicit,

quantitative?

  • Nobody can be an expert on every program
slide-15
SLIDE 15

March 21, 2006 Paul Berube, ISPASS 2006 15

Inputs: Computer Architect

  • Do the inputs stress the architecture in the

same way?

– IPL, branch predictability, cache behavior, etc...

  • Metrics not unique

– Same ILP for two different functions – Similar cache behavior for two different pieces

  • f code that do similar data structure traversals
slide-16
SLIDE 16

March 21, 2006 Paul Berube, ISPASS 2006 16

Inputs: Compiler Designer

  • Do the inputs exercises the same code in the

same way, have similar memory behavior?

  • I.e., how similar are the profiles?

– Different behavior does not necessitate different transformation decisions

  • Scaled frequencies
  • Same “hot” regions
  • How different is different enough?

– Depends on the compiler heuristics!

slide-17
SLIDE 17

March 21, 2006 Paul Berube, ISPASS 2006 17

Inputs: Compiler Heuristic

  • Does the expected code behavior results in

the same transformation decisions?

  • I.e., same results of cost-benefit analysis
  • If all decisions are the same, then we get the

same binary even if:

– Different inputs – Different ILP, cache behavior – Different frequencies in profiles

slide-18
SLIDE 18

March 21, 2006 Paul Berube, ISPASS 2006 18

The Difference Metric

  • Let's quantitatively compare two inputs

based on transformation decisions!

  • Output a log of decisions during FDO

compilation

– Multiple inputs used to create multiple logs

  • Treat a log of decisions as a vector

– Yes/No decisions produce binary vectors – Quantitative decisions produce integer vectors

slide-19
SLIDE 19

March 21, 2006 Paul Berube, ISPASS 2006 19

Converting Logs to Vectors

void foo () {} void bar() { foo(); } int main(int argc, char* argv[]) { foo(); bar(); }

slide-20
SLIDE 20

March 21, 2006 Paul Berube, ISPASS 2006 20

Converting Logs to Vectors

void foo () {} void bar() { foo(); } int main(int argc, char* argv[]) { foo(); bar(); }

callsite log 1 log 2 log 3 log 4 bar.foo inline call inline call main.foo call call call inline main.bar call inline inline inline main.bar.foo inline inline inline

slide-21
SLIDE 21

March 21, 2006 Paul Berube, ISPASS 2006 21

Converting Logs to Vectors

void foo () {} void bar() { foo(); } int main(int argc, char* argv[]) { foo(); bar(); }

callsite log 1 log 2 log 3 log 4 bar.foo inline call inline call main.foo call call call inline main.bar call inline inline inline main.bar.foo inline inline inline callsite v 1 v 2 v 3 v 4 bar.foo main.foo main.bar main.bar.foo

slide-22
SLIDE 22

March 21, 2006 Paul Berube, ISPASS 2006 22

Converting Logs to Vectors

void foo () {} void bar() { foo(); } int main(int argc, char* argv[]) { foo(); bar(); }

callsite log 1 log 2 log 3 log 4 bar.foo inline call inline call main.foo call call call inline main.bar call inline inline inline main.bar.foo inline inline inline callsite v 1 v 2 v 3 v 4 bar.foo 1 1 main.foo 1 main.bar 1 1 1 main.bar.foo 1 1 1

slide-23
SLIDE 23

March 21, 2006 Paul Berube, ISPASS 2006 23

Converting Logs to Vectors

void foo () {} void bar() { foo(); } int main(int argc, char* argv[]) { foo(); bar(); }

callsite log 1 log 2 log 3 log 4 bar.foo inline call inline call main.foo call call call inline main.bar call inline inline inline main.bar.foo inline inline inline callsite v 1 v 2 v 3 v 4 bar.foo 1 1 main.foo 1 main.bar 1 1 1 main.bar.foo 1 1 1

slide-24
SLIDE 24

March 21, 2006 Paul Berube, ISPASS 2006 24

void foo () {} void bar() { foo(); } int main(int argc, char* argv[]) { foo(); bar(); }

Converting Logs to Vectors

callsite v 1 v 2 v 3 v 4 bar.foo 1 1 main.foo 1 main.bar 1 1 1 main.bar.foo 1 1 1 callsite log 1 log 2 log 3 log 4 bar.foo inline call inline call main.foo call call call inline main.bar call inline inline inline main.bar.foo inline inline inline

slide-25
SLIDE 25

March 21, 2006 Paul Berube, ISPASS 2006 25

Difference: Definition

  • d(va,vb) = |va – vb|2

– L2-norm of vector difference, squared – Hamming Distance if vectors are binary

  • Count of bit-wise differences
  • Linear and intuitive
slide-26
SLIDE 26

March 21, 2006 Paul Berube, ISPASS 2006 26

Difference: What it tells us

  • Does the compiler transform the program the

same way?

  • Not:

– Importance of any decision for performance – Inputs are equivalent for use as a training input – Inputs are equivalent for use for evaluation

slide-27
SLIDE 27

March 21, 2006 Paul Berube, ISPASS 2006 27

The Alignment Metric

  • Can we say more if we have many inputs?
  • Are there decisions that are made the same

way for all inputs?

  • Alternately, how “conformist” are the logs?
  • Can we quantify “conformity” with a single

number?

slide-28
SLIDE 28

March 21, 2006 Paul Berube, ISPASS 2006 28

Alignment: Graphical Analogy

  • 8 logs
  • Two clusters of similar logs
  • One very distinct log
  • 32 pairwise difference scores!
slide-29
SLIDE 29

March 21, 2006 Paul Berube, ISPASS 2006 29

Alignment: Definition

T =

∑ vi α i =

T•vi = T•vi

∑ iT[i] |T|1 α i =

T•vi = T•vi

∑ iT[i] |T|1

  • T summarizes/accumulates all the logs
  • With binary vectors:

– dividing by |T|1 normalizes alignment – T·v filters T by choices in v

  • Recall: inner product = |a||b|cosθ
slide-30
SLIDE 30

March 21, 2006 Paul Berube, ISPASS 2006 30

Alignment: What it tells us

  • Big angle, very different from all the others

T

slide-31
SLIDE 31

March 21, 2006 Paul Berube, ISPASS 2006 31

Alignment: What it tells us

  • Moderate angle, a bit different from T
  • All blue logs have similar alignment

T

slide-32
SLIDE 32

March 21, 2006 Paul Berube, ISPASS 2006 32

Alignment: What it tells us

  • Small angle, fairly similar to T
  • All red logs have similar alignment

T

slide-33
SLIDE 33

March 21, 2006 Paul Berube, ISPASS 2006 33

Alignment: What it tells us

  • Does NOT tell us:

– Green will perform poorly – Red will perform well – Anything else about relative performance!

T

slide-34
SLIDE 34

March 21, 2006 Paul Berube, ISPASS 2006 34

Getting More Information: Cuts

  • A real situation:

– All average difference scores are high

  • 16 logs = 128 pairwise differences

– Half the alignment scores are low – Half the alignment scores are moderate

slide-35
SLIDE 35

March 21, 2006 Paul Berube, ISPASS 2006 35

Cuts

  • Separate based on alignment and recalculate:

– Blue inputs really are different

  • Alignment scores still low
  • Difference scores still high

– Red inputs are very similar

  • High alignments
  • Low differences
slide-36
SLIDE 36

March 21, 2006 Paul Berube, ISPASS 2006 36

Summary

  • Input Characterization is important due to

sensitivity of performance evaluation to input selection

  • For FDO compiler work, it makes sense to

characterize training inputs based on the transformations they induce

  • Metrics based on transformation logs can

discriminate between inputs

slide-37
SLIDE 37

March 21, 2006 Paul Berube, ISPASS 2006 37

Thanks

Questions?