Compiler Analyses for Improved Return Value Prediction Christopher - - PowerPoint PPT Presentation

compiler analyses for improved return value prediction
SMART_READER_LITE
LIVE PREVIEW

Compiler Analyses for Improved Return Value Prediction Christopher - - PowerPoint PPT Presentation

Compiler Analyses for Improved Return Value Prediction Christopher J.F . Pickett Clark Verbrugge { cpicke,clump } @sable.mcgill.ca School of Computer Science, McGill University Montr eal, Qu ebec, Canada H3A 2A7 Overview Introduction


slide-1
SLIDE 1

Compiler Analyses for Improved Return Value Prediction

Christopher J.F . Pickett Clark Verbrugge {cpicke,clump}@sable.mcgill.ca School of Computer Science, McGill University Montr´ eal, Qu´ ebec, Canada H3A 2A7

slide-2
SLIDE 2

Overview

Introduction and Related Work Contributions Framework Parameter Dependence Analysis Return Value Use Analysis Conclusions Future Work

CDP04 – 1/48

slide-3
SLIDE 3

Introduction and Related Work

Speculative method-level parallelism (SMLP) allows for dynamic parallelisation of single-threaded programs speculative threads are forked at callsites suitable for Java virtual machines Perfect return value prediction can double performance of SMLP (Hu et al., 2003) Implemented accurate return value prediction in SableVM, our group’s JVM (Pickett et al., 2004) Current goals: Reduce memory requirements Achieve higher accuracy

CDP04 – 2/48

slide-4
SLIDE 4

Speculative Method-Level Parallelism

// execute foo non-speculatively r = foo (a, b, c); // execute past return point // speculatively in parallel with foo() if (r > 10) { ... } else { ... }

CDP04 – 3/48

slide-5
SLIDE 5

Impact of Return Value Prediction

RVP strategy return value SMLP speedup none arbitrary 1.52 best predicted 1.92 perfect correct 2.76 26% speedup over no RVP with Hu’s best predictor 82% speedup over no RVP with perfect prediction Improved hybrid accuracy is highly desirable

  • S. Hu., R. Bhargava, and L. K. John. The role of return value

prediction in exploiting speculative method-level parallelism.

Journal of Instruction-Level Parallelism, 5:1–21, Nov. 2003.

CDP04 – 4/48

slide-6
SLIDE 6

Return Value Prediction in SableVM

Implemented all of Hu et al.’s predictors in SableVM Introduced new memoization predictor into hybrid

C.J.F. Pickett and C. Verbrugge. Return value prediction in a Java virtual machine. Second Value-Prediction and Value-Based Optimization

Workshop (VPW2) at ASPLOS, Boston, Massachusetts, Oct. 2004.

CDP04 – 5/48

slide-7
SLIDE 7

Return Value Prediction in SableVM

Achieved 72% accuracy over SPEC JVM98 81% if memoization is included But ... Large amounts of memory are required Still room for greater accuracy

C.J.F. Pickett and C. Verbrugge. Return value prediction in a Java virtual machine. Second Value-Prediction and Value-Based Optimization

Workshop (VPW2) at ASPLOS, Boston, Massachusetts, Oct. 2004.

CDP04 – 6/48

slide-8
SLIDE 8

Contributions

Static analyses in Soot Parameter dependence analysis Eliminate unnecessary memoization inputs Save memory Increase accuracy Return value use analysis Allow for use of incorrect predictions Increase accuracy Convey results to SableVM using attributes

CDP04 – 7/48

slide-9
SLIDE 9

Framework

Soot: Java bytecode compiler framework Spark: points-to analysis and callgraph Jimple: typed, stackless, 3-address IR Baf: streamlined representation of Java bytecode Attribute generation framework SableVM: portable Java virtual machine Attribute parsing Previous RVP implementation SPEC Client JVM98 Benchmark Suite S100 (size 100), no harness All benchmarks except raytrace

CDP04 – 8/48

slide-10
SLIDE 10

Parameter Dependence Analysis

Memoization predictor Hash together method arguments One predictor hashtable per callsite Problem: redundant entries in hashtables

CDP04 – 9/48

slide-11
SLIDE 11

Parameter Dependence Analysis

Insight: not all parameters affect return value Eliminate inputs to predictor Increase hashtable sharing ++accuracy

  • -size

CDP04 – 10/48

slide-12
SLIDE 12

Intraprocedural Parameter Dependence

CDP04 – 11/48

slide-13
SLIDE 13

Intraprocedural Parameter Dependence

CDP04 – 12/48

slide-14
SLIDE 14

Intraprocedural Parameter Dependence

CDP04 – 13/48

slide-15
SLIDE 15

Intraprocedural Parameter Dependence

CDP04 – 14/48

slide-16
SLIDE 16

Intraprocedural Parameter Dependence

CDP04 – 15/48

slide-17
SLIDE 17

Intraprocedural Parameter Dependence

CDP04 – 16/48

slide-18
SLIDE 18

Intraprocedural Parameter Dependence

CDP04 – 17/48

slide-19
SLIDE 19

Intraprocedural Parameter Dependence

CDP04 – 18/48

slide-20
SLIDE 20

Intraprocedural Parameter Dependence

CDP04 – 19/48

slide-21
SLIDE 21

Intraprocedural Parameter Dependence

CDP04 – 20/48

slide-22
SLIDE 22

Intraprocedural Parameter Dependence

CDP04 – 21/48

slide-23
SLIDE 23

Intraprocedural Parameter Dependence

CDP04 – 22/48

slide-24
SLIDE 24

Intraprocedural Parameter Dependence

CDP04 – 23/48

slide-25
SLIDE 25

Intraprocedural Parameter Dependence

CDP04 – 24/48

slide-26
SLIDE 26

Intraprocedural Parameter Dependence

CDP04 – 25/48

slide-27
SLIDE 27

Interprocedural Parameter Dependence

CDP04 – 26/48

slide-28
SLIDE 28

Interprocedural Parameter Dependence

CDP04 – 27/48

slide-29
SLIDE 29

Interprocedural Parameter Dependence

CDP04 – 28/48

slide-30
SLIDE 30

Interprocedural Parameter Dependence

CDP04 – 29/48

slide-31
SLIDE 31

Interprocedural Parameter Dependence

CDP04 – 30/48

slide-32
SLIDE 32

Interprocedural Parameter Dependence

CDP04 – 31/48

slide-33
SLIDE 33

Interprocedural Parameter Dependence

CDP04 – 32/48

slide-34
SLIDE 34

Interprocedural Parameter Dependence

CDP04 – 33/48

slide-35
SLIDE 35

Interprocedural Parameter Dependence

CDP04 – 34/48

slide-36
SLIDE 36

Interprocedural Parameter Dependence

CDP04 – 35/48

slide-37
SLIDE 37

Interprocedural Parameter Dependence

CDP04 – 36/48

slide-38
SLIDE 38

Parameter Dependence Results

consumed non-void dependence type callsites methods full 51% 58% partial 22% 9% zero, with parameters 24% 30% zero, without parameters 3% 3% Memoization at 22% of callsites will be improved 27% of callsites do not benefit from memoization Average taken over SPEC JVM98

CDP04 – 37/48

slide-39
SLIDE 39

Return Value Use Analysis

An incorrect return value r may be OK If r is unused If r appears inside a boolean expression r = foo (a, b, c); if (r > 10) { ... // r == 11, 12, 13, ... } else { ... // r == 10, 9, 8, ... }

CDP04 – 38/48

slide-40
SLIDE 40

Return Value Use Analysis

Collect use expressions for each return value Evaluate use expressions at runtime If predicted and actual return values satisfy use expressions identically, we can substitute an inaccurate prediction ++accuracy

CDP04 – 39/48

slide-41
SLIDE 41

Return Value Use

CDP04 – 40/48

slide-42
SLIDE 42

Return Value Use

CDP04 – 41/48

slide-43
SLIDE 43

Return Value Use

CDP04 – 42/48

slide-44
SLIDE 44

Return Value Use

CDP04 – 43/48

slide-45
SLIDE 45

Return Value Use

CDP04 – 44/48

slide-46
SLIDE 46

Return Value Use Results

consumed accurate callsites (%) no no 21 yes no 10 yes yes 69 Use expressions only involve r and a constant Future: allow for locals as well as constants Relax accuracy constraints further

CDP04 – 45/48

slide-47
SLIDE 47

Conclusions (1)

Two new compiler analyses for improved RVP Parameter dependence analysis: production Return value use analysis: consumption Static results look promising: 22% of callsites have partial dependencies 27% of callsites have zero dependencies 21% of return values are unconsumed 31% of return values may be inaccurate

CDP04 – 46/48

slide-48
SLIDE 48

Conclusions (2)

Parameter dependence analysis is optimistic Conservative correctness not required Return value use analysis relaxes safety constraints

CDP04 – 47/48

slide-49
SLIDE 49

Future Work

Allow for comparisons with locals in use expressions. At runtime, these values may be: Parameter locals Non-parameter locals Stack values Determine effect of analyses at runtime Implement purity analysis in Soot (S˘ alcianu, Rinard) Skip pure methods altogether via memoization! Finish SMLP implementation in SableVM Study costs and benefits of RVP in this system

CDP04 – 48/48