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(gpu): implement fhe rand on gpu #1958

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

guillermo-oyarzun
Copy link
Member

closes: please link all relevant issues

PR content/description

Check-list:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Relevant issues are marked as resolved/closed, related issues are linked in the description
  • Check for breaking changes (including serialization changes) and add them to commit message following the conventional commit specification

@guillermo-oyarzun guillermo-oyarzun self-assigned this Jan 13, 2025
@cla-bot cla-bot bot added the cla-signed label Jan 13, 2025
@guillermo-oyarzun guillermo-oyarzun force-pushed the go/feature/implement-fherand-on-gpu branch from 349cfaa to 9088fb0 Compare January 13, 2025 18:04
Copy link
Contributor

@agnesLeroy agnesLeroy left a comment

Choose a reason for hiding this comment

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

Hey @guillermo-oyarzun! Thanks a lot for this PR, here comes my review. My main question is about the par_generate... entry points: at the moment the cuda calls are made on the same streams, which makes execution sequential. What we could do is use a different set of streams for each of the par_iter iteration maybe? Wdyt?

backends/tfhe-cuda-backend/cuda/include/linear_algebra.h Outdated Show resolved Hide resolved
tfhe/src/integer/gpu/server_key/radix/oprf.rs Outdated Show resolved Hide resolved
tfhe/src/integer/gpu/server_key/radix/oprf.rs Outdated Show resolved Hide resolved
tfhe/src/integer/gpu/server_key/radix/oprf.rs Outdated Show resolved Hide resolved
tfhe/src/integer/gpu/server_key/radix/oprf.rs Outdated Show resolved Hide resolved
tfhe/src/integer/gpu/server_key/radix/oprf.rs Outdated Show resolved Hide resolved
@guillermo-oyarzun guillermo-oyarzun force-pushed the go/feature/implement-fherand-on-gpu branch 3 times, most recently from 5d54d65 to 63eb9b8 Compare January 14, 2025 12:04
@guillermo-oyarzun guillermo-oyarzun force-pushed the go/feature/implement-fherand-on-gpu branch 2 times, most recently from cd28cff to 29dcb98 Compare January 15, 2025 18:08
.into_par_iter()
.enumerate()
.map(|(i, seed)| {
let stream_index = i;
Copy link
Contributor

Choose a reason for hiding this comment

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

Here if there are too many blocks this won't work, will it? We would need something like

let stream_index = i % streams.gpu_indexes.len()

instead

Copy link
Member Author

Choose a reason for hiding this comment

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

It will work because before I generate a vector of streams with as many streams as blocks are. This is being executed in a single GPU but with many streams.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yes of course, thanks for the clarification!

@guillermo-oyarzun guillermo-oyarzun force-pushed the go/feature/implement-fherand-on-gpu branch from 29dcb98 to 17f5d05 Compare January 16, 2025 11:45
@zama-bot zama-bot removed the approved label Jan 16, 2025
@guillermo-oyarzun guillermo-oyarzun merged commit a9e4724 into main Jan 16, 2025
53 checks passed
@guillermo-oyarzun guillermo-oyarzun deleted the go/feature/implement-fherand-on-gpu branch January 16, 2025 13:48
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.

3 participants