一句话:提出基于约束的 idiom 检测与映射方法,自动将遗留代码匹配到异构加速器 API 与 DSL,实现最高 20 倍加速。
异构加速器虽能提供高性能,但往往需使用厂商优化库或 DSL,要求大量修改遗留代码,阻碍其采用。本文提出自动检测加速机会的方法,聚焦稀疏/稠密线性代数、stencil、广义归约与直方图等有成熟 API 支持的 idiom,用自定义的基于约束的 Idiom Description Language (IDL) 在用户代码中发现它们,并将检测到的 idiom 映射到 BLAS、cuSPARSE、clSPARSE 以及 Halide、Lift 两个 DSL。该方法在 LLVM 中实现,在 NAS 和 Parboil 顺序 C/C++ 基准上评估,共检测到 60 个 idiom 实例;当 idiom 占顺序执行时间显著比例时,生成的代码在集成与外部 GPU 上取得 1.26 倍至 20 倍以上加速。
Heterogeneous accelerators often disappoint. They provide the prospect of great performance, but only deliver it when using vendor specific optimized libraries or domain specific languages. This requires considerable legacy code modifications, hindering the adoption of heterogeneous computing. This paper develops a novel approach to automatically detect opportunities for accelerator exploitation. We focus on calculations that are well supported by established APIs: sparse and dense linear algebra, stencil codes and generalized reductions and histograms. We call them idioms and use a custom constraint-based Idiom Description Language (IDL) to discover them within user code. Detected idioms are then mapped to BLAS libraries, cuSPARSE and clSPARSE and two DSLs: Halide and Lift. We implemented the approach in LLVM and evaluated it on the NAS and Parboil sequential C/C++ benchmarks, where we detect 60 idiom instances. In those cases where idioms are a significant part of the sequential execution time, we generate code that achieves 1.26x to over 20x speedup on integrated and external GPUs.
@inproceedings{paperbot4290,
title = {Automatic Matching of Legacy Code to Heterogeneous APIs},
author = {Philip Ginsbach and Toomas Remmelg and Michel Steuwer and Bruno Bodin and Christophe Dubach and Michael F. P. O'Boyle},
booktitle = {ASPLOS},
year = {2018},
doi = {10.1145/3173162.3173182}
}