Compiling for Resource-Constrained Platforms using ASSHes: Application- and System-Specific Heuristics

We present and evaluate application- and system-specific heuristics (ASSHes) for optimizing embedded software. ASSHes are scripts that decide which compiler optimizations to apply; they make decisions using feedback from previous compilations, using the results of program analyses, and using high-level information, e.g., “there are only 4 KB of RAM, and interrupt handlers 5‐7 should be fast since we expect them to execute very frequently.” In contrast, traditional compilers base optimization decisions on built-in heuristics that are oblivious to high-level application- and platform-specific concerns. The ASSH effectively becomes the high-level optimization policy and the existing compiler becomes a low-level mechanism for applying code transformations. ASSHes are more generic than previous approaches to compiling embedded software: they permit compilation to be directed towards meeting many different goals and combinations of goals. So far we have investigated ASSHes that control two optimizations: loop unrolling and function inlining. We evaluate ASSHes by applying them to TinyOS sensor network applications, where they have successfully reduced resource usage. For example, for one large application we can either reduce worst-case stack depth by 16%, reduce code size by 3.5%, or reduce the amount of time the processor is active by 14% (our baseline for comparison is the output of the nesC compiler, which itself performs aggressive crossmodule inlining). These various improvements conflict: they can be achieved individually but not together—dealing with tradeoffs among resources is central to designing efficient embedded systems.

[1]  Laurie Hendren,et al.  Soot---a java optimization framework , 1999 .

[2]  Jan Gustafsson,et al.  Worst-case execution-time analysis for embedded real-time systems , 2003, International Journal on Software Tools for Technology Transfer.

[3]  L. Almagor,et al.  Finding effective compilation sequences , 2004, LCTES '04.

[4]  Scott A. Mahlke,et al.  Using profile information to assist classic code optimizations , 1991, Softw. Pract. Exp..

[5]  Ko-Yang Wang Precise compile-time performance prediction for superscalar-based computers , 1994, PLDI '94.

[6]  M.L. Soffa,et al.  Capturing the effects of code improving transformations , 1998, Proceedings. 1998 International Conference on Parallel Architectures and Compilation Techniques (Cat. No.98EX192).

[7]  Mary Lou Soffa,et al.  Predicting the impact of optimizations for embedded systems , 2003, LCTES '03.

[8]  Matthias Felleisen,et al.  Hygienic macro expansion , 1986, LFP '86.

[9]  John Regehr,et al.  Eliminating stack overflow by abstract interpretation , 2003, TECS.

[10]  Todd L. Veldhuizen,et al.  Using C++ template metaprograms , 1996 .

[11]  Matt Welsh,et al.  Simulating the power consumption of large-scale sensor network applications , 2004, SenSys '04.

[12]  Huiyang Zhou,et al.  Code size efficiency in global scheduling for ILP processors , 2002, Proceedings Sixth Annual Workshop on Interaction between Compilers and Computer Architectures.

[13]  Jens Palsberg,et al.  Deadline analysis of interrupt-driven software , 2003, IEEE Transactions on Software Engineering.

[14]  Keith D. Cooper,et al.  An experiment with inline substitution , 1991, Softw. Pract. Exp..

[15]  Craig Chambers,et al.  Towards better inlining decisions using inlining trials , 1994, LFP '94.

[16]  David B. Whalley,et al.  Timing the WCET of embedded applications , 2004, Proceedings. RTAS 2004. 10th IEEE Real-Time and Embedded Technology and Applications Symposium, 2004..

[17]  Jens Palsberg,et al.  Compiling with code-size constraints , 2004, TECS.

[18]  David E. Culler,et al.  The nesC language: A holistic approach to networked embedded systems , 2003, PLDI.

[19]  Yunheung Paek,et al.  Finding effective optimization phase sequences , 2003, LCTES '03.

[20]  George C. Necula,et al.  CIL: Intermediate Language and Tools for Analysis and Transformation of C Programs , 2002, CC.

[21]  Steven W. K. Tjiang,et al.  SUIF: an infrastructure for research on parallelizing and optimizing compilers , 1994, SIGP.

[22]  Douglas L. Jones,et al.  Fast searches for effective optimization phase sequences , 2004, PLDI '04.

[23]  John S. Baras,et al.  ATEMU: a fine-grained sensor network simulator , 2004, 2004 First Annual IEEE Communications Society Conference on Sensor and Ad Hoc Communications and Networks, 2004. IEEE SECON 2004..

[24]  Anantha P. Chandrakasan,et al.  Low-power CMOS digital design , 1992 .

[25]  Robert Szewczyk,et al.  System architecture directions for networked sensors , 2000, ASPLOS IX.

[26]  Eric Eide,et al.  Knit: component composition for systems software , 2000, OSDI.

[27]  Rainer Leupers,et al.  Function inlining under code size constraints for embedded processors , 1999, 1999 IEEE/ACM International Conference on Computer-Aided Design. Digest of Technical Papers (Cat. No.99CH37051).

[28]  Calvin Lin,et al.  Broadway: A Compiler for Exploiting the Domain-Specific Semantics of Software Libraries , 2005, Proceedings of the IEEE.

[29]  Arch D. Robison,et al.  Impact of economics on compiler optimization , 2001, JGI '01.

[30]  Karl Pettis,et al.  Profile guided code positioning , 1990, PLDI '90.