Automatically translating image processing libraries to halide

This paper presents Dexter, a new tool that automatically translates image processing functions from a low-level general-purpose language to a high-level domain-specific language (DSL), allowing them to leverage cross-platform optimizations enabled by DSLs. Rather than building a classical syntax-driven compiler to do this translation, Dexter leverages recent advances in program synthesis and program verification, along with a new domain-specific synthesis algorithm, to translate C++ image processing code to the Halide DSL, while guaranteeing semantic equivalence. This new synthesis algorithm scales and generalizes to much larger and more complex functions than prior work, including the ability to handle tiling, conditionals, and multi-stage pipelines in the original low-level code. To demonstrate the effectiveness of our approach, we evaluate Dexter using real-world image processing functions from Adobe Photoshop, a widely used multi-platform image processing program. Our results show that Dexter can translate 264 out of 353 functions in our test set, with the original implementations ranging from 20 to 150 lines of code. By leveraging Halide's advanced auto-scheduling capabilities, we get median speedups of 7.03× and 4.52× for Dexter-translated functions as compared to the original implementations on Intel and ARM architectures, respectively.

[1]  Sarfraz Khurshid,et al.  Systematic Generation of Non-equivalent Expressions for Relational Algebra , 2018, ABZ.

[2]  Shoaib Kamil,et al.  Portable parallel performance from sequential, productive, embedded domain-specific languages , 2012, PPoPP '12.

[3]  Sanjit A. Seshia,et al.  Sketching stencils , 2007, PLDI '07.

[4]  Maaz Bin Safeer Ahmad,et al.  Automatically Leveraging MapReduce Frameworks for Data-Intensive Applications , 2018, SIGMOD Conference.

[5]  Alexander Aiken,et al.  Stochastic optimization of floating-point programs with tunable precision , 2014, PLDI.

[6]  Yuting Yang,et al.  VizGen: accelerating visual computing prototypes in dynamic languages , 2016, ACM Trans. Graph..

[7]  Stefan Behnel,et al.  Cython: The Best of Both Worlds , 2011, Computing in Science & Engineering.

[8]  Alvin Cheung,et al.  Verified lifting of stencil computations , 2016, PLDI.

[9]  Bruno Cardoso Lopes,et al.  Getting Started with LLVM Core Libraries , 2014 .

[10]  Frédo Durand,et al.  Halide: a language and compiler for optimizing parallelism, locality, and recomputation in image processing pipelines , 2013, PLDI 2013.

[11]  Lauretta O. Osho,et al.  Axiomatic Basis for Computer Programming , 2013 .

[12]  Sylvain Paris,et al.  Helium: lifting high-performance stencil kernels from stripped x86 binaries to halide DSL code , 2015, PLDI.

[13]  Pat Hanrahan,et al.  Rigel , 2016, ACM Trans. Graph..

[14]  John Shalf,et al.  SEJITS: Getting Productivity and Performance With Selective Embedded JIT Specialization , 2010 .

[15]  Alvin Cheung,et al.  Interactive Query Synthesis from Input-Output Examples , 2017, SIGMOD Conference.

[16]  Alfred V. Aho,et al.  Compilers: Principles, Techniques, and Tools (2nd Edition) , 2006 .

[17]  Tom Duff,et al.  Compositing digital images , 1984, SIGGRAPH.

[18]  Hans-Peter Seidel,et al.  Representing and scheduling procedural generation using operator graphs , 2016, ACM Trans. Graph..

[19]  Dinakar Dhurjati,et al.  Scaling up Superoptimization , 2016, ASPLOS.

[20]  Sumit Gulwani,et al.  Automating string processing in spreadsheets using input-output examples , 2011, POPL '11.

[21]  Pat Hanrahan,et al.  Darkroom , 2014, ACM Trans. Graph..

[22]  Frédo Durand,et al.  Decoupling algorithms from schedules for easy optimization of image processing pipelines , 2012, ACM Trans. Graph..

[23]  Rastislav Bodík,et al.  Algorithmic program synthesis: introduction , 2013, International Journal on Software Tools for Technology Transfer.

[24]  Frédo Durand,et al.  Learning to optimize halide with tree search and random programs , 2019, ACM Trans. Graph..

[25]  Diego Nehab,et al.  The Neon Image Processing Language , 2010 .

[26]  Sumit Gulwani,et al.  Dimensions in program synthesis , 2010, Formal Methods in Computer Aided Design.

[27]  Jonathan Ragan-Kelley,et al.  Automatically scheduling halide image processing pipelines , 2016, ACM Trans. Graph..

[28]  Alvin Cheung,et al.  Optimizing database-backed applications with query synthesis , 2013, PLDI.

[29]  Nikolaj Bjørner,et al.  Z3: An Efficient SMT Solver , 2008, TACAS.