Template-Based Automatic Library Function Generation with Halide for Compute-Intensive Simulink Models
Qi Li, Masato Edahiro · 2024
This paper presents a templated approach to automatically generate a library function to replace a function generated in Simulink. Simulink is used in model-based development and is known for generating optimized code for embedded systems through methods such as expression folding and variable reuse. However, for compute-intensive models, the efficiency of the generated code may be limited. To address this issue, integrating calls to external libraries into Simulink’s code is common. Consequently, the choice and performance of these libraries significantly affect the overall efficiency. Halide has proven effective for authoring high-performance compute-intensive code. It boasts an efficient automatic scheduling tool that generates optimized code tailored to different platforms and adjusts adaptively for various input scales. In this paper, we propose a library function generation with Halide from pre-written templates and Simulink model parameters extracted by Model-Based Parallelizer (MBP). Experimental results show a maximum 80 times speed-up for compute-intensive functions.