Repository navigation
unify full and complex packing among FBT - #1370
Merged
Merged
Conversation
Collaborator
Author
|
20d4337 is a pure optimization. |
For CKKSDataType COMPLEX, FE functional bootstrapping and full-packing EvalMVB evaluated the series on the real and imaginary channels and took twice the real part of each with its own conjugation. Compute 2Re(s0) + i*2Re(s1) as (s0 + i*s1) + conj(s0 - i*s1) instead, so one conjugation (one key switch) serves both channels; multiplication by i is a free monomial multiplication. RecombineFEChannels is replaced by TwiceRealPartPair, and the order-1 integer branch of EvalMVBNoDecoding, which has no conjugation, keeps its own recombination. Per-function EvalMVBNoDecoding on full complex packing is 1.18x (2-bit FLEXIBLEAUTO) and 1.26x (2-bit FIXEDMANUAL) faster, 1.04x for 4-bit and unchanged for 8-bit; FE functional bootstrapping with precomputed powers is 1.01-1.03x faster. Outputs and precision are unchanged.
EvalFBTSetup takes a trailing numValues argument, the number of values encrypted in the RLWE input, and records the resulting layout in the FBT precomputation. EvalMVBPrecompute and EvalMVBNoDecoding read it there instead of the CKKS data type. With full packing, more than N/2 values are processed as two ciphertexts (real and imaginary channels), and N/2 values as one, at half the cost of the approximate modular reduction and the look-up table evaluation. More values than the slots hold are rejected at setup. numValues defaults to the capacity of the slots (N for full packing), which keeps the two-ciphertext processing of earlier releases. Code that passes N values without setting a CKKS data type therefore stays correct, instead of silently losing the upper half of its values under the default REAL data type. The CKKSDataType settings derived from the packing are removed from the examples, benchmark and tests, which pass the value count instead. FE functional bootstrapping still uses the CKKS data type, which describes its input. The documentation notes when full complex packing needs CKKSDataType COMPLEX: encoding complex plaintexts or decrypting the CKKS ciphertext before EvalHomDecoding.
pascoec
force-pushed
the
fully-packed-FBT
branch
from
October 20, 2026 23:01
8ae8480 to
e60648f
Compare
yspolyakov
approved these changes
Oct 21, 2026
pascoec
approved these changes
Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1369.