Skip to main content

Using Performance Event Profiles to Deduce an Execution Model of MATLAB with Just-In-Time Compilation

  • Conference paper
  • First Online:
Languages and Compilers for Parallel Computing (LCPC 2019)

Abstract

The knowledge about how an interpreter executes programs allows writing faster code and creating powerful source-to-source compilers. However, many languages and environments either lack a specification of the execution semantics, or the semantics frequently changes with new releases. In this article, we present (1) performance event profiles with execution regions, inventive use of event-based sampling on processors where we correlate profiles of many performance events to find regions with desired properties. Furthermore, we use the performance event profiles to deduce (2) a static, tree-based execution model of MATLAB with the Just-In-Time (JIT) compilation. The environment of MATLAB is closed-source, which makes it a perfect testbed for our approach. With the new model and better understanding of how MATLAB executes programs, we propose a new code transformation, (3) repacking of array slices, which can increase the amount of JIT-compiled code in MATLAB programs.

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 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.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://github.com/quepas/mPAPI.

  2. 2.

    https://github.com/quepas/lcpc19-execution-model.

  3. 3.

    https://www.mathworks.com/help/matlab/call-mex-files-1.html.

  4. 4.

    https://www.netlib.org/benchmark/livermore.

  5. 5.

    https://pypy.org/.

  6. 6.

    https://julialang.org/.

References

  1. Aycock, J.: A brief history of just-in-time. ACM Comput. Surv. 35(2), 97–113 (2003). https://doi.org/10.1145/857076.857077

    Article  Google Scholar 

  2. Bruening, D., Garnett, T., Amarasinghe, S.: An infrastructure for adaptive dynamic optimization. In: International Symposium on Code Generation and Optimization, CGO, vol. 2003, pp. 265–275 (2003). https://doi.org/10.1109/CGO.2003.1191551

  3. Chen, H., Krolik, A., Lavoie, E., Hendren, L.: Automatic vectorization for MATLAB. In: Ding, C., Criswell, J., Wu, P. (eds.) LCPC 2016. LNCS, vol. 10136, pp. 171–187. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-52709-3_14

    Chapter  Google Scholar 

  4. Doweck, J., et al.: Inside 6th-generation intel core: new microarchitecture code-named skylake. IEEE Micro 37(2), 52–62 (2017). https://doi.org/10.1109/MM.2017.38

    Article  Google Scholar 

  5. Duesterwald, E., Cascaval, C., Dwarkadas, S.: Characterizing and predicting program behavior and its variability. In: Parallel Architectures and Compilation Techniques, PACT, vol. 2003, pp. 220–231 (2003). https://doi.org/10.1109/PACT.2003.1238018

  6. Eeckhout, L., Georges, A., De Bosschere, K.: How java programs interact with virtual machines at the microarchitectural level. In: ACM SIGPLAN Notices, vol. 38, no. 11, p. 169 (2003). https://doi.org/10.1145/949343.949321

  7. Hauswirth, M., Diwan, A., Sweeney, P.F., Mozer, M.C.: Automating vertical profiling. In: ACM SIGPLAN Notices, vol. 40, no. 10, p. 281 (2006). https://doi.org/10.1145/1103845.1094834

  8. Hauswirth, M., Sweeney, P.F., Diwan, A.: Temporal vertical profiling. Softw. Pract. Experience 40(8), 627–654 (2010). https://doi.org/10.1002/spe.972

    Article  Google Scholar 

  9. Hauswirth, M., Sweeney, P.F., Diwan, A., Hind, M.: Vertical profiling: understanding the behavior of object-oriented applications. In: Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2004, vol. 39, p. 251 (2004). https://doi.org/10.1145/1028976.1028998

  10. Hennessy, J.L., Patterson, D.: Computer Architecture: A Quantitive Approach. Morgan Kaufmann, United States (2017)

    Google Scholar 

  11. Luk, C.K., et al.: Pin: building customized program analysis tools with dynamic instrumentation. In: Programming Language Design and Implementation, PLDI 2005, p. 190. ACM Press (2005). https://doi.org/10.1145/1065010.1065034

  12. Maleki, S., Gao, Y., Garzarán, M.J., Wong, T., Padua, D.A.: An evaluation of vectorizing compilers. In: Parallel Architectures and Compilation Techniques, PACT, vol. 2011, no. 7, pp. 372–382 (2011). https://doi.org/10.1109/PACT.2011.68

  13. Sherwood, T., Perelman, E., Hamerly, G., Sair, S., Calder, B.: Discovering and exploiting program phases. IEEE Micro 23(6), 84–93 (2003). https://doi.org/10.1109/MM.2003.1261391

    Article  Google Scholar 

  14. Sherwood, T., Calder, B.: Time Varying Behavior of Programs. Technical report (1999). https://cseweb.ucsd.edu/~calder/papers/UCSD-CS99-630.pdf

  15. Sherwood, T., Perelman, E., Hamerly, G., Calder, B.: Automatically characterizing large scale program behavior. In: Architectural Support for Programming Languages and Operating Systems, ASPLOS 2002, vol. 36, p. 45 (2002). https://doi.org/10.1145/605397.605403

  16. Sprunt, B.: The basics of performance-monitoring hardware. IEEE Micro 22(4), 64–71 (2002). https://doi.org/10.1109/MM.2002.1028477

    Article  Google Scholar 

  17. Sweeney, P.F., et al.: Using hardware performance monitors to understand the behavior of java applications. In: Virtual Machine Research And Technology Symposium, VM, vol. 2004, p. 5 (2004)

    Google Scholar 

  18. Terpstra, D., Jagode, H., You, H., Dongarra, J.: Collecting performance data with PAPI-C. In: Müller, M., Resch, M., Schulz, A., Nagel, W. (eds.) Tools for High Performance Computing, vol. 2009, pp. 157–173 (2010). https://doi.org/10.1007/978-3-642-11261-4_11

  19. Weaver, V.M., McKee, S.A.: Can hardware performance counters be trusted? In: International Symposium on Workload Characterization, IISWC, vol. 2008, pp. 141–150 (2008). https://doi.org/10.1109/IISWC.2008.4636099

  20. Williams, S., Waterman, A., Patterson, D.: Roofline: an insightful visual performance model for multicore architectures. Commun. ACM 52(4), 65 (2009). https://doi.org/10.1145/1498765.1498785

    Article  Google Scholar 

  21. Yasin, A.: A top-down method for performance analysis and counters architecture. In: International Symposium on Performance Analysis of Systems and Software, ISPASS, vol. 2014, pp. 35–44 (2014). https://doi.org/10.1109/ISPASS.2014.6844459

  22. Zaparanuks, D., Jovic, M., Hauswirth, M.: Accuracy of performance counter measurements. In: International Symposium on Performance Analysis of Systems and Software, ISPASS, vol. 2009, pp. 23–32 (2009). https://doi.org/10.1109/ISPASS.2009.4919635

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Patryk Kiepas .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2021 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Kiepas, P., Ancourt, C., Tadonki, C., Koźlak, J. (2021). Using Performance Event Profiles to Deduce an Execution Model of MATLAB with Just-In-Time Compilation. In: Pande, S., Sarkar, V. (eds) Languages and Compilers for Parallel Computing. LCPC 2019. Lecture Notes in Computer Science(), vol 11998. Springer, Cham. https://doi.org/10.1007/978-3-030-72789-5_6

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-72789-5_6

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-72788-8

  • Online ISBN: 978-3-030-72789-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics