一句话:将 C/C++ 自动转写为保持测试行为且性能更优的 HLS 代码,结合定向修复模式与自动测试生成。
异构与专用硬件的兴起使得异构应用开发仍局限于少数具备深厚硬件经验的工程师。HeteroGen 以 C/C++ 代码为输入,自动生成行为保持且性能更优的 HLS 版本。其核心是把基于搜索的程序修复思想迁移到异构计算领域,并应对两个挑战:一是 HLS 编译与仿真周期远长于常规 C/C++ 编译执行,因此采用由常见修复模式及其依赖关系引导的模式化程序编辑;二是行为与性能检查依赖测试而测试用例常不可得,因此自动生成适合检测 C 到 HLS-C 转换错误的测试输入,同时为原 C 代码提供高分支覆盖。在十个真实异构应用上的评估表明,HeteroGen 能对其中九个全自动地生成 HLS 兼容版本,最多施加 438 行编辑,所得 HLS 版本比原版本快 1.63 倍。
Despite the trend of incorporating heterogeneity and specialization in hardware, the development of heterogeneous applications is limited to a handful of engineers with deep hardware expertise. We propose HeteroGen that takes C/C++ code as input and automatically generates an HLS version with test behavior preservation and better performance. Key to the success of HeteroGen is adapting the idea of search-based program repair to the heterogeneous computing domain, while addressing two technical challenges. First, the turn-around time of HLS compilation and simulation is much longer than the usual C/C++ compilation and execution time; therefore, HeteroGen applies pattern-oriented program edits guided by common fix patterns and their dependences. Second, behavior and performance checking requires testing, but test cases are often unavailable. Thus, HeteroGen auto-generates test inputs suitable for checking C to HLS-C conversion errors, while providing high branch coverage for the original C code. An evaluation of HeteroGen shows that it produces an HLS-compatible version for nine out of ten real-world heterogeneous applications fully automatically, applying up to 438 lines of edits to produce an HLS version 1.63x faster than the original version.
@inproceedings{ZhangWXK22,
title = {HeteroGen: transpiling C to heterogeneous HLS code with automated test generation and program repair},
author = {Qian Zhang and Jiyuan Wang and Guoqing Harry Xu and Miryung Kim},
booktitle = {ASPLOS},
year = {2022},
doi = {10.1145/3503222.3507748}
}