Abstract
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.
Preview
Unable to display preview. Download preview PDF.
References
W.B. Ackerman and J.B. Dennis. VAL-A Value-Oriented Algorithmic Language: Preliminary Reference Manual. TR 218, MIT, Cambridge, MA, 1979.
A.V. Aho, R. Sethi, and J.D. Ullman. Compilers — Principles, Techniquies, and Tools. Addison-Wesley, 1986. ISBN 0-201-10194-7.
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.
D.F. Bacon, S.L. Graham, and O.J. Sharp. Compiler Transformations for HighPerformance Computing. ACM Computing Surveys, 26(4): 345–420, 1994.
G.E. Blelloch. NESL: A Nested Data-Parallel Language (Version 3.0). Carnegie Mellon University, 1994.
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.
D. Braess. Finite Elemente. Springer, 1996. ISBN 3-540-61905-4.
D.C. Cann. Retire Fortran? A Debate Rekindled. Communications of the ACM, 35(8): 81–89, 1992.
W.-N. Chin. Safe Fusion of Functional Expressions II: Further Improvements. Journal of Functional Programming, 4(4): 515–550, 1994.
D. Gilly et al. Unix in a Nutshell. A Nutshell Handbook. O'Reilly & Associates, Inc., 1992. ISBN 1-56592-001-5.
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.
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.
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.
K.E. Iverson. A Programming Language. Wiley, New York, 1962.
M.A. Jenkins and W.H. Jenkins. The Q'Nial Language and Reference Manuals. Nial Systems Ltd., Ottawa, Canada, 1993.
B.W. Kernighan and D.M. Ritchie. Programmieren in C. PC professionell. Hanser, 1990. ISBN 3-446-15497-3.
J. Launchbury and S. Peyton Jones. Lazy Functional State Threads. In Programming Languages Design and Implementation. ACM Press, 1994.
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.
D.A. Padua and M.J. Wolfe. Advanced Compiler Optimizations for Supercomputers. Comm. ACM, 29(12): 1184–1201, 1986.
M.J. Plasmeijer and M. van Eckelen. Concurrent Clean 1.0 Language Report. University of Nijmegen, 1995.
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.
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.
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.
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.
P.L. Wadler. Deforestation: transforming programs to eliminate trees. Theoretical Computer Science, 73(2): 231–248, 1990.
H. Wehnes. FORTRAN-77: Strukturierte Programmierung mit FORTRAN-77. Carl Hanser Verlag, 1985.
M.J. Wolfe. High-Performance Compilers for Parallel Computing. Addison-Wesley, 1995. ISBN 0-8053-2730-4.
H. Zima and B. Chapman. Supercompilers for Parallel and Vector Computers. Addison-Wesley, 1991.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1998 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Scholz, SB. (1998). With-loop-folding in Sac-condensing consecutive array operations. In: Clack, C., Hammond, K., Davie, T. (eds) Implementation of Functional Languages. IFL 1997. Lecture Notes in Computer Science, vol 1467. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0055425
Download citation
DOI: https://doi.org/10.1007/BFb0055425
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-64849-9
Online ISBN: 978-3-540-68528-9
eBook Packages: Springer Book Archive