With-loop-folding in Sac-condensing consecutive array operations

  • Sven-Bodo Scholz
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1467)


This paper introduces a new compiler optimization called With-loop-folding. It is based on a special loop construct, the with-loop, which in the functional language SAC (for Single Assignment C) serves as a versatile vehicle to describe array operations on an elementwise basis. A general mechanism for combining two of these With-loops into a single loop construct is presented. This mechanism constitutes a powerful tool when it comes to generate efficiently executable code from high-level array specifications. By means of a few examples it is shown that even complex nestings of array operations similar to those available in Apl can be transformed into single loop operations which are similar to hand-optimized With-loop specifications. As a consequence, the way a complex array operation is combined from primitive array operations does not affect the runtime performance of the compiled code, i.e., the programmer is liberated from the burden to take performance considerations into account when specifying complex array operations.


Index Vector Functional Language Language Construct Operation Part Executable Code 
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]
    W.B. Ackerman and J.B. Dennis. VAL-A Value-Oriented Algorithmic Language: Preliminary Reference Manual. TR 218, MIT, Cambridge, MA, 1979.Google Scholar
  2. [2]
    A.V. Aho, R. Sethi, and J.D. Ullman. Compilers — Principles, Techniquies, and Tools. Addison-Wesley, 1986. ISBN 0-201-10194-7.Google Scholar
  3. [3]
    Arvind, K.P. Gostelow, and W. Plouffe. The ID-Report: An asynchronous Programming Language and Computing Machine. Technical Report 114, University of California at Irvine, 1978.Google Scholar
  4. [4]
    D.F. Bacon, S.L. Graham, and O.J. Sharp. Compiler Transformations for HighPerformance Computing. ACM Computing Surveys, 26(4): 345–420, 1994.CrossRefGoogle Scholar
  5. [5]
    G.E. Blelloch. NESL: A Nested Data-Parallel Language (Version 3.0). Carnegie Mellon University, 1994.Google Scholar
  6. [6]
    A.P.W. Böhm, D.C. Cann, R.R. Oldehoeft, and J.T. Feo. SISAL Reference Manual Language Version 2.0. CS 91-118, Colorado State University, Fort Collins, Colorado, 1991.Google Scholar
  7. [7]
    D. Braess. Finite Elemente. Springer, 1996. ISBN 3-540-61905-4.Google Scholar
  8. [8]
    D.C. Cann. Retire Fortran? A Debate Rekindled. Communications of the ACM, 35(8): 81–89, 1992.CrossRefGoogle Scholar
  9. [9]
    W.-N. Chin. Safe Fusion of Functional Expressions II: Further Improvements. Journal of Functional Programming, 4(4): 515–550, 1994.CrossRefGoogle Scholar
  10. [10]
    D. Gilly et al. Unix in a Nutshell. A Nutshell Handbook. O'Reilly & Associates, Inc., 1992. ISBN 1-56592-001-5.Google Scholar
  11. [11]
    C. Grelck and S.B. Scholz. Classes and Objects as Basis for I/O in SAC. In T. Johnsson, editor, Proceedings of the Workshop on the Implementation of Functional Languages'95, pages 30–44. Chalmers University, 1995.Google Scholar
  12. [12]
    J. Hammes, S. Sur, and W. Böhm. On the effectiveness of functional language features: NAS benchmark FT. Journal of Functional Programming, 7(1): 103–123, 1997.zbMATHCrossRefGoogle Scholar
  13. [13]
    K. Hammond, L. Augustsson, B. Boutel, et al. Report on the Programming Language Haskell: A Non-strict, Purely Functional Language. University of Glasgow, 1995. Version 1.3.Google Scholar
  14. [14]
    K.E. Iverson. A Programming Language. Wiley, New York, 1962.zbMATHGoogle Scholar
  15. [15]
    M.A. Jenkins and W.H. Jenkins. The Q'Nial Language and Reference Manuals. Nial Systems Ltd., Ottawa, Canada, 1993.Google Scholar
  16. [16]
    B.W. Kernighan and D.M. Ritchie. Programmieren in C. PC professionell. Hanser, 1990. ISBN 3-446-15497-3.Google Scholar
  17. [17]
    J. Launchbury and S. Peyton Jones. Lazy Functional State Threads. In Programming Languages Design and Implementation. ACM Press, 1994.Google Scholar
  18. [18]
    J.R. McGraw, S.K. Skedzielewski, S.J. Allan, R.R. Oldehoeft, et al.. Sisal: Streams and Iteration in a Single Assignment Language: Reference Manual Version 1.2. M 146, Lawrence Livermore National Laboratory, LLNL, Livermore California, 1985.Google Scholar
  19. [19]
    D.A. Padua and M.J. Wolfe. Advanced Compiler Optimizations for Supercomputers. Comm. ACM, 29(12): 1184–1201, 1986.CrossRefGoogle Scholar
  20. [20]
    M.J. Plasmeijer and M. van Eckelen. Concurrent Clean 1.0 Language Report. University of Nijmegen, 1995.Google Scholar
  21. [21]
    S.-B. Scholz. Single Assignment C — Entwurf und Implementierung einer funktionalen C-Variante mit spezieller Unterstützung shape-invarianter Array-Operationen. PhD thesis, Institut für Informatik und Praktische Mathematik, Universität Kiel, 1996.Google Scholar
  22. [22]
    S.-B. Scholz. On Programming Scientific Applications in Sac — A Functional Language Extended by a Subsystem for High-Level Array Operations. In Werner Kluge, editor, Implementation of Functional Languages, 8th International Workshop, Bad Godesberg, Germany, September 1996, Selected Papers, volume 1268 of LNCS, pages 85–104. Springer, 1997.Google Scholar
  23. [23]
    P.R. Serrarens. Implementing the Conjugate Gradient Algorithm in a Functional Language. In Werner Kluge, editor, Implementation of Functional Languages, 8th International Workshop, Bad Godesberg, Germany, September 1996, Selected Papers, volume 1268 of LNCS, pages 125–140. Springer, 1997.Google Scholar
  24. [24]
    S. Smetsers, E. Barendsen, M. van Eeklen, and R. Plasmeijer. Guaranteeing Safe Destructive Updates through a Type System with Uniqueness Information for Graphs. Technical report, University of Nijmegen, 1993.Google Scholar
  25. [25]
    P.L. Wadler. Deforestation: transforming programs to eliminate trees. Theoretical Computer Science, 73(2): 231–248, 1990.zbMATHMathSciNetCrossRefGoogle Scholar
  26. [26]
    H. Wehnes. FORTRAN-77: Strukturierte Programmierung mit FORTRAN-77. Carl Hanser Verlag, 1985.Google Scholar
  27. [27]
    M.J. Wolfe. High-Performance Compilers for Parallel Computing. Addison-Wesley, 1995. ISBN 0-8053-2730-4.Google Scholar
  28. [28]
    H. Zima and B. Chapman. Supercompilers for Parallel and Vector Computers. Addison-Wesley, 1991.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1998

Authors and Affiliations

  • Sven-Bodo Scholz
    • 1
  1. 1.Dept of Computer ScienceUniversity of KielKielGermany

Personalised recommendations