Performance Potential of Optimization Phase Selection During Dynamic - - PowerPoint PPT Presentation

performance potential of optimization phase selection
SMART_READER_LITE
LIVE PREVIEW

Performance Potential of Optimization Phase Selection During Dynamic - - PowerPoint PPT Presentation

Performance Potential of Optimization Phase Selection During Dynamic JIT Compilation Performance Potential of Optimization Phase Selection During Dynamic JIT Compilation Michael R. Jantz Prasad A. Kulkarni Electrical Engineering and Computer


slide-1
SLIDE 1

Performance Potential of Optimization Phase Selection During Dynamic JIT Compilation

Performance Potential of Optimization Phase Selection During Dynamic JIT Compilation

Michael R. Jantz Prasad A. Kulkarni

Electrical Engineering and Computer Science, University of Kansas {mjantz,kulkarni}@ittc.ku.edu

March 17, 2013

1/20

slide-2
SLIDE 2

Performance Potential of Optimization Phase Selection During Dynamic JIT Compilation Introduction

Phase Selection in Dynamic Compilers

◮ Phase Selection – customizing set of optimizations applied for

each method / program to generate the best quality code

◮ Static solutions do not necessarily apply to JITs ◮ Heuristics improve startup performance. ◮ Is it possible for phase customization to improve peak

throughput (aka steady-state performance)?

2/20

slide-3
SLIDE 3

Performance Potential of Optimization Phase Selection During Dynamic JIT Compilation Introduction

Our Goals

◮ Understand optimization behavior relevant to phase selection ◮ Quantify the performance potential of customizing phase

selections in online JIT compilers

◮ Determine if current state-of-the-art heuristics achieve ideal

performance

3/20

slide-4
SLIDE 4

Performance Potential of Optimization Phase Selection During Dynamic JIT Compilation Experimental Framework

Our Experimental Framework

◮ Uses the server compiler in Sun/Oracle’s HotSpotTMJVM

◮ Applies a fixed optimization set to each compiled method ◮ Imposes a strict optimization ordering ◮ Modified to optionally enable / disable 28 optimizations

◮ Two benchmark suites with two inputs:

◮ SPECjvm98 (input sizes 10 and 100) ◮ DaCapo (small and default)

◮ Phase selection applied to one focus method at a time

◮ Profiling run to determine hottest methods ◮ Select methods that comprise at least 10% of total program

runtime (53 focus methods across all of the benchmarks)

4/20

slide-5
SLIDE 5

Performance Potential of Optimization Phase Selection During Dynamic JIT Compilation Experimental Framework Performance Measurement

Performance Measurement

◮ All experiments measure steady-state performance

◮ Hot methods pre-compiled ◮ No compilation during steady-state iterations

◮ Run on a cluster of server machines

◮ CPU: four 2.8GHz Intel Xeon processors ◮ Memory: 6GB DDR2 SDRAM, 4MB L2 Cache ◮ OS: Red Hat Enterprise Linux 5.1 5/20

slide-6
SLIDE 6

Performance Potential of Optimization Phase Selection During Dynamic JIT Compilation Analyzing Behavior of Compiler Optimizations for Phase Selection

Analyzing Behavior of Compiler Optimizations

◮ In some situations, applying an optimization may have

detrimental effects

◮ Optimization phases interact with each other ◮ Experiments to explore the effect of optimization phases on

code quality

T(OPT < defOpt − x >) − T(OPT < defOpt >) T(OPT < defOpt >) (1)

6/20

slide-7
SLIDE 7

Performance Potential of Optimization Phase Selection During Dynamic JIT Compilation Analyzing Behavior of Compiler Optimizations for Phase Selection Impact of each Optimization over Focus Methods

Impact of each Optimization over Focus Methods

  • 20
  • 10

10 20 30 40

  • 0.4
  • 0.2

0.2 0.4 0.6 0.8

Number of impacted methods Accumulated impact HotSpot optimizations

  • acc. impact

+ acc. impact

  • # impacted

+ # impacted

16.06 1.92

Figure 1: Left Y-axis: Accumulated positive and negative impact of each HotSpot optimization over our

focus methods (non-scaled). Right Y-axis: Number of focus methods that are positively or negatively impacted by each HotSpot optimization.

◮ Optimizations not always beneficial to program performance ◮ Most optimizations have occasional negative effects

7/20

slide-8
SLIDE 8

Performance Potential of Optimization Phase Selection During Dynamic JIT Compilation Analyzing Behavior of Compiler Optimizations for Phase Selection Impact of each Optimization over Focus Methods

Impact of each Optimization over Focus Methods

Figure 1: Left Y-axis: Accumulated positive and negative impact of each HotSpot optimization over our

focus methods (non-scaled). Right Y-axis: Number of focus methods that are positively or negatively impacted by each HotSpot optimization.

◮ Some optimizations show degrading impact more often

8/20

slide-9
SLIDE 9

Performance Potential of Optimization Phase Selection During Dynamic JIT Compilation Analyzing Behavior of Compiler Optimizations for Phase Selection Impact of each Optimization over Focus Methods

Impact of each Optimization over Focus Methods

Figure 1: Left Y-axis: Accumulated positive and negative impact of each HotSpot optimization over our

focus methods (non-scaled). Right Y-axis: Number of focus methods that are positively or negatively impacted by each HotSpot optimization.

◮ Most optimizations only have marginal impact on performance ◮ Most beneficial is method inlining, followed by register allocation

9/20

slide-10
SLIDE 10

Performance Potential of Optimization Phase Selection During Dynamic JIT Compilation Analyzing Behavior of Compiler Optimizations for Phase Selection Impact of Optimizations for each Focus Method

Impact of Optimizations for each Focus Method

  • 10
  • 5

5 10 15 20

  • 0.8
  • 0.4

0.4 0.8 1.2 1.6

Number of optimizations with significant impact Accumulated impact Methods

  • acc. Imp.

+ acc. Imp.

  • # opts

+ # opts

2.48 3.33 3.38

Figure 2: Left Y-axis: Accumulated positive and negative impact of the 25 HotSpot optimizations for each

focus method (non-scaled). Right Y-axis: Number of optimizations that positively or negatively impact each focus

  • method. The rightmost bar displays the average.

◮ Not many optimizations degrade performance (2.2, on average) ◮ Only a few optimizations benefit performance (4.4, on average)

10/20

slide-11
SLIDE 11

Performance Potential of Optimization Phase Selection During Dynamic JIT Compilation Limits of Optimization Phase Selection

Limits of Optimization Phase Selection

◮ Iterative search infeasible due to number of optimizations ◮ Employ long-running genetic algorithms (GA’s) to find

near-optimal phase selections

◮ Evaluate group of phase selections in each GA generation ◮ Random mutation and crossover to next generation’s set of

phase selections

◮ 20 phase selections per generation over 100 generations 11/20

slide-12
SLIDE 12

Performance Potential of Optimization Phase Selection During Dynamic JIT Compilation Limits of Optimization Phase Selection

GA Results for Focus Methods

0.2 0.4 0.6 0.8 1 1.2

Best method-specific GA time / time with default compiler Methods

Figure 3: Performance of method-specific optimization selection after 100 GA generations. All results are

scaled by the fraction of total program time spent in the focus method to show the runtime improvement for each individual method. The rightmost bar displays the average.

◮ Customizing optimization phase selections achieves significant gains ◮ Maximum improvement of 44%, average improvements of 6.2%

12/20

slide-13
SLIDE 13

Performance Potential of Optimization Phase Selection During Dynamic JIT Compilation Effectiveness of Feature-Vector Based Heuristics

Effectiveness of Feature-Vector Based Heuristics

◮ Iterative searches not practical for JITs ◮ Previous works proposed using feature-vector based heuristics

during online compilation [1, 2]

◮ GA results allow the first evaluation of these heuristics

(compared to ideal phase selections)

13/20

slide-14
SLIDE 14

Performance Potential of Optimization Phase Selection During Dynamic JIT Compilation Effectiveness of Feature-Vector Based Heuristics Overview of Approach

Overview of Approach

◮ Training stage

◮ Evaluate program performance for different phase selections ◮ Construct a feature set to characterize methods ◮ Correlate good phase selections with method features

◮ Deployment stage

◮ Install learned statistical model into compiler ◮ Extract each method’s feature set at runtime ◮ Predict a customized phase selection for each method 14/20

slide-15
SLIDE 15

Performance Potential of Optimization Phase Selection During Dynamic JIT Compilation Effectiveness of Feature-Vector Based Heuristics Our Experimental Setup

Our Experimental Setup

Scalar Features Distribution Features Counters Types ALU Operations Bytecodes byte char add sub Arguments int double mul div Temporaries short long rem neg Nodes float

  • bject

shift

  • r

address and xor inc compare Attributes Casting Memory Operations Constructor to byte load load const Final to char store new Protected to short new array / multiarray Public to int Static to long Control Flow Synchronized to float branch call Exceptions to double jsr switch Loops to address to object Miscellaneous cast check instance of throw array ops field ops synchronization

Table 1:

List of method features used in our experiments ◮ Select method features relevant to HotSpot ◮ Use logistic regression to train our predictive model

15/20

slide-16
SLIDE 16

Performance Potential of Optimization Phase Selection During Dynamic JIT Compilation Effectiveness of Feature-Vector Based Heuristics Feature-Vector Based Heuristic Algorithm Results

Feature-Vector Based Heuristic Algorithm Results

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6

Feature vector model time / best method-specific GA time Methods 4.95 5.34

Figure 4: Effectiveness of method-specific feature-vector based heuristic. Training data for each method

consists of all the other focus methods.

◮ On average, 22% worse than ideal, 14% worse than default compiler ◮ Feature-vector based heuristics cannot achieve improvements found by GA, but this result is similar to findings in previous research.

16/20

slide-17
SLIDE 17

Performance Potential of Optimization Phase Selection During Dynamic JIT Compilation Effectiveness of Feature-Vector Based Heuristics Feature-Vector Based Heuristic Algorithm Results

Feature-Vector Based Heuristic with Additional Analysis

0.2 0.4 0.6 0.8 1 1.2 1.4

Feature vector model time / best method-specific GA time Methods 1.56 1.66

Figure 5: Experiments that use the observations from analysis of optimization behavior to improve the

performance of feature-vector based heuristic algorithms for online phase selection

◮ Only predict ON/OFF setting for optimizations that show negative performance impact for at least 10% of methods ◮ Does not achieve ideal code quality, but only 8.4% worse than ideal

17/20

slide-18
SLIDE 18

Performance Potential of Optimization Phase Selection During Dynamic JIT Compilation Conclusions

Conclusions

◮ Framework for optimization selection research in JITs ◮ Observations

◮ Most optimizations have modest performance impact ◮ Few optimizations are active for most methods ◮ Most optimizations do not negatively affect performance ◮ Modest potential for optimization phase selection ◮ GA-based search yields 6.2% average improvement ◮ Feature-vector based heuristics do not attain ideal performance ◮ Suggested directions may improve phase selection heuristics 18/20

slide-19
SLIDE 19

Performance Potential of Optimization Phase Selection During Dynamic JIT Compilation Conclusions

Questions

Thank you for your time. Questions?

19/20

slide-20
SLIDE 20

Performance Potential of Optimization Phase Selection During Dynamic JIT Compilation References

References

[1] John Cavazos and Michael F. P. O’Boyle. Method-specific dynamic compilation using logistic regression. In Proceedings

  • f the conference on Object-oriented programming systems,

languages, and applications, pages 229–240, 2006. [2] R.N. Sanchez, J.N. Amaral, D. Szafron, M. Pirvu, and

  • M. Stoodley. Using machines to learn method-specific

compilation strategies. In Code Generation and Optimization, pages 257 –266, April 2011.

20/20