Skip to main content

Verified Validation for Affine Scheduling in Polyhedral Compilation

  • Conference paper
  • First Online:
Theoretical Aspects of Software Engineering (TASE 2024)

Abstract

Structural nested loops can be abstracted into polyhedral models, based on which one can perform aggressive loop optimizations; however, the optimizations are often heuristic and complex, and therefore error-prone. Meanwhile, verified compilers, though rigorously correct, still miss powerful optimizing transformations and therefore produce less efficient code than industrial ones. To bridge this gap, this work provides a general verified validation framework based on Bernstein’s conditions for affine scheduling, the core component of polyhedral optimization techniques. It is parameterized over the concrete definitions and proofs of the instruction language to be reusable. As shown in our evaluation, the framework is flexible enough to support both existing verified compilers like CompCert and existing polyhedral compilers like Pluto. The result is fully mechanized in the Coq proof assistant.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    https://compcert.org/doc/html/compcert.cfrontend.Csyntax.html.

  2. 2.

    https://github.com/bondhugula/pluto.

  3. 3.

    Please note that P-Time and V-Time for each test are not comparable, as they pertain to implementations of different algorithms in different programming languages.

References

  1. Bang, S., Nam, S., Chun, I., Jhoo, H.Y., Lee, J.: Smt-based translation validation for machine learning compiler. In: Computer Aided Verification: 34th International Conference, CAV 2022, Haifa, Israel, 7–10 August 2022, Proceedings, Part II, p. 386-407, Springer, Berlin (2022). https://doi.org/10.1007/978-3-031-13188-2_19

  2. Bastoul, C.: Openscop: A specification and a library for data exchange in polyhedral compilation tools. Paris-Sud University, France (September, Technical Report (2011)

    Google Scholar 

  3. Bernstein, A.J.: Analysis of programs for parallel processing. IEEE Trans. Electron. Comput. 15, 757–763 (1966). https://doi.org/10.1109/PGEC.1966.264565

  4. Bondhugula, U., Hartono, A., Ramanujam, J., Sadayappan, P.: A practical automatic polyhedral parallelizer and locality optimizer. SIGPLAN Not. 43(6), 101–113 (2008). https://doi.org/10.1145/1379022.1375595

  5. Boulmé, S., Maréchaly, A., Monniaux, D., Périn, M., Yu, H.: The verified polyhedron library: an overview. In: 2018 20th International Symposium on Symbolic and Numeric Algorithms for Scientific Computing (SYNASC), pp. 9–17, September 2018. https://doi.org/10.1109/SYNASC.2018.00014

  6. Chen, T., et al.: Tvm: an automated end-to-end optimizing compiler for deep learning. In: Proceedings of the 13th USENIX Conference on Operating Systems Design and Implementation, OSDI 2018, pp. 579–594, USENIX Association, USA (2018)

    Google Scholar 

  7. Clément, B., Cohen, A.: End-to-end translation validation for the halide language. Proc. ACM Program. Lang. 6(OOPSLA1) (2022). https://doi.org/10.1145/3527328

  8. Courant, N., Leroy, X.: Verified code generation for the polyhedral model. Proc. ACM Program. Lang. 5(POPL) (2021). https://doi.org/10.1145/3434321

  9. Cuervo Parrino, B., Narboux, J., Violard, E., Magaud, N.: Dealing with arithmetic overflows in the polyhedral model. In: Bondhugula, U., Loechner, V. (eds.) IMPACT 2012–2nd International Workshop on Polyhedral Compilation Techniques. Louis-Noel Pouchet, Paris, France, January 2012

    Google Scholar 

  10. Doerfert, J., Grosser, T., Hack, S.: Optimistic loop optimization. In: Proceedings of the 2017 International Symposium on Code Generation and Optimization, CGO 2017, pp. 292-304, IEEE Press (2017). https://doi.org/10.1109/CGO.2017.7863748

  11. Feautrier, P.: Some efficient solutions to the affine scheduling problem: Part i. one-dimensional time. Int. J. Parall. Program. 21(5), 313–348 (1992a). https://doi.org/10.1007/BF01407835

  12. Feautrier, P.: Some efficient solutions to the affine scheduling problem. part ii. multidimensional time. Int. J. Parall. Program. 21, 389–420 (1992b). https://doi.org/10.1007/BF01379404

  13. Feautrier, P.: Bernstein’s Conditions, pp. 130–134. Springer US, Boston, MA (2011).https://doi.org/10.1007/978-0-387-09766-4_521

  14. Feautrier, P., Lengauer, C.: Polyhedron model. In: Padua, D. (ed.) Encyclopedia of Parallel Computing, pp. 1581–1592, Springer, Boston (2011). https://doi.org/10.1007/978-0-387-09766-4_502

  15. Gourdin, L., Bonneau, B., Boulmé, S., Monniaux, D., Bérard, A.: Formally verifying optimizations with block simulations. Proc. ACM Program. Lang. 7(OOPSLA2) (2023). https://doi.org/10.1145/3622799

  16. Grosser, T., Zheng, H., Aloor, R., Simbürger, A., Größlinger, A., Pouchet, L.N.: Polly - polyhedral optimization in LLVM. In: Alias, C., Bastoul, C. (eds.) 1st International Workshop on Polyhedral Compilation Techniques (IMPACT). Chamonix, France (2011)

    Google Scholar 

  17. Jourdan, J.-H., Pottier, F., Leroy, X.: Validating LR(1) parsers. In: Seidl, H. (ed.) ESOP 2012. LNCS, vol. 7211, pp. 397–416. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-28869-2_20

    Chapter  MATH  Google Scholar 

  18. Leroy, X., Appel, A.W., Blazy, S., Stewart, G.: The CompCert memory model, version 2. Research report RR-7987, INRIA (Jun 2012)

    Google Scholar 

  19. Leroy, X., Blazy, S.: Formal verification of a C-like memory model and its uses for verifying program transformations. J. Autom. Reasoning 41(1), 1–31 (2008). https://doi.org/10.1007/s10817-008-9099-0

  20. Liu, A., Bernstein, G.L., Chlipala, A., Ragan-Kelley, J.: Verified tensor-program optimization via high-level scheduling rewrites. Proc. ACM Program. Lang. 6(POPL) (2022). https://doi.org/10.1145/3498717

  21. Livinskii, V., Babokin, D., Regehr, J.: Fuzzing loop optimizations in compilers for c++ and data-parallel languages. Proc. ACM Program. Lang. 7(PLDI) (2023). https://doi.org/10.1145/3591295

  22. Monniaux, D., Six, C.: Formally verified loop-invariant code motion and assorted optimizations. ACM Trans. Embed. Comput. Syst. 22(1) (2022). https://doi.org/10.1145/3529507

  23. Namjoshi, K.S., Singhania, N.: Loopy: programmable and formally verified loop transformations. In: Rival, X. (ed.) SAS 2016. LNCS, vol. 9837, pp. 383–402. Springer, Heidelberg (2016). https://doi.org/10.1007/978-3-662-53413-7_19

    Chapter  MATH  Google Scholar 

  24. Pilkiewicz, A.: s2sloop: a validator for polyhedral transformations. https://github.com/pilki/s2sLoop (2010-2013)

  25. Pop, S., Cohen, A., Bastoul, C., Girbal, S., Silber, G.A., Vasilache, N.: Graphite: polyhedral analyses and optimizations for QCC. In: Proceedings of the 2006 GCC Developers Summit, p. 2006 (2006)

    Google Scholar 

  26. Pouchet, L.N., Bondhugula, U., et al.: The polybench benchmarks. https://www.cs.colostate.edu/~pouchet/software/polybench/ (2010-2015)

  27. Ragan-Kelley, J., et al.: Halide: decoupling algorithms from schedules for high-performance image processing. Commun. ACM 61(1), 106–115 (2017). https://doi.org/10.1145/3150211

  28. Rideau, S., Leroy, X.: Validating register allocation and spilling. In: Gupta, R. (ed.) CC 2010. LNCS, vol. 6011, pp. 224–243. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-11970-5_13

    Chapter  MATH  Google Scholar 

  29. Six, C., Gourdin, L., Boulmé, S., Monniaux, D., Fasse, J., Nardino, N.: Formally verified superblock scheduling. In: Proceedings of the 11th ACM SIGPLAN International Conference on Certified Programs and Proofs, CPP 2022, pp. 40–54, Association for Computing Machinery, New York, NY, USA (2022). https://doi.org/10.1145/3497775.3503679

  30. Tristan, J.B., Leroy, X.: Formal verification of translation validators: a case study on instruction scheduling optimizations. SIGPLAN Not. 43(1), 17–27 (2008). https://doi.org/10.1145/1328897.1328444

  31. Tristan, J.B., Leroy, X.: Verified validation of lazy code motion. SIGPLAN Not. 44(6), 316–326 (2009). https://doi.org/10.1145/1543135.1542512

  32. Tristan, J.B., Leroy, X.: A simple, verified validator for software pipelining. In: Proceedings of the 37th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2010, pp. 83–92, Association for Computing Machinery, New York, NY, USA (2010). https://doi.org/10.1145/1706299.1706311

  33. Verdoolaege, S., Guelton, S., Grosser, T., Cohen, A.: Schedule trees. In: Rajopadhye, S., Verdoolaege, S. (eds.) Proceedings of the 4th International Workshop on Polyhedral Compilation Techniques (IMPACT), Vienna, Austria, January 2014

    Google Scholar 

  34. Zhao, J., et al.: Akg: automatic kernel generation for neural processing units using polyhedral transformations. In: Proceedings of the 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation, PLDI 2021, pp. 1233–1248, Association for Computing Machinery, New York, NY, USA (2021). https://doi.org/10.1145/3453483.3454106

Download references

Acknowledgments

We thank anonymous referees for their suggestions and comments on earlier versions of this paper. This work is supported in part by National Natural Science Foundation of China (NSFC) under Grant No. 62232015.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Xinyu Feng .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2024 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Li, X., Liang, H., Feng, X. (2024). Verified Validation for Affine Scheduling in Polyhedral Compilation. In: Chin, WN., Xu, Z. (eds) Theoretical Aspects of Software Engineering. TASE 2024. Lecture Notes in Computer Science, vol 14777. Springer, Cham. https://doi.org/10.1007/978-3-031-64626-3_17

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-64626-3_17

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-64625-6

  • Online ISBN: 978-3-031-64626-3

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics