Project overview, fork notes, documentation index, and build instructions.
Allo is a Python-embedded, MLIR-based accelerator design language and compiler. It is designed for modular construction of high-performance hardware accelerators, especially machine-learning accelerators. The upstream project combines a Python frontend, MLIR-based compiler infrastructure, scheduling and transformation APIs, simulation flows, and backend code generation for hardware targets such as FPGA and AI Engine platforms.
The upstream Allo repository is maintained at cornell-zhang/allo. Upstream Allo is licensed under the Apache License 2.0; this fork follows the same license.
Upstream Allo provides a unified abstraction for accelerator design and programming. Its core features include:
This repository is a fork of upstream Allo. The active fork branch is allov2,
hosted at kkkaishao/allo. It keeps the
upstream goal of composable accelerator design, while changing the frontend and
runtime interface to make Allo kernels feel more native in Python.
The main changes in this fork are:
@kernel, explicit annotations, nested
kernels, constexpr, consteval, templates, postponed type annotations, and
clearer scoping rules.Stream frontend types for FIFO communication, including scalar and
block payloads.NOTE: This fork is still in active development, and the documentation and build instructions may not be fully up to date.
NOTE: This fork is not intended to be merged back into the upstream repository, and does not represent the direction of upstream development. The upstream project is still active and have different design goals and priorities.
The documents in this directory describe the Allo frontend, compiler, and runtime stack:
For the upstream released package, follow the upstream installation guide. For this fork, building from source is the recommended path because the new frontend and backend changes are developed in the repository.
All commands below assume a Unix-like shell. The project requires Python 3.12 or newer, CMake 3.20 or newer, Ninja, a C++ compiler, and an LLVM/MLIR build from the repository submodule.
On Ubuntu or Debian:
sudo apt-get update
sudo apt-get install -y \
build-essential \
ccache \
clang \
cmake \
lld \
ninja-build \
python3 \
python3-dev \
python3-pip \
python3-venvOn macOS, install the common dependencies with Homebrew:
brew install cmake ninja python@3.12 ccacheOn macOS, prefer the system Clang and linker or it may introduce some linking issues.
git clone https://github.com/kkkaishao/allo.git
cd allo
git checkout allov2
git submodule update --init --recursive --depth 1Using conda:
conda create -n allo python=3.12
conda activate alloUsing venv:
python3 -m venv .env --prompt allo
source .env/bin/activate
python -m pip install --upgrade pipFrom the repository root:
cmake -S externals/llvm-project/llvm -B externals/llvm-project/build -G Ninja \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_PROJECTS="mlir" \
-DLLVM_USE_CCACHE=ON \
-DLLVM_USE_LINKER=lld
ninja -C externals/llvm-project/buildOn macOS, use the same source and build directories, but omit the compiler and linker-related flags:
cmake -S externals/llvm-project/llvm -B externals/llvm-project/build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_PROJECTS="mlir" \
-DLLVM_USE_CCACHE=ON
ninja -C externals/llvm-project/buildFrom the repository root, keep the Python environment active:
python -m pip install -v -e .After the editable install has configured the project, the CMake build directory
is build. Use Ninja for focused rebuilds:
ninja -C build <target>Always activate the allo Python environment before building or running tests.