mirror of
https://github.com/zama-ai/tfhe-rs.git
synced 2026-01-08 22:28:01 -05:00
chore(gpu): add the possibility to run classical bench for erc20 and dex
This commit is contained in:
3
.github/workflows/benchmark_gpu.yml
vendored
3
.github/workflows/benchmark_gpu.yml
vendored
@@ -21,10 +21,9 @@ on:
|
|||||||
command:
|
command:
|
||||||
description: "Benchmark command to run"
|
description: "Benchmark command to run"
|
||||||
type: choice
|
type: choice
|
||||||
default: integer_multi_bit
|
default: integer
|
||||||
options:
|
options:
|
||||||
- integer
|
- integer
|
||||||
- integer_multi_bit
|
|
||||||
- integer_compression
|
- integer_compression
|
||||||
- pbs
|
- pbs
|
||||||
- pbs128
|
- pbs128
|
||||||
|
|||||||
18
Makefile
18
Makefile
@@ -1616,7 +1616,14 @@ bench_hlapi_erc20: install_rs_check_toolchain
|
|||||||
|
|
||||||
.PHONY: bench_hlapi_erc20_gpu # Run benchmarks for ERC20 operations on GPU
|
.PHONY: bench_hlapi_erc20_gpu # Run benchmarks for ERC20 operations on GPU
|
||||||
bench_hlapi_erc20_gpu: install_rs_check_toolchain
|
bench_hlapi_erc20_gpu: install_rs_check_toolchain
|
||||||
RUSTFLAGS="$(RUSTFLAGS)" __TFHE_RS_BENCH_TYPE=$(BENCH_TYPE) \
|
RUSTFLAGS="$(RUSTFLAGS)" __TFHE_RS_BENCH_TYPE=$(BENCH_TYPE) __TFHE_RS_PARAM_TYPE=$(BENCH_PARAM_TYPE) \
|
||||||
|
cargo $(CARGO_RS_CHECK_TOOLCHAIN) bench \
|
||||||
|
--bench hlapi-erc20 \
|
||||||
|
--features=integer,gpu,internal-keycache,pbs-stats -p tfhe-benchmark --profile release_lto_off --
|
||||||
|
|
||||||
|
.PHONY: bench_hlapi_erc20_gpu_classical # Run benchmarks for ERC20 operations on GPU with classical parameters
|
||||||
|
bench_hlapi_erc20_gpu_classical: install_rs_check_toolchain
|
||||||
|
RUSTFLAGS="$(RUSTFLAGS)" __TFHE_RS_BENCH_TYPE=$(BENCH_TYPE) __TFHE_RS_PARAM_TYPE=classical \
|
||||||
cargo $(CARGO_RS_CHECK_TOOLCHAIN) bench \
|
cargo $(CARGO_RS_CHECK_TOOLCHAIN) bench \
|
||||||
--bench hlapi-erc20 \
|
--bench hlapi-erc20 \
|
||||||
--features=integer,gpu,internal-keycache,pbs-stats -p tfhe-benchmark --profile release_lto_off --
|
--features=integer,gpu,internal-keycache,pbs-stats -p tfhe-benchmark --profile release_lto_off --
|
||||||
@@ -1630,7 +1637,14 @@ bench_hlapi_dex: install_rs_check_toolchain
|
|||||||
|
|
||||||
.PHONY: bench_hlapi_dex_gpu # Run benchmarks for DEX operations on GPU
|
.PHONY: bench_hlapi_dex_gpu # Run benchmarks for DEX operations on GPU
|
||||||
bench_hlapi_dex_gpu: install_rs_check_toolchain
|
bench_hlapi_dex_gpu: install_rs_check_toolchain
|
||||||
RUSTFLAGS="$(RUSTFLAGS)" __TFHE_RS_BENCH_TYPE=$(BENCH_TYPE) \
|
RUSTFLAGS="$(RUSTFLAGS)" __TFHE_RS_BENCH_TYPE=$(BENCH_TYPE) __TFHE_RS_PARAM_TYPE=$(BENCH_PARAM_TYPE) \
|
||||||
|
cargo $(CARGO_RS_CHECK_TOOLCHAIN) bench \
|
||||||
|
--bench hlapi-dex \
|
||||||
|
--features=integer,gpu,internal-keycache,pbs-stats -p tfhe-benchmark --profile release_lto_off --
|
||||||
|
|
||||||
|
.PHONY: bench_hlapi_dex_gpu_classical # Run benchmarks for DEX operations on GPU with classical parameters
|
||||||
|
bench_hlapi_dex_gpu_classical: install_rs_check_toolchain
|
||||||
|
RUSTFLAGS="$(RUSTFLAGS)" __TFHE_RS_BENCH_TYPE=$(BENCH_TYPE) __TFHE_RS_PARAM_TYPE=$(BENCH_PARAM_TYPE) \
|
||||||
cargo $(CARGO_RS_CHECK_TOOLCHAIN) bench \
|
cargo $(CARGO_RS_CHECK_TOOLCHAIN) bench \
|
||||||
--bench hlapi-dex \
|
--bench hlapi-dex \
|
||||||
--features=integer,gpu,internal-keycache,pbs-stats -p tfhe-benchmark --profile release_lto_off --
|
--features=integer,gpu,internal-keycache,pbs-stats -p tfhe-benchmark --profile release_lto_off --
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
#[cfg(feature = "gpu")]
|
|
||||||
use benchmark::params_aliases::BENCH_PARAM_GPU_MULTI_BIT_GROUP_4_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128;
|
|
||||||
#[cfg(not(feature = "gpu"))]
|
#[cfg(not(feature = "gpu"))]
|
||||||
use benchmark::params_aliases::BENCH_PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128;
|
use benchmark::params_aliases::BENCH_PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128;
|
||||||
#[cfg(feature = "gpu")]
|
#[cfg(feature = "gpu")]
|
||||||
use benchmark::utilities::configure_gpu;
|
use benchmark::params_aliases::{
|
||||||
|
BENCH_PARAM_GPU_MULTI_BIT_GROUP_4_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128,
|
||||||
|
BENCH_PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128,
|
||||||
|
};
|
||||||
|
#[cfg(feature = "gpu")]
|
||||||
|
use benchmark::utilities::{configure_gpu, get_param_type, ParamType};
|
||||||
use benchmark::utilities::{get_bench_type, write_to_json, BenchmarkType, OperatorType};
|
use benchmark::utilities::{get_bench_type, write_to_json, BenchmarkType, OperatorType};
|
||||||
use criterion::measurement::WallTime;
|
use criterion::measurement::WallTime;
|
||||||
use criterion::{BenchmarkGroup, Criterion, Throughput};
|
use criterion::{BenchmarkGroup, Criterion, Throughput};
|
||||||
@@ -1434,9 +1437,13 @@ fn main() {
|
|||||||
|
|
||||||
#[cfg(feature = "gpu")]
|
#[cfg(feature = "gpu")]
|
||||||
fn main() {
|
fn main() {
|
||||||
let params = BENCH_PARAM_GPU_MULTI_BIT_GROUP_4_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128;
|
let params: tfhe::shortint::AtomicPatternParameters = match get_param_type() {
|
||||||
|
ParamType::Classical => BENCH_PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128.into(),
|
||||||
|
_ => BENCH_PARAM_GPU_MULTI_BIT_GROUP_4_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128.into(),
|
||||||
|
};
|
||||||
|
|
||||||
let config = ConfigBuilder::with_custom_parameters(params).build();
|
let config = ConfigBuilder::with_custom_parameters(params).build();
|
||||||
|
|
||||||
let cks = ClientKey::generate(config);
|
let cks = ClientKey::generate(config);
|
||||||
|
|
||||||
let mut c = Criterion::default().sample_size(10).configure_from_args();
|
let mut c = Criterion::default().sample_size(10).configure_from_args();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#[cfg(feature = "gpu")]
|
#[cfg(feature = "gpu")]
|
||||||
use benchmark::utilities::configure_gpu;
|
use benchmark::utilities::{configure_gpu, get_param_type, ParamType};
|
||||||
use benchmark::utilities::{get_bench_type, write_to_json, BenchmarkType, OperatorType};
|
use benchmark::utilities::{get_bench_type, write_to_json, BenchmarkType, OperatorType};
|
||||||
use criterion::measurement::WallTime;
|
use criterion::measurement::WallTime;
|
||||||
use criterion::{BenchmarkGroup, Criterion, Throughput};
|
use criterion::{BenchmarkGroup, Criterion, Throughput};
|
||||||
@@ -864,10 +864,17 @@ fn main() {
|
|||||||
|
|
||||||
#[cfg(feature = "gpu")]
|
#[cfg(feature = "gpu")]
|
||||||
fn main() {
|
fn main() {
|
||||||
let params =
|
let params: tfhe::shortint::AtomicPatternParameters = match get_param_type() {
|
||||||
benchmark::params_aliases::BENCH_PARAM_GPU_MULTI_BIT_GROUP_4_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128;
|
ParamType::Classical => {
|
||||||
|
benchmark::params_aliases::BENCH_PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128.into()
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
benchmark::params_aliases::BENCH_PARAM_GPU_MULTI_BIT_GROUP_4_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128.into()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let config = tfhe::ConfigBuilder::with_custom_parameters(params).build();
|
let config = tfhe::ConfigBuilder::with_custom_parameters(params).build();
|
||||||
|
|
||||||
let cks = ClientKey::generate(config);
|
let cks = ClientKey::generate(config);
|
||||||
|
|
||||||
let mut c = Criterion::default().sample_size(10).configure_from_args();
|
let mut c = Criterion::default().sample_size(10).configure_from_args();
|
||||||
|
|||||||
Reference in New Issue
Block a user