Paper 2023/1445

HEIR: A Unified Representation for Cross-Scheme Compilation of Fully Homomorphic Computation

Song Bian
Zian Zhao
Zhou Zhang
Ran Mao
Kohei Suenaga
Yier Jin
Zhenyu Guan
Jianwei Liu

We propose a new compiler framework that automates code generation over multiple fully homomorphic encryption (FHE) schemes. While it was recently shown that algorithms combining multiple FHE schemes (e.g., CKKS and TFHE) achieve high execution efficiency and task utility at the same time, developing fast cross-scheme FHE algorithms for real-world applications generally require heavy hand-tuned optimizations by cryptographic experts, resulting in either high usability costs or low computational efficiency. To solve the usability and efficiency dilemma, we design and implement HEIR, a compiler framework based on multi-level intermediate representation (IR). To achieve cross-scheme compilation of efficient FHE circuits, we develop a two-stage code-lowering structure based on our custom IR dialects. First, the plaintext program along with the associated data types are converted into FHE-friendly dialects in the transformation stage. Then, in the optimization stage, we apply FHE-specific optimizations to lower the transformed dialect into our bottom-level FHE library operators. In the experiment, we implement the entire software stack for HEIR, and demonstrate that complex end-to-end programs, such as homomorphic K-Means clustering and homomorphic data aggregation in databases, can easily be compiled to run $72$--$179\times$ faster than the program generated by the state-of-the-art FHE compilers.

Available format(s)
Publication info
Published elsewhere. Minor revision. NDSS 2024
Fully Homomorphic Encryptionprivacy-preserving computation
Contact author(s)
sbian @ buaa edu cn
zhaozian @ buaa edu cn
2023-12-18: revised
2023-09-22: received
See all versions
Short URL
Creative Commons Attribution


      author = {Song Bian and Zian Zhao and Zhou Zhang and Ran Mao and Kohei Suenaga and Yier Jin and Zhenyu Guan and Jianwei Liu},
      title = {{HEIR}: A Unified Representation for Cross-Scheme Compilation of Fully Homomorphic Computation},
      howpublished = {Cryptology ePrint Archive, Paper 2023/1445},
      year = {2023},
      doi = {10.14722/ndss.2024.23067},
      note = {\url{}},
      url = {}
Note: In order to protect the privacy of readers, does not use cookies or embedded third party content.