With-Loop Fusion for Data Locality and Parallelism

  • Clemens Grelck
  • Karsten Hinckfuß
  • Sven-Bodo Scholz
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4015)


With are versatile array comprehensions used in the functional array language SaC to implement aggregate array operations that are applicable to arrays of any rank and shape. We describe the fusion of with as a novel optimisation technique to improve both the data locality of compiled code in general and the synchronisation behaviour of compiler-parallelised code in particular. Some experiments demonstrate the impact of With-loop-fusion on the runtime performance of compiled SaC code.


Functional Language Runtime Performance Code Transformation Relaxation Step Loop Fusion 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Scholz, S.B.: Single Assignment C — Efficient Support for High-Level Array Operations in a Functional Setting. J. Functional Programming 13, 1005–1059 (2003)MATHCrossRefMathSciNetGoogle Scholar
  2. 2.
    Grelck, C.: Implementing the NAS Benchmark MG in SAC. In: Proceedings of the 16th International Parallel and Distributed Processing Symposium (IPDPS 2002), Fort Lauderdale, USA. IEEE Computer Society Press, Los Alamitos (2002)Google Scholar
  3. 3.
    Grelck, C., Scholz, S.-B.: Towards an Efficient Functional Implementation of the NAS Benchmark FT. In: Malyshkin, V.E. (ed.) PaCT 2003. LNCS, vol. 2763, pp. 230–235. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  4. 4.
    Iverson, K.: A Programming Language. John Wiley, New York (1962)MATHGoogle Scholar
  5. 5.
    Iverson, K.: Programming in J. Iverson Software Inc., Toronto (1991)Google Scholar
  6. 6.
    Jenkins, M.: Q’Nial: A Portable Interpreter for the Nested Interactive Array Language Nial. Software Practice and Experience 19, 111–126 (1989)CrossRefGoogle Scholar
  7. 7.
    Scholz, S.-B.: WITH-loop-folding in SAC - condensing consecutive array operations. In: Clack, C., Hammond, K., Davie, T. (eds.) IFL 1997. LNCS, vol. 1467, pp. 72–92. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  8. 8.
    Grelck, C., Scholz, S.-B., Trojahner, K.: With-Loop Scalarization – Merging Nested Array Operations. In: Trinder, P., Michaelson, G.J., Peña, R. (eds.) IFL 2003. LNCS, vol. 3145, pp. 118–134. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  9. 9.
    Appel, A.: SSA is Functional Programming. ACM SIGPLAN Notices 33 (1998)Google Scholar
  10. 10.
    Hinckfuß, K.: With-Loop Fusion für die Funktionale Programmiersprache SAC. Master’s thesis, University of Lübeck, Institute of Software Technology and Programming Languages, Lübeck, Germany (2005)Google Scholar
  11. 11.
    Chin, W.: Towards an Automated Tupling Strategy. In: Proceedings of the ACM SIGPLAN Symposium on Partial Evaluation and Semantic-Based Program Manipulation (PEPM 1997), Copenhagen, Denmark, pp. 119–132. ACM Press, New York (1993)CrossRefGoogle Scholar
  12. 12.
    Wadler, P.: Deforestation: Transforming Programs to Eliminate Trees. Theoretical Computer Science 73, 231–248 (1990)MATHCrossRefMathSciNetGoogle Scholar
  13. 13.
    Gill, A., Launchbury, J., Peyton Jones, S.: A Short Cut to Deforestation. In: Proceedings of the Conference on Functional Programming Languages and Computer Architecture (FPCA 1993), Copenhagen, Denmark, pp. 223–232. ACM Press, New York (1993)CrossRefGoogle Scholar
  14. 14.
    Chin, W.: Safe Fusion of Functional Expressions II: Further Improvements. J. Functional Programming 4, 515–550 (1994)CrossRefGoogle Scholar
  15. 15.
    van Arkel, D., van Groningen, J., Smetsers, S.: Fusion in Practice. In: Peña, R., Arts, T. (eds.) IFL 2002. LNCS, vol. 2670, Springer, Heidelberg (2003)CrossRefGoogle Scholar
  16. 16.
    Alimarine, A., Plasmeijer, R.: A Generic Programming Extension for Clean. In: Arts, T., Mohnen, M. (eds.) IFL 2002. LNCS, vol. 2312, pp. 168–186. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  17. 17.
    Löh, A., Clarke, D., Jeuring, J.: Dependency-style Generic Haskell. In: Proceedings of the 8th ACM SIGPLAN Conference on Functional Programming (ICFP 2003), Uppsala, Sweden, pp. 141–152. ACM Press, New York (2003)CrossRefGoogle Scholar
  18. 18.
    Alimarine, A., Smetsers, S.: Improved Fusion for Optimizing Generics. In: Hermenegildo, M.V., Cabeza, D. (eds.) PADL 2004. LNCS, vol. 3350, pp. 203–218. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  19. 19.
    Chakravarty, M.M., Keller, G.: Functional Array Fusion. In: Proceedings of the 6th ACM SIGPLAN International Conference on Functional Programming (ICFP 2001), Florence, Italy, pp. 205–216. ACM Press, New York (2001)CrossRefGoogle Scholar
  20. 20.
    McKinley, K., Carr, S., Tseng, C.W.: Improving Data Locality with Loop Transformations. ACM Transactions on Programming Languages and Systems 18 (1996)Google Scholar
  21. 21.
    Manjikian, N., Abdelrahman, T.: Fusion of Loops for Parallelism and Locality. IEEE Transactions on Parallel and Distributed Systems 8, 193–209 (1997)CrossRefGoogle Scholar
  22. 22.
    Roth, G., Kennedy, K.: Loop Fusion in High Performance Fortran. In: Proceedings of the 12th ACM International Conference on Supercomputing (ICS 1998), Melbourne, Australia, pp. 125–132. ACM Press, New York (1998)CrossRefGoogle Scholar
  23. 23.
    Xue, J.: Aggressive Loop Fusion for Improving Locality and Parallelism. In: Pan, Y., Chen, D.-x., Guo, M., Cao, J., Dongarra, J. (eds.) ISPA 2005. LNCS, vol. 3758, pp. 224–238. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  24. 24.
    Grelck, C.: Shared memory multiprocessor support for functional array processing in SAC. J. Functional Programming 15, 353–401 (2005)MATHCrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Clemens Grelck
    • 1
  • Karsten Hinckfuß
    • 1
  • Sven-Bodo Scholz
    • 2
  1. 1.Institute of Software Technology and Programming LanguagesUniversity of LübeckGermany
  2. 2.Department of Computer ScienceUniversity of HertfordshireUnited Kingdom

Personalised recommendations