Knight: Optimizing Code Generation for Simulink Models With Loop Reshaping

被引:0
作者
Yu, Zehong [1 ]
Yang, Yixiao [2 ]
Su, Zhuo [1 ]
Wang, Rui [2 ]
Tao, Yang [3 ]
Jiang, Yu [1 ]
机构
[1] Tsinghua Univ, Sch Software, KLISS, BNRist, Beijing 100084, Peoples R China
[2] Capital Normal Univ, Informat Engn Coll, Beijing 100089, Peoples R China
[3] Huawei Technol Co Ltd, Intelligent Automot Solut Business Unit, Shanghai 200120, Peoples R China
关键词
Codes; Software packages; Analytical models; Semantics; Generators; Data models; Switches; Code generation; loop-semantic; Simulink models; DRIVEN DESIGN;
D O I
10.1109/TCAD.2024.3438691
中图分类号
TP3 [计算技术、计算机技术];
学科分类号
0812 ;
摘要
Simulink has become a pivotal infrastructure in embedded scenarios, including automotive systems and aerospace designs. To improve the performance of the code generated from Simulink models, state-of-the-art code generators employ various optimization techniques, such as expression folding, variable reuse, and parallelism. However, they struggle to generate efficient code for loop-semantic models which are crucial in substantial data processing tasks. This inefficiency manifests in numerous redundant calculations, such as array calculations and conditional statements. As a result, the performance of the generated code is limited. This article proposes Knight, an efficient code generator for loop-semantic Simulink models with loop reshaping. Knight first parses the Simulink model to extract essential content, such as block functionalities and connections. Knight then identifies blocks with internal states and implements the specific interaction rules to discern those that are state-dependent. For state-dependent blocks, Knight conducts forward inference to obtain their preceding blocks, which influence the internal state calculations. Subsequently, Knight isolates blocks that are optimizable and irrelevant to the internal states. These blocks are strategically relocated outside the loop semantics while preserving critical semantics related to code generation. We implemented and evaluated Knight on benchmark Simulink models across different compilers and architectures. Compared with the state-of-the-art code generators Simulink Embedded Coder, DFSynth, and HCG, the code generated by Knight is 16.58 x faster, 16.89x faster, and 15.38 x faster in terms of execution duration on average, without incurring additional overhead of memory usage.
引用
收藏
页码:444 / 457
页数:14
相关论文
共 32 条
  • [1] Adam G. K., 2022, Int. J. High Perform. Syst. Archit., V11, P105
  • [2] Performance Assessment of Linux Kernels with PREEMPT_RT on ARM-Based Embedded Devices
    Adam, George K.
    Petrellis, Nikos
    Doulos, Lambros T.
    [J]. ELECTRONICS, 2021, 10 (11)
  • [3] Dealing with Non-Functional Requirements in Model-Driven Development: A Survey
    Ameller, David
    Franch, Xavier
    Gomez, Cristina
    Martinez-Fernandez, Silverio
    Araujo, Joao
    Biffl, Stefan
    Cabot, Jordi
    Cortellessa, Vittorio
    Fernandez, Daniel Mendez
    Moreira, Ana
    Muccini, Henry
    Vallecillo, Antonio
    Wimmer, Manuel
    Amaral, Vasco
    Bohm, Wolfgang
    Bruneliere, Hugo
    Burgueno, Loli
    Goulao, Miguel
    Teufl, Sabine
    Berardinelli, Luca
    [J]. IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, 2021, 47 (04) : 818 - 835
  • [4] [Anonymous], 2023, SIM EMB COD DOC
  • [5] [Anonymous], [68] MATLAB C/C++, Fortran, Java, and Python API Reference, The MathWorks, Inc, Natick, MA, USA, Sep. 2022, (accessed Feb. 17, 2023). [Online]. Available: https://www.mathworks.com/help/releases/R2022b/pdfdoc/matlab/matlabapiref.pdf
  • [6] Developing applications using model-driven design environments
    Balasubramanian, K
    Gokhale, A
    Karsai, G
    Sztipanovits, J
    Neema, S
    [J]. COMPUTER, 2006, 39 (02) : 33 - +
  • [7] Baldwin P, 2004, IPSN '04: THIRD INTERNATIONAL SYMPOSIUM ON INFORMATION PROCESSING IN SENSOR NETWORKS, P359
  • [8] SCADE: Synchronous design and validation of embedded control software
    Berry, Gerard
    [J]. NEXT GENERATION DESIGN AND VERIFICATION METHODOLOGIES FOR DISTRIBUTED EMBEDDED CONTROL SYSTEMS, 2007, : 19 - 33
  • [9] Brooks C., 2010, 2010 IEEE/ACM/IFIP International Conference on Hardware/Software Codesign and System Synthesis (CODES+ISSS), P331
  • [10] Buck J., 2002, Readings in Hardware/Software Co-Design (Systems on Silicon), P527