Skip to content

An MLIR-based AI compiler designed for Python frontend to RISC-V DSA

License

Notifications You must be signed in to change notification settings

alexshuang/fleet-compiler

Repository files navigation

fleet-compiler

Fleet compiler is based on MLIR and aims to compile Python frontend code to Host/RISC-V domain-specific architectures (DSA).

The compiler parses neural networks written in Python and Numpy into Abstract Syntax Tree (AST), translates into Intermediate Representation (IR) for graph optimiaztion.

The IR is inspired by MLIR, with its dialects and operations having similar syntax and semantics to those in MLIR. This ensures that any dialect and operation can be easily converted into MLIR, allowing for optimization and code generation by MLIR/LLVM.

Quick Start

  1. Install from source:
pip install fleet-compiler
  1. Try to inference gpt2:
fleet_compiler_cli examples/gpt2.py
  1. Dump executable intermediaes AST/MLIR:
fleet_compiler_cli examples/gpt2.py --emitAST --emitMLIR --only-compile
fleet_compiler_cli examples/gpt2.py --emitMLIR --opt --only-compile --dump-intermediates-to dumps

Developers

pip install -r dev_requirements.txt
apt install llvm-15 mlir-tools-15

Run tests:

pytest tests/python
lit tests/mlir

About

An MLIR-based AI compiler designed for Python frontend to RISC-V DSA

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages