Contents    Page-10    Prev    Next    Page+10    Index   

Partial Evaluation

Partial evaluation is the technique of evaluating those parts of a program that can be evaluated at compile time, rather than waiting for execution time.

For example, the rotation of a point in homogeneous coordinates by an angle θ around the x axis is accomplished by multiplying by the matrix:

lccr 1 0 0 0
0 cos θ - sin θ 0
0 sin θ cos θ 0
0 0 0 1

Many of the cycles consumed in the matrix multiply would be wasted because they would be trivial computations ( e.g., multiplying by 1 or adding 0).

By unrolling the loops of matrix multiply, substituting the values from the coefficient matrix, and performing partial evaluation on the result, a specialized version of the matrix multiply can be obtained. This version saves many operations:

Version: Load Store Add/Sub Mul Total
General 128 16 48 64 256
Specialized 24 16 8 16 64