Skip to content

Fix CI test failures and HomDecomp for 128-bit torus #39

Fix CI test failures and HomDecomp for 128-bit torus

Fix CI test failures and HomDecomp for 128-bit torus #39

name: Compare with tfhe-rs
# Runs on every push and can also be triggered manually.
on:
push:
workflow_dispatch:
jobs:
compare-pbs:
name: PBS benchmark (TFHEpp vs tfhe-rs) on Ubuntu 24.04
runs-on: ubuntu-latest
container:
image: ubuntu:24.04
steps:
# ── System dependencies ───────────────────────────────────────────────
- name: Install system dependencies
run: |
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential g++-14 libomp-dev cmake ninja-build git \
curl wget ca-certificates
# ── Rust toolchain (rustup) ───────────────────────────────────────────
- name: Install Rust via rustup
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- -y --default-toolchain stable --no-modify-path
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
# ── Checkout TFHEpp ───────────────────────────────────────────────────
- name: Checkout TFHEpp
uses: actions/checkout@v4
with:
submodules: recursive
# ── Clone tfhe-rs alongside TFHEpp ───────────────────────────────────
- name: Clone tfhe-rs
run: |
git clone --depth 1 https://github.com/zama-ai/tfhe-rs.git tfhe-rs
# ── Build TFHEpp (split layout — default SPQLIOS) ───────────────────
- name: Build TFHEpp (split layout)
run: |
cmake . -B build-split -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER=g++-14 \
-DCMAKE_C_COMPILER=gcc-14 \
-DUSE_TFHE_RS=ON \
-DENABLE_TEST=ON
cmake --build build-split --target pbs_tfhers
# ── Build TFHEpp (interleaved layout — SPQLIOS_INTL) ────────────────
- name: Build TFHEpp (interleaved layout)
run: |
cmake . -B build-intl -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER=g++-14 \
-DCMAKE_C_COMPILER=gcc-14 \
-DUSE_TFHE_RS=ON \
-DUSE_SPQLIOS_INTL=ON \
-DENABLE_TEST=ON
cmake --build build-intl --target pbs_tfhers
# ── Build tfhe-rs Rust benchmark ──────────────────────────────────────
- name: Install pinned Rust toolchain (from tfhe-rs/rust-toolchain.toml)
working-directory: bench-tfhers
run: rustup show # triggers toolchain download from rust-toolchain.toml
- name: Build tfhe-rs benchmark (Release)
working-directory: bench-tfhers
run: cargo build --release
# ── Show machine info ─────────────────────────────────────────────────
- name: Machine info
run: |
echo "=== CPU info ==="
lscpu | grep -E "Model name|CPU\(s\)|Thread|MHz" || true
echo "=== Memory ==="
free -h || true
# ── Run benchmarks and compare ────────────────────────────────────────
- name: Run TFHEpp pbs_tfhers (split layout)
run: |
echo "=== TFHEpp NAND gate (split layout, SPQLIOS) ==="
echo "Parameters: n=805, k=3, N=512, pbs_level=2, pbs_base_log=10"
build-split/test/pbs_tfhers
- name: Run TFHEpp pbs_tfhers (interleaved layout)
run: |
echo "=== TFHEpp NAND gate (interleaved layout, SPQLIOS_INTL) ==="
echo "Parameters: n=805, k=3, N=512, pbs_level=2, pbs_base_log=10"
build-intl/test/pbs_tfhers
- name: Run tfhe-rs benchmark
run: |
echo "=== tfhe-rs NAND gate (DEFAULT_PARAMETERS) ==="
echo "Parameters: n=805, k=3, N=512, pbs_level=2, pbs_base_log=10"
bench-tfhers/target/release/pbs-tfhers-bench