Skip to content

FreeMark/openfhe-gpu-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

openfhe-gpu-backend

GPU-accelerated homomorphic blind vector recall for OpenFHE CKKS, built by integrating FIDESlib (MIT, OpenFHE-1.5.1-interoperable). It takes encrypted cosine recall over a corpus of ciphertexts from minutes per query to single-digit seconds, with results bit-exact against the CPU library and the secret key never touching the GPU.

First proving ground: the resonant_lattice blind memory store, whose encrypted vault of ~4,952 facts is scored entirely on the GPU with exact top-k parity.

Result (real vault, RTX 3090 Ti, 4,952 facts, 768-dim, CKKS depth 2)

Path Per query
CPU streaming scan ~356 s
GPU, naive per-fact stream ~81 s
GPU, corpus resident + batched decrypt ~7 s (after a ~22 s one-time corpus bridge)

5 of 5 test queries match the plaintext top-10 exactly and in order; per-id scores agree with the CPU reference to about 1e-11. A resident daemon holds the corpus on the GPU so each query sustains ~7 s.

How it works

  • Integrate, do not reinvent. FIDESlib already ships optimized CUDA CKKS kernels for OpenFHE 1.5.1. The contribution here is the application layer: scoring an encrypted corpus, not the ring arithmetic.
  • Foreign ciphertexts on the GPU. The low-level FIDESlib::CKKS layer bridges natively serialized OpenFHE ciphertexts onto the GPU (GetRawCipherText / GetOpenFHECipherText), so the existing encrypted vault loads without re-encryption.
  • The hot path. Homomorphic cosine = one ciphertext multiply plus a power-of-2 rotate-and-sum.
  • Interactive speed. Two optimizations: keep the whole encrypted corpus resident on the GPU, and pack many scores per ciphertext (one-hot mask + accumulate) so a handful of decrypts replace one per fact.

Trust boundary

The GPU is a faster untrusted evaluator. It receives only public material - the crypto context, the public key, and the public evaluation and rotation keys - plus the encrypted corpus and the encrypted query. The secret key and the user passphrase never go to the GPU, which never decrypts. The blind property (the store computes on ciphertext it cannot read) is preserved unchanged.

Layout

  • PLAN.md - vision, invariants, measured results, phases P0 through P7.
  • src/ - the native scorers: rlm_gpu_recall.cu (one-shot), rlm_gpu_recalld.cu (resident daemon), a minimal sqlite3_shim.h, and a CMake that builds both.
  • integration/ - the resonant_lattice wiring: gpu_recall.py (the GPUBlindBackend adapter), demos, and README.md describing the seam and config-driven activation.

Build (dev node: CUDA 13.2, gcc/g++ 13)

Build FIDESlib (which vendors and patches OpenFHE 1.5.1) for the target GPU architecture, then the scorers against both installs. The scorer targets need separable compilation plus device LTO to link FIDESlib's relocatable-device-code archive, and OpenMP at the final link (OpenFHE uses it). See src/CMakeLists.txt.

Status

P0 through P6 are done: bit-exact GPU parity, the real vault scored on the GPU with exact top-k, and a config-driven resonant_lattice integration with CPU fallback. P7 (hardening/release) has the resident daemon and config activation done; remaining are larger-than-VRAM corpus tiling and multi-GPU, precision and security validation across OpenFHE point releases, and the public release.

License

MIT. See LICENSE.

About

GPU-accelerated homomorphic blind vector recall for OpenFHE CKKS via FIDESlib. Encrypted cosine recall from minutes to single-digit seconds per query, bit-exact, with the secret key never on the GPU.

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors