Overview

The pioneers of the computer revolution hand-tuned their programs to take advantage of every architectural resource.  As resources became more abundant and datapaths widened, programming styles changed.  Programmers paid less attention to details such as the bitwidth (e.g., 1, 8, 16, 32) of program variables.  For instance, today it is common to use a 32-bit integer data type to represent boolean variables!  How can we explain this apparent programmer apathy?

First of all, memory became less of a commodity, making it unnecessary to waste valuable programmer time packing several sub-word quantities together.   In addition, although datapaths became wider, the entire datapath was exercised regardless of operand size.  Lastly, the additional overhead of packing and unpacking sub-word quantities -- now only to save abundant memory -- eventually led to performance degradation.

Recent architectural innovations and compilation techniques have re-invigorated the need for accurately specified bitwidths.  For instance, recent compiler advances have made it possible to automatically extract data-parallelism from sequential code, dramatically improving performance on processors that support sub-word operations (see the SLP project for more information).

In addition, there has been a recent surge of both academic and industrial interest in creating reconfigurable architectures.  For these architectures, bitwidth information is of paramount importance: smaller operand sizes correspond to smaller occupation of the reconfigurable substrate.

We created the Bitwise compiler to automatically determine the bitwidth of program variables.  At a high level, Bitwise is a SUIF compiler pass that annotates variables with bitwidth information.  The scope of Bitwise includes fixed point arithmetic, bit manipulation and boolean operations.  It uses additional sources of information such as type casts, array bounds, and loop iteration counts to refine the bitwidth information gathered.

In some cases, Bitwise is able to analyze the bitwidth information as accurately as the bitwidth information gathered from run-time profiles.  On average we reduce the size of program scalars by 12% - 80% and program arrays by up to 93%.

 


 

 

Papers

M. Stephenson and J. Babb and S. Amarasinghe.  Bitwidth Analysis with Application to Silicon Compilation.  In Proceedings of the SIGPLAN conference on Programming Language Design and Implementation, Vancouver, British Columbia, June 2000. (ps,pdf).

Mark Stephenson.  Bitwise: Optimizing Bitwidths Using Data-Range Propagation.  Master's thesis.  Massachusetts Institute of Technology.  May 2000. (ps,pdf).

M. Stephenson and J. Babb and S. Amarasinghe.  Bitwidth Analysis with Application to Silicon Compilation.  MIT/LCS Technical Memo, LCS-TM-602, November 18, 1999.  (ps,pdf).

To view the benchmarks surveyed in these publications click here.

 

Presentations

Programming Language Design and Implementation 2000 presentation (ppt).
 

Related Work

The piperench project at CMU.

 

People

Mark Stephenson
mstephen@mit.edu


Jonathan Babb
jbabb@ee.princeton.edu

  
Saman Amarasinghe
saman@lcs.mit.edu