HPU acceleration
This guide explains how to update your existing program to leverage HPU acceleration, or to start a new program using HPU.
TFHE-rs now supports a HPU backend based on FPGA implementation, enabling integer arithmetic operations on encrypted data.
Prerequisites
An AMD/Xilinx V80 board installed on a server running Linux with kernel 5.15.0-*
A HPU bitstream that you can find (or build) in HPU fpga repository and load in V80 flash and FPGA using its README
AMI linux device driver version from this fork
QDMA linux device driver version from this fork
Rust version - check this page
Importing to your project
To use the TFHE-rs HPU backend in your project, add the following dependency in your Cargo.toml.
tfhe = { version = "~1.4.2", features = ["integer", "hpu-v80"] }For optimal performance when using TFHE-rs, run your code in release mode with the --release flag.
Supported platforms
TFHE-rs HPU backend is only supported on Linux (x86).
Linux
Supported
Unsupported
macOS
Unsupported
Unsupported
Windows
Unsupported
Unsupported
A first example
Configuring and creating keys.
Comparing to the CPU example, HPU set up differs in the key creation and device registration, as detailed here
Here is a full example (combining the client and server parts):
Setting the hpu
An HPU device is built for a given parameter set. At this point, because HPU is still a prototype, the software provided is retrieving this parameter set from an instantiated HpuDevice. Once retrieved, reading some HPU registers, this parameter set is used by the example applications to generate both client and compressed server keys. Server key has then to be decompressed by the server to be converted into the right format and uploaded to the device. Once decompressed, the operations between CPU and HPU are identical.
Encryption
On the client-side, the method to encrypt the data is exactly the same than the CPU one, as shown in the following example:
Computation
The server first needs to set up its keys with set_server_key((hpu_device, compressed_server_key)).
Then, homomorphic computations are performed using the same approach as the CPU operations.
Decryption
Finally, the client decrypts the result using:
List of available operations
The HPU backend includes the following operations for unsigned encrypted integers:
name
symbol
Enc/Enc
Enc/ Int
Last updated
Was this helpful?