Skip to content
New issue

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

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

Already on GitHub? # to your account

implemented approximate gadget decomposition + optimization for LMKCDEY #487

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

yspolyakov
Copy link
Contributor

@yspolyakov yspolyakov commented Jul 14, 2023

  • Re-implemented the changes in PR 469 approx decomp #482 as the binfhe code has significantly changed as compared to the commit the branch was created from (it was easier to reimplement than resolve the conflicts)
  • Optimized the Automorphism bootstrapping step for the LMKCDEY mode
    • Removed 2 NTTs (automorphisms can be done directly in EVALUATION representation)
    • Switched to an optimized version of automorphisms (with precomputed bit reversal tables)

Ran benchmarks for STD128* on an Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz and 64 GB of RAM, running Ubuntu 20.04 LTS with clang 10.0.0 (CMake flags: NATIVE_SIZE=32; WITH_NATIVEOPT=ON; OMP_NUM_THREADS=1)

  • GINX (TFHE) runtime went down from 49 ms to 39 ms.
  • LMKCDEY (FHEW) runtime went down from 40 ms to 29 ms.

@yspolyakov yspolyakov added the optimization Improves performance label Jul 14, 2023
@yspolyakov yspolyakov added this to the Release 1.1.0 milestone Jul 14, 2023
@yspolyakov yspolyakov linked an issue Jul 14, 2023 that may be closed by this pull request
@yspolyakov
Copy link
Contributor Author

yspolyakov commented Jul 14, 2023

The benchmark results for CLANG 10.0.0; NATIVE_SIZE=32; WITH_NATIVEOPT=ON; OMP_NUM_THREADS=1

dev branch issue-469 branch
 bin/benchmark/binfhe-ginx
2023-07-13T17:22:08-04:00
Running bin/benchmark/binfhe-ginx
Run on (8 X 4707.17 MHz CPU s)
CPU Caches:
  L1 Data 32 KiB (x8)
  L1 Instruction 32 KiB (x8)
  L2 Unified 256 KiB (x8)
  L3 Unified 12288 KiB (x1)
Load Average: 4.32, 2.48, 1.40
---------------------------------------------------------------------------------
Benchmark                                       Time             CPU   Iterations
---------------------------------------------------------------------------------
FHEW_BTKEYGEN/MEDIUM                     31079099 us       885542 us            1
FHEW_BTKEYGEN/STD128                      3041986 us      1220569 us            1
FHEW_ENCRYPT/MEDIUM                          16.7 us         16.7 us        41987
FHEW_ENCRYPT/STD128                          20.2 us         20.2 us        34697
FHEW_NOT/MEDIUM                             0.098 us        0.098 us      7115550
FHEW_NOT/STD128                             0.099 us        0.099 us      6941123
FHEW_BINGATE/MEDIUM_OR/min_time:10.000      31910 us        31909 us          438
FHEW_BINGATE/MEDIUM_AND                     32054 us        32053 us           22
FHEW_BINGATE/MEDIUM_NOR                     32168 us        32167 us           22
FHEW_BINGATE/MEDIUM_NAND                    32122 us        32122 us           22
FHEW_BINGATE/MEDIUM_XOR                     96653 us        96651 us            7
FHEW_BINGATE/MEDIUM_XNOR                    97045 us        97039 us            7
FHEW_BINGATE/MEDIUM_XOR_FAST                31979 us        31978 us           22
FHEW_BINGATE/MEDIUM_XNOR_FAST               32072 us        32071 us           22
FHEW_BINGATE/STD128_OR/min_time:10.000      48906 us        48905 us          284
FHEW_BINGATE/STD128_AND                     49009 us        49008 us           14
FHEW_BINGATE/STD128_NOR                     49179 us        49179 us           14
FHEW_BINGATE/STD128_NAND                    49156 us        49154 us           14
FHEW_BINGATE/STD128_XOR                    148204 us       148196 us            5
FHEW_BINGATE/STD128_XNOR                   146888 us       146887 us            5
FHEW_BINGATE/STD128_XOR_FAST                49200 us        49199 us           14
FHEW_BINGATE/STD128_XNOR_FAST               49131 us        49130 us           14
FHEW_KEYSWITCH/MEDIUM/min_time:1.000          202 us          202 us         6844
FHEW_KEYSWITCH/STD128/min_time:1.000          225 us          225 us         5928
 bin/benchmark/binfhe-ginx
2023-07-14T20:20:46-04:00
Running bin/benchmark/binfhe-ginx
Run on (8 X 4697.84 MHz CPU s)
CPU Caches:
  L1 Data 32 KiB (x8)
  L1 Instruction 32 KiB (x8)
  L2 Unified 256 KiB (x8)
  L3 Unified 12288 KiB (x1)
Load Average: 0.43, 4.00, 12.63
---------------------------------------------------------------------------------
Benchmark                                       Time             CPU   Iterations
---------------------------------------------------------------------------------
FHEW_BTKEYGEN/MEDIUM                     26424121 us       666320 us            1
FHEW_BTKEYGEN/STD128                      2551875 us       984935 us            1
FHEW_ENCRYPT/MEDIUM                          16.8 us         16.8 us        41779
FHEW_ENCRYPT/STD128                          20.2 us         20.2 us        34544
FHEW_NOT/MEDIUM                             0.101 us        0.101 us      6986544
FHEW_NOT/STD128                             0.102 us        0.102 us      6874272
FHEW_BINGATE/MEDIUM_OR/min_time:10.000      23709 us        23708 us          587
FHEW_BINGATE/MEDIUM_AND                     23914 us        23914 us           29
FHEW_BINGATE/MEDIUM_NOR                     23909 us        23908 us           29
FHEW_BINGATE/MEDIUM_NAND                    24045 us        24045 us           29
FHEW_BINGATE/MEDIUM_XOR                     71577 us        71574 us           10
FHEW_BINGATE/MEDIUM_XNOR                    72093 us        72090 us           10
FHEW_BINGATE/MEDIUM_XOR_FAST                23886 us        23885 us           29
FHEW_BINGATE/MEDIUM_XNOR_FAST               23783 us        23782 us           29
FHEW_BINGATE/STD128_OR/min_time:10.000      38953 us        38949 us          357
FHEW_BINGATE/STD128_AND                     39309 us        39308 us           18
FHEW_BINGATE/STD128_NOR                     39294 us        39293 us           18
FHEW_BINGATE/STD128_NAND                    39169 us        39168 us           18
FHEW_BINGATE/STD128_XOR                    117742 us       117739 us            6
FHEW_BINGATE/STD128_XNOR                   117611 us       117608 us            6
FHEW_BINGATE/STD128_XOR_FAST                39199 us        39198 us           18
FHEW_BINGATE/STD128_XNOR_FAST               38913 us        38912 us           18
FHEW_KEYSWITCH/MEDIUM/min_time:1.000          204 us          204 us         6675
FHEW_KEYSWITCH/STD128/min_time:1.000          222 us          222 us         6223

@yspolyakov
Copy link
Contributor Author

yspolyakov commented Jul 14, 2023

The benchmark results for CLANG 10.0.0; NATIVE_SIZE=32; WITH_NATIVEOPT=ON; OMP_NUM_THREADS=1

dev branch issue-469 branch
bin/benchmark/binfhe-lmkcdey
2023-07-13T17:26:48-04:00
Running bin/benchmark/binfhe-lmkcdey
Run on (8 X 4699.8 MHz CPU s)
CPU Caches:
  L1 Data 32 KiB (x8)
  L1 Instruction 32 KiB (x8)
  L2 Unified 256 KiB (x8)
  L3 Unified 12288 KiB (x1)
Load Average: 63.38, 85.54, 42.16
-----------------------------------------------------------------------------------------
Benchmark                                               Time             CPU   Iterations
-----------------------------------------------------------------------------------------
FHEW_BTKEYGEN/MEDIUM                             25951948 us       595114 us            1
FHEW_BTKEYGEN/STD128_LMKCDEY                      2255082 us       519150 us            1
FHEW_ENCRYPT/MEDIUM                                  16.8 us         16.8 us        41643
FHEW_ENCRYPT/STD128_LMKCDEY                          18.2 us         18.2 us        38479
FHEW_NOT/MEDIUM                                     0.101 us        0.101 us      6940454
FHEW_NOT/STD128_LMKCDEY                             0.118 us        0.118 us      5577489
FHEW_BINGATE/MEDIUM_OR/min_time:10.000              38189 us        38188 us          367
FHEW_BINGATE/MEDIUM_AND                             38020 us        38019 us           19
FHEW_BINGATE/MEDIUM_NOR                             37716 us        37713 us           19
FHEW_BINGATE/MEDIUM_NAND                            38333 us        38331 us           19
FHEW_BINGATE/MEDIUM_XOR                            113917 us       113915 us            6
FHEW_BINGATE/MEDIUM_XNOR                           113483 us       113481 us            6
FHEW_BINGATE/MEDIUM_XOR_FAST                        38129 us        38129 us           18
FHEW_BINGATE/MEDIUM_XNOR_FAST                       37539 us        37538 us           18
FHEW_BINGATE/STD128_LMKCDEY_OR/min_time:10.000      40425 us        40424 us          348
FHEW_BINGATE/STD128_LMKCDEY_AND                     40429 us        40428 us           17
FHEW_BINGATE/STD128_LMKCDEY_NOR                     40771 us        40770 us           17
FHEW_BINGATE/STD128_LMKCDEY_NAND                    40440 us        40439 us           17
FHEW_BINGATE/STD128_LMKCDEY_XOR                    122276 us       122272 us            6
FHEW_BINGATE/STD128_LMKCDEY_XNOR                   121351 us       121349 us            6
FHEW_BINGATE/STD128_LMKCDEY_XOR_FAST                40092 us        40091 us           17
FHEW_BINGATE/STD128_LMKCDEY_XNOR_FAST               40703 us        40701 us           17
FHEW_KEYSWITCH/MEDIUM/min_time:1.000                  204 us          204 us         6749
FHEW_KEYSWITCH/STD128_LMKCDEY/min_time:1.000          224 us          224 us         6388
bin/benchmark/binfhe-lmkcdey
2023-07-14T20:24:45-04:00
Running bin/benchmark/binfhe-lmkcdey
Run on (8 X 4700.8 MHz CPU s)
CPU Caches:
  L1 Data 32 KiB (x8)
  L1 Instruction 32 KiB (x8)
  L2 Unified 256 KiB (x8)
  L3 Unified 12288 KiB (x1)
Load Average: 125.56, 110.56, 57.53
-----------------------------------------------------------------------------------------
Benchmark                                               Time             CPU   Iterations
-----------------------------------------------------------------------------------------
FHEW_BTKEYGEN/MEDIUM                             29487406 us       451986 us            1
FHEW_BTKEYGEN/STD128_LMKCDEY                       238015 us        78007 us            7
FHEW_ENCRYPT/MEDIUM                                  16.8 us         16.8 us        41859
FHEW_ENCRYPT/STD128_LMKCDEY                          18.1 us         18.1 us        38579
FHEW_NOT/MEDIUM                                     0.099 us        0.099 us      7089960
FHEW_NOT/STD128_LMKCDEY                             0.108 us        0.108 us      6384297
FHEW_BINGATE/MEDIUM_OR/min_time:10.000              26964 us        26963 us          515
FHEW_BINGATE/MEDIUM_AND                             27138 us        27137 us           26
FHEW_BINGATE/MEDIUM_NOR                             27050 us        27049 us           26
FHEW_BINGATE/MEDIUM_NAND                            26951 us        26950 us           26
FHEW_BINGATE/MEDIUM_XOR                             81878 us        81874 us            9
FHEW_BINGATE/MEDIUM_XNOR                            82040 us        82039 us            9
FHEW_BINGATE/MEDIUM_XOR_FAST                        27123 us        27123 us           26
FHEW_BINGATE/MEDIUM_XNOR_FAST                       27231 us        27231 us           26
FHEW_BINGATE/STD128_LMKCDEY_OR/min_time:10.000      28981 us        28980 us          483
FHEW_BINGATE/STD128_LMKCDEY_AND                     29312 us        29311 us           24
FHEW_BINGATE/STD128_LMKCDEY_NOR                     29008 us        29008 us           24
FHEW_BINGATE/STD128_LMKCDEY_NAND                    29177 us        29177 us           24
FHEW_BINGATE/STD128_LMKCDEY_XOR                     86865 us        86860 us            8
FHEW_BINGATE/STD128_LMKCDEY_XNOR                    88545 us        88544 us            8
FHEW_BINGATE/STD128_LMKCDEY_XOR_FAST                29001 us        29001 us           24
FHEW_BINGATE/STD128_LMKCDEY_XNOR_FAST               28877 us        28877 us           24
FHEW_KEYSWITCH/MEDIUM/min_time:1.000                  201 us          201 us         6752
FHEW_KEYSWITCH/STD128_LMKCDEY/min_time:1.000          215 us          215 us         6393

@dsuponitskiy dsuponitskiy requested a review from pascoec July 17, 2023 18:54
Copy link
Collaborator

@dsuponitskiy dsuponitskiy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

Copy link
Collaborator

@Yongwoo-Lee-ccl Yongwoo-Lee-ccl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you.

@dsuponitskiy dsuponitskiy merged commit 3ee035b into dev Jul 18, 2023
dsuponitskiy added a commit that referenced this pull request Jul 28, 2023
* PRE changes for noise flooding (#232)

* *removed TRAPDOOR_HRA from PRE options in constants
*change noise flooding to be done in base-pre.cpp instead of the noise in encryptzerocore
*include the statistical security and num of queries in computing noise flooding param in initializeflooding function in bgvrns-paramatersgeneration.cpp
*included parameters statisticalSecurity and numAdversarialQueries used for ckks noise flooding in cryptocontextparams into internal rlwe-parameters to reuse the same parameters for PRE noise flooding

* fixed review comments

* small correction in example link (#230)

* Manjaro is an installer of Arch Linux (#236)

Co-authored-by: yspolyakov <89226542+yspolyakov@users.noreply.github.com>

* Fhe aborts (#243)

* changes for aborts with threshold fhe

* Miscellaneous change

* modified return type of shareKeys from vector to map, added new testcases to UnitTestMultiParty for Aborts but have to debug some testdata issue

* added testcases to UnitTestMultiparty for aborts. the unittests pass but the parameters for ckks are not read in the correct order

* fixed UnitTestMultiparty after adding new testcases for aborts, all tests pass

* minor edit to aborts parameters

* fix evalmult after CI fail for 128 bits CLANG10 and gcc10

* parameter changes for ckksrns test aborts

* changes for aborts with threshold fhe

* Miscellaneous change

* modified return type of shareKeys from vector to map, added new testcases to UnitTestMultiParty for Aborts but have to debug some testdata issue

* added testcases to UnitTestMultiparty for aborts. the unittests pass but the parameters for ckks are not read in the correct order

* fixed UnitTestMultiparty after adding new testcases for aborts, all tests pass

* minor edit to aborts parameters

* fix evalmult after CI fail for 128 bits CLANG10 and gcc10

* parameter changes for ckksrns test aborts

* changed additive sharing map logic in cryptocontext.cpp

* Code corrections

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* autoconf is not required for a simple build anymore, corrections to the documentation (#252)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Emscripten support (#240)

* Support/guards for Emscripten

* Reduced the memory usage for UTGENERAL_MULTIPARTY unittests

* More changes for emscripten

* Corrections to the emscripten changes

* Enscripten change in CMakeLists.txt

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* BINFHE segfault fix (#241)

* Segfault fix

* Additional unit tests

* Fixed operator==() for RingGSWACCKeyImpl and RingGSWEvalKeyImpl

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Update windows.rst

Fixes #242

* updated BINFHE documentation

* Update binfhe.rst

Fixed the documentation

* updated the version to v1.0.1

* Additional support for the Emscripten compiler (#248)

* Additional Emscripten support

* Disabled UnitTestFHEWSerial with JSON

* Temporarily disabled some unit test for Emscripten as they throw std::bad_alloc if linked with Emscripten

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Disabled the i386 architecture (#259)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Removed not used variables (#269)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Set CMAKE_CXX_STANDARD to 17 for user projects (#268)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Switch mTilde related params to uint64_t (#260)

* Switch mTilde related params to uint64_t

* Enahncing readability and using in-place arithmetic operators

* More optimizations

* Migration guide (#274)

* Migration guide

* Format changes to z_migration_guide.rst

* Format changes to z_migration_guide.rst (2)

* update z_migration

* Format changes to z_migration_guide.rst (3)

* Format changes to z_migration_guide.rst (4)

* made some small formatting changes

* Small edits.

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>
Co-authored-by: Ian Quah <iquah@dualitytech.com>
Co-authored-by: Saroja Erabelli <serabelli@dualitytech.com>

* Refactor unit tests: move test data to .csv files (#281)

* Moved test data to .csv file for UnitTestBGVrnsAutomorphism.cpp

* Added error handling

* Moved the implementation of Params(const std::vector<std::string>& vals) to .cpp

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

SquashMerge after 1 CI run, per DS.

* Fix for Issue 282 (#283)

* fixed code for issue #282

* fixed revew comment

* Use the CKKSRNS_SCHEME schemeId in CKKSPackedencoding constructors (#291)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Srv fix issue 273 (#290)

* changes to add threshold number of parties as cryptocontext params and adjust the cushion in findlevelstodrop for noise estimation

* changes to add threshold number of parties as cryptocontext params and adjust the cushion in findlevelstodrop for noise estimation

* cleaned up and added comment in findlevelstodrop

* typos and comments

* fixed review comments

* Use the CKKSRNS_SCHEME schemeId in CKKSPackedencoding constructors (#291)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* fixed thresholdparties *1 in two other lines

* changes to add threshold number of parties as cryptocontext params and adjust the cushion in findlevelstodrop for noise estimation

* cleaned up and added comment in findlevelstodrop

* typos and comments

* fixed review comments

* fixed thresholdparties *1 in two other lines

---------

Co-authored-by: dsuponitskiy <dmitriy.suponitskiy@gmail.com>
Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Edit readme for new example threshold-fhe-5p (#296)

* updated readme for new example threshold-fhe-5p

* fixed link in readme

* Fixed compiler errors in advanced-real-numbers.cpp (#299)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* added check for batch size to be a power of two (#300)

Co-authored-by: Andrey Kim <andreykim@Andreys-MacBook-Pro.local>

* Exception for oversized plaintext (#301)

* Throw an exception if the plaintext size exceeds its limit

* Set the scalingModSize default values for CKKS

* Added schemeId to error messages

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Added a call to PackedEncoding::SetParams() in CryptoContextFactory<Element>::GetContext (#303)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Srv fhew pke changes (#295)

* fixed 2020/086 reference

* code that compiles, need to debug segmentation fault

* running code but result fluctuates

* working code for boolean LWE pke

* fixed 2020/086 reference

* code that compiles, need to debug segmentation fault

* running code but result fluctuates

* working code for boolean LWE pke

* added more examples, benchmark and cleaned up code and comments. Still need to test new unittests added for lwe pke

* check input ciphertext to encryptn, removed unittests copy for pke to identify tests to add and some cleanup (this branch fixes issue #235)

* Edit readme for new example threshold-fhe-5p (#296)

* updated readme for new example threshold-fhe-5p

* fixed link in readme

* changes to pk generation in BTKeygen instead of generating a triple, encrypt function with pk that calls both encryptN and encryptn, added unittests

* added pubkeygen to binfhecontext, modified keygen benchmark to include btkeygen in ske

* modified keygen function in binfhe-benchmarks, cleaned up comments

* clean up

* correction to benchmark binfhe-ginx-pke

* Fixed compiler errors in advanced-real-numbers.cpp (#299)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* added check for batch size to be a power of two (#300)

Co-authored-by: Andrey Kim <andreykim@Andreys-MacBook-Pro.local>

* fixed yuriy review comments

* fixed 2020/086 reference

* code that compiles, need to debug segmentation fault

* running code but result fluctuates

* working code for boolean LWE pke

* code that compiles, need to debug segmentation fault

* running code but result fluctuates

* working code for boolean LWE pke

* added more examples, benchmark and cleaned up code and comments. Still need to test new unittests added for lwe pke

* check input ciphertext to encryptn, removed unittests copy for pke to identify tests to add and some cleanup (this branch fixes issue #235)

* changes to pk generation in BTKeygen instead of generating a triple, encrypt function with pk that calls both encryptN and encryptn, added unittests

* added pubkeygen to binfhecontext, modified keygen benchmark to include btkeygen in ske

* modified keygen function in binfhe-benchmarks, cleaned up comments

* clean up

* correction to benchmark binfhe-ginx-pke

* fixed yuriy review comments

* fixed some typos and comments

* fixed review comments

* small edits to binfhe/examples/readme and docs/sphinx_rsts/modules/binfhe.rst

---------

Co-authored-by: dsuponitskiy <dmitriy.suponitskiy@gmail.com>
Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>
Co-authored-by: Andrey Kim <kimandr.kz@gmail.com>
Co-authored-by: Andrey Kim <andreykim@Andreys-MacBook-Pro.local>

* Correction on the serialization page (#309)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Changed Hamming weight from 16 to 64 for SPARSE_TERNARY (#312)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Return original ciphertext in bootstrapping if we already start with enough towers. (#314)

* Return original ciphertext if we already start with enough towers.

* Add comment to explain changes.

* Fixed vectorization bug (#322)

* fixed vectorization in pubkeygen for xor performance difference in ske vs pke

* fixed noise issue with pke with native size 32 - modaddeq for every addition instead of using +operator, fixed review comment for changing variable name size and its type

* MATHBACKEND cleanup (#327)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* minor bug fix for throwing exception when vector of values is empty in packedencoding (#330)

* fixed the input ranges for function-evaluation.cpp (#335)

Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

* fixes documentation issue #272

* fixes documentation issue #262

* updated to v1.0.2

* Update publications.rst

* added changes (#287)

Calabacitas merge now.

* updated to v1.0.3

* Added MATHBACKEND to config_core.in (#345)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* PS parameters (#342)

* PS parameters

* cleanup

* update name

* Update FUNCTION_EVALUATION.md

* fix issue 355 - should not delete elements of DCRTPoly with one element (#379)

* fix issue 355 - should not elements of DCRTPoly with one element

* fix format

* more exception to a lower level function

* Hybrid Key Switching Optimization (#377)

* optimization from https://eprint.iacr.org/2018/117 Section 3.3

* sw optimizations

* Replaced usint with size_t and deleted redundant code for KeySwitchGen()

---------

Co-authored-by: Andrey Kim <andreykim>
Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* add check to prevent negative moduli (#386)

* Fix eval-decomp example returning wrong output (#357)

* removed final bootstrapping in evaldecomp function and changed p=8 in decrypt for last digit

* change to example to compute modulus for last digit instead of hardcoding, change to unittest to check all the digits

* replaced pow with bitwise operation

* replace log2 with getMSB in digitdecomp example and unittest

* change to example to compute modulus for last digit instead of hardcoding, change to unittest to check all the digits

* replaced pow with bitwise operation

* Modified Native Transform (#384)

* initial set of native transform modifications

* reduced set of native transform modifications; only includes transforms used in SwitchFormat()

* modified implementation after gcc benchmarking

* add in inner product example (#391)

* add in inner product example

* added in tests

* done

* Added a missing argument (ExecutionMode) to calls to Decode() (#394)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* comment out for now (#397)

* Check if std::map<>::find() returns a valid iterator (#395)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Fixed code to disallow out-of-bounds vector access (#398)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Verify that ring dimension for cryptocontext params is always power of 2 (#401)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Added a check for nullptr to GetParamsPK() to fix crashes (#399)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Do not request Git to be installed if GIT_SUBMOD_AUTO=OFF (#405)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Code improvements (#406)

* Design changes in class templates v1

* Design changes in class templates 2

* Design changes in class templates 3

* Added unittest/utils/*.h to be installed and fixed a bug in UnitTestGenerateContext()

* Assign a default slot size if slots == 0

* Do not catch and hide exceptions for cryptocontext serialization; removed unused m_autoIdxLis

* Cleanup

* Fixed clang errors

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Modified lattice (#365)

* initial setup for modifications to Lattice and Math Layers

* modifications to Lattice and Math Layers; Poly into HAL; optimization of poly/dcrtpoly rootines; speedup builds; workaround for include *.cpp files

* remove remaining HEXL-specific code

* modifications of other files to accommodate Lattice/Math Layer changes

* fixes after running unittests

* fix for compilation issue on mac

* bug fix for BE6 builds

* bug fix for BUILD_EXTRAS=ON

* fix for compilation issue with MING64 + Windows 10 (g++ 12.2.0)

* Small documentation fixes (#417)

* small comment typo in example

* Removed a text left over from Palisade

---------

Co-authored-by: Rener Oliveira <53785783+reneroliveira@users.noreply.github.com>
Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Conversion functions for crypto parameters' enums (#420)

* Added functions converting uint32_t to enum for crypto parameters

* Additional conversion functions

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* fixed the bug with large CKKS plaintexts (#424)

* fixed the bug with large CKKS plaintexts

* fix for 128-bit CKKS unit tests

* fixed the word size in MakeAuxPlaintext

---------

Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

* cyclotomic order instead of ring dimension (#427)

* gcc13 compiler errors (#430)

* Disabled -Werror=dangling-reference for the cereal library as gcc-13 throws an error

* Fixed gcc-13 errors: added <cstdint> and removed a call to std::move

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Port of PR#415 - Fix some undefined behavior (#429)

* Fix UB in CKKSPackedEncoding

Avoid casting a potentially-infinite floating point value to int32_t.

* Fix UB in FHECKKSRNS::MakeAuxPlaintext

Avoid casting a potentially-infinite floating point value to int32_t.

* Restore std:: prefix for abs in ckkspackedencoding.cpp

* Fix for segmentation fault in MakeCKKSPackedPlaintext() (#403)

* Limited the upper value of the level to encode the plaintext at

* Addressed comments

* Addressed comments about the error condition

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Issue 382 - Fix BFV security check (#432)

* fixed a bug with BFV parameter generation

* updated documentation

* Added a test for ring dimension failure on security requirement

---------

Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>
Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* fixed bugs with addition and multiplication of large doubles in CKKS (#436)

Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

* fix bfv hps (#422)

* fix bfv hps

* Moved bfv-mult-bug.cpp to src/pke/extras

* Added unittests to check the multiplicative depth limit

* dcrtpoly bug fix with alpha

* some tests should not run for mathbackend 2

* updated unit tests for deep BFV setups

* fixed the overflow check for max double

---------

Co-authored-by: Andrey Kim <andreykim@Andreys-MacBook-Pro.local>
Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>
Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

* Updated standard security tables (#439)

* updated stdlatticeparms for ternary, error secret distribution with 2^16 ring dimension for classic 128, 192, 256 security and parameter sets for 128, 192, 256 quantum security levels upto 2^15 ring dimension

* removed the hard-coding of the maximum ring dimension

---------

Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

* Correct max value for implicit conversion from int64 to double (#441)

* Corrected the max value of double that can be converted to int64_t

* Replaced the number with an expression in Max64BitValue()

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* updated version to v1.0.4

* Uncommented unittests and an example for innerproduct (#452)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Added functions to check enabled features in the cryptocontext and called them in all cryptocontext interfaces (#451)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Small correction to the migration guide (from Palisade to OpenFHE) (#453)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* New FHEW bootstrapping method LMKCDEY (ia.cr/2022/198) (#352)

* stubs

* Key generation added

* fix syntax errors

* code finished, seg. fault occurs

* try to round-to-odd

* test passed

* lmkcdey finished (replicated Yongwoo Lee's commit 1ea84c7)

* bench added, revise rgsw-acc-lmk+

* openmp for auto key gen. m_logGen to PreCompute

* error fix: add precomputation  RingGSWCryptoParams

* binfhe support Gaussian secrets

* Add STD128_LMKCDEY to binfhe-constants-impl.cpp.

* modified fhew unittest, removing repeated functions and looping through the different bootstrapping techniques instead

* fixed UnitTestFHEW after adding LMKCDEY

* Refactored unittests in UnitTestFHEW.cpp

* code cleanup in binfhe: reuse the PreCompute code

* unittest serialize for lmkcdey

---------

Co-authored-by: Yongwoo Lee <yongwool@snu.ac.kr>
Co-authored-by: randomcryptoguy <yw0803.lee@samsung.com>
Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>
Co-authored-by: sararv22 <saraswathy@dualitytech.com>
Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

* fix for issue #402 (#442)

* fix for issue #402

* additional edits

* added description for PolyImpl::TimesNoCheck()

* New function to estimate the levels consumed in bootstrapping (#459)

* Rename the private function GetBootstrapDepth() and made g_coefficients static

* Added a function to estimate the levels consumed in bootstrapping

* minor fixes in bootstrapping examples

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>
Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

* Corrected CMakeLists.User.txt and documentation for custom build location and updated docs with other OSs where OpenFHE has been sucessfully linked (#460)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Update CMakeLists.txt (#462)

Co-authored-by: Hunter Richards <36270862+harichards@users.noreply.github.com>

* Replaced uint with size_t (#465)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Problem with two coexisting CKKS crypto contexts with different ring dimensions (#463)

* Created a static map of precomputed values with ringDim as the key to handle multiple cryptocontexts

* Added a unittest to verify that ringDim for the first cryptocontext is not overriden by creation of another cryptocontext.

* Inlined FFTSpecialInvLazy() as it was called in one place only

* Added a benchmark for DiscreteFourierTransform::FFTSpecial and FFTSpecialInv

* Moved the benchmark for DiscreteFourierTransform::FFTSpecial and FFTSpecialInv to fft-ckks-encoding.cpp

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Changes to improve readability (mostly cosmetic) (#467)

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Add numAutoKeys to RingGSWCryptoParams (#466)

* add numAutoKeys to RingGSWCryptoParams

* numAutoKeys arg to end; throw if numAutoKeys==0

* Added m_numAutoKeys to save()/load() for RingGSWCryptoParams

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* added support for Compress to BFV for HPS* modes (#472)

Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

* Modified math (#476)

* initial setup for modifications to Lattice and Math Layers

* modifications to Lattice and Math Layers; Poly into HAL; optimization of poly/dcrtpoly rootines; speedup builds; workaround for include *.cpp files

* checkpoint after modified SwitchModulus

* remove unused variable

* checkpoint before adding operator*=(NativeInteger) to DCRTPoly

* added a few NativeInteger operations DCRTPoly

* decouple and add guards for BE2/4/6; bug fix for index check

* updated Native/BE4 Vector/Integer routines; updated IntegerMath benchmark; use of uint64_t as BigInteger for BE4

* updates after unit tests and benchmarking

* optimizations to distribution generators

* optimizations to binfhe

* updated CMake file

* a few binfhe optimizations

* DCRTPoly passed by const& instead of value in keyswitch

* fix for failed workflow

* fix for BE6

* remove noexcept from default ctor (#485)

* Code for multi-input gates (#488)

* new branch to transfer changes from srv_multi_input_gates branch because that branch has many conflicts after carlo's PR was merged into dev

* small change for compatibility with paramsgen script

* confirmed changes to not conflict with carlo's pr

* fixed doxygen comments

* hardening and optimizations of CKKS bootstrapping for sparse secrets (#489)

Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

* implemented approximate gadget decomposition (#487)

Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

* Added noise flag for parameter estimator script (#492)

* added noise flag for parameter estimator script

* sorted the variable names in config_core.h

---------

Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

* Scheme switching (#367) (#486)

* initial switch CKKS->FHEW

* initial switch FHEW->CKKS

* sign evaluation via scheme switching

* initial min/max

* some code cleanup

* 3 scaletechs and argminAlt

* secure CKKS->FHEW switching

* all scaling modes

* unit tests

* examples and documentation

* extra and code clean-up

* 128-bit and cleanup

* finalized rebase + renamed constants

* params for inner binfhe cc and comments

* addressed all comments except circular dependency + reused code

* addressed all comments except fwd headers

* constants file in core

* rebased again to resolve conflicts

* 454 fix comments in binfhe documentation (#496)

* updated descriptions in binfhe header files

* updated README

* more README and comments updates

* FIxed CKKS precision unit tests (#499)

* fixed CKKS precision unit tests

* additional fix

---------

Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

* trimmed unit tests for scheme switching (#501)

* trimmed unit tests for scheme switching

* more trimming of scheme switching unit tests

* Issue 495 optimized fhew parameters (#503)

* simplified named parameter sets for binfhe

* optimized STD128* datasets

* added more optimized parameters for FHEW

---------

Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

* Ckks int mp boot tmp (#502)

* Initial commit - driver app stub

* trial one

* stub is ready - adding intmpboot adjust scale

* cleaner version of stub

* Adding generateCRP

* Adding IntMPBootDecrypt

* Adding IntMPBootAdd

* Adding IntMPBootEncrypt

* first working implementation - tckks

* evaluating Chebyshev series example

* supporting 4 mode of scaling

* fix scale issue in flexible* modes

* Added unit tests for interactive bootstrapping, fixed some code

* issue in passing compression level parameter from user level params to rns params

* working implementation after moving compression level

* small fix

* Added interactiveBootCompressionLevel to params used for cryptocontext generation

* small updates to improve examples output

* improving comments and adding serialization logic for new parameter: compression level

* Reduced scalingModSize to 50 in unittests

* Changed the epsilon value used for results comparison in unittests

* Added skipTest() to BaseTestCase.h to skip some unittests

* Ran pre-commit on all changed files and removed tabs

* fixed error messages and DropLastElement -> DropLastElements

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Pke documentation + optimized parameters for LMKCDEY FHEW (#507)

* beginning of documentation changes

* documentation changes

* more updates in the parameter sets

* many documentation changes in cryptocontext.h and some other small changes

* more FHEW parameter changes

* optimized FHEW parameter sets

---------

Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

* Unittests fail on mingw (#506)

* Fixed unittest failures on MinGW

* Disabled an OMP pragma that caused a crash on MinGW

* Completely disabled that pragma as it should be revised

* int32_t and std::abs

* Corrected the CryptoContext static data members

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>
Co-authored-by: Andreea Alexandru <aalexandru@dualitytech.com>

* 483 implement compiler specific optimizations for ntt and ringmult (#508)

* limited omp performance tuning

* tunning of ModAdd/ModMul for g++-10/WITH_NATIVEOPT=OFF/OMP_NUM_THREADS=1; Implementation of NoCheck functions

* change >= to > in ModAddFastEq for performance

* initial tunning of ntt for g++-10/WITH_NATIVEOPT=OFF/OMP_NUM_THREADS=1

* tunning of ntt/intt for g++-10/WITH_NATIVEOPT=OFF/WITH_OPENMP=OFF

* Issue 434 (#450)

* Fix unnecesary copy

* Additional code corrections

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

* Reduced runtime of pke unit tests (#510)

* optimized many unit tests

* reduce time scheme switching unit tests

---------

Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

* Documentation changes (#514)

* some documentation changes

* fixed README

* more documentation changes

* more documentation changes

* more rst changes

* more documentation changes

---------

Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>

* Compiler errors on macos (#515)

* Removed constexpr for some utility functions

* Moved ToNativePoly() from poly-impl.h to poly.h

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>

---------

Co-authored-by: sararv22 <100254654+sararv22@users.noreply.github.com>
Co-authored-by: Rener Oliveira <53785783+reneroliveira@users.noreply.github.com>
Co-authored-by: Bastiaan Quast <bquast@gmail.com>
Co-authored-by: yspolyakov <89226542+yspolyakov@users.noreply.github.com>
Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>
Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>
Co-authored-by: Jack Bates <101598183+jbates-duality@users.noreply.github.com>
Co-authored-by: caesar <caesar.etos@gmail.com>
Co-authored-by: Ian Quah <iquah@dualitytech.com>
Co-authored-by: Saroja Erabelli <serabelli@dualitytech.com>
Co-authored-by: Andrey Kim <kimandr.kz@gmail.com>
Co-authored-by: Andrey Kim <andreykim@Andreys-MacBook-Pro.local>
Co-authored-by: sarojaduality <95240483+sarojaduality@users.noreply.github.com>
Co-authored-by: iquah1 <97902382+iquah1@users.noreply.github.com>
Co-authored-by: andreea-alexandru <31080521+andreea-alexandru@users.noreply.github.com>
Co-authored-by: pascoec <123595534+pascoec@users.noreply.github.com>
Co-authored-by: Eric Astor <epastor@google.com>
Co-authored-by: Yongwoo Lee <yongwool@snu.ac.kr>
Co-authored-by: randomcryptoguy <yw0803.lee@samsung.com>
Co-authored-by: sararv22 <saraswathy@dualitytech.com>
Co-authored-by: Hunter Richards <36270862+harichards@users.noreply.github.com>
Co-authored-by: Andreea Alexandru <aalexandru@dualitytech.com>
Co-authored-by: Saman <100295082+enum-class@users.noreply.github.com>
@dsuponitskiy dsuponitskiy deleted the issue-469 branch August 1, 2023 23:49
@dsuponitskiy dsuponitskiy restored the issue-469 branch August 1, 2023 23:51
@dsuponitskiy dsuponitskiy deleted the issue-469 branch August 1, 2023 23:51
@dsuponitskiy dsuponitskiy restored the issue-469 branch August 1, 2023 23:51
@dsuponitskiy dsuponitskiy deleted the issue-469 branch August 1, 2023 23:51
gong-cr pushed a commit to gong-cr/openfhe-development that referenced this pull request Mar 6, 2024
Co-authored-by: Yuriy Polyakov <ypolyakod@dualitytech.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
optimization Improves performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Approximate gadget decomposition for DM-like schemes
4 participants