A compiler for homomorphic encryption
An MLIR-based toolchain for homomorphic encryption compilers. Read the docs at the HEIR website.
For more information on MLIR, see the MLIR homepage.
There are currently three ways to use HEIR:
bazel and
rules_heir with either
the OpenFHE or
Lattigo backends.heir_py Python package.heir-opt and heir-translate
binaries directly, extracting the generated backend code and integrating it
into your project manually.See Getting Started for more details.
This project uses bazel for its build system. Install
bazelisk to manage the bazel version
automatically. Then, with bazel on your path (pointing to bazelisk), run the
following to build the main pass-running tool.
bazel build //tools:heir-optOr run an end-to-end test like
bazel test //tests/Examples/openfhe/ckks/halevi_shoup_matvec:allHEIR depends on LLVM (from source) so a clean build may take 30 minutes
depending on your machine. For faster builds, use
BuildBuddy. Sign up for an account, create an API
key, and add the following to .bazelrc.user in the root of the HEIR workspace:
common --remote_header=x-buildbuddy-api-key=
common --config=remoteThis should reduce a clean build time to about 5 minutes.
See the bazel tips page for more example commands and tips on using bazel.
| Backend Library | BGV | BFV | CKKS | CGGI |
|---|---|---|---|---|
| OpenFHE | ✅ | ✅ | ✅ | ❌ |
| Lattigo | ✅ | ✅ | ✅ | ❌ |
| tfhe-rs | ❌ | ❌ | ❌ | ✅ |
| Jaxite | ❌ | ❌ | ❌ | ✅ |
Note some backends do not support all schemes.
There are many ways to contribute to HEIR:
#heir channel on
the FHE.org discord.The HEIR project can be cited in academic work through the following entry:
@misc{ali2025heir,
title={HEIR: A Universal Compiler for Homomorphic Encryption},
author={Asra Ali and Jaeho Choi and Bryant Gipson and Shruthi Gorantala
and Jeremy Kun and Wouter Legiest and Lawrence Lim and Alexander
Viand and Meron Zerihun Demissie and Hongren Zheng},
year={2025},
eprint={2508.11095},
archivePrefix={arXiv},
primaryClass={cs.CR},
url={https://arxiv.org/abs/2508.11095},
}This is not an officially supported Google product.
No open issues yet, or sync has not completed.