Multi-Target C Code Generation from MATLAB

This paper describes our recent work on MATISSE, a framework for MATLAB to C compilation. We focus on the new optimizations and transformations, as well as on OpenCL generation. MATISSE is controlled with LARA, an aspect-oriented language, able to specify transformations to the input MATLAB code (e.g., insertion of code for variable initialization and for monitoring) and to express information concerning types and shapes of variables. We evaluate the compiler with a set of benchmarks when targeting both an embedded system and a desktop system. The results show that we were able to achieve a speedup up to 1.8× by employing information provided by LARA aspects. We also compare the execution time of the generated C code with the original code running on MATLAB, and we achieve a geometric mean speedup of 19×. The geometric mean speedup reduces to 12× when optimizing the MATLAB code with LARA aspects. Finally, we present a preliminary version of a fully-functioning pragma-based OpenCL generator, built over the MATISSE framework.

[1]  Matlab Matlab (the language of technical computing): using matlab graphics ver.5 , 2014 .

[2]  Gregor Kiczales,et al.  Aspect-oriented programming , 2001, ESEC/FSE-9.

[3]  Prithviraj Banerjee,et al.  Automatic conversion of floating point MATLAB programs into fixed point FPGA based hardware design , 2003, 11th Annual IEEE Symposium on Field-Programmable Custom Computing Machines, 2003. FCCM 2003..

[4]  Alok N. Choudhary,et al.  Parallelization of MATLAB Applications for a Multi-FPGA System , 2001, The 9th Annual IEEE Symposium on Field-Programmable Custom Computing Machines (FCCM'01).

[5]  John Freeman,et al.  From opencl to high-performance hardware on FPGAS , 2012, 22nd International Conference on Field Programmable Logic and Applications (FPL).

[6]  João Saraiva,et al.  A domain-specific aspect language for transforming MATLAB programs , 2010 .

[7]  Laurie J. Hendren,et al.  AspectMatlab: an aspect-oriented scientific programming language , 2010, AOSD.

[8]  Prithviraj Banerjee,et al.  An algebraic array shape inference system for MATLAB® , 2006, TOPL.

[9]  Joseph D. Gradecki,et al.  Mastering AspectJ: Aspect-Oriented Programming in Java , 2003 .

[10]  Pedro C. Diniz,et al.  Compilation and Synthesis for Embedded Reconfigurable Systems , 2013 .

[11]  David A. Padua,et al.  Techniques for the translation of MATLAB programs into Fortran 90 , 1999, TOPL.

[12]  Laurie J. Hendren,et al.  Optimizing Matlab through Just-In-Time Specialization , 2010, CC.

[13]  Eelco Visser,et al.  Turning dynamic typing into static typing by program specialization in a compiler front-end for Octave , 2003, Proceedings Third IEEE International Workshop on Source Code Analysis and Manipulation.

[14]  Pedro C. Diniz,et al.  Compilation and Synthesis for Embedded Reconfigurable Systems: An Aspect-Oriented Approach , 2015 .

[15]  Alfred V. Aho,et al.  Compilers: Principles, Techniques, and Tools , 1986, Addison-Wesley series in computer science / World student series edition.

[16]  Wayne Luk,et al.  LARA: an aspect-oriented programming language for embedded systems , 2012, AOSD '12.

[17]  Embedded Coder Generate C and C + + code optimized for embedded systems , .

[18]  Prithviraj Banerjee,et al.  Static array storage optimization in MATLAB , 2003, PLDI '03.