Fast Greedy Weighted Fusion

  • Authors:
  • Ken Kennedy

  • Affiliations:
  • Center for High Performance Software, Rice University, 6100 Main, Houston, Texas

  • Venue:
  • International Journal of Parallel Programming
  • Year:
  • 2001

Quantified Score

Hi-index 0.00

Visualization

Abstract

Loop fusion is an important compiler strategy for managing memory hierarchy. By fusing loops that use the same data elements, a compiler can reduce the distance between accesses to the same datum and avoid costly cache misses. Unfortunately the problem of optimal loop fusion for reuse has been shown to be NP-hard, so compilers must resort to heuristics to avoid unreasonably long compile times. Greedy strategies are often excellent heuristics that produce high-quality solutions quickly. We present an algorithm for greedy weighted fusion, in which the heaviest edge (the one with the most reuse) is selected for possible fusion on each step. The algorithm is shown to be fast in the sense that it takes O(V(E+V)) time, which is arguably optimal for producing the greedy solution. In addition, this algorithm has the advantage that it requires only O(E) edge reweighting operations after fusions. This means that it is suitable for use on the problem of enhancing cache reuse, for which the ideal reweighting operation is much more complex than addition. If each reweighting operation requires no more than O(V) time, the time bound of the overall fusion process remains at O(V(E+V)).