Skip to content

esl-epfl/Compigra

Repository files navigation

Compigra

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.

Prerequisites

Please refer to LLVM-Getting Started to see the requirements on the hardware and software.

Build the project

1.(1) [Recommended] Clone the full project and use all features in Compigra.

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).

$ git clone --recurse-submodules https://github.com/yuxwang99/compigra.git

1.(2) Use compilation front-end in Clang and MLIR.

Polygeist is not compulsory for the back end assembly code generation. You can also refer to LLVM to build LLVM, MLIR, and clang for front end support(Rough disk space ~30G). It is highly recommended to use LLVM version in commit hash ID(26eb428) same with the Polygeist version to ensure MLIR consistency.

$ git clone https://github.com/yuxwang99/compigra.git

2. Install gurobi as ILP solver

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.

3. Build compigra

If you use 1.(1) to clone the project, 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

Otherwise, set MLIR_DIR(Line50) and LLVM_BUILD_MAIN_SRC_DIR(Line58) in the CMakeLists.txt to point to your customized MLIR location.

Use Compigra

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

[ARC25 submission]

You could refer ARC25 for detailed explanations on the passes we use in the end-to-end compilation flow for the ARC25 submission.

Simulate your result

Software simulation

Use CGRA-simulator for software simulation to get CGRA computation results using assembly.

RTL simulation

See X-Heep and OpenEdgeCGRA for more help.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published