Sasa Misailovic MIT CSAIL Collaborators Martin Rinard Michael Carbin Stelios Sidiroglou Henry Hoffmann Deokhwan Kim Fan Long Daniel Roy Zeyuan Allen Zhu Michael Kling ID: 640360
Download Presentation The PPT/PDF document "Accuracy-Aware Program Transformations" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Accuracy-Aware Program Transformations
Sasa
Misailovic
MIT CSAILSlide2
Collaborators
Martin
Rinard
, Michael
Carbin
,
Stelios
Sidiroglou
, Henry Hoffmann,
Deokhwan
Kim, Fan Long, Daniel Roy,
Zeyuan
Allen Zhu, Michael Kling,
Jonathan
Kelner
,
Anant
AgarwalSlide3
Trade Accuracy
for Energy and Performance
[
Rinard
ICS’06, OOPSLA’07;
Misailovic
,
Sidiroglou
, Hoffmann,
Rinard
ICSE’10;
Carbin
,
Rinard
, ISSTA’10; Hoffmann,
Sidiroglou
,
Carbin
,
Misailovic
, Agarwal,
Rinard
ASPLOS’11;
Sidiroglou
,
Misailovic
, Hoffmann,
Rinard
FSE’11;
Misailovic
, Roy,
Rinard
, SAS‘11; Zhu,
Misailovic
,
Kelner
,
Rinard
POPL’12;
Carbin
, Kim,
Misailovic
,
Rinard
PLDI’12;
Misailovic
,
Sidiroglou
,
Rinard
, RACES‘12;
Misailovic
, Kim,
Rinard
TECS PEC’13;
Carbin
, Kim,
Misailovic
,
Rinard
PEPM’13;
Carbin
,
Misailovic
,
Rinard
, OOPSLA ‘13; …]Slide4
Harness Approximate Computing
How to
systematically
generate approximate programs?How to predict accuracy of the results ofapproximate programs?How to find the most profitable approximate programs?
Automated Transformations
Probabilistic Reasoning
Explicit Search and Mathematical OptimizationSlide5
Transformations
Do less work
Loop perforation
Sampling, Task skipping
for (
i
= 0;
i
< n;
i
+= 2
)
{ … }
r =
var
+. 2;
lock(x); function(); unlock(x);
r = f_0(x) f_1(x);
Do different kind of workRandomized substitution
Exploit Execution Environment
Unreliable operation
p
lacement
Unreliable memory regions, Lock elisionSlide6
Where
and
when
should we apply the transformations?What are the benefits and costs?Slide7
Optimization Framework
F
ind Candidates
for Transformation Analyze Effects of the Transformations Navigate Tradeoff Space
for (
i
= 0;
i
< n;
i
++
)
{ … }
for (
i
= 0;
i
< n;
i
+= 2
)
{ … }
c
c
cSlide8
F
ind Transformation Candidates:
Profile program to find time-consuming for loops
A
nalyze the Effects of Transformation:
Performance: Compare execution times
Accuracy: Compare the quality of the results
Safety: memory safety, well formed
output
N
avigate Tradeoff Space:
Combine multiple
perforatable
loops
Prioritize loops by their individual performance and accuracy
Greedy or Exhaustive Search with Pruning
Explicit Search Algorithm for Perforation
[Misailovic, Sidiroglou, Hoffmann, Rinard ICSE’10; Hoffmann, Sidiroglou, Carbin
, Misailovic, Agarwal, Rinard ASPLOS’11; Sidiroglou, Misailovic, Hoffmann, Rinard FSE’11]Slide9
x264 Cumulative Loop Scores
Mean Normalized Time
Accuracy loss (%) Slide10
Computational Kernels:
Several
perforatable
computations
execute for the majority of the time
Computational patterns:
Distance metrics
Data Statistics
Iteration steps
Monte-Carlo
Benchmark
#
Perforatable
Loops
% Time
X264
14
> 60%Bodytrack8> 75%Swaptions4> 99%
Ferret2> 40%Blackscholes1> 98%Canneal1
> 5%Streamcluster1
> 98%Slide11
Next Step: Analyses with Guarantees
Accuracy analysis
:
Results valid for a whole range of inputs, not just those used in testing
Navigation: Explore the space of transformed programs to find those with optimal tradeoffsSlide12
Accuracy Analysis:
Probabilistic Reasoning
[
Misailovic
, Roy,
Rinard
SAS ’11
;
Zhu,
Misailovic
,
Kelner
,
Rinard
POPL ’12
;
Misailovic, Sidiroglou, Rinard
, RACES ‘12, Misailovic, Kim, Rinard TECS PEC ’13, Carbin, Misailovic, Rinard, OOPSLA ’13, Misailovic, Rinard WACAS ‘14,
Misailovic, Carbin, Achour, Qi, Rinard MIT-TR ‘14]
For approximate program configuration
Slide13
Optimization of Map-Fold Computations
outList
= Map ( Func(x),
inputList
)
Func0: (
0
,T
0
)
Func1: (
1,T1)Func2: (
2,T2)[Zhu, Misailovic, Kelner, Rinard POPL 2012; Misailovic, Rinard
WACAS 2014]Accuracy Requirement:
Slide14
Optimization of Map-Fold ComputationsConfiguration:
Probability to execute each version of
Func
Range
:
,
Sum:
Accuracy Loss Constraint:
Goal:
Linear + Dynamic programming
outList
=
Map
(
Func0(x)
Func1(x)
Func2(x)
,
inputList
)
Func0: (
0
,T
0
)
Func1: (
1
,T
1
)
Func2: (
2
,T
2
)
[Zhu,
Misailovic
,
Kelner
,
Rinard
POPL 2012;
Misailovic
,
Rinard
WACAS 2014]Slide15
float<0.99*R(x)
>
f(float in unrel x) {
y = g(x) +. h(x);
return
y *. y;
}
Developer’s reliability
specification
Chisel:
Automatic Generation of Approximate Rely Programs
[
Misailovic
,
Carbin, Achour, Qi, Rinard MIT-TR 14]
Variable and
Operation
AnnotationsSlide16
Chisel:
Automatic Generation of Approximate Rely Programs
Configuration:
Unreliable variable or unreliable operation
Range
:
Reliability Constraint:
Goal:
Integer Linear Programming
float<
0.99*R(x)
>
f
(float
x
)
{
y = g(x) +
h(x);
return
y *
y;
}
Developer’s
specification
[
Misailovic
,
Carbin
,
Achour
, Qi,
Rinard
MIT-TR 14]Slide17
Navigate Search Space:
Mathematical Optimization
Find configuration
s. t.
[Zhu
,
Misailovic
,
Kelner
,
Rinard
POPL
’12;
Misailovic
,
Rinard
WACAS ‘14
Misailovic
,
Carbin
, Achour, Qi, Rinard, MIT-TR ‘14] Slide18
Looking Forward
Fully Exploit Optimization Opportunities:
both application- and hardware-level transformations
Reasoning About Uncertainty:
logic-based techniquesprobabilistic techniquesempirical techniquesPractical Aspects: provide intuition and control for developers and domain expertsSlide19
Takeaway
Emerging trend of
approximate
programs and devices
Accuracy-aware transformations are powerful toolImprove performanceReduce energy consumptionFacilitate dynamic adaptation andsoftware specializationInteraction of program analysis and search techniques to find profitable, safe, and predictable tradeoffsSlide20
Takeaway
Accuracy-aware transformations
Improve performance
Reduce
energy consumptionFacilitate dynamic adaptation and software specializationProgram analysis and search can help find profitable, safe,
and predictable
tradeoffsSlide21
Takeaway
Accuracy-aware transformations
Improve performance
Reduce
energy consumptionFacilitate dynamic adaptation and software specialization
Program analysis and search
can help f
ind
profitable, safe
, and predictable tradeoffs