Skip to content

MLIR Toy tutorial in Rust! See how you can implement a programming language using MLIR and Rust.

License

Notifications You must be signed in to change notification settings

ArtemSkrebkov/mlir-rust-toy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MLIR RUST TOY

Motivation

The content of this repo is a humble attempt to implement Toy tutorial using Rust.

Fortunately, MLIR framework provides a decent C API and the current project uses the MLIR C API to build a Rust wrapper around it to be able to implement the Toy language in Rust. However, some parts still require building C++ project :)

The current state of main branch corresponds to chapter 6. So curious user can play with building AST, MLIR IR as well as executing Toy language sources with and without optimizations. There are a few bugs and some optimizations are missed since they are not yet available in C API. Hopefully, they will be resolved in near future.

Building & playing

  1. Make sure that you have LLVM 14.0.0 installed - at this point, this is the only compatible version
  2. Build ODS description for Toy
mkdir -p ./cpp/toy/build
cd ./cpp/toy/build
cmake ..
make
  1. Build and test
cargo build
cargo test
  1. Run the Toy compiler
cargo run --example toy-compiler -- --filename ./testdata/reshape_opt.toy --emit mlir --opt

Inspiration

About

MLIR Toy tutorial in Rust! See how you can implement a programming language using MLIR and Rust.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published