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

fix(integer): is_neg/sub/add possible #581

Merged
merged 1 commit into from
Sep 26, 2023
Merged

fix(integer): is_neg/sub/add possible #581

merged 1 commit into from
Sep 26, 2023

Conversation

tmontaigu
Copy link
Contributor

The way we did the is_neg/add/sub possible at the integer level was incorrect in two ways.

  1. We simply called the is_neg/add/sub_possible from
    the shortint impl on each block as if the were independant.
    However that is not the case, and to the check did not reflect
    actual computation.

  2. We checked that we did not go beyond max degree on each block,
    However, a more correct approach would be to check that adding
    the potential carry from preceding block would not exceeding the
    current block max capacity.

Fixes asserts for is_sub_possible being triggered in #536

@cla-bot cla-bot bot added the cla-signed label Sep 22, 2023
@github-actions
Copy link

@slab-ci cpu_fast_test

@github-actions
Copy link

@slab-ci cpu_fast_test

@tmontaigu
Copy link
Contributor Author

@slab-ci cpu_integer_test

@github-actions
Copy link

@slab-ci cpu_fast_test

@github-actions
Copy link

@slab-ci cpu_fast_test

tfhe/src/integer/server_key/radix/neg.rs Show resolved Hide resolved
tfhe/src/integer/server_key/radix/neg.rs Outdated Show resolved Hide resolved
tfhe/src/integer/server_key/radix/neg.rs Outdated Show resolved Hide resolved
tfhe/src/integer/server_key/radix/sub.rs Outdated Show resolved Hide resolved
The way we did the is_neg/add/sub possible at the integer level was
incorrect in two ways.

1) We simply called the is_neg/add/sub_possible from
   the shortint impl on each block as if the were independant.
   However that is not the case, and to the check did not reflect
   actual computation.

2) We checked that we did not go beyond max degree on each block,
   However, a more correct approach would be to check that adding
   the potential carry from preceding block would not exceeding the
   current block max capacity.
@github-actions
Copy link

@slab-ci cpu_fast_test

Copy link
Member

@IceTDrinker IceTDrinker left a comment

Choose a reason for hiding this comment

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

Let's go, thanks !

@github-actions
Copy link

Pull Request has been approved 🎉
Launching full test suite...
@slab-ci cpu_test
@slab-ci cpu_integer_test
@slab-ci cpu_multi_bit_test
@slab-ci cpu_wasm_test
@slab-ci csprng_randomness_testing

@tmontaigu tmontaigu merged commit 37be751 into main Sep 26, 2023
20 checks passed
@tmontaigu tmontaigu deleted the fix-is-possible branch September 26, 2023 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants