chore(ci): add parameters filtering for data extractor

When doing regression generation, one can provide a global parameters set name pattern to filter head branch benchmark results.
This fixes the issue encountered when there are more than one parameters' set used to benchmark an operation, for example, in core_crypto or shortint tfhe-rs layer.
This commit is contained in:
David Testé
2025-10-28 11:32:02 +01:00
committed by David Testé
parent 398c441c95
commit 2542ef38e6
2 changed files with 23 additions and 2 deletions

View File

@@ -15,7 +15,10 @@ except ModuleNotFoundError:
def generate_json_regression_file(
conn: connector.PostgreConnector, ops_filter: dict, user_config: config.UserConfig
conn: connector.PostgreConnector,
ops_filter: dict,
user_config: config.UserConfig,
params_filter: str = None,
):
"""
Generate a JSON regression file based on benchmark data from specified branches
@@ -33,6 +36,8 @@ def generate_json_regression_file(
:param user_config: A configuration object that contains branch information,
backend settings, and output preferences for regression.
:type user_config: UserConfig
:param params_filter: Optional parameter filter to be applied to the benchmark results
:type params_filter: str, optional
:raises NoDataFound: If benchmark data is not found for the HEAD or BASE branch
during processing.
@@ -59,6 +64,14 @@ def generate_json_regression_file(
print(error_msg.format("HEAD", user_config.head_branch, layer, ops))
raise
if params_filter and layer != Layer.HLApi:
head_branch_data = dict(
filter(
lambda item: params_filter in item[0].params,
head_branch_data.items(),
)
)
try:
base_branch_data = conn.fetch_benchmark_data(
user_config,
@@ -180,4 +193,9 @@ def perform_regression_json_generation(
)
sys.exit(5)
generate_json_regression_file(conn, operations_filter, user_config)
generate_json_regression_file(
conn,
operations_filter,
user_config,
profile_definition.get("parameters_filter", None),
)

View File

@@ -25,6 +25,8 @@
# Possible values for target_name are listed in tfhe-benchmark/Cargo.toml file under `[[bench]]` section in the
# `name` field.
#
# > parameters_filter: a parameters' set name pattern to filter against when performing data extraction
#
# > env.<variable_name>: environment variable that will be used to alter benchmark execution enviroment
# Possible values for variable_name are (case-insensitive):
# * FAST_BENCH
@@ -85,6 +87,7 @@ target.hlapi-erc20 = ["transfer::whitepaper", "transfer::no_cmux"]
target.shortint = ["bitand"]
target.core_crypto-ks = ["keyswitch"]
target.core_crypto-pbs = [ "pbs_mem_optimized"]
parameters_filter = "PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128"
slab.backend = "aws"
slab.profile = "bench"
env.fast_bench = "TRUE"