Skip to content

Latest commit

 

History

History
50 lines (40 loc) · 1.22 KB

README.md

File metadata and controls

50 lines (40 loc) · 1.22 KB

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