From 141efc8db2c011aa247b0f87ac797c42c290825e Mon Sep 17 00:00:00 2001 From: aPere3 Date: Tue, 4 Apr 2023 17:23:10 +0200 Subject: [PATCH] bench(compiler): Add e2e benchmark for rounded PBS --- compilers/concrete-compiler/compiler/Makefile | 5 ++++- .../tests/end_to_end_fixture/end_to_end_round_gen.py | 10 +++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/compilers/concrete-compiler/compiler/Makefile b/compilers/concrete-compiler/compiler/Makefile index 375f5656b..9284e0d9c 100644 --- a/compilers/concrete-compiler/compiler/Makefile +++ b/compilers/concrete-compiler/compiler/Makefile @@ -331,10 +331,13 @@ $(BENCHMARK_CPU_DIR): $(BENCHMARK_CPU_DIR)/end_to_end_linalg_apply_lookup_table.yaml: tests/end_to_end_fixture/end_to_end_linalg_apply_lookup_table_gen.py $(Python3_EXECUTABLE) $< --n-ct 64 128 1024 > $@ +$(BENCHMARK_CPU_DIR)/end_to_end_round.yaml: tests/end_to_end_fixture/end_to_end_round_gen.py + $(Python3_EXECUTABLE) $< --shapes 64 128 1024 > $@ + $(BENCHMARK_CPU_DIR)/%.yaml: tests/end_to_end_fixture/%_gen.py $(Python3_EXECUTABLE) $< > $@ -generate-cpu-benchmarks: $(BENCHMARK_CPU_DIR) $(BENCHMARK_CPU_DIR)/end_to_end_linalg_apply_lookup_table.yaml $(BENCHMARK_CPU_DIR)/end_to_end_apply_lookup_table.yaml +generate-cpu-benchmarks: $(BENCHMARK_CPU_DIR) $(BENCHMARK_CPU_DIR)/end_to_end_linalg_apply_lookup_table.yaml $(BENCHMARK_CPU_DIR)/end_to_end_apply_lookup_table.yaml $(BENCHMARK_CPU_DIR)/end_to_end_round.yaml SECURITY_TO_BENCH=128 run-cpu-benchmarks: build-benchmarks generate-cpu-benchmarks diff --git a/compilers/concrete-compiler/compiler/tests/end_to_end_fixture/end_to_end_round_gen.py b/compilers/concrete-compiler/compiler/tests/end_to_end_fixture/end_to_end_round_gen.py index 0fa07c3ed..1be6e79b9 100644 --- a/compilers/concrete-compiler/compiler/tests/end_to_end_fixture/end_to_end_round_gen.py +++ b/compilers/concrete-compiler/compiler/tests/end_to_end_fixture/end_to_end_round_gen.py @@ -117,13 +117,14 @@ def generate(args): print("# /!\ THIS FILE HAS BEEN GENERATED") np.random.seed(0) # unsigned_unsigned + shapes = ([shape] for shape in args.shapes) if args.shapes else (None, [3], [2, 3] , [1, 2, 3]) domain = [ (from_p, to_p, signed, with_tlu, with_shape) for from_p in args.acc_bitwidth for to_p in args.bitwidth for signed in (False, True) for with_tlu in (False, True) - for with_shape in (None, [3], [2, 3] , [1, 2, 3]) + for with_shape in shapes if to_p < from_p ] for (from_p, to_p, signed, with_tlu, with_shape) in domain: @@ -155,6 +156,13 @@ if __name__ == "__main__": type=int, default=[8, 13, 16], ) + CLI.add_argument( + "--shapes", + help="Specify the shapes to test", + nargs='*', + type=int, + default=[], + ) CLI.add_argument( "--minimal", help="Specify whether to generate minimal tests only",