| Information | |
|---|---|
| Team number | AOHW-339 |
| Project name | Homomorphic Encryption Acceleration Through Reconfigurable Fabric |
| YouTube's video | https://youtu.be/GwnpjDBOPcQ |
| Project's repository | https://github.com/IoSonoDue2/AOHW-24-HERF |
| University name | Politecnico di Milano |
| Participant (email) | Valentino Guerrini (valentino.guerrini@mail.polimi.it) |
| Supervisor name | Marco Domenico Santambrogio |
| Supervisor email | marco.santambrogio@polimi.it |
AMD Kria KV260, AMD-Xilinx Versal VCK5000
Vitis HLS 2022.2, Vivado 2022.2, Vitis 2022.2 , PYNQ 3.0.1
This project brings the CKKS homomorphic encryption scheme to hardware, leveraging the capabilities of AMD-Xilinx tools. This innovative solution accelerates encryption and decryption processes in both embedded environments with the Kria KV260 and data center accelerators using the Versal VCK5000. Uniquely, in the data center setting, we have enhanced the homomorphic addition operation, demonstrating the seamless transition from secure encryption in embedded systems to efficient homomorphic computation on ciphertexts in data centers. This project showcases the future of secure, scalable, and efficient data processing across diverse computing environments.
The repository contains the following main directories and files:
├─`Kria_kv260`: Supports the development and deployment of the CKKS scheme on the Kria KV260 SOM. It includes:
└─`Makefile` #Makefile for building the Kria implementation and packaging it into a zip file ready for deployment.
└─`setup_kria.sh` #Script to set up the environment for Vitis HLS and Vivado.
└─`DataGen/` #Includes files required to compile the software version of the algorithm on the Kria KV260 arm cpu. The generated binary is used by the host code to create encryption keys, secret keys, reference values, and measure the time taken to test the hardware version's correctness and speedup.
└─`hw/` #Directory for build outputs.
└─`host/` #Host code and all necessary files for testing.
└─`hw_build/` #Directory containing the Bitstreams.
└─`source/` #Source code implementing the CKKS encryption scheme.
└─`ready_to_run/` #Directory containing ready-to-run files.
├─`VCK5000` : Supports the development and deployment of the CKKS scheme on the Versal VCK5000 platform. It includes:
└─`Makefile` #Automates the build process for compiling source code and generating binaries and hardware configuration files.
└─`setup_versal.sh` #Script to set up the environment for the Versal platform.
└─`hw/` #Contains configuration files for generating hardware overlays for CKKS scheme and homomorphic operations.
└─`hw_build/` #Stores build outputs (xclbins), including executable host binary file to program the FPGA.
└─`source/` #Contains source code for the CKKS encryption scheme, including implementation files, headers, and test benches.
└─`sw/` #Includes software components for interfacing with VCK5000 hardware, host code, setup scripts for emulation, and runtime configuration files.
- Open a terminal, then clone the repository by running the following command
git clone https://github.com/IoSonoDue2/AOHW-24-HERF.git- move into the repository with
cd AOHW-24-HERF- Navigate to the
Kria_kv260/directory. - Move the folder
ready_to_run/to your Kria in/home/root/jupyter_notebooks/(this path can vary according to your installation of pynq) - Connect through shell to the board, move in the
ready_to_run/directory and execute:chmod +x data_gen
- Connect through Jupyter to the board and move in the
ready_to_run/directory. - Open the host you want to test
<...>_host.ipynband run it.
- Navigate to the
VCK5000/directory. - Move the
hw_build/folder on the host machine connected to a VersalVCK5000 eith qdma2022.2 platform, enter the folder, and run the host application with:
./host_overlay.exeNote: The host will let you select which kernel to run and test
Open a terminal, then clone the repository by running the following command
git clone https://github.com/IoSonoDue2/AOHW-24-HERF.gitThen, move into the repository with
cd AOHW-24-HERFEnsure that all necessary tools and dependencies are installed and configured. This includes Vitis HLS 2022.2 and Vivado 2022.2.
- Open a terminal.
- Navigate to the
Kria_kv260/directory. - Run the setup script:
Alternatively, if Vivado and Vitis_HLS are installed in different paths, then run these commands:
source setup_kria.shsource <PATH_TO_XILINX_VIVADO_2022_2>/settings64.sh source <PATH_TO_XILINX_VITIS_HLS_2022_2>/settings64.sh
- Open a terminal.
- Navigate to the
VCK5000/directory. - Run the setup script:
Alternatively, if xrt and Vitis are installed in different paths, then run these commands:
source setup_versal.shsource <PATH_TO_XILINX_XRT>/setup.sh source <PATH_TO_XILINX_VITIS_2022_2>/settings64.sh
Navigate to the appropriate directory (Kria_kv260 or VCK5000) and run the Makefile to build the project.
- Navigate to the
Kria_kv260/directory. - Run the Makefile:
Wait to finish and you will find a zip folder
make all make pack
<export.zip>containing the vivado generated bitstreams along with hostcodes for encryption and decryption - Mode the
data_gen/folder on your device (Kria KV260), enter the folder and run:A binary executable namedmake data_gen
data_genwill be generated.
- Navigate to the
VCK5000/directory. - Run the Makefile:
Note: the default value for NAME is "hw_build/" and the default for TARGET is "hw". Wait to finish and you will find the folder containg the xclbins and the host code binary to program the FPGA
make build_and_pack NAME=<build_name> TARTGET=<hw|hw_emu>
After building the project, program and run the FPGA with the generated files.
- Connect to your Kria KV260 with pynq installed.
- Create a folder
<folder_name>/on the board in/home/root/jupyter_notebooks/(this path can vary according to your installation of pynq) - Move the files generated in the
<export.zipanddata_genexecutable compiled on kria in this folder. In particular you need to obtain the following structure:├─ <folder_name>/ └─ data_gen └─ decryption_host.ipynb └─ encryption_host.ipynb └─ ckks_encryption_wrapper.xsa └─ ckks_decryption_wrapper.xsa └─ data/ (this folder can be empty but it is necessary) - Open the host you want to test
<...>_host.ipynband run it.
Move the <build_name>/ folder on the host machine connected to board, enter the folder, and run the host application with:
./host_overlay.exeThe host will let you select which kernel to run and test
- For further customization and testing, modify the source code in the
sourcedirectories and rebuild the project.
