Helium
A tool for lifting stencil code from stripped x86 binaries to Halide DSL code
Overview
Highly optimized programs are prone to bit rot, where performance quickly becomes suboptimal in the face of new hardware and compiler techniques. In this project, we show how to automatically lift performance-critical stencil kernels from a stripped x86 binary and generate the corresponding code in the high-level domain-specific language Halide. Using Halide's state-of-the-art optimizations targeting current hardware, we show that new optimized versions of these kernels can replace the originals to rejuvenate the application for newer hardware.
The original optimized code for kernels in stripped binaries is nearly impossible to analyze statically. Instead, we rely on dynamic traces to regenerate the kernels. Helium first localizes the code performing the stencil computation with in the application executable (Code Localization) and then extracts the exact computation (Expression Extraction) from the localized code. Following diagram depicts how Helium systematically generates the expression for the filter from the localized code.
We lift seven kernels from Adobe Photoshop giving a 75% performance improvement, four kernels from IrfanView, leading to 4.97x performance, and one stencil from the miniGMG multigrid benchmark netting a 4.25x improvement in performance. We manually rejuvenated Photoshop by replacing eleven of Photoshop's filters with our lifted implementations, giving 1.12x speedup without affecting the user experience.
Publications
Helium: Lifting High-Performance Stencil Kernels
from Stripped x86 Binaries to Halide DSL Code
Charith Mendis,
Jeffrey Bosboom,
Kevin Wu,
Shoaib Kamil,
Jonathan Ragan-Kelley,
Sylvain Paris,
Qin Zhao,
Saman Amarasinghe
PLDI 2015. Bibtex
Helium: Lifting High-Performance Stencil Kernels
from Stripped x86 Binaries to Halide DSL Code
Charith Mendis
SM Thesis, Massachusetts Institute of Technology. Bibtex