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

feat(integer): speed-up division by using overflowing_sub #619

Merged
merged 1 commit into from
Oct 12, 2023
Merged

Conversation

tmontaigu
Copy link
Contributor

using overflowing sub allows to remove the comparison used in the algorithm, giving significant performance boost.

before
                8        16       32      40       64       128        256
hpc7a:    `981 ms` `2.53 s` `6.41 s` `9.04 s` `16.1 s` `39.3 s` `1.55 min`
m6i:        `1.10 s` `2.97 s` `7.17 s` `10.5 s` `19.7 s` `50.2 s` `2.11 min`

afer:
                8        16       32      40       64       128        256
hpc7a:   `604 ms` `1.6 s`  `3.8 s`  `5.14 s` `9.4 s`  `22.4 s`  `54.613 s`
m6i:      `659 ms` `1.77 s` `4.4 s`  `5.9 s`  `11.5 s` `29.8 s`  `79.95 s`

@cla-bot cla-bot bot added the cla-signed label Oct 9, 2023
@github-actions
Copy link

github-actions bot commented Oct 9, 2023

@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.

Some nitpicks, if you have some time to quickly discuss the changes you did, they seem pretty extensive and I'm not sure I got all of them

@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.

Looks good noise wise (hopefully I did not miss anything) small nitpicks in comments, let me know if you want to proceed without them

tfhe/src/integer/server_key/radix_parallel/div_mod.rs Outdated Show resolved Hide resolved
@github-actions
Copy link

@slab-ci cpu_fast_test

using overflowing sub allows to remove the comparison used
in the algorithm, giving significant performance boost.

before
             8        16       32      40       64       128        256
hpc7a:    `981 ms` `2.53 s` `6.41 s` `9.04 s` `16.1 s` `39.3 s` `1.55 min`
m6i:      `1.10 s` `2.97 s` `7.17 s` `10.5 s` `19.7 s` `50.2 s` `2.11 min`

afer:
             8        16       32      40       64       128        256
hpc7a:   `604 ms` `1.6 s`  `3.8 s`  `5.14 s` `9.4 s`  `22.4 s`  `54.613 s`
m6i:     `659 ms` `1.77 s` `4.4 s`  `5.9 s`  `11.5 s` `29.8 s`  `87.95 s`
@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.

Thanks a lot !

@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

@slab-ci
Copy link

slab-ci bot commented Oct 11, 2023

Failed to spawn EC2 instances: failed to create aws ec2 instance after many attempts (InsufficientInstanceCapacity(ApiErrorInfo { code: "InsufficientInstanceCapacity", message: "We currently do not have sufficient m6i.32xlarge capacity in zones with support for 'gp2' volumes. Our system will be working on provisioning additional capacity." }))

2 similar comments
@slab-ci
Copy link

slab-ci bot commented Oct 11, 2023

Failed to spawn EC2 instances: failed to create aws ec2 instance after many attempts (InsufficientInstanceCapacity(ApiErrorInfo { code: "InsufficientInstanceCapacity", message: "We currently do not have sufficient m6i.32xlarge capacity in zones with support for 'gp2' volumes. Our system will be working on provisioning additional capacity." }))

@slab-ci
Copy link

slab-ci bot commented Oct 11, 2023

Failed to spawn EC2 instances: failed to create aws ec2 instance after many attempts (InsufficientInstanceCapacity(ApiErrorInfo { code: "InsufficientInstanceCapacity", message: "We currently do not have sufficient m6i.32xlarge capacity in zones with support for 'gp2' volumes. Our system will be working on provisioning additional capacity." }))

@tmontaigu
Copy link
Contributor Author

@slab-ci cpu_integer_test
@slab-ci cpu_multi_bit_test
@slab-ci cpu_wasm_test

@tmontaigu
Copy link
Contributor Author

@slab-ci cpu_integer_test

@tmontaigu
Copy link
Contributor Author

@slab-ci cpu_fast_test
@slab-ci cpu_test

@IceTDrinker
Copy link
Member

if we are getting sig kills we may want to change the number of cargo nextest processes we launch in parallel

@IceTDrinker
Copy link
Member

or limit the tests given the biggest server key size so that it fits in RAM, as the tests are multi threaded anyways we should not be losing too much hopefully

btw the test executor taking the key by value will make things worse right ? Could we maybe move the key in the executor and have an accessor on the executor to get a ref to the server key so that we don't have an extra copy in memory ?

@tmontaigu
Copy link
Contributor Author

btw the test executor taking the key by value will make things worse right ? Could we maybe move the key in the executor and have an accessor on the executor to get a ref to the server key so that we don't have an extra copy in memory ?

Yes that should work

@tmontaigu tmontaigu merged commit bc34411 into main Oct 12, 2023
19 of 21 checks passed
@tmontaigu tmontaigu deleted the div branch October 12, 2023 12:35
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