Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composite Scaling CKKS Bootstrapping (#910 phase 3) #931

Merged
merged 41 commits into from
Mar 11, 2025
Merged
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
3ed5909
Initial commit: adding composite scaling parameters and scaling tech …
fdiasmor Dec 12, 2024
fb50d79
Initial commit: adding composite scaling parameters and scaling tech …
fdiasmor Dec 12, 2024
d3c1a58
Composite prime generation and adaptive scaling factors.
fdiasmor Dec 16, 2024
e397a73
Propagating composite degree to mod reduce calls.
fdiasmor Dec 17, 2024
3bf393a
Handling overflow for scaling factors over 64 bits on composite scali…
fdiasmor Dec 17, 2024
51db3ca
Bug fix of overflow handling for d > 2 and sc > 64.
fdiasmor Dec 18, 2024
44b206b
Update impl of Rescale and Mod/LevelReduce methods with composite deg…
fdiasmor Dec 18, 2024
3d2c220
Minor bug fix: else case missing.
fdiasmor Dec 19, 2024
a9c9978
Update EvalPoly functions to use composite degree.
fdiasmor Dec 19, 2024
c03c8f9
Update Compress function to raise error.
fdiasmor Dec 19, 2024
470cd11
Update/Add new composite scaling examples.
fdiasmor Dec 19, 2024
6369eaa
Recalculate sizeP and update EstimateLogP interface.
fdiasmor Dec 19, 2024
c29fc6b
Updated CKKS bootstrapping for composite scaling with examples.
fdiasmor Dec 20, 2024
fde39d7
Update error conditions.
fdiasmor Dec 21, 2024
58881c0
Update poly evaluation example.
fdiasmor Dec 21, 2024
d257f15
Tweak error condition regarding prime moduli size.
fdiasmor Dec 21, 2024
5d54a9f
Update composite-prime generation function.
fdiasmor Dec 31, 2024
a5a2b9c
Remove comments from prime gen function.
fdiasmor Jan 3, 2025
9a7ad26
Update composite scaling unittests and fix unittest runtime issue.
fdiasmor Dec 25, 2024
c8c76a8
Some review changes.
fdiasmor Jan 8, 2025
4b721d9
Update composite scaling unittests and fix unittest runtime issue.
fdiasmor Dec 25, 2024
cf685de
Disable composite scaling set methods for non-CKKS schemes.
fdiasmor Jan 9, 2025
a5a443a
Move COMPOSITESCALING support error handling.
fdiasmor Jan 10, 2025
b14472d
Disable composite scaling set methods for non-CKKS schemes.
fdiasmor Jan 9, 2025
6dd35c0
Removing additional constructor that accepts composite scaling parame…
fdiasmor Jan 10, 2025
e9cdffa
Merge/rebase review changes from (#928).
fdiasmor Jan 18, 2025
80fe03f
Merge branch 'dev' into 910-composite-prime-gen
fdiasmor Jan 18, 2025
c63d0fe
Review changes for PR 910 phase 2.
fdiasmor Feb 5, 2025
2ec7adf
Review updates and fixes.
fdiasmor Feb 6, 2025
abd4585
Review updates and fixes.
fdiasmor Feb 6, 2025
d3208fa
Review updates and fixes.
fdiasmor Feb 6, 2025
3fdb02e
Rebase with latest revised changes.
fdiasmor Feb 20, 2025
13424f2
Merge branch 'dev' into 910-bootstrapping-composite-scaling
fdiasmor Feb 20, 2025
044ba22
Update error message.
fdiasmor Feb 20, 2025
28e7a1a
Update error message.
fdiasmor Feb 20, 2025
e54a469
Code improvements
dsuponitskiy-duality Mar 3, 2025
9e0eaba
Avoid infinite loop in next prime sampling.
fdiasmor Mar 5, 2025
cdb9d69
Fix decryption failed bug.
fdiasmor Mar 7, 2025
13a3236
Replace std::round(std::log2()) by std::frexp to get bit size of qDou…
fdiasmor Mar 7, 2025
2a7477c
Update error message.
fdiasmor Mar 11, 2025
d7402eb
Code improvements
dsuponitskiy-duality Mar 11, 2025
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
8 changes: 6 additions & 2 deletions src/pke/lib/scheme/ckksrns/ckksrns-fhe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ void FHECKKSRNS::EvalBootstrapSetup(const CryptoContextImpl<DCRTPoly>& cc, std::
// Extract the modulus prior to bootstrapping
double qDouble = GetBigModulus(cryptoParams);

uint128_t factor = (static_cast<uint128_t>(1) << (static_cast<uint32_t>(std::round(std::log2(qDouble)))));
int exponent;
std::frexp(static_cast<double>(qDouble), &exponent);
uint128_t factor = static_cast<uint128_t>(1) << static_cast<uint32_t>(exponent - 1);
double pre = (compositeDegree > 1) ? 1.0 : qDouble / factor;
double k = (cryptoParams->GetSecretKeyDist() == SPARSE_TERNARY) ? K_SPARSE : 1.0;
double scaleEnc = pre / k;
Expand Down Expand Up @@ -309,7 +311,9 @@ void FHECKKSRNS::EvalBootstrapPrecompute(const CryptoContextImpl<DCRTPoly>& cc,
// Extract the modulus prior to bootstrapping
double qDouble = GetBigModulus(cryptoParams);

uint128_t factor = (static_cast<uint128_t>(1) << (static_cast<uint32_t>(std::round(std::log2(qDouble)))));
int exponent;
std::frexp(static_cast<double>(qDouble), &exponent);
uint128_t factor = static_cast<uint128_t>(1) << static_cast<uint32_t>(exponent - 1);
double pre = qDouble / factor;
double k = (cryptoParams->GetSecretKeyDist() == SPARSE_TERNARY) ? K_SPARSE : 1.0;
double scaleEnc = (compositeDegree > 1) ? 1.0 / k : pre / k;
Expand Down