Skip to content
This repository was archived by the owner on Dec 25, 2023. It is now read-only.

Commit 4f2e5f1

Browse files
authored
prepare for v2.0 oneapi release (#19)
1 parent d4e9d5a commit 4f2e5f1

File tree

101 files changed

+6423
-6389
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+6423
-6389
lines changed

.github/workflows/ci.yml

Lines changed: 53 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ on:
55
# or "reopened".
66
pull_request:
77
branches:
8-
- main
98
- development
9+
- main
1010
- "[0-9]+.[0-9]+" # Run on release branch, e.g. 1.0
1111
# Run when protected branches are pushed to, e.g. via merge
1212
push:
1313
branches:
14-
- main
1514
- development
15+
- main
1616
- "[0-9]+.[0-9]+" # Run on release branch, e.g. 1.0
1717
workflow_dispatch:
1818

@@ -40,87 +40,93 @@ jobs:
4040
echo 'hostname'
4141
hostname
4242
43-
- name: build_he-fpga
43+
- name: prebuild_hexl-fpga
4444
run: |
45+
source /opt/intel/oneapi/setvars.sh
46+
rm -rf build
47+
rm -rf hexl-fpga-install
4548
mkdir build
46-
cd build
47-
cmake .. -DCMAKE_INSTALL_PREFIX=install -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DENABLE_FPGA_DEBUG=ON -DENABLE_TESTS=ON -DENABLE_BENCHMARK=ON
48-
make -j
49+
cmake -S . -B build -DCMAKE_CXX_COMPILER=dpcpp -DCMAKE_INSTALL_PREFIX=hexl-fpga-install -DCMAKE_BUILD_TYPE=Release -DENABLE_FPGA_DEBUG=OFF -DENABLE_TESTS=ON -DENABLE_BENCHMARK=ON
50+
51+
- name: build_host
52+
run: |
53+
source /opt/intel/oneapi/setvars.sh
54+
cmake --build build --target hexl-fpga -j
4955
5056
- name: build_emulation
5157
run: |
52-
source /disk1/tools/init_env.sh
53-
source /disk1/tools/new_env_setup.sh
54-
cd build
55-
make emulation
58+
source /opt/intel/oneapi/setvars.sh
59+
cmake --build build --target emulation -j
5660
5761
- name: build_install
5862
run: |
59-
cd build
60-
make install
63+
cmake --install build
6164
62-
- name: run_tests
65+
- name: run_test_fpga
6366
run: |
64-
source /disk1/tools/init_env.sh
65-
source /disk1/tools/new_env_setup.sh
66-
cd build
67-
export FPGA_DATA_DIR="/disk1/hexl-fpga-data"
67+
source /opt/intel/oneapi/setvars.sh
68+
export FPGA_DATA_DIR="/disk1/hexl-fpga-data-oneapi"
6869
export KEYSWITCH_DATA_DIR="${FPGA_DATA_DIR}/test-vectors"
69-
echo "Run tests with bitstream"
70+
export RUN_CHOICE=2
7071
export FPGA_BITSTREAM_DIR="${FPGA_DATA_DIR}/bitstreams"
71-
make tests
72-
echo "Run tests with emulation"
73-
export FPGA_BITSTREAM_DIR=
74-
RUN_CHOICE=1 make tests
72+
cmake --build build --target tests
7573
76-
- name: run_bench
74+
- name: run_test_emu
7775
run: |
78-
source /disk1/tools/init_env.sh
79-
source /disk1/tools/new_env_setup.sh
80-
cd build
81-
export FPGA_DATA_DIR="/disk1/hexl-fpga-data"
76+
source /opt/intel/oneapi/setvars.sh
77+
export FPGA_DATA_DIR="/disk1/hexl-fpga-data-oneapi"
78+
export KEYSWITCH_DATA_DIR="${FPGA_DATA_DIR}/test-vectors"
79+
export RUN_CHOICE=1
80+
cmake --build build --target tests
81+
82+
- name: run_bench_fpga
83+
run: |
84+
source /opt/intel/oneapi/setvars.sh
85+
export FPGA_DATA_DIR="/disk1/hexl-fpga-data-oneapi"
8286
export FPGA_BITSTREAM_DIR="${FPGA_DATA_DIR}/bitstreams"
8387
export KEYSWITCH_DATA_DIR="${FPGA_DATA_DIR}/test-vectors"
84-
make bench
88+
echo "Run benchmark with hardware bitstream"
89+
cmake --build build --target bench
8590
8691
- name: build_examples
8792
run: |
93+
source /opt/intel/oneapi/setvars.sh
8894
mkdir build-examples
89-
cd build-examples
90-
cmake ../examples/ -DCMAKE_PREFIX_PATH=$(realpath ..)/build/install/lib/cmake/ -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc
91-
make -j
95+
cmake -S ./examples -B ./build-examples -DCMAKE_PREFIX_PATH=$(realpath .)/hexl-fpga-install/lib/cmake/ -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=dpcpp
96+
cmake --build build-examples
9297
93-
- name: run_examples
98+
- name: run_examples_fpga
9499
run: |
95-
source /disk1/tools/init_env.sh
96-
source /disk1/tools/new_env_setup.sh
97-
cd build-examples
98-
RUN_CHOICE=1 make examples
100+
source /opt/intel/oneapi/setvars.sh
101+
aocl initialize acl0 pac_s10_usm
102+
export FPGA_DATA_DIR="/disk1/hexl-fpga-data-oneapi"
103+
export FPGA_KERNEL=DYADIC_MULTIPLY
104+
export FPGA_BITSTREAM="${FPGA_DATA_DIR}/bitstreams/libdyadic_multiply.so"
105+
export RUN_CHOICE=2
106+
cmake --build build-examples --target examples
99107
100108
- name: build_experimental_bridges
101109
run: |
102110
pushd experimental/bridge-seal
103-
cmake -S . -B build-seal4.0.0-fpga -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$(realpath ${PWD}/../../build/install)" -DCMAKE_INSTALL_PREFIX=seal-fpga-install
111+
cmake -S . -B build-seal4.0.0-fpga -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$(realpath ${PWD}/../../hexl-fpga-install)" -DCMAKE_INSTALL_PREFIX=seal-fpga-install
104112
cmake --build build-seal4.0.0-fpga -j
105113
popd
106114
107-
- name: build_experimental_tests
115+
- name: build_seal_based_test
108116
run: |
117+
source /opt/intel/oneapi/setvars.sh
109118
pushd experimental/bridge-seal/tests
110-
cmake -S . -B build -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$(realpath ${PWD}/../../../build/install);$(realpath ${PWD}/../seal-fpga-install)"
119+
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$(realpath ${PWD}/../../../hexl-fpga-install);$(realpath ${PWD}/../seal-fpga-install)"
111120
cmake --build build -j
112121
popd
113122
114123
- name: run_experimental_tests
115124
run: |
116-
source /disk1/tools/init_env.sh
117-
source /disk1/tools/new_env_setup.sh
118-
pushd experimental/bridge-seal/tests/build
125+
source /opt/intel/oneapi/setvars.sh
126+
pushd experimental/bridge-seal/tests
119127
echo "Run experimental tests with FPGA bitstream"
120-
export FPGA_DATA_DIR="/disk1/hexl-fpga-data"
128+
export FPGA_DATA_DIR="/disk1/hexl-fpga-data-oneapi"
121129
export FPGA_BITSTREAM_DIR="${FPGA_DATA_DIR}/bitstreams"
122-
make seal_test
123-
echo "Run experimental tests with emulation"
124-
export FPGA_BITSTREAM_DIR=
125-
RUN_CHOICE=1 make seal_test
130+
export RUN_CHOICE=2
131+
cmake --build build --target seal_test
126132
popd

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*.aoclib
22
*.aocx
33
*.pdf
4-
build/
4+
*build/
55
build-examples/
66
hexl-fpga-install/
7+
test_data_dir/

CHANGES.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changes
22

3+
## Version 2.0-rc1
4+
- Migrated the HEXL-FPGA library from OpenCL to oneAPI.
5+
- Added experimental bridge to Microsoft SEAL v4.0.0.
6+
- Added framework for comparing performance between HEXL-FPGA and HEXL.
7+
- Updated related documents.
8+
9+
Co-Authored-by: @[shahzadATintel](https://github.com/shahzadATintel) <br/>
10+
Co-Authored-by: @[wangyon1](https://github.com/wangyon1) <br/>
11+
Co-Authored-by: @[ymeng-git](https://github.com/ymeng-git) <br/>
12+
Co-Authored-by: @[yzhou79](https://github.com/yzhou79) <br/>
13+
314
## Version 1.1
415
- Added KeySwitch FPGA kernel support.
516
- Added integrated kernel support for DyadicMultiply and KeySwitch.

CMakeLists.txt

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,13 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
cmake_minimum_required(VERSION 3.5.1)
5+
project(hexl-fpga)
6+
set(hexl-fpga_VERSION 2.0)
57

6-
project(hexl-fpga LANGUAGES C CXX)
7-
set(hexl-fpga_VERSION 1.1)
8-
9-
set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING INTERNAL FORCE)
10-
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build Type: Debug or Release")
11-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
12-
set(CMAKE_CXX_STANDARD 11)
13-
set(CMAKE_CXX_FLAGS_DEBUG "-g3 -O0 -Wall")
14-
set(CMAKE_C_FLAGS_DEBUG "-g3 -O0 -Wall")
15-
set(CMAKE_CXX_FLAGS_RELEASE "-march=native -O3 -funroll-loops -Wall ")
16-
set(CMAKE_C_FLAGS_RELEASE "-march=native -O3 -funroll-loops -Wall ")
17-
18-
set(OPENCL_ROOT_PATH $ENV{INTELFPGAOCLSDKROOT})
198
set(FPGA_SRC_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
209

2110
option(ENABLE_FPGA_DEBUG "Enable FPGA debugging info" OFF)
11+
message(STATUS "Using Compiler for C++ : ${CMAKE_CXX_COMPILER}")
2212
message(STATUS "ENABLE_FPGA_DEBUG: ${ENABLE_FPGA_DEBUG}")
2313
option(ENABLE_TESTS "Enable Tests" OFF)
2414
message(STATUS "ENABLE_TESTS: ${ENABLE_TESTS}")
@@ -51,6 +41,7 @@ if(FPGA_USE_INTEL_HEXL)
5141
endif()
5242
endif()
5343

44+
5445
add_subdirectory(host)
5546
add_subdirectory(device)
5647

PREREQUISITE.md

Lines changed: 9 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,24 @@
11
# Prerequisite -- Environment Setup for Using Intel FPGA Acceleration Card
22

3-
## Intel Acceleration Stack
3+
Intel provides detailed information about [Intel(R) oneAPI Toolkits](https://www.intel.com/content/www/us/en/developer/tools/oneapi/toolkits.html#gs.4ip3tr) on its website, users can find information about how to download, install and use the Intel(R) oneAPI toolkits. The oneAPI version used in the hexl-fpga project is Intel® oneAPI Base Toolkit (version 2022.2.0). <br>
44

5-
There are two types of Intel Acceleration Stack (version 2.0.1), namely, the [Acceleration Stack for Runtime](https://www.intel.com/content/www/us/en/programmable/f/download/accelerator/license-agreement-pac-d5005.html?swcode=WWW-SWD-IAS-RTE-201) and the [Acceleration Stack for Development](https://www.intel.com/content/altera-www/global/en_us/index/f/download/accelerator/pac-d5005-thank-you.html?swcode=WWW-SWD-IAS-DEV-201). The runtime stack provides a smaller footprint package for software development of runtime host application. It includes Intel FPGA Runtime Environment (RTE) for OpenCL but does not include Intel Quartus Prime; thus, it assumes that the FPGA bitstreams are available. The development stack allows for accelerator function development using the Intel Quartus Prime Pro Edition software (required and included). Additionally, it comes with the Intel FPGA Software Development Kit (SDK) for OpenCL and the Acceleration Stack. <br>
5+
## Intel(R) oneAPI base toolkit installation
66

7-
The Intel Acceleration Stack for development (`d5005_pac_ias_2_0_1_pv_dev_installer.tar.gz`) is encouraged and required to reap the full benefits of Intel HE Acceleration Library for FPGAs, especially before attempting to build the FPGA kernels and if intended usage of Intel HE Acceleration Library for FPGAs includes development contributions. Download, read more detailed installation instructions, updates and related additional resources at [Intel Acceleration Stack link](https://www.intel.com/content/www/us/en/programmable/products/boards_and_kits/dev-kits/altera/intel-fpga-pac-d5005/getting-started.html). <br>
7+
Following the [Intel(R) oneAPI toolkits installation guide for Linux* OS](https://www.intel.com/content/www/us/en/develop/documentation/installation-guide-for-intel-oneapi-toolkits-linux/top.html) to download and install the Intel(R) oneAPI base basekit. <br>
88

9-
Note: Even though the validated operating system is RHEL 7.6, we used CentOS 7.9 without issues.<br>
9+
## Set up a system for FPGA with the Intel(R) PAC
1010

11-
## Intel Quartus Prime Pro Edition
11+
To use Intel(R) PAC FPGA with Intel(R) oneAPI, you also need to install [Intel(R) FPGA add-on package](https://www.intel.com/content/www/us/en/develop/documentation/installation-guide-for-intel-oneapi-toolkits-linux/top/installation/set-up-a-system-for-fpga-with-the-intel-pac/install-fpga-add-on-for-oneapi-base-toolkit.html) and [Intel(R) PAC software stack](https://www.intel.com/content/www/us/en/develop/documentation/installation-guide-for-intel-oneapi-toolkits-linux/top/installation/set-up-a-system-for-fpga-with-the-intel-pac/install-intel-pac-software-stack.html).
1212

13-
Quartus Prime version 19.2 is installed in the Acceleration Stack installation. For Intel HE Acceleration Library for FPGAs, the installation of Quartus Prime version 20.3 is required. [Download the complete version ](https://fpgasoftware.intel.com/20.3/?edition=pro) and follow the instructions below. <br>
14-
15-
```
16-
tar xvf Quartus-pro-20.3.0.158-linux-complete.tar
17-
./setup_pro.sh
18-
```
19-
20-
Use the following configuration:<br>
21-
22-
```
23-
Select the components you want to install:
24-
25-
Quartus Prime Pro Edition [Y/n]: Y
26-
27-
ModelSim -- Intel FPGA Starter Edition (Free) (17169.4MB) [Y/n]: n
28-
29-
ModelSim -- Intel FPGA Edition (Free) (17169.4MB) [Y/n]: n
30-
31-
Intel High Level Synthesis Compiler (2481.9MB) [Y/n]: Y
32-
33-
DSP Builder Pro Edition (185.8MB) [Y/n]: n
34-
35-
Intel FPGA SDK for OpenCL Pro Edition (1822.6MB) [Y/n]: Y
36-
```
37-
38-
Note that the installation of Intel HLS compiler is required to compile the smaller IP modules that support the larger kernels with modular addition and modular multiplication arithmetic.<br>
39-
40-
## Intel OneAPI
41-
42-
Install the oneAPI Toolkit from the following site: <br>
43-
44-
[Installation Guide for Intel OneAPI Toolkits](https://software.intel.com/content/www/us/en/develop/articles/installation-guide-for-intel-oneapi-toolkits.html).<br>
45-
46-
More information on the FPGA related components can be found on this [here](https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/fpga.html#gs.6nbq2b). <br>
47-
48-
Instructions on direct installation via yum located at [https://software.intel.com/content/www/us/en/develop/documentation/installation-guide-for-intel-oneapi-toolkits-linux/top/installation/install-using-package-managers/yum-dnf-zypper.html](https://software.intel.com/content/www/us/en/develop/documentation/installation-guide-for-intel-oneapi-toolkits-linux/top/installation/install-using-package-managers/yum-dnf-zypper.html). <br>
49-
50-
```
51-
sudo yum install intel-basekit
52-
sudo yum install intel-oneapi-intelfpgadpcpp-custom-platforms-quartus20.3
53-
```
5413

5514
## Initializing the FPGA Environment
5615

57-
Upon completion of the installation of the FPGA software stack, the next step is to initialize the environment for FPGA runtime and development. We provide below an example script that automates this process, in particular for the combination of software versions installed. <br>
16+
Upon completion of the installation of the FPGA software stack, the next step is to initialize the environment for FPGA runtime and development. Use the below command to initialize the environment whenever you want to use the oneAPI. <br>
5817

5918
```
60-
# init_env.sh
61-
62-
export QUARTUS_HOME="/disk1/tools/intelFPGA_pro/19.2/quartus"
63-
export OPAE_PLATFORM_ROOT="/disk1/tools/inteldevstack/d5005_ias_2_0_1_b237"
64-
65-
export AOCL_BOARD_PACKAGE_ROOT="/disk1/tools/inteldevstack/d5005_ias_2_0_1_b237/opencl/opencl_bsp"
66-
if ls /dev/intel-fpga-* 1> /dev/null 2>&1; then
67-
source $AOCL_BOARD_PACKAGE_ROOT/linux64/libexec/setup_permissions.sh >> /dev/null
68-
fi
69-
70-
OPAE_PLATFORM_BIN="/disk1/tools/inteldevstack/d5005_ias_2_0_1_b237/bin"
71-
if [[ ":${PATH}:" = *":${OPAE_PLATFORM_BIN}:"* ]] ;then
72-
echo "\$OPAE_PLATFORM_ROOT/bin is in PATH already"
73-
else
74-
echo "Adding \$OPAE_PLATFORM_ROOT/bin to PATH"
75-
export PATH="${PATH}":"${OPAE_PLATFORM_BIN}"
76-
fi
77-
78-
echo export AOCL_BOARD_PACKAGE_ROOT="/opt/intel/oneapi/intelfpgadpcpp/latest/board/intel_s10sx_pac"
79-
export AOCL_BOARD_PACKAGE_ROOT="/opt/intel/oneapi/intelfpgadpcpp/latest/board/intel_s10sx_pac"
80-
if ls /dev/intel-fpga-* 1> /dev/null 2>&1; then
81-
echo source $AOCL_BOARD_PACKAGE_ROOT/linux64/libexec/setup_permissions.sh
82-
source $AOCL_BOARD_PACKAGE_ROOT/linux64/libexec/setup_permissions.sh >> /dev/null
83-
fi
84-
85-
echo export INTELFPGAOCLSDKROOT="/disk1/tools/intelFPGA_pro/20.3/hld"
86-
export INTELFPGAOCLSDKROOT="/disk1/tools/intelFPGA_pro/20.3/hld"
87-
88-
# Enable Backwards Compatibility with older BSP
89-
export ACL_ACDS_VERSION_OVERRIDE="19.2"
90-
export QUARTUS_ROOTDIR_OVERRIDE="/disk1/tools/intelFPGA_pro/quartus_19.2.0b57/quartus"
91-
92-
echo export ALTERAOCLSDKROOT=$INTELFPGAOCLSDKROOT
93-
export ALTERAOCLSDKROOT=$INTELFPGAOCLSDKROOT
94-
export PAC_DMA_WORK_THREAD=yes
95-
96-
QUARTUS_BIN="/disk1/tools/intelFPGA_pro/20.3/quartus/bin"
97-
if [[ ":${PATH}:" = *":${QUARTUS_BIN}:"* ]] ;then
98-
echo "\$QUARTUS_HOME/bin is in PATH already"
99-
else
100-
echo "Adding \$QUARTUS_HOME/bin to PATH"
101-
export PATH="${QUARTUS_BIN}":"${PATH}"
102-
fi
103-
104-
export AOCL_BOARD_PACKAGE_ROOT=/opt/intel/oneapi/intelfpgadpcpp/latest/board/intel_s10sx_pac
105-
source $INTELFPGAOCLSDKROOT/init_opencl.sh >> /dev/null
106-
107-
aocl initialize acl0 pac_s10_usm
19+
source /opt/intel/oneapi/setvars.sh
10820
```
10921

110-
The script above needs to be modified to reflect the real paths where the installation have been placed. This initialization process requires sudo (administrator) privileges. The OneAPI `AOCL_BOARD_PACKAGE_ROOT` variable value may differ from the example, depending from the source package, which could be `AOCL_BOARD_PACKAGE_ROOT="/opt/intel/oneapi/compiler/2021.3.0/linux/lib/oclfpga/board/intel_s10sx_pac`. Try `locate intel_s10sx_pac` to find out the actual path.
22+
## Build and run sample code to test your setup
11123

112-
### Fix Permissions on /dev Files
113-
114-
The PAC D5005 requires sudo access with default permissions. This needs to be modified at least once during installation. The unmodified version of `init_env.sh` performs this step every time it is called, but that requires all users to have sudo access to source `init_env.sh`. Instead, run the permission setting script on its own after modifying `init_env.sh`.
115-
116-
```
117-
$ source $AOCL_BOARD_PACKAGE_ROOT/linux64/libexec/setup_permissions.sh
118-
Configuring locked memory setting
119-
Configuring udev rules for intel-fpga device permission
120-
Configuring system with 2048 2M hugepages
121-
Finished setup_permissions.sh script. All configuration settings are persistent.
122-
```
24+
After you finish the installation, you can build and run a sample code to test your environment. You can find [Intel(R) oneAPI sample code](https://github.com/oneapi-src/oneAPI-samples) in this Github repo. [Every sample project](https://github.com/oneapi-src/oneAPI-samples/tree/master/DirectProgramming/DPC%2B%2BFPGA) has detailed steps to guide you build and run the code on Intel(R) FPGA.

0 commit comments

Comments
 (0)