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

Speed up im2col_encoding for GPUs #503

Open
dimk1 opened this issue Dec 6, 2024 · 2 comments
Open

Speed up im2col_encoding for GPUs #503

dimk1 opened this issue Dec 6, 2024 · 2 comments
Labels
Type: Improvement 📈 Performance improvement not introducing a new feature or requiring a major refactor

Comments

@dimk1
Copy link

dimk1 commented Dec 6, 2024

Currently, in encrypted inference, we encrypt images one by one when calling ts.im2col_encoding() function and do encrypted inference on "model(context, x_enc, windows_nb)" on one sample x_enc. I think we have the most problematic performance bottleneck here. The acceleration effect of GPU is seen most when we do inference on batches of data and running model(batch_x), where batch_x is a 3D or 4D tensor (#num of samples, width, height). But now the #num_of_samples=1 in encrypted inference and the GPU utilization is very low. I looked if there is a way of "CKKSTensor - Batching" in TenSEAL, but I could not find any. Have you considered this feature as an improvement? It would speed up things a lot.

@dimk1 dimk1 added the Type: Improvement 📈 Performance improvement not introducing a new feature or requiring a major refactor label Dec 6, 2024
@youben11
Copy link
Member

youben11 commented Dec 6, 2024

Nothing is running on GPU. Ciphertext computation (even with a batch of 1) could benefit from running in GPU, but this is not the case. Everything in running on CPU. So this is clearly out of reach.

@dimk1
Copy link
Author

dimk1 commented Dec 6, 2024

Ok, sorry for the misunderstanding, I'm new to FHE and TenSEAL. So there is no way to speed up this operation to run in batches > 1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Improvement 📈 Performance improvement not introducing a new feature or requiring a major refactor
Projects
None yet
Development

No branches or pull requests

2 participants