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

chore(bench): implement throughput benchmarks on core_crypto layer #2183

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

soonum
Copy link
Contributor

@soonum soonum commented Mar 18, 2025

There is still a bit a of work to do but that won't change much the implementation.
Still to do:

  • Check if the GPU devices are fully loaded during benchmarks, adapt elements generation if needed
  • Double check usage of streams (seems sub-optimal at the moment)

This change is Reviewable

@soonum soonum self-assigned this Mar 18, 2025
@cla-bot cla-bot bot added the cla-signed label Mar 18, 2025
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.

Looks good to me except for the comment I left earlier, and I think we can keep only one workflow for GPU benchmarks for integer+core, wdyt?

@soonum soonum force-pushed the dt/bench/throughput_core_crypto branch from 94a2343 to 5b0c7ed Compare March 19, 2025 15:05
@soonum soonum requested a review from agnesLeroy March 19, 2025 15:16
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.

Thanks a lot @soonum! In the end you kept cuda_local_streams and cuda_local_streams_core then?

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.

@soonum the PR is quite big tell me which part you wanted me to look at in particular that you mentionned

Reviewed 10 of 14 files at r1, all commit messages.
Reviewable status: 10 of 14 files reviewed, 7 unresolved discussions (waiting on @agnesLeroy and @soonum)


tfhe/benches/integer/signed_bench.rs line 3071 at r1 (raw file):

fn main() {
    init_bench_type();

can even be a get_bench_type that populates the once lock on demand


tfhe/benches/utilities.rs line 703 at r1 (raw file):

    /// Instantiate Cuda server key to each available GPU.
    #[allow(dead_code)]
    #[cfg(feature = "integer")]

pattern to try to make it less annoying with features

if I have somethign for integer

#[cfg(feature = "integer")]
pub mod my_integer_mod {
}

#[cfg(feature = "integer")]
pub use my_integer_mod::*;

avoids to have to repeat the feature and have dead code potentially


tfhe/benches/integer/bench.rs line 3329 at r1 (raw file):

fn main() {
    init_bench_type();

can even be a get_bench_type that populates the once lock on demand


tfhe/benches/integer/glwe_packing_compression.rs line 368 at r1 (raw file):

fn main() {
    init_bench_type();

can even be a get_bench_type that populates the once lock on demand so no need to manually init


tfhe/benches/integer/zk_pke.rs line 440 at r1 (raw file):

fn main() {
    init_bench_type();

same here probably not needed

@soonum
Copy link
Contributor Author

soonum commented Mar 20, 2025

tfhe/benches/integer/bench.rs line 3329 at r1 (raw file):

Previously, IceTDrinker (Arthur Meyre) wrote…

can even be a get_bench_type that populates the once lock on demand

A getter would mean, to me, returning a value that we should pass around.

@soonum
Copy link
Contributor Author

soonum commented Mar 20, 2025

tfhe/benches/integer/bench.rs line 3329 at r1 (raw file):

Previously, soonum (David Testé) wrote…

A getter would mean, to me, returning a value that we should pass around.

Unless you mean a get_bench_type called directly in the benchmark functions ?

@IceTDrinker
Copy link
Member

tfhe/benches/integer/bench.rs line 3329 at r1 (raw file):

Previously, IceTDrinker (Arthur Meyre) wrote…
A getter would mean, to me, returning a value that we should pass around.

no something like

pub fn get_bench_type() -> BenchType {
    static BENCH_TYPE: OnceLock<BenchType> = OnceLocke::new();

    BENCH_TYPE.get_or_init(|| /* env var logiv*/)
    return bench_type
}

you call it where you need it and the bench type is cacehd in the once lock

@soonum soonum force-pushed the dt/bench/throughput_core_crypto branch from 5b0c7ed to 3fe645f Compare March 24, 2025 07:59
@zama-bot zama-bot removed the approved label Mar 24, 2025
@soonum soonum force-pushed the dt/bench/throughput_core_crypto branch 4 times, most recently from d499b1f to 4a6e7f9 Compare March 26, 2025 12:48
@soonum soonum force-pushed the dt/bench/throughput_core_crypto branch from 4a6e7f9 to b4ea49a Compare March 27, 2025 10:00
@soonum soonum force-pushed the dt/bench/throughput_core_crypto branch from b4ea49a to 7765f77 Compare March 27, 2025 10:37
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.

4 participants