Slice-hoisting for Array-size Inference in MATLAB
Arun Chauhan and Ken Kennedy
To appear at
16th Workshop on Languages and Compilers for Parallel Computing (LCPC03), College Station, TX, 2-4 October 2003
Full Text, Printable Abstract.
Abstract
Inferring variable types precisely is very important to be able to
compile MATLAB libraries effectively in the context of the telescoping
languages framework being developed at Rice. Past studies have
demonstrated the value of type information in optimizing MATLAB. The
variable types are inferred through a static approach based on writing
propositional constraints on program statements.
The static approach has certain limitations with respect to inferring
array-sizes. Imprecise inference of array-sizes can have a drastic
effect on the performance of the generated code, especially in those
cases where arrays are resized dynamically. The impact of appropriate
array allocation is also borne out of earlier studies. This paper
presents a new approach to inferring array-sizes, called
slice-hoisting. The approach is based on simple code transformations
and is easy to implement in a practical compiler. Experimental
evaluation shows that slice-hoisting, along with the constraints-based
static algorithm, can result in a very high level of precision in
inferring MATLAB array sizes.