Compigra is an open-source compilation tool to produce assembly code from C/C++ code targets at CGRA based on MLIR. Compigra provides customized dialects to abstract operations on IR level in front end. In the back end, an ILP model is supported to compute mapping and output assembly code.
Please refer to LLVM-Getting Started to see the requirements on the hardware and software.
You can full clone the project with --recurse-submodules
. Please refer to Polygeist to build dependencies including LLVM, MLIR, and Polygeist(Rough disk space ~130G).
We use gurobi as our solver for the ILP model. Gurobi is compulsory for back end assembly code generation, but not for building the project. You can still use the front end optimization passes to generate hardware compatible IR even without gurobi enabled. You can apply gurobi acedemic license and configure it if you work in acedemia.
Run the following command to build the project and specify GUROBI_INSTALL_DIR if gurobi is installed in your workstation.
$ mkdir build && and cd build
$ cmake -DGUROBI_INSTALL_DIR=/path/to/gurobi ../
$ ninja
All the passes including front end optimization and back end assembly generation is integrated in our executable compigra-opt, for more helpful information run:
./bin/compigra-opt -h
For detailed instructions on compiling your C code using Compigra, refer to the runner_compile.sh
script. This script integrates front-end parsing, user-defined middle-end optimizations, back-end mapping, and optimizations using modulo scheduling.
Use CGRA-simulator for software simulation to get CGRA computation results using assembly.
See X-Heep and OpenEdgeCGRA for more help.