Skip to main content

Better Predicates and Heuristics for Improved Commutativity Synthesis

  • Conference paper
  • First Online:
Automated Technology for Verification and Analysis (ATVA 2023)

Abstract

Code commutativity has increasingly many applications including proof methodologies for concurrency, reductions, automated parallelization, distributed systems and blockchain smart contracts. While there has been some work on automatically generating commutativity conditions through abstraction refinement, the performance of such refinement algorithms critically depends on (i) the universe of predicates and (ii) the choice of the next predicate during search, and thus far this has not been examined in detail.

In this paper, we improve commutativity synthesis by addressing these under-explored requirements. We prune the universe of predicates through a combination of better predicate generation, new a priori syntactic filtering, and through dynamic reduction of the search space. We also present new predicate selection heuristics: one based on look-ahead, and one that utilizes model counting to greedily cover the search space.

Our work is embodied in the new commutativity synthesis tool Servois2, a generational improvement over the state-of-the-art tool Servois. Servois2 is implemented in a faster language and has support for CVC5 and Z3. We contribute new, non-trivial commutativity benchmarks. All of the new features in Servois2 are shown to either increase performance (geomean \(3.58 \times \) speedup) or simplify the conditions generated, when compared against Servois. We also show that our look-ahead heuristic leads to better scaling with respect to the number of predicates.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 59.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 74.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    https://pldi22.sigplan.org/home/cora-2022.

  2. 2.

    To satisfy closure, we include negations of all predicates. This comes at no performance loss, as such additions can be skipped over by Choose. This is valid because Refine recurses upon the negation of the chosen predicate.

  3. 3.

    https://github.com/veracity-lang/servois2.

  4. 4.

    http://www.veracity-lang.org.

  5. 5.

    mVarA and mVarB are short for multiVarA and multiVarB.

  6. 6.

    http://www.veracity-lang.org.

References

  1. Farzan, A., Vandikas, A.: Reductions for safety proofs. In: Proceedings of the ACM on Programming Languages, vol. 4, no. POPL, pp. 1–28 (2019)

    Google Scholar 

  2. Kragl, B., Qadeer, S.: The civl verifier. In: 2021 Formal Methods in Computer Aided Design (FMCAD), pp. 143–152. IEEE (2021)

    Google Scholar 

  3. Flanagan, C., Freund, S.N.: The anchor verifier for blocking and non-blocking concurrent software. In: Proceedings of the ACM on Programming Languages, vol. 4, no. OOPSLA, pp. 1–29 (2020)

    Google Scholar 

  4. Rinard, M.C., Diniz, P.C.: Commutativity analysis: a new analysis technique for parallelizing compilers. ACM Trans. Program. Lang. Syst. (TOPLAS) 19(6), 942–991 (1997). https://citeseer.ist.psu.edu/rinard97commutativity.html

  5. Spiegelman, A., Golan-Gueta, G., Keidar, I.: Transactional data structure libraries. ACM SIGPLAN Not. 51(6), 682–696 (2016)

    Article  Google Scholar 

  6. Chen, A., Fathololumi, P., Koskinen, E., Pincus, J.: Veracity: declarative multicore programming with commutativity). In: Proceedings of the ACM Programming Language, vol. 6, no. OOPSLA2, pp. 186:1–186:31 (2022). https://doi.org/10.1145/3563349

  7. Prabhu, P., Ghosh, S., Zhang, Y., Johnson, N.P., August, D.I.: Commutative set: a language extension for implicit parallel programming. In: Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 1–11 (2011)

    Google Scholar 

  8. Clements, A.T., Kaashoek, M.F., Zeldovich, N., Morris, R.T., Kohler, E.: The scalable commutativity rule: designing scalable software for multicore processors. ACM Trans. Comput. Syst. (TOCS) 32(4), 1–47 (2015)

    Article  Google Scholar 

  9. Shapiro, M., Preguiça, N., Baquero, C., Zawirski, M.: A comprehensive study of convergent and commutative replicated data types. Ph.D. dissertation, Inria-Centre Paris-Rocquencourt; INRIA (2011)

    Google Scholar 

  10. Dickerson, T., Gazzillo, P., Herlihy, M., Koskinen, E.: Adding concurrency to smart contracts. In: Proceedings of the ACM Symposium on Principles of Distributed Computing, Series PODC 2017, pp. 303–312. ACM, New York (2017). https://doi.acm.org/10.1145/3087801.3087835

  11. Pîrlea, G., Kumar, A., Sergey, I.: Practical smart contract sharding with ownership and commutativity analysis. In: Freund, S.N., Yahav, E. (eds.) PLDI 2021: 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation, Virtual Event, Canada, 20–25 June 2021, pp. 1327–1341. ACM (2021). https://doi.org/10.1145/3453483.3454112

  12. Gehr, T., Dimitrov, D., Vechev, M.: Learning commutativity specifications. In: Kroening, D., Păsăreanu, C.S. (eds.) CAV 2015, Part I. LNCS, vol. 9206, pp. 307–323. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-21690-4_18

    Chapter  Google Scholar 

  13. Aleen, F., Clark, N.: Commutativity analysis for software parallelization: letting program transformations see the big picture. In: Soffa, M.L., Irwin, M.J. (eds.) Proceedings of the 14th International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS-XII), pp. 241–252. ACM (2009)

    Google Scholar 

  14. Bansal, K., Koskinen, E., Tripp, O.: Automatic generation of precise and useful commutativity conditions. In: Beyer, D., Huisman, M. (eds.) TACAS 2018. LNCS, vol. 10805, pp. 115–132. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-89960-2_7

    Chapter  MATH  Google Scholar 

  15. Bansal, K., Koskinen, E., Tripp, O.: Synthesizing precise and useful commutativity conditions. J. Autom. Reason. 64(7), 1333–1359 (2020)

    Article  MathSciNet  MATH  Google Scholar 

  16. Gomes, C.P., Sabharwal, A., Selman, B.: Model counting. In: Handbook of Satisfiability, pp. 993–1014. IOS Press (2021)

    Google Scholar 

  17. De Loera, J.A., Hemmecke, R., Tauzer, J., Yoshida, R.: Effective lattice point counting in rational convex polytopes. J. Symb. Comput. 38(4), 1273–1302 (2004)

    Article  MathSciNet  MATH  Google Scholar 

  18. Aydin, A., Bang, L., Bultan, T.: Automata-based model counting for string constraints. In: Kroening, D., Păsăreanu, C.S. (eds.) CAV 2015. LNCS, vol. 9206, pp. 255–272. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-21690-4_15

    Chapter  Google Scholar 

  19. Molavi, A., Schneider, T., Downing, M., Bang, L.: MCBAT: model counting for constraints over bounded integer arrays. In: Christakis, M., Polikarpova, N., Duggirala, P.S., Schrammel, P. (eds.) NSV/VSTTE -2020. LNCS, vol. 12549, pp. 124–143. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-63618-0_8

    Chapter  Google Scholar 

  20. Barrett, C., et al.: CVC4. In: Gopalakrishnan, G., Qadeer, S. (eds.) CAV 2011. LNCS, vol. 6806, pp. 171–177. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-22110-1_14

    Chapter  Google Scholar 

  21. Barbosa, H., et al.: cvc5: a versatile and industrial-strength SMT solver. In: Fisman, D., Rosu, G. (eds.) TACAS 2022, Part I. LNCS, vol. 13243, pp. 415–442. Springer, Cham (2022). https://doi.org/10.1007/978-3-030-99524-9_24

    Chapter  Google Scholar 

  22. de Moura, L., Bjørner, N.: Z3: an efficient SMT solver. In: Ramakrishnan, C.R., Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 337–340. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-78800-3_24

    Chapter  Google Scholar 

  23. Aydin, A., Bang, L., Bultan, T.: Automata-based model counting for string constraints. In: Kroening, D., Păsăreanu, C.S. (eds.) CAV 2015. LNCS, vol. 9206, pp. 255–272. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-21690-4_15

    Chapter  Google Scholar 

  24. Chakraborty, S., Meel, K.S., Vardi, M.Y.: Approximate model counting. In: Handbook of Satisfiability, pp. 1015–1045. IOS Press (2021)

    Google Scholar 

  25. Jia, X., Ghezzi, C., Ying, S.: Enhancing reuse of constraint solutions to improve symbolic execution. In: Proceedings of the 2015 International Symposium on Software Testing and Analysis, ISSTA 2015, pp. 177–187. Association for Computing Machinery, New York (2015). https://doi.org/10.1145/2771783.2771806

Download references

Acknowledgements

This work is supported in part by NSF Award #2008633 and #2107169.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Adam Chen .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2023 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

Chen, A., Fathololumi, P., Nicola, M., Pincus, J., Brennan, T., Koskinen, E. (2023). Better Predicates and Heuristics for Improved Commutativity Synthesis. In: André, É., Sun, J. (eds) Automated Technology for Verification and Analysis. ATVA 2023. Lecture Notes in Computer Science, vol 14216. Springer, Cham. https://doi.org/10.1007/978-3-031-45332-8_5

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-45332-8_5

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-45331-1

  • Online ISBN: 978-3-031-45332-8

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics