Source Matching and Rewriting

02/05/2022
by   Vinicius Couto, et al.
0

A typical compiler flow relies on a uni-directional sequence of translation/optimization steps that lower the program abstract representation, making it hard to preserve higher-level program information across each transformation step. On the other hand, modern ISA extensions and hardware accelerators can benefit from the compiler's ability to detect and raise program idioms to acceleration instructions or optimized library calls. Although recent works based on Multi-Level IR (MLIR) have been proposed for code raising, they rely on specialized languages, compiler recompilation, or in-depth dialect knowledge. This paper presents Source Matching and Rewriting (SMR), a user-oriented source-code-based approach for MLIR idiom matching and rewriting that does not require a compiler expert's intervention. SMR uses a two-phase automaton-based DAG-matching algorithm inspired by early work on tree-pattern matching. First, the idiom Control-Dependency Graph (CDG) is matched against the program's CDG to rule out code fragments that do not have a control-flow structure similar to the desired idiom. Second, candidate code fragments from the previous phase have their Data-Dependency Graphs (DDGs) constructed and matched against the idiom DDG. Experimental results show that SMR can effectively match idioms from Fortran (FIR) and C (CIL) programs while raising them as BLAS calls to improve performance.

READ FULL TEXT

page 4

page 10

research
04/20/2022

Unleashing the Power of Compiler Intermediate Representation to Enhance Neural Program Embeddings

Neural program embeddings have demonstrated considerable promise in a ra...
research
01/22/2020

Automatically Harnessing Sparse Acceleration

Sparse linear algebra is central to many scientific programs, yet compil...
research
06/03/2019

A scheme for dynamically integrating C library functions into a λProlog implementation

The Teyjus system realizes the higher-order logic programming languageλP...
research
05/20/2019

Towards Neural Decompilation

We address the problem of automatic decompilation, converting a program ...
research
09/09/2019

Structural and semantic pattern matching analysis in Haskell

Haskell functions are defined as a series of clauses consisting of patte...
research
01/27/2023

Matching Linear Algebra and Tensor Code to Specialized Hardware Accelerators

Dedicated tensor accelerators demonstrate the importance of linear algeb...
research
01/03/2023

Boosting Neural Networks to Decompile Optimized Binaries

Decompilation aims to transform a low-level program language (LPL) (eg.,...

Please sign up or login with your details

Forgot password? Click here to reset