skip to main content
research-article

Specifying and verifying sparse matrix codes

Authors Info & Claims
Published:27 September 2010Publication History
Skip Abstract Section

Abstract

Sparse matrix formats are typically implemented with low-level imperative programs. The optimized nature of these implementations hides the structural organization of the sparse format and complicates its verification. We define a variable-free functional language (LL) in which even advanced formats can be expressed naturally, as a pipeline-style composition of smaller construction steps. We translate LL programs to Isabelle/HOL and describe a proof system based on parametric predicates for tracking relationship between mathematical vectors and their concrete representations. This proof theory automatically verifies full functional correctness of many formats. We show that it is reusable and extensible to hierarchical sparse formats.

Skip Supplemental Material Section

Supplemental Material

icfp-weds-1030-arnoldholzl.mov

References

  1. }}J. Backus. Can programming be liberated from the von Neumann style? A functional style and its algebra of programs. Communications of the ACM (CACM), 21(8):613--641, 1978. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. }}A. J. C. Bik, P. Brinkhaus, P. M. W. Knijnenburg, and H. A. G. Wijshoff. The automatic generation of sparse primitives. ACM Transactions on Mathematical Software, 24(2):190--225, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. }}G. E. Blelloch. Programming parallel algorithms. Communications of the ACM (CACM), 39(3):85--97, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. }}M. M. T. Chakravarty, R. Leshchinskiy, S. P. Jones, G. Keller, and S. Marlow. Data Parallel Haskell: a status report. In Workshop on Declarative Aspects of Multicore Programming (DAMP), pages 10--18, New York, NY, USA, 2007. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. }}J. Duan, J. Hurd, G. Li, S. Owens, K. Slind, and J. Zhang. Functional correctness proofs of encryption algorithms. In Logic for Programming, Artificial Intelligence and Reasoning (LPAR), pages 519--533, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. }}C. Flanagan, K. R. M. Leino, M. Lillibridge, G. Nelson, J. B. Saxe, and R. Stata. Extended static checking for Java. In Programming Languages Design and Implementation, pages 234--245, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. }}E.-J. Im. Optimizing the performance of sparse matrix-vector multiplication. PhD thesis, University of California, Berkeley, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. }}V. Kotlyar and K. Pingali. Sparse code generation for imperfectly nested loops with dependences. In International Conference on Supercomputing (ICS), pages 188--195, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. }}V. Kotlyar, K. Pingali, and P. Stodghill. A relational approach to the compilation of sparse matrix programs. In Euro-Par, pages 318--327, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. }}N. Mateev, K. Pingali, P. Stodghill, and V. Kotlyar. Next-generation generic programming and its application to sparse matrix computations. In International Conference on Supercomputing (ICS), pages 88--99, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. }}T. Nipkow, L. C. Paulson, and M. Wenzel. Isabelle/HOL: A Proof Assistant for Higher-Order Logic, volume 2283 of Lecture Notes in Computer Science. Springer-Verlag, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. }}S. Obua. Flyspeck II: The Basic Linear Programs. PhD thesis, Technische Universität München, 2008.Google ScholarGoogle Scholar
  13. }}M. Sagiv, T. W. Reps, and R. Wilhelm. Parametric shape analysis via 3-valued logic. ACM Transactions on Programming Languages and Systems (TOPLAS), 24(3):217--298, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. }}R. W. Vuduc. Automatic performance tuning of sparse matrix kernels. PhD thesis, University of California, Berkeley, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. }}M. Wenzel. The Isabelle/Isar Implementation. Technische Universität München. http://isabelle.in.tum.de/doc/implementation.pdf.Google ScholarGoogle Scholar
  16. }}M. Wildmoser and T. Nipkow. Certifying machine code safety: Shallow versus deep embedding. In International Conference on Theorem Proving in Higher-Order Logics, pages 305--320, 2004.Google ScholarGoogle ScholarCross RefCross Ref

Index Terms

  1. Specifying and verifying sparse matrix codes

      Recommendations

      Reviews

      Jacques Carette

      It is increasingly recognized that the heroics involved in coding efficient, low-level, imperative programs for various tasks are not sustainable. While the gain in efficiency might be quite real, the loss of certainty (with respect to correctness) is just as real. A promising, recent line of research is to instead use a focused, purely functional, higher-level domain-specific language (DSL). The use of a focused DSL, here referred to as a "little language,"? presents opportunities to encode the complex invariants that are natural in a domain in ways that are typically unavailable in general-purpose, imperative languages. In this paper, the domain choices are sparse matrix formats and associated (simple) operations. The result of picking the right abstractions (for example, those that are derived from the natural semantics of the domain) and omitting general-purpose abstractions is a language that can be fruitfully used to generate low-level implementations; in addition, its correctness can be mechanically verified (the authors choose Isabelle/HOL for this purpose). The authors present their work in a very readable manner, with well-chosen and well-illustrated examples. The material is appropriately motivated, with a pleasant mix of conceptual illustration and formal presentation. Several nice ideas are presented, including a shift to relations rather than representation functions. The authors also use solid engineering details to simplify their proofs. This work might have been better had the authors been more aware of related works such as single-assignment C, computer algebra, and the Spiral project. Furthermore, their (ab)use of lists and predicates (like their indexed lists and associative lists) lies at a somewhat lower level of abstraction than would be optimal. The use of rewrite rules also makes certain parts feel more ad hoc than seems necessary. Nevertheless, this represents an excellent step forward in the quest for liberating efficient sparse matrix codes from the tyranny of low-level languages and moving those codes into the realm of modular specification and verification. Online Computing Reviews Service

      Access critical reviews of Computing literature here

      Become a reviewer for Computing Reviews.

      Comments

      Login options

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

      Sign in

      Full Access

      • Published in

        cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 45, Issue 9
        ICFP '10
        September 2010
        382 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/1932681
        Issue’s Table of Contents
        • cover image ACM Conferences
          ICFP '10: Proceedings of the 15th ACM SIGPLAN international conference on Functional programming
          September 2010
          398 pages
          ISBN:9781605587943
          DOI:10.1145/1863543

        Copyright © 2010 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 27 September 2010

        Check for updates

        Qualifiers

        • research-article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader

      ePub

      View this article in ePub.

      View ePub
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!