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, and clearer scoping rules.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 current documents in this directory describe the new forked frontend and runtime stack:
The legacy upstream documentation under docs/source/ is still useful for
background on Allo's broader design and backend ecosystem.
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 unless a specific LLVM toolchain is
needed. When building LLVM on macOS, include compiler-rt together with
openmp in LLVM_ENABLE_RUNTIMES.
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_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS="clang;mlir" \
-DLLVM_ENABLE_RUNTIMES="openmp" \
-DLLVM_TARGETS_TO_BUILD="Native" \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_INSTALL_UTILS=ON \
-DLLVM_USE_CCACHE=ON \
-DLLVM_USE_LINKER=lld
ninja -C externals/llvm-project/buildOn macOS, use the same source and build directories, but use the runtime list
below and omit Linux-specific linker settings to use system lld:
cmake -S externals/llvm-project/llvm -B externals/llvm-project/build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS="clang;mlir" \
-DLLVM_ENABLE_RUNTIMES="compiler-rt;openmp" \
-DLLVM_TARGETS_TO_BUILD="Native" \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_INSTALL_UTILS=ON \
-DLLVM_USE_CCACHE=ON
ninja -C externals/llvm-project/buildFrom the repository root, keep the Python environment active:
export LLVM_BASE_DIR="$PWD/externals/llvm-project/build"
python -m pip install -v -e .LLVM_BASE_DIR is used by the package build to find LLVM and MLIR CMake
packages.
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.