Giter VIP home page Giter VIP logo

t2-fhe-compiler-and-benchmarks's Introduction

T2: A cross compiler and standardized benchmarks for FHE computation

Overview

T2 is an extensible cross compiler and standardized benchmark suite enabling comparisons between fully-homomorphic encryption (FHE) libraries. The T2 repository comprises the T2 DSL and the T2 compiler from T2 DSL to state-of-the-art FHE back-ends.

T2 aims to offer a standardized benchmark suite for FHE that encompasses realistic use-cases. Additionally, the T2 compiler offers a great starting point to explore the different backends (e.g., HElib, Lattigo, PALISADE, SEAL, and TFHE) as a single T2 program is effortlessly transpiled to all supported FHE libraries.

The T2 compiler supports three distinct computational models: Integer, Binary, and Floating-Point domains. Each domain utilizes different sets of functional units, some of which are inherently supported by the backends, while others are implemented on top of the FHE back-ends. This allows users to compare the different domains and find the most efficient for their applications.

T2 is the spiritual successor to the TERMinator suite repository, which includes benchmarks tailored to encrypted computation. The original Terminator suite targets partially homomorphic architectures, however, since its release, fully homomorphic encryption (FHE) has become increasingly popular and more viable. To account for this, T2 targets FHE architectures by modifying the original benchmarks as well as adding new additions.

How to cite this work

The SoK outlining this framework appears in PoPETS 2023 (the preprint can be accessed here). An earlier journal article describing the original Terminator suite can be accessed here, while the authors' version is available here. You can cite these articles as follows:

@Article{PoPETS:Gouert23sok,
  author =       "Charles Gouert and
                  Dimitris Mouris and
                  Nektarios Georgios Tsoutsos",
  title =        "{SoK: New Insights into Fully Homomorphic Encryption Libraries via Standardized Benchmarks}",
  volume =       2023,
  month =        Jul,
  year =         2023,
  publisher =    sciendo,
  journal =      "{Proceedings on Privacy Enhancing Technologies}",
  number =       3,
  pages =        "154โ€“172",
  doi =          "10.56553/popets-2023-0075",
}

@Article{IEEECAL:Mouris18terminator,
  author  =     "Dimitris Mouris and
                 Nektarios Georgios Tsoutsos and
                 Michail Maniatakos",
  title   =     "{TERMinator Suite: Benchmarking Privacy-Preserving Architectures}",
  journal =     "IEEE Computer Architecture Letters",
  year    =     "2018",
  volume  =     "17",
  number  =     "2",
  pages   =     "122-125",
  doi     =     "10.1109/LCA.2018.281281"}
}

Supported Homomorphic Encryption Libraries


Build and Run Instructions

Building with Docker

  • Build the Docker image:
    docker build -t t2 .
  • Run the Docker container:
    docker run --rm -i -t t2 bash

Building from Scratch

Tested on Ubuntu 22.04 LTS with Java 8, 9, and 19. For Lattigo, we used go version 1.17.6 and 1.18.1.

Dependencies

  • apt install cmake make build-essential g++ clang autoconf javacc patchelf openjdk-8-jdk maven m4 tar lzip libfftw3-dev
  • Go-lang
  • Follow and modify clone_libs.sh and build_libs.sh scripts to install the FHE libraries in your custom destinations.

Compile the T2 compiler

mvn initialize package

To skip running the test when compiling the T2 compiler run:

mvn package -Dmaven.test.skip

Compile T2 programs

To compile a T2 program type:

java -jar target/terminator-compiler-1.0.jar <path_to_t2_file> [--debug] <LIB> [--w word_size]

where <LIB> can be one of HElib, Lattigo, SEAL, PALISADE, and TFHE. For instance:

Example of compiling a T2 program for SEAL:

java -jar target/terminator-compiler-1.0.jar src/test/resources/tests/arithmetic.t2 --seal

will use SEAL as the back-end over the integers.

Example of compiling a T2 program for Lattigo in the binary domain:

java -jar target/terminator-compiler-1.0.jar src/test/resources/tests/bin_test.t2 --lattigo --w 6

will use Lattigo as the back-end in the binary domain. The T2 compiler automatically detects the appropriate scheme (i.e., BFV/BGV or CKKS) based on the type of the encrypted variables that the T2 program uses (i.e., EncInt or EncDouble).

Example of compiling a T2 program for SEAL in the floating-point domain:

java -jar target/terminator-compiler-1.0.jar src/test/resources/tests/ckks_test.t2 --seal

will use SEAL with the CKKS scheme.

Trustworthy Computing Group

t2-fhe-compiler-and-benchmarks's People

Contributors

cgouert avatar jimouris avatar trustworthycomputing avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

t2-fhe-compiler-and-benchmarks's Issues

Slot rotation

T2 function for rotate left and rotate right the slots.

Documentation

Hi everyone.

I am trying to use T2 for my own research and I am wondering if there is any documentation listing all the available functions/calls and basics regarding how to use the software.

Thanks so much in advance.

Clean-up functional units

We have duplicate code in helper.cpp and functional_units.cpp. Do we need both? Maybe it would be best to completely remove the helper and merge everything into the functional units. In this case, we also need to revisit the benchmarks that we developed manually (i.e., before the compiler) and update the includes.

Support binary encoding

When the user passes a --bin flag, all the integers are encoded as binary arrays. Binary arrays will be encoded in the slots in the schemes that support packing.

  • TFHE
  • SEAL
  • HElib
  • Lattigo
  • PALISADE

Comparison functional units

For keeping track of comparison functional unit progress.

  • SEAL
    • BFV:
      • Integer
      • Binary
  • TFHE
  • PALISADE
    • BFV:
      • Integer
      • Binary
  • Lattigo
    • BFV:
      • Integer
      • Binary
  • HElib
    • BFV:
      • Integer
      • Binary

Automated testing

Add automated tests.

  • 1: Compile some test files for each library when the compiler is compiled.
    • SEAL
    • TFHE
    • PALISADE
    • Lattigo
    • HElib
  • 2: Add CI
  • 3: Assert that the compiled files are correct (ideally by running them with each library and comparing the results)
  • 4: Add more tests
  • 5: Add CKKS tests

Logical right shift

Add logical right shift that does not do the sign extension.

>> is arithmetic shift right, >>> is logical shift right.

TFHE debugging

LR and chi^2 benchmarks have issues with TFHE. The LR benchmark crashes, while the chi^2 benchmark returns the wrong result.

Add encrypted XOR support

Needs to be added to compiler and functional units generated for all libraries except SEAL and TFHE.

MUX operator

(sel) ? c1 : c2 --> mux(se, c1, c2)

All libs except TFHE: sel * c1 + (1 - sel) * c2

Integers:

  • SEAL
  • HElib
  • Palisade
  • Lattigo

Binary:

  • SEAL
  • HElib
  • Palisade
  • Lattigo
  • TFHE

Questions Regarding T2 Test Execution

Hello there! Thanks for the interesting project!

I'm currently working on developing a testing tool for HE libraries, based on this project.
I'm using the test programs from this project to ensure my tool is functioning correctly, and I have a couple of questions I'd like to ask:

  1. I noticed that the test execution code seems to test comp.t2 only in the HElib backend. Is there a specific reason why it's not tested in other library backends, such as SEAL?
  2. I couldn't find the code to execute the conditions.t2 test. What configuration should I use to run it in SEAL?

Thank you!

Error while building using Docker

Hi,

I got following error while trying to build repo using Docker:

=> ERROR [11/13] RUN .circleci/clone_libs.sh                                                                      0.3s
------
 > [11/13] RUN .circleci/clone_libs.sh:
0.246 + .circleci/clone_libs.sh
0.246 /bin/bash: .circleci/clone_libs.sh: /bin/bash^M: bad interpreter: No such file or directory
------
Dockerfile:23
--------------------
  21 |
  22 |     # Clone HE libraries
  23 | >>> RUN .circleci/clone_libs.sh
  24 |
  25 |     # Build HE libraries
--------------------
ERROR: failed to solve: process "/bin/bash -exo pipefail -c .circleci/clone_libs.sh" did not complete successfully: exit code: 126

Here is my current configuration:

Docker version: 4.26.1
WSL version: 2.0.9.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.2861

Thanks

Shift operations

Add a shift built-in functions for the T2 DSL and shift functional units for all the backends.

Currently, T2 supports << and >> but does not call any underlying functional unit.

Add CKKS support

CKKS support:

  • New datatypes: double, EncDouble, EncDouble[]
  • Automatically detect between BFV/BGV and CKKS
  • SEAL CKKS
  • PALISADE CKKS
  • HElib CKKS
  • Lattigo CKKS

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.