Giter Club home page Giter Club logo

buddy-mlir's Introduction

BUDDY MLIR

MLIR-Based Ideas Landing Project (Project page).

Getting Started

LLVM/MLIR Dependencies

This project uses LLVM/MLIR as an external library. Please make sure the dependencies are available on your machine.

Clone and Initialize

$ git clone [email protected]:buddy-compiler/buddy-mlir.git
$ cd buddy-mlir
$ git submodule update --init

Build and Test LLVM/MLIR/CLANG

$ cd buddy-mlir
$ mkdir llvm/build
$ cd llvm/build
$ cmake -G Ninja ../llvm \
    -DLLVM_ENABLE_PROJECTS="mlir;clang" \
    -DLLVM_TARGETS_TO_BUILD="host;RISCV" \
    -DLLVM_ENABLE_ASSERTIONS=ON \
    -DCMAKE_BUILD_TYPE=RELEASE
$ ninja check-mlir check-clang

If your target machine includes a Nvidia GPU, you can use the following configuration:

$ cmake -G Ninja ../llvm \
    -DLLVM_ENABLE_PROJECTS="mlir;clang" \
    -DLLVM_TARGETS_TO_BUILD="host;RISCV;NVPTX" \
    -DMLIR_ENABLE_CUDA_RUNNER=ON \
    -DLLVM_ENABLE_ASSERTIONS=ON \
    -DCMAKE_BUILD_TYPE=RELEASE

If your target machine has lld installed, you can use the following configuration:

$ cmake -G Ninja ../llvm \
    -DLLVM_ENABLE_PROJECTS="mlir;clang" \
    -DLLVM_TARGETS_TO_BUILD="host;RISCV" \
    -DLLVM_USE_LINKER=lld \
    -DLLVM_ENABLE_ASSERTIONS=ON \
    -DCMAKE_BUILD_TYPE=RELEASE

Build buddy-mlir

$ cd buddy-mlir
$ mkdir build
$ cd build
$ cmake -G Ninja .. \
    -DMLIR_DIR=$PWD/../llvm/build/lib/cmake/mlir \
    -DLLVM_DIR=$PWD/../llvm/build/lib/cmake/llvm \
    -DLLVM_ENABLE_ASSERTIONS=ON \
    -DCMAKE_BUILD_TYPE=RELEASE
$ ninja
$ ninja check-buddy

If you want to add domain-specific framework support, please add the following cmake options:

Framework Enable Option Other Options
OpenCV -DBUDDY_ENABLE_OPENCV=ON Add -DOpenCV_DIR=</PATH/TO/OPENCV/BUILD/> or install OpenCV release version on your local device.

Dialects

Bud Dialect

Bud dialect is designed for testing and demonstrating.

DIP Dialect

DIP dialect is designed for digital image processing abstraction.

Tools

buddy-opt

The buddy-opt is the driver for dialects and optimization in buddy-mlir project.

AutoConfig Mechanism

The AutoConfig mechanism is designed to detect the target hardware and configure the toolchain automatically.

Examples

The purpose of the examples is to give users a better understanding of how to use the passes and the interfaces in buddy-mlir. Currently, we provide three types of examples.

  • IR level conversion and transformation examples.
  • Domain-specific application level examples.
  • Testing and demonstrating examples.

For more details, please see the documentation of the examples.

Benchmarks

The benchmarks in this repo use JIT tool (mlir-cpu-runner) as the execution engine. For AOT benchmarks, please see buddy-benchmark repo.

We provide the following benchmarks:

  • Conv2D
$ cd buddy-mlir/benchmark
$ make

For more features and configurations, please see the benchmark document.

buddy-mlir's People

Contributors

zhanghb97 avatar meshtag avatar axmat avatar linuxlonelyeagle avatar joejiong avatar origami404 avatar sforekeeper avatar xtayex avatar artemskrebkov avatar ris-bali avatar xlinsist avatar bbuf avatar amanchhaparia avatar lhy-24 avatar wlfj avatar leiwang1999 avatar taiqzheng avatar hanliutong avatar panhaolin2001 avatar joshuaqsh avatar inclyc avatar zdx0317 avatar zrr1999 avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.