Statistical Selection of Compiler Options - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

Statistical Selection of Compiler Options

Description:

Optimal setting of those options depends on ... peephole. O14. Caller-saves. O13. Expensive-optimizations. O12. Thread-jumps. O11. Omit-frame-pointer ... – PowerPoint PPT presentation

Number of Views:18
Avg rating:3.0/5.0
Slides: 18
Provided by: masayo6
Category:

less

Transcript and Presenter's Notes

Title: Statistical Selection of Compiler Options


1
Statistical Selectionof Compiler Options
  • R.P.J. Pinkers
  • P.M.W. Knijnenburg
  • M. Haneda
  • H.A.G. Wijshoff

2
Motivation
  • Modern compilers contain dozens of options.
  • Options can positively or negatively interfere.
  • Optimal setting of those options depends on
    application as well as target architecture.
  • Standard Ox settings produce sub-optimal
    results.
  • We propose almost automatic iterative procedure
    to select options for a given application and
    architecture based on statistical analysis

3
Fragment Optimization Space gcc
4
Fragment Optimization Space ijpeg
5
Orthogonal Arrays
  • If there are N options or factors, the full
    optimization space contains 2N combinations.
  • This space is called a full factorial design.
  • A fractional factorial design is a subset of the
    full factorial design.
  • An Orthogonal Array (OA) or Taguchi design is a
    well-known approach to fractional factorial
    designs.
  • An OA allows us to determine the effect of a
    factor in the presence of other factors using a
    reduced space.

6
Definition of Orthogonal Arrays
  • OA is N x k matrix of zeroes and ones.
  • The columns are interpreted as options.
  • Each row defines a compiler setting.
  • An OA has the property that two arbitrary columns
    contain the patterns
  • equally often.
  • Each option Oi is turned on and off equally
    often.
  • If Oi is turned on, then each other option Oj is
    turned on and off equally often.

00 01 10 11
7
Orthogonal Array (Example)
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0
1 0 1 0 1 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 1 0 0 1
1 0 0 1 1 0 0 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
1 0 1 1 0 1 0 0 1 0 1 1 0 1 0 0 1 1 1 1 0 0 0 0 1
1 1 1 0 0 1 1 0 1 0 0 1 0 1 1 0 1 0 0 1 0 0 0 0 0
0 0 1 1 1 1 1 1 1 1 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0
0 1 1 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 0
1 1 0 0 1 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 0 1 1 0
1 0 1 0 1 0 0 1 0 1 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1
1 1 0 1 0 0 1 1 0 0 1 0 1 1 0
8
Main Effects of Options
  • An OA allows us to calculate the main effect of
    options.
  • The main effect of an option Oi wrt an OA A is
    defined as
  • where s denotes a row in A and T(s) denotes the
    execution time of the program when compiles with
    setting s.

9
Relative Effects
  • Execution times are given in cycles or seconds.
  • Effects of options for different benchmarks
    cannot be compared easily.
  • We define relative effect of an option Oi as

10
Improvement of Options
  • An option can improve or degrade performance.
  • The main effect is always positive and does not
    distinguish between improvement or degradation.
  • We define the improvement of an option Oi wrt an
    OA A as

11
Iterative Algorithm
  • Repeat
  • Compile application with each row from A as
    compiler setting and execute optimized
    application.
  • Compute effect of each option.
  • If effect is larger than threshold of 10
  • if option has positive improvement, switch option
    on
  • else switch option off.
  • Construct new OA A by dropping columns
    corresponding to selected options.
  • until all options are set

12
Experimental Setup
  • SimpleScalar simulator with GCC 2.6.3.
  • Contains 19 options divided in 14 factors
  • 6 SPEC95 benchmarks.

O1 unroll-loops, strength-reduce, rerun-cse-after-loop
O2 fast-math
O3 schedule-insns, schedule-insns2
O4 inline, inline-functions
O5 cse-follow-jumps, cse-skip-blocks
O6 float-store
O7 Defer-pop
O8 Force-mem
O9 Force-addr
O10 Omit-frame-pointer
O11 Thread-jumps
O12 Expensive-optimizations
O13 Caller-saves
O14 peephole
13
Iteration 1 for gcc
14
Iteration 2 for gcc
15
Iteration 3 for gcc
16
Comparison with Standard Settings
17
Conclusions
  • We have proposed a method based on statistical
    analysis of the effect of options using
    Orthogonal Arrays.
  • Method uses (almost) no knowledge of compiler.
  • Can be implemented as a simple driver on top of
    any compiler.
  • Significant improvement can be obtained by
    automatically tuning compiler options over
    standard optimization settings.
Write a Comment
User Comments (0)
About PowerShow.com