New C Frontend for MLIR Affine

MLIR is a powerful tool to represent the complicated semantics with retaining the high-level structure of the code. The most notable thing about MLIR is polyhedral compilation support by Affine dialect. The capability of expressing the static control part (SCoP) of the program allows us to accomplish the tailored optimization caring more about the semantics of the nested loop.

But current toolchain of the MLIR does not necessarily lead us to compile the existing C/C++ program easily. Additionally, we cannot make use of the existing polyhedral compilation like Polly, Pluto as they are not aware of the MLIR signatures.

Today, I found a paper about a tool working as a frontend for C/C++, enabling us to a polyhedral compilation on MLIR.

Polygeist: Affine C in MLIR

Polygeist makes two things possible. The first is converting the given C code into MLIR code described in Standard/SCF/Affine dialects. We can utilize MLIR infrastructure for the code transformation. The second is the integration with the existing polyhedral compilation framework. Polygeist converts the C code into the format which other polyhedral tools can recognize. It is a standard format expected by these tools, such as the instantiation form of each statement with induction variables. (e.g. $S(i1, i2)$)

Although Polygeist does not regard the performance as a first-class scope, the code generated by the framework shows the competitive performance.

I found a code in GitHub but not sure the repository is truly for Polygeist because it does not have any reference to the paper.

https://github.com/wsmoses/Polygeist