Seminar Zhang, XiangWei

Download Report

Transcript Seminar Zhang, XiangWei

EnerJ: Approximate Data Types for Safe
and General Low-Power Computation
(PLDI’2011)
Adrian Sampson, Werner Dietl, Emily Fortuna
Danushen Gnanapragasam, Luis Ceze, Dan Grossman
University of Washington
Presented by Xianwei Zhang
Overview
2

Observations
o
o
o

Challenge to exploit energy-accuracy tradeoff
o

Energy is an increasing concern in computer systems (phones, data centers, etc)
Systems spend a significant amount of energy guaranteeing correctness
Many applications have high tolerance to run-time faults.
Isolate parts of the program that must be precise from those that can be
approximated so that a program functions correctly even QoS degrades.
Contributions
o
o
o
Propose a safe and general model for approximate programming
Present EnerJ, an extension of Java with type qualifiers
Demonstrate effectiveness using proposed approximation-aware architecture.
Presented by Xianwei Zhang
4/11/2016
Perfect Correctness is Not Always Required
3

No perfect answers or hard to get perfect answers
o

Heuristic algorithms, inherent incorrectness.
Care more about aggregate trends
o
Large-scale data analytics, trends instead of individual data elements.
4/11/2016
Not All Data Are Error Resilient
4

Non-critical portion - safely to do approximation
o

E.g., errors in output pixel data are tolerable and even undectable.
Critical portion - must be protected from error
o
Small errors in image format make the output unreadable.
✓
✗
4/11/2016
Type System for Approximate Computation
5

Safety
o

Generality
o

Separate critical and non-critical program components.
A range of approximation strategies supported with a single
abstraction.
EnerJ, an extension to Java that adds approximate data
types.
o
o
o
o
o
Type qualifiers
Endorsement
Operator overloading
Prevention of implicit flows
Objects: qualifier polymorphism
4/11/2016
Type Qualifiers
6

Every value has an approximate or precise type

Precise types are the default, @Approx is made explicit

Illegal to assign approx into a precise-typed variable
@Approx int a = …;
@Precise int p = …;
p = a;
a = p;
✗
✓
4/11/2016
Endorsement: Escape Hatch
7

Fully isolating approx and precise parts is not very useful
o
o

Programs usually have a phase of fault-tolerant computation followed
by a phase of fault-sensitive reduction or output
E.g., image manipulation phase, then a critical checksum over the result.
Programmer controls explicitly when approx data can affect
precise state
@Approx int a = expensiveCal();
int p; //precise by
default
p = endorse (a); //legal
quickChecksum (p);
4/11/2016
Logic Approximation: Overloading
8

Overload operators and methods based on type qualifiers
o
E.g., two signatures for + operator on integers.
@Approx int a = …;
int p = …;
p + p;
+: @Precise int, @Precise int  @Precise int
p + a;
a + a;
+: @Approx int, @Approx int  @Approx int
4/11/2016
Control Flow
9

Disallow implicit flows that occur via control flow
o

The restriction is conservative
o

While p is precise and no assignment is present, its value is affected.
Prohibits approx conditions even when the result can affect only approx.
Work around the restriction using endorse
@Approx int a = …;
int p = …;
if (a == 10) {
p = 2;
}
✗
@Approx int a = …;
int p = …;
if (endorse (a == 10)) {
p = 2;
}
✓
4/11/2016
Objects
10

Classes also support approximation
o
o
o
@Approximable: enable approx or precise instances
@Context: non-static members, depends on the instance’s type
_APPROX: specialize method definitions based on class type qualifier.
@Approximable class FloatSet {
@Precise FloatSet pSet;
@Context float[] nums = …;
pSet.mean(); //mean
float mean() {
@Approx FloatSet aSet;
calculate mean
aSet.mean(); //mean_APPROX
}
@Approx float mean_APPROX() {
take mean of first 1/2
}
}
4/11/2016
Architectural Approximation
11

Approximate storages
o
o

Registers: precise and approx are distinguished using register number
Cache and memory: distinguished by address.
Approximate operations
o
Approx instructions use special FUs that perform approx operations.
4/11/2016
Hardware Techniques for Saving Energy
12




Voltage scaling in logic circuits
Width reduction is FP operations
DRAM refresh rate
SRAM supply voltage
4/11/2016
Implementation
13

Annotation
o
o

Simulation
o
o

Manually annotate each application using EnerJ
Focused on critical code where most of the time is spent.
Implemented a compiler and runtime system that executes EnerJ code
Utilize instrumentation calls to inject transient faults to emulate approx.
Approximation
o
o
Reduce FP bit-width, flip bit of accesses into SRAM and DRAM
Assumption: heap data in DRAM, stack data in SRAM.
4/11/2016
Annotated Declarations
14


Primary approx data is in a small portion of code
Annotations are sparse and straightforward to insert
4/11/2016
Energy Savings
15


Save 9%-48% of total execution energy
Majority of savings come from Base to Mild
4/11/2016
Output Error
16


Metric: compare approx result against precise one
“Mild” configuration is a good fit for all
4/11/2016
Summary
17

Approximate computing is promising
o

Proposed type system
o
o
o

A new way to save energy in large classes of applications.
Variables and objects can be declared as approx or precise
Safe: guarantees precise unless given explicit programmer permission
General: unifies approx data storage, approx computation and approx algs.
Implementations and evaluations
o
o
o
o
Implemented the type system atop of Java and tested with several apps
Annotations are easy to insert
For annotated programs, the runtime system or arch can choose multi approx
execution techniques
Hardware-based model shows potential energy savings in 9%-48% range.
Presented by Xianwei Zhang
4/11/2016