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

Gemm-based packing ks #1859

Closed
wants to merge 13 commits into from
Closed

Conversation

andrei-stoian-zama
Copy link
Contributor

@andrei-stoian-zama andrei-stoian-zama commented Dec 9, 2024

  • Adds an optimized GEMM kernel
  • Adds an alternative packing keyswitch implementation using the gemm kernel
  • Implements a fast path for packing keyswitch for levels==1 using the gemm kernel
  • Adds the fast path to the integer compression GPU code and adds a test with custom parameters that use the fast path

Achieves ~4x speedup for packing keyswitch

#[test]
fn test_gpu_ciphertext_compression_fast_path() {
// these parameters are insecure
const PARAM_CUSTOM_FAST_PATH: ClassicPBSParameters = ClassicPBSParameters {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@IceTDrinker , @agnesLeroy here I added dummy parameters that use the fast path but have no correctness guarantee - thus I removed the and operation in the test so no PBS is done -> just encrypt/compress/extract/decrypt.

I hope this is ok, let me know.

const PARAM_CUSTOM_FAST_PATH: ClassicPBSParameters = ClassicPBSParameters {
lwe_dimension: LweDimension(2048),
glwe_dimension: GlweDimension(1),
polynomial_size: PolynomialSize(2048),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

should I add other poly sizes in the test ?

@IceTDrinker
Copy link
Member

hey I've been very busy with noise verifications, I should have some time to review hopefully in the next few days, but I have a ZK review that will take priority

@andrei-stoian-zama
Copy link
Contributor Author

Closed because I generalized this approach in #1875

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