Skip to content

This repository is used to study compiler technology based on MLIR.

License

Notifications You must be signed in to change notification settings

matrix97317/beginner-compiler

Repository files navigation

beginner-compiler

This repository is used to study compiler technology based on MLIR. Mainly concentrated in the following aspects:

  • Code Scaffolding Toolchain (CMake,Code Standards,Software Dependency Management, etc)
  • Language Binding Technology (Pybind,etc)
  • MLIR
  • MLIR-Extension (torch-mlir,onnx-mlir)
  • Compiler based MLIR (IREE, CIRCT)
  • Compiler Optimization Theory

Build Project

STEP 1. Build Third Party Package

Refer to /third_party/README.md

STEP 2. Build Beginner Compiler Project

mkdir build

cd build

cmake -G Ninja .. \
  -DLLVM_DIR=$PWD/../third_party/llvm-project/build/lib/cmake/llvm \
  -DMLIR_DIR=$PWD/../third_party/llvm-project/build/lib/cmake/mlir \
  -DLLVM_ENABLE_ASSERTIONS=ON \
  -DCMAKE_BUILD_TYPE=RELEASE

cmake --build . --target beginner-opt

PS: VSCode Debug Project

mkdir debug
cd debug
cmake -G Ninja .. \
  -DLLVM_DIR=$PWD/../third_party/llvm-project/build/lib/cmake/llvm \
  -DMLIR_DIR=$PWD/../third_party/llvm-project/build/lib/cmake/mlir \
  -DLLVM_ENABLE_ASSERTIONS=ON \
  -DCMAKE_BUILD_TYPE=Debug

cmake --build . --target beginner-opt

Run Demo

Demo 1: Parser MLIR file
cd build/bin
./beginner-opt ../../example/mlir/helloworld.mlir

Reference

About

This repository is used to study compiler technology based on MLIR.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published