170 likes | 190 Views
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. Observations
E N D
EnerJ: Approximate Data Types for Safe and General Low-Power Computation(PLDI’2011) Adrian Sampson, Werner Dietl, Emily Fortuna DanushenGnanapragasam, Luis Ceze, Dan Grossman University of Washington Presented by Xianwei Zhang
Overview • Observations • 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. • Challenge to exploit energy-accuracy tradeoff • 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 • 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
Perfect Correctness is Not Always Required • No perfect answers or hard to get perfect answers • Heuristic algorithms, inherent incorrectness. • Care more about aggregate trends • Large-scale data analytics, trends instead of individual data elements.
Not All Data Are Error Resilient • Non-critical portion - safely to do approximation • E.g., errors in output pixel data are tolerable and even undectable. • Critical portion - must be protected from error • Small errors in image format make the output unreadable. ✓ ✗
Type System for Approximate Computation • Safety • Separate critical and non-critical program components. • Generality • A range of approximation strategies supported with a single abstraction. • EnerJ, an extension to Java that adds approximate data types. • Type qualifiers • Endorsement • Operator overloading • Prevention of implicit flows • Objects: qualifier polymorphism
Type Qualifiers @Approx int a = …; @Precise int p = …; p = a; a = p; • 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 ✗ ✓
Endorsement: Escape Hatch @Approx int a = expensiveCal(); int p; //precise by default p = endorse (a); //legal quickChecksum (p); output (p); • Fully isolating approx and precise parts is not very useful • 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
Logic Approximation: Overloading @Approx int a = …; int p = …; p + p; +: @Precise int, @Precise int @Precise int p + a; a + a; +: @Approx int, @Approx int @Approx int • Overload operators and methods based on type qualifiers • E.g., two signatures for + operator on integers.
Control Flow @Approx int a = …; int p = …; if (a == 10) { p = 2; } • Disallow implicit flows that occur via control flow • While p is precise and no assignment is present, its value is affected. • The restriction is conservative • Prohibits approx conditions even when the result can affect only approx. • Work around the restriction using endorse @Approx int a = …; int p = …; if (endorse (a == 10)) { p = 2; } ✗ ✓
Objects @Approximable class FloatSet { @Context float[] nums = …; float mean() { calculate mean } @Approx float mean_APPROX() { take mean of first 1/2 } } • Classes also support approximation • @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. @Precise FloatSet pSet; pSet.mean(); //mean @Approx FloatSet aSet; aSet.mean(); //mean_APPROX
Architectural Approximation • Approximate storages • Registers: precise and approx are distinguished using register number • Cache and memory: distinguished by address. • Approximate operations • Approx instructions use special FUs that perform approx operations.
Hardware Techniques for Saving Energy • Voltage scaling in logic circuits • Width reduction is FP operations • DRAM refresh rate • SRAM supply voltage
Implementation • Annotation • Manually annotate each application using EnerJ • Focused on critical code where most of the time is spent. • Simulation • Implemented a compiler and runtime system that executes EnerJ code • Utilize instrumentation calls to inject transient faults to emulate approx. • Approximation • Reduce FP bit-width, flip bit of accesses into SRAM and DRAM • Assumption: heap data in DRAM, stack data in SRAM.
Annotated Declarations • Primary approx data is in a small portion of code • Annotations are sparse and straightforward to insert
Energy Savings • Save 9%-48% of total execution energy • Majority of savings come from Base to Mild
Output Error • Metric: compare approx result against precise one • “Mild” configuration is a good fit for all
Summary • Approximate computing is promising • A new way to save energy in large classes of applications. • Proposed type system • 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 approxalgs. • Implementations and evaluations • 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