skip to main content
10.1145/2248418.2248426acmconferencesArticle/Chapter ViewAbstractPublication PagescpsweekConference Proceedingsconference-collections
research-article

A modular memory optimization for synchronous data-flow languages: application to arrays in a lustre compiler

Published:12 June 2012Publication History

ABSTRACT

The generation of efficient sequential code for synchronous data-flow languages raises two intertwined issues: control and memory optimization. While the former has been extensively studied, for instance in the compilation of Lustre and Signal, the latter has only been addressed in a restricted manner. Yet, memory optimization becomes a pressing issue when arrays are added to such languages.

This article presents a two-level solution to the memory optimization problem. It combines a compile-time optimization algorithm, reminiscent of register allocation, paired with language annotations on the source given by the designer. Annotations express in-place modifications and control where allocation is performed. Moreover, they allow external functions performing in-place modifications to be safely imported. Soundness of annotations is guaranteed by a semilinear type system and additional scheduling constraints. A key feature is that annotations for well-typed programs do not change the semantics of the language: removing them may lead to less efficient code but will not alter the semantics.

The method has been implemented in a new compiler for a LUSTRE-like synchronous language extended with hierarchical automata and arrays. Experiments show that the proposed approach removes most of the unnecessary array copies, resulting in faster code that uses less memory.

References

  1. S. Abu-Mahmeed, C. Mccosh, Z. Budimlić, K. Kennedy, K. Ravindran, K. Hogan, P. Austin, S. Rogers, and J. Kornerup. Scheduling tasks to maximize usage of aggregate variables in place. In CC '09: Proceedings of the 18th International Conference on Compiler Construction, pages 204--219, Berlin, Heidelberg, 2009. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. T. Amagbegnon, L. Besnard, and P. Le Guernic. Implementation of the Data-flow Synchronous Language SIGNAL. In Programming Languages Design and Implementation (PLDI), pages 163--173. ACM, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. H. G. Baker. Unify and conquer. In LFP '90: Proceedings of the 1990 ACM conference on LISP and functional programming, pages 218--226, New York, NY, USA, 1990. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. E. Barendsen and S. Smetsers. Uniqueness type inference. In PLILPS '95: Proceedings of the 7th International Symposium on Programming Languages: Implementations, Logics and Programs, pages 189--206, London, UK, 1995. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. A. Benveniste, P. Caspi, S. A. Edwards, N. Halbwachs, P. Le Guernic, and R. De Simone. The synchronous languages twelve years later. In Proceedings of the IEEE, pages 64--83, 2003.Google ScholarGoogle ScholarCross RefCross Ref
  6. A. Benveniste, P. LeGuernic, and Ch. Jacquemot. Synchronous programming with events and relations: the SIGNAL language and its semantics. Science of Computer Programming, 16:103--149, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. D. Biernacki, J.-L. Colaço, G. Hamon, and M. Pouzet. Clock-directed modular code generation for synchronous data-flow languages. In LCTES '08: Proceedings of the 2008 ACM SIGPLAN-SIGBED conference on Languages, compilers, and tools for embedded systems, pages 121--130, New York, NY, USA, 2008. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. D. Brélaz. New methods to color the vertices of a graph. Commun. ACM, 22(4):251--256, 1979. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. P. Caspi, D. Pilaud, N. Halbwachs, and J. A. Plaice. Lustre: a declarative language for real-time programming. In POPL '87: Proceedings of the 14th ACM SIGACT-SIGPLAN symposium on Principles of programming languages, pages 178--188, New York, NY, USA, 1987. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. G. J. Chaitin, M. A. Auslander, A. K. Chandra, J. Cocke, M. E. Hopkins, and P. W. Markstein. Register allocation via coloring. Computer Languages, 6(1):47--57, 1981. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. J.-L. Colaço, B. Pagano, and M. Pouzet. A conservative extension of synchronous data-flow with state machines. In ACM International Conference on Embedded Software (EMSOFT'05), Jersey city, New Jersey, USA, September 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. P. F. Dietz. Fully persistent arrays (extended array). In WADS '89: Proceedings of the Workshop on Algorithms and Data Structures, pages 67--74, London, UK, 1989. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. J.-Y. Girard. Linear logic. Theoretical computer science, 50(1):1--102, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. J. R. Goodman and W.-C. Hsu. Code scheduling and register allocation in large basic blocks. In ICS '88: Proceedings of the 2nd international conference on Supercomputing, pages 442--452, New York, NY, USA, 1988. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. N. Halbwachs, P. Raymond, and C. Ratel. Generating efficient code from data-flow programs. In Third International Symposium on Programming Language Implementation and Logic Programming, Passau, Germany, August 1991.Google ScholarGoogle ScholarCross RefCross Ref
  16. P. Hudak and A. Bloss. The aggregate update problem in functional programming systems. In POPL '85: Proceedings of the 12th ACM SIGACT-SIGPLAN symposium on Principles of programming languages, pages 300--314, New York, NY, USA, 1985. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. X. Leroy. Formal verification of a realistic compiler. Commun. ACM, 52:107--115, July 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. L. Morel. Array Iterators in Lustre: From a Language Extension to Its Exploitation in Validation. EURASIP Journal on Embedded Systems, 2007.Google ScholarGoogle Scholar
  19. D. Novillo. TreeSSA a new optimization infrastructure for GCC. In Proceedings of the 2003 GCC Developers' Summit, pages 181--193, 2003.Google ScholarGoogle Scholar
  20. M. Odersky. How to make destructive updates less destructive. In POPL '91: Proceedings of the 18th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 25--36, New York, NY, USA, 1991. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. B. Pagano. The optimization of iterators and updates for functional arrays in scade 6. Personal communication, June 2010.Google ScholarGoogle Scholar
  22. P. Schnorf, M. Ganapathi, and J. L. Hennessy. Compile-time copy elimination. Softw. Pract. Exper., 23(11):1175--1200, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. P. Wadler. Deforestation: transforming programs to eliminate trees. In Proceedings of the Second European Symposium on Programming, pages 231--248, Amsterdam, The Netherlands, 1988. North-Holland Publishing Co. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. P. Wadler. Linear types can change the world! In IFIP TC 2 Working Conference on Programming Concepts and Methods, Sea of Galilee, Israel, pages 347--359. North Holland, 1990.Google ScholarGoogle Scholar

Index Terms

  1. A modular memory optimization for synchronous data-flow languages: application to arrays in a lustre compiler

          Recommendations

          Comments

          Login options

          Check if you have access through your login credentials or your institution to get full access on this article.

          Sign in
          • Published in

            cover image ACM Conferences
            LCTES '12: Proceedings of the 13th ACM SIGPLAN/SIGBED International Conference on Languages, Compilers, Tools and Theory for Embedded Systems
            June 2012
            153 pages
            ISBN:9781450312127
            DOI:10.1145/2248418
            • cover image ACM SIGPLAN Notices
              ACM SIGPLAN Notices  Volume 47, Issue 5
              LCTES '12
              MAY 2012
              152 pages
              ISSN:0362-1340
              EISSN:1558-1160
              DOI:10.1145/2345141
              Issue’s Table of Contents

            Copyright © 2012 ACM

            Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 12 June 2012

            Permissions

            Request permissions about this article.

            Request Permissions

            Check for updates

            Qualifiers

            • research-article

            Acceptance Rates

            Overall Acceptance Rate116of438submissions,26%

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader