一句话:提出基于程序合成的指令选择算法,先将目标平台指令抽象为 uber-instruction,再通过提升与下降生成 DSP 机器码,性能最高提升 2.1 倍。
指令选择是优化编译器中最依赖目标平台的组件,现有方法要么使用脆弱且设计繁琐的模式匹配,要么受限于基于搜索方法的可扩展性。论文提出一种新的指令选择算法:首先将目标平台指令抽象为高层 uber-instruction,每条 uber-instruction 统一多条具体指令;然后利用程序合成将输入代码序列提升为语义等价的 uber-instruction 序列,再从 uber-instruction 下降为机器码。作者在 21 个真实基准上对数字信号处理器进行实验,结果表明该基于合成的指令选择算法能够为目标硬件生成指令序列,且合成代码相比同一平台上专业开发的优化编译器所生成的代码最高可快 2.1 倍。
Instruction selection, whereby input code represented in an intermediate representation is translated into executable instructions from the target platform, is often the most target-dependent component in optimizing compilers. Current approaches include pattern matching, which is brittle and tedious to design, or search-based methods, which are limited by scalability of the search algorithm. In this paper, we propose a new algorithm that first abstracts the target platform instructions into high-level uber-instructions, with each uber-instruction unifying multiple concrete instructions from the target platform. Program synthesis is used to lift input code sequences into semantically equivalent sequences of uber-instructions and then to lower from uber-instructions to machine code. Using 21 real-world benchmarks, we show that our synthesis-based instruction selection algorithm can generate instruction sequences for a hardware target, with the synthesized code performing up to 2.1x faster as compared to code generated by a professionally-developed optimizing compiler for the same platform.
@inproceedings{AhmadRAKC22,
title = {Vector instruction selection for digital signal processors using program synthesis},
author = {Maaz Bin Safeer Ahmad and Alexander J. Root and Andrew Adams and Shoaib Kamil and Alvin Cheung},
booktitle = {ASPLOS},
year = {2022},
doi = {10.1145/3503222.3507714}
}