Authors James Pallister, Jeremy Bennett,
License CC-BY-2.0
Identifying compiler options to minimize energy
consumption by embedded programs
Jeremy Bennett, James Pallister Embecosm
GCC Cauldron, Prague, 9 July 2012
About Embecosm
FLOSS software house developing embedded SW tools
– GNU and (soon) LLVM tool chains
– Hardware simulation (Verilator and Icarus Verilog)
Founded 2008
– UK HQ
– 4 staff
– Joern Rennecke leads GCC work
– Jeremy Bennett leads GDB and HW modeling work
GCC interests
– Adapteva Epiphany
– Synopsys ARC600/700
– OpenRISC 1000
– MILEPOST
Why?
Ericsson T65
– released 2001
– Li-Ion 720 mAh
– standby 300 h
– talk time 11 h
– includes talk/standby prediction
Copyright © 2012 Embecosm. Freely available under a Creative Commons license 3
Why?
Ericsson T65 Sony Ericsson Xperia X10 mini
– released 2001 – released 2010
– Li-Ion 720 mAh – Li-polymer 930 mAh
– standby 300 h – standby up to 285 h (3G) / 360 h
– talk time 11 h (2G)
– includes talk/standby prediction – talk time up to 4 h (2G) / 3.5 h (3G)
Copyright © 2012 Embecosm. Freely available under a Creative Commons license 4
Free Mobile Apps
“Drain Battery Faster”
Copyright © 2012 Embecosm. Freely available under a Creative Commons license 5
Improving Battery Life
Application
Compiler
Speculation!
Programming language
ISA
Architecture
RTL synthesis
Gate
Layout
0 50 100 150 200 250 300
Relative battery life
Based on Bennett & Eder, 2011
Copyright © 2012 Embecosm. Freely available under a Creative Commons license 6
Energy Saving Today
Largely in the realm of hardware engineering
Hardware design aims to mimimize
– static (leakage) power loss
– dynamic (switching) power loss
Techniques used
– dynamic voltage and frequency scaling (DVFS)
– multiple mode operation (standby, sleep, suspend, off)
Scope for savings
– P = V2R
– on-chip voltage can range from ~0.5V to ~1.5V
– lower frequencies mean lower voltages can be used
win on both static and dynamic power loss
Is this where the greatest savings can be made?
Copyright © 2012 Embecosm. Freely available under a Creative Commons license 7
Focussing on Software
Software controls the hardware
– algorithms and data flow
– compiler optimization traditionally speed or size as objective
Few software engineers appreciate this
– how does an algorithm affect the power consumption?
– power consumption is often a secondary design criterion in software
Yet biggest savings are at the higher levels of abstraction
– choice of algorithm
– data handling
– instruction set architecture and compiler
Why?
– energy is consumed by the hardware computations
– but ultimate control of that hardware lies with the software
Copyright © 2012 Embecosm. Freely available under a Creative Commons license 8
This is Not New
Kaushik Roy and Mark C. Johnson. 1997. Software design for low
power. In Low power design in deep submicron electronics,
Wolfgang Nebel and Jean Mermet (Eds.). Kluwer Nato Advanced
Science Institutes Series, Vol. 337. Kluwer Academic Publishers,
Norwell, MA, USA, pp 433-460.
Choose the best algorithm to fit the hardware
Tune algorithms to manage memory size and memory access
Optimize for performance, making best use of parallelism
Use hardware support for power management
Minimize CPU and data path switching in the generated code
Copyright © 2012 Embecosm. Freely available under a Creative Commons license 9
Our Project
Is the compiler a good place to seek energy saving?
– how influential are compiler options?
No one knows!
– lots of speculation, little experimental data
Our project, July-Oct 2012 with Bristol University & EACO
– measure energy consumption by a representative set of programs
what set?
– do compiler options have any impact?
is optimizing for speed the same as optimizing for power
– does choice of compiler (GCC, LLVM) make a difference?
– does architecture (XMOS, ARM, Epiphany) make a difference?
Your help is needed...
Copyright © 2012 Embecosm. Freely available under a Creative Commons license 10
The Future
MILEPOST GCC
MILEPOST GCC Continuous Collective
Program1 Compilation Framework (CCC)
Training
IC Plugins
Drivers for
... Recording pass iterative
sequences Global
compilation Optimization
Extracting static and model Database
Programn Program features training
EU funded research project completed in 2009
– aim to achieve similar results to full Iterative Compilation
This could be ideal for energy minimization
From Fursin et al, 2008
Copyright © 2012 Embecosm. Freely available under a Creative Commons license 11
The Future
MILEPOST
MILEPOST GCC Continuous Collective
Program1 Compilation Framework (CCC)
Training
IC Plugins
Drivers for
... Recording pass iterative
sequences Global
compilation Optimization
Extracting static and model Database
Programn Program features training
MILEPOST GCC
Deployment
Extracting static Predicting “good”
program features passes to improve
New program
Selecting “good” exec time, code size
passes and compile time
From Fursin et al, 2008
Copyright © 2012 Embecosm. Freely available under a Creative Commons license 12
Thank You
Thank You
www.embecosm.com
Copyright © 2012 Embecosm. Freely available under a Creative Commons license 13