Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
169 changes: 15 additions & 154 deletions .github/workflows/github-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

name: Build and Test
permissions: read-all
on:
# By default this will run when the activity type is "opened", "synchronize",
# or "reopened".
Expand All @@ -24,14 +25,14 @@ on:
# Define env vars #
###################
env:
HEXL_VER: 1.2.5
HEXL_VER: 1.2.6
HEXL_DIR: ${GITHUB_WORKSPACE}/lib/cmake/hexl-${HEXL_VER}
HEXL_HINT_DIR: >
-DHEXL_HINT_DIR=${GITHUB_WORKSPACE}/lib/cmake/hexl-${HEXL_VER}
COVERAGE_COMPILER_FLAGS: >
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_CXX_COMPILER=g++-9
-DCMAKE_C_COMPILER=gcc-9
-DCMAKE_CXX_COMPILER=g++-11
-DCMAKE_C_COMPILER=gcc-11
-DHEXL_BENCHMARK=ON
-DHEXL_TESTING=ON
-DHEXL_COVERAGE=ON
Expand All @@ -42,26 +43,28 @@ env:
jobs:
format:
name: Format
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
# Required for pre-commit
- run: pip3 install cpplint==1.5.5
# NOTE: This is deprecated in favor of pre-commit.ci
- uses: pre-commit/action@v2.0.2
- uses: pre-commit/action@v3.0.1
with:
extra_args: --all-files

nix-build:
name: '${{ matrix.os }} ${{ matrix.build_type }} shared=${{ matrix.shared_lib }}'
runs-on: '${{ matrix.os }}'
permissions:
contents: write # required for actions/upload-artifacts@v2
defaults:
run:
shell: bash
strategy:
matrix:
# os: [ice-lake, [self-hosted, ubuntu-18.04], macos-latest, ubuntu-20.04]
os: [ice-lake, macos-latest, ubuntu-20.04]
# removed platforms not available on github hosted servers.
os: [ubuntu-22.04]
build_type: [Release, Debug]
shared_lib: [ON, OFF]
include:
Expand All @@ -70,9 +73,6 @@ jobs:
benchmark_min_time: "--benchmark_min_time=0.001"
- build_type: Release
benchmark_min_time: ""
exclude: # Skip debug on Mac. TODO: add Debug mode
- os: macos-latest
build_type: Debug
steps:
- uses: actions/checkout@v2
- name: Setup cmake
Expand All @@ -83,8 +83,8 @@ jobs:
run: |
set -x
if [ "$RUNNER_OS" == "Linux" ]; then
export CC=clang-10
export CXX=clang++-10
export CC=clang-14
export CXX=clang++-14
fi

# Print information useful for debugging
Expand Down Expand Up @@ -136,9 +136,9 @@ jobs:
# set +x

- name: Archive benchmark results
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: bench_hexl_${{github.sha}}.csv
name: bench_hexl_${{github.sha}}_${{github.run_id}}_${{github.job}}_${{matrix.os}}_${{matrix.build_type}}_Shared_${{matrix.shared_lib}}
path: ${{ github.workspace }}/${{ github.workflow }}_${{ github.sha }}
retention-days: 90 # Maximum for free version

Expand Down Expand Up @@ -176,142 +176,3 @@ jobs:
build/${{ matrix.build_type}}/example.exe

# TODO: add pkgconfig and vcpkg examples



ubuntu-1804-build:
name: '${{ matrix.os }} ${{ matrix.build_type }} shared=${{ matrix.shared_lib }}'
runs-on: '${{ matrix.os }}'
defaults:
run:
shell: bash
strategy:
matrix:
os: [ubuntu-18.04]
build_type: [Release, Debug]
shared_lib: [ON, OFF]
include:
# Run benchmarks quickly in Debug mode
- build_type: Debug
benchmark_min_time: "--benchmark_min_time=0.001"
- build_type: Release
benchmark_min_time: ""
exclude: # Skip debug on Mac. TODO: add Debug mode
- os: macos-latest
build_type: Debug
steps:
- uses: actions/checkout@v2
- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.13.x'
- name: Default build
run: |
set -x
if [ "$RUNNER_OS" == "Linux" ]; then
export CC=gcc
export CXX=g++
fi

# Print information useful for debugging
gcc --version
g++ --version
whoami
echo $HOME
echo $GITHUB_WORKSPACE
echo "Testing from branch:"
echo $GITHUB_REFH
cmake --version
pwd

# Build library
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DHEXL_SHARED_LIB=${{ matrix.shared_lib }} \
-DCMAKE_INSTALL_PREFIX=./
cmake --build build -j
cmake --build build --target install
cmake --build build --target unittest
# Instead of calling cmake --build build --target bench,
# we run the executable directly to pass command-line arguments
./build/benchmark/bench_hexl \
--benchmark_out="${GITHUB_WORKFLOW}_${GITHUB_SHA}" \
--benchmark_out_format=csv ${{ matrix.benchmark_min_time }}

# Build and run examples
cd $GITHUB_WORKSPACE/example/cmake
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
${{ env.HEXL_HINT_DIR }}
cmake --build build
build/example

# Build example using pkgconfig
cd $GITHUB_WORKSPACE/example/pkgconfig
# Set PKG_CONFIG_PATH to locate hexl.pc
export PKG_CONFIG_PATH=$GITHUB_WORKSPACE/lib/pkgconfig
cmake -S . -B build
cmake --build build
build/example

# Build example using vcpkg
# TODO: fix vcpkg example CI
# vcpkg install hexl --overlay-ports=$GITHUB_WORKSPACE/port/hexl/ --head
# cd $GITHUB_WORKSPACE/example/vcpkg
# vcpkg_toolchain=$(locate vcpkg.cmake)
# echo $vcpkg_toolchain
# cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=$vcpkg_toolchain
# cmake --build build
# build/example
# set +x

- name: Archive benchmark results
uses: actions/upload-artifact@v2
with:
name: bench_hexl_${{github.sha}}.csv
path: ${{ github.workspace }}/${{ github.workflow }}_${{ github.sha }}
retention-days: 90 # Maximum for free version



experimental-build:
name: 'experimental: ${{ matrix.os }} ${{ matrix.build_type }} shared=${{ matrix.shared_lib }}'
runs-on: '${{ matrix.os }}'
defaults:
run:
shell: bash
strategy:
matrix:
os: [ice-lake]
build_type: [Release]
shared_lib: [ON]
steps:
- uses: actions/checkout@v2
- name: Default build
run: |
set -x
if [ "$RUNNER_OS" == "Linux" ]; then
export CC=clang-10
export CXX=clang++-10
fi

# Print information useful for debugging
whoami
echo $HOME
echo $GITHUB_WORKSPACE
echo "Testing from branch:"
echo $GITHUB_REFH
cmake --version
pwd

# Build library
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DHEXL_SHARED_LIB=${{ matrix.shared_lib }} \
-DCMAKE_INSTALL_PREFIX=./ \
-DHEXL_EXPERIMENTAL=ON
cmake --build build -j
cmake --build build --target install
cmake --build build --target unittest
# Instead of calling cmake --build build --target bench,
# we run the executable directly to pass command-line arguments
./build/benchmark/bench_hexl \
--benchmark_out="${GITHUB_WORKFLOW}_${GITHUB_SHA}" \
--benchmark_out_format=csv
11 changes: 10 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
# Changes

## Version 1.2.5
## Version 1.2.6
- Update documentation to make a reference to OpenFHE
- Complies with Clang-Format +11
- Fixes EltwiseFMAMod Failing on 52 bits modulus (https://github.com/IntelLabs/hexl/pull/136)
- Fixes Check Bounds for avx512 reduction mod_2 (https://github.com/IntelLabs/hexl/pull/153)
- Fixes Destructor error (https://github.com/IntelLabs/hexl/pull/159)
- Updates to CI/CD
- Add SECURITY.md for OSSF Scorecard compliance
- Added workflow permissions to meet OpenSSF Scorecard requirements

## Version 1.2.5
- Adds experimental FFT-like (https://github.com/intel/hexl/pull/104)
- Adds big moduli tests for IFMA (https://github.com/intel/hexl/pull/123)
- Fixes HEXL's example build (https://github.com/intel/hexl/pull/114)
Expand Down
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# target_link_options and cmake -S . -B build require cmake 3.13
cmake_minimum_required(VERSION 3.13)
project(HEXL VERSION 1.2.5 LANGUAGES C CXX)
project(HEXL VERSION 1.2.6 LANGUAGES C CXX)

include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
Expand Down Expand Up @@ -66,6 +66,15 @@ if (NOT HEXL_FPGA_COMPATIBILITY)
set(HEXL_FPGA_COMPATIBILITY "0" CACHE INTERNAL "Set FPGA compatibility mask" FORCE)
endif()

# Get the current working branch
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)

message(STATUS "HEXL BRANCH: ${GIT_BRANCH}")
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# SPDX-License-Identifier: Apache-2.0

# Default codeowner for all files
* @intel/hexl-maintain
* @IntelLabs/hexl-maintain
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build and Test](https://github.com/intel/hexl/actions/workflows/github-ci.yml/badge.svg?branch=main)](https://github.com/intel/hexl/actions/workflows/github-ci.yml)
[![Build and Test](https://github.com/intel/hexl/actions/workflows/github-ci.yml/badge.svg)](https://github.com/intel/hexl/actions/workflows/github-ci.yml)

# Intel Homomorphic Encryption (HE) Acceleration Library
Intel:registered: HE Acceleration Library is an open-source library which
Expand Down Expand Up @@ -268,6 +268,7 @@ Intel HE Acceleration Library is single-threaded and thread-safe.

Intel HE Acceleration Library has been integrated to the following homomorphic
encryption libraries:
- [OpenFHE](https://github.com/openfheorg/openfhe-development)
- [PALISADE](https://gitlab.com/palisade/palisade-release)
- [Microsoft SEAL](https://github.com/microsoft/SEAL)
- [HElib](https://github.com/homenc/HElib)
Expand Down
8 changes: 8 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Security Policy
Intel is committed to rapidly addressing security vulnerabilities affecting
our customers and providing clear guidance on the solution, impact, severity
and mitigation.

## Reporting a Vulnerability
Please report any security vulnerabilities in this project utilizing the
guidelines [here](https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html).
4 changes: 2 additions & 2 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ Once you have installed Intel HE Acceleration Library. Then, in your external
application, add the following lines to your `CMakeLists.txt`:

```bash
find_package(HEXL 1.2.5
find_package(HEXL 1.2.6
HINTS ${HEXL_HINT_DIR}
REQUIRED)
target_link_libraries(<your target> HEXL::hexl)
```
If Intel HE Acceleration Library is installed globally, `HEXL_HINT_DIR` is not
needed. Otherwise, `HEXL_HINT_DIR` should be the directory containing
`HEXLConfig.cmake`, e.g. `${CMAKE_INSTALL_PREFIX}/lib/cmake/hexl-1.2.5/`
`HEXLConfig.cmake`, e.g. `${CMAKE_INSTALL_PREFIX}/lib/cmake/hexl-1.2.6/`

## Method 2 (pkgconfig)

Expand Down
2 changes: 1 addition & 1 deletion example/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.13)
set(CMAKE_CXX_STANDARD 17)

# Example using source
find_package(HEXL 1.2.5
find_package(HEXL 1.2.6
HINTS ${HEXL_HINT_DIR}
REQUIRED)
if (NOT TARGET HEXL::hexl)
Expand Down
4 changes: 2 additions & 2 deletions example/vcpkg/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"dependencies": [
{
"name": "hexl",
"version>=": "1.2.5"
"version>=": "1.2.6"
}
],
"builtin-baseline": "7baf7bc9f3390bab2f47e2bcbd35b065663bc80d",
"overrides": [
{ "name": "hexl", "version": "1.2.1", "port-version": 0}
{ "name": "hexl", "version": "1.2.6", "port-version": 0}
]
}
2 changes: 1 addition & 1 deletion hexl/eltwise/eltwise-fma-mod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void EltwiseFMAMod(uint64_t* result, const uint64_t* arg1, uint64_t arg2,
<< (input_mod_factor * modulus));

#ifdef HEXL_HAS_AVX512IFMA
if (has_avx512ifma && input_mod_factor * modulus < (1ULL << 52)) {
if (has_avx512ifma && input_mod_factor * modulus < (1ULL << 51)) {
HEXL_VLOG(3, "Calling 52-bit EltwiseFMAModAVX512");

switch (input_mod_factor) {
Expand Down
4 changes: 2 additions & 2 deletions hexl/eltwise/eltwise-reduce-mod-avx512.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ void EltwiseReduceModAVX512(uint64_t* result, const uint64_t* operand,
__m512i v_op = _mm512_loadu_si512(v_operand);
v_op = _mm512_hexl_barrett_reduce64<BitShift, 2>(
v_op, v_modulus, v_bf, v_bf_52, prod_right_shift, v_neg_mod);
HEXL_CHECK_BOUNDS(ExtractValues(v_op).data(), 8, modulus,
"v_op exceeds bound " << modulus);
HEXL_CHECK_BOUNDS(ExtractValues(v_op).data(), 8, twice_mod,
"v_op exceeds bound " << twice_mod);
_mm512_storeu_si512(v_result, v_op);
++v_operand;
++v_result;
Expand Down
2 changes: 1 addition & 1 deletion hexl/eltwise/eltwise-reduce-mod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void EltwiseReduceModNative(uint64_t* result, const uint64_t* operand,
if (input_mod_factor == modulus) {
if (output_mod_factor == 2) {
for (size_t i = 0; i < n; ++i) {
if (operand[i] >= modulus) {
if (operand[i] >= twice_modulus) {
result[i] = BarrettReduce64<2>(operand[i], modulus, barrett_factor);
} else {
result[i] = operand[i];
Expand Down
Loading