chore(pr): address some comments

This commit is contained in:
Thomas Montaigu
2026-01-08 15:50:00 +01:00
parent 40e96d4c84
commit 6e7ff77932
5 changed files with 148 additions and 203 deletions

View File

@@ -23,6 +23,7 @@ on:
# Allows you to run this workflow manually from the Actions tab as an alternative.
workflow_dispatch:
pull_request:
types: [ labeled ]
permissions:
contents: read
@@ -32,6 +33,7 @@ permissions:
jobs:
should-run:
name: aws_tfhe_param_prod_tests/should-run
if: (github.event_name == 'pull_request' && contains(github.event.label.name, 'approved')) || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
pull-requests: read # Needed to check for file change
@@ -39,27 +41,15 @@ jobs:
csprng_test: ${{ env.IS_PULL_REQUEST == 'false' || steps.changed-files.outputs.csprng_any_changed }}
zk_pok_test: ${{ env.IS_PULL_REQUEST == 'false' || steps.changed-files.outputs.zk_pok_any_changed }}
versionable_test: ${{ env.IS_PULL_REQUEST == 'false' || steps.changed-files.outputs.versionable_any_changed }}
core_crypto_test: ${{ env.IS_PULL_REQUEST == 'false' ||
steps.changed-files.outputs.core_crypto_any_changed ||
steps.changed-files.outputs.dependencies_any_changed }}
boolean_test: ${{ env.IS_PULL_REQUEST == 'false' ||
steps.changed-files.outputs.boolean_any_changed ||
steps.changed-files.outputs.dependencies_any_changed }}
shortint_test: ${{ env.IS_PULL_REQUEST == 'false' ||
steps.changed-files.outputs.shortint_any_changed ||
steps.changed-files.outputs.dependencies_any_changed }}
integer_test: ${{ env.IS_PULL_REQUEST == 'false' ||
steps.changed-files.outputs.integer_any_changed ||
steps.changed-files.outputs.dependencies_any_changed }}
wasm_test: ${{ env.IS_PULL_REQUEST == 'false' ||
steps.changed-files.outputs.wasm_any_changed ||
steps.changed-files.outputs.dependencies_any_changed }}
high_level_api_test: ${{ env.IS_PULL_REQUEST == 'false' ||
steps.changed-files.outputs.high_level_api_any_changed ||
steps.changed-files.outputs.dependencies_any_changed }}
user_docs_test: ${{ env.IS_PULL_REQUEST == 'false' ||
steps.changed-files.outputs.user_docs_any_changed ||
steps.changed-files.outputs.dependencies_any_changed }}
any_file_changed: ${{ env.IS_PULL_REQUEST == 'false' || steps.aggregated-changes.outputs.any_changed }}
steps:
- name: Checkout tfhe-rs
@@ -81,18 +71,9 @@ jobs:
- tfhe-zk-pok/**
- utils/tfhe-versionable/**
- utils/tfhe-versionable-derive/**
csprng:
- tfhe-csprng/**
zk_pok:
- tfhe-zk-pok/**
versionable:
- utils/tfhe-versionable/**
- utils/tfhe-versionable-derive/**
core_crypto:
- tfhe/src/core_crypto/**
boolean:
- tfhe/src/core_crypto/**
- tfhe/src/boolean/**
shortint:
- tfhe/src/core_crypto/**
- tfhe/src/shortint/**
@@ -100,23 +81,12 @@ jobs:
- tfhe/src/core_crypto/**
- tfhe/src/shortint/**
- tfhe/src/integer/**
wasm:
- tfhe/src/**
- tfhe/js_on_wasm_tests/**
- tfhe/web_wasm_parallel_tests/**
- '!tfhe/src/c_api/**'
- '!tfhe/src/boolean/**'
high_level_api:
- tfhe/src/**
- '!tfhe/src/c_api/**'
- '!tfhe/src/boolean/**'
- '!tfhe/src/c_api/**'
- '!tfhe/src/js_on_wasm_api/**'
user_docs:
- tfhe/src/**
- '!tfhe/src/c_api/**'
- 'tfhe/docs/**/**.md'
- README.md
- name: Aggregate file changes
id: aggregated-changes
@@ -163,7 +133,7 @@ jobs:
echo "runner_group=${EXTERNAL_CONTRIBUTION_RUNNER}" >> "$GITHUB_OUTPUT"
param-prod-tests:
name: Fast CPU tests
name: aws_tfhe_param_prod_tests/param-prod-tests
needs: [ should-run, setup-instance ]
concurrency:
group: ${{ github.workflow_ref }}
@@ -181,43 +151,6 @@ jobs:
with:
toolchain: stable
- name: Run user docs tests
if: needs.should-run.outputs.user_docs_test == 'true'
run: |
make test_user_doc
- name: Get Node version
run: |
echo "NODE_VERSION=$(make node_version)" >> "${GITHUB_ENV}"
- name: Node cache restoration
id: node-cache
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 #v4.3.0
with:
path: |
~/.nvm
~/.npm
key: node-${{ env.NODE_VERSION }}
- name: Install Node
if: steps.node-cache.outputs.cache-hit != 'true'
run: |
make install_node
- name: Node cache save
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 #v4.3.0
if: steps.node-cache.outputs.cache-hit != 'true'
with:
path: |
~/.nvm
~/.npm
key: node-${{ env.NODE_VERSION }}
- name: Run js on wasm API tests
if: needs.should-run.outputs.wasm_test == 'true'
run: |
make test_nodejs_wasm_api_ci
- name: Gen Keys if required
if: needs.should-run.outputs.shortint_test == 'true' ||
needs.should-run.outputs.integer_test == 'true'
@@ -227,7 +160,7 @@ jobs:
- name: Run shortint tests
if: needs.should-run.outputs.shortint_test == 'true'
run: |
BIG_TESTS_INSTANCE=TRUE FAST_TESTS=FALSE make test_shortint_ci
BIG_TESTS_INSTANCE=TRUE FAST_TESTS=FALSE make test_param_prod_shortint_ci
- name: Run integer tests
if: needs.should-run.outputs.integer_test == 'true'

View File

@@ -905,6 +905,14 @@ test_shortint_ci: install_cargo_nextest
./scripts/shortint-tests.sh \
--cargo-profile "$(CARGO_PROFILE)" --tfhe-package "tfhe"
.PHONY: test_param_prod_shortint_ci # Run the tests for shortint ci
test_param_prod_shortint_ci: install_cargo_nextest
BIG_TESTS_INSTANCE="$(BIG_TESTS_INSTANCE)" \
FAST_TESTS="$(FAST_TESTS)" \
./scripts/shortint-tests.sh \
--cargo-profile "$(CARGO_PROFILE)" --run-prod-only --tfhe-package "tfhe"
.PHONY: test_shortint_multi_bit_ci # Run the tests for shortint ci running only multibit tests
test_shortint_multi_bit_ci: install_cargo_nextest
BIG_TESTS_INSTANCE="$(BIG_TESTS_INSTANCE)" \

View File

@@ -3,23 +3,23 @@
set -e
function usage() {
echo "$0: integer test runner"
echo
echo "--help Print this message"
echo "--no-run Does not run the tests, but prints which tests would be ran (except doctests)"
echo "--rust-toolchain The toolchain to run the tests with default: stable"
echo "--multi-bit Run multi-bit tests only: default off"
echo "--unsigned-only Run only unsigned integer tests, by default both signed and unsigned tests are run"
echo "--signed-only Run only signed integer tests, by default both signed and unsigned tests are run"
echo "--run-prod-only Run only the tests using the prod parameters"
echo "--nightly-tests Run integer tests configured for nightly runs (3_3 params)"
echo "--fast-tests Run integer set but skip a subset of longer tests"
echo "--long-tests Run only long run integer tests"
echo "--cargo-profile The cargo profile used to build tests"
echo "--backend Backend to use with tfhe-rs"
echo "--avx512-support Set to ON to enable avx512"
echo "--tfhe-package The package spec like tfhe@0.4.2, default=tfhe"
echo
echo "$0: integer test runner"
echo
echo "--help Print this message"
echo "--no-run Does not run the tests, but prints which tests would be ran (except doctests)"
echo "--rust-toolchain The toolchain to run the tests with default: stable"
echo "--multi-bit Run multi-bit tests only: default off"
echo "--unsigned-only Run only unsigned integer tests, by default both signed and unsigned tests are run"
echo "--signed-only Run only signed integer tests, by default both signed and unsigned tests are run"
echo "--run-prod-only Run only the tests using the prod parameters"
echo "--nightly-tests Run integer tests configured for nightly runs (3_3 params)"
echo "--fast-tests Run integer set but skip a subset of longer tests"
echo "--long-tests Run only long run integer tests"
echo "--cargo-profile The cargo profile used to build tests"
echo "--backend Backend to use with tfhe-rs"
echo "--avx512-support Set to ON to enable avx512"
echo "--tfhe-package The package spec like tfhe@0.4.2, default=tfhe"
echo
}
RUST_TOOLCHAIN=""
@@ -38,94 +38,93 @@ tfhe_package="tfhe"
prod_param_argument=
no_run=false
while [ -n "$1" ]
do
case "$1" in
"--help" | "-h" )
usage
exit 0
;;
while [ -n "$1" ]; do
case "$1" in
"--help" | "-h")
usage
exit 0
;;
"--no-run" )
no_run=true
;;
"--no-run")
no_run=true
;;
"--run-prod-only" )
prod_param_argument="--run-prod-only"
;;
"--run-prod-only")
prod_param_argument="--run-prod-only"
;;
"--rust-toolchain" )
shift
RUST_TOOLCHAIN="$1"
;;
"--rust-toolchain")
shift
RUST_TOOLCHAIN="$1"
;;
"--multi-bit" )
multi_bit_argument=--multi-bit
;;
"--multi-bit")
multi_bit_argument=--multi-bit
;;
"--unsigned-only" )
sign_argument=--unsigned-only
;;
"--unsigned-only")
sign_argument=--unsigned-only
;;
"--signed-only" )
sign_argument=--signed-only
;;
"--signed-only")
sign_argument=--signed-only
;;
"--cargo-profile" )
shift
cargo_profile="$1"
;;
"--cargo-profile")
shift
cargo_profile="$1"
;;
"--backend" )
shift
backend="$1"
;;
"--avx512-support" )
shift
if [[ "$1" == "ON" ]]; then
avx512_feature=avx512
fi
;;
"--backend")
shift
backend="$1"
;;
"--avx512-support")
shift
if [[ "$1" == "ON" ]]; then
avx512_feature=avx512
fi
;;
"--tfhe-package" )
shift
tfhe_package="$1"
;;
"--tfhe-package")
shift
tfhe_package="$1"
;;
*)
echo "Unknown param : $1"
exit 1
;;
esac
shift
*)
echo "Unknown param : $1"
exit 1
;;
esac
shift
done
if [[ "${RUST_TOOLCHAIN::1}" != "+" ]]; then
RUST_TOOLCHAIN=${RUST_TOOLCHAIN:+"+${RUST_TOOLCHAIN}"}
RUST_TOOLCHAIN=${RUST_TOOLCHAIN:+"+${RUST_TOOLCHAIN}"}
fi
if [[ "${FAST_TESTS}" == TRUE ]]; then
fast_tests_argument=--fast-tests
fast_tests_argument=--fast-tests
fi
if [[ "${LONG_TESTS}" == TRUE ]]; then
long_tests_argument=--long-tests
long_tests_argument=--long-tests
fi
if [[ "${NIGHTLY_TESTS}" == TRUE ]]; then
nightly_tests_argument=--nightly-tests
nightly_tests_argument=--nightly-tests
fi
if [[ "${NO_BIG_PARAMS}" == TRUE ]]; then
no_big_params_argument=--no-big-params
no_big_params_argument=--no-big-params
fi
if [[ "${NO_BIG_PARAMS_GPU}" == TRUE ]]; then
no_big_params_argument_gpu=--no-big-params-gpu
no_big_params_argument_gpu=--no-big-params-gpu
fi
if [[ "${backend}" == "gpu" ]]; then
gpu_feature="gpu"
gpu_feature="gpu"
fi
CURR_DIR="$(dirname "$0")"
@@ -134,85 +133,80 @@ CURR_DIR="$(dirname "$0")"
num_cpu_threads="$("${CURR_DIR}"/cpu_count.sh)"
if uname -a | grep "arm64"; then
if [[ $(uname) == "Darwin" ]]; then
# Keys are 4.7 gigs at max, CI M1 macs only has 8 gigs of RAM
small_instance_n_threads=1
fi
if [[ $(uname) == "Darwin" ]]; then
# Keys are 4.7 gigs at max, CI M1 macs only has 8 gigs of RAM
small_instance_n_threads=1
fi
else
# Keys are 4.7 gigs at max, test machine has 32 gigs of RAM
small_instance_n_threads=6
# Keys are 4.7 gigs at max, test machine has 32 gigs of RAM
small_instance_n_threads=6
fi
if [[ "${BIG_TESTS_INSTANCE}" == TRUE ]]; then
test_threads="$((num_cpu_threads * 1 / 4))"
doctest_threads="${num_cpu_threads}"
test_threads="$((num_cpu_threads * 1 / 4))"
doctest_threads="${num_cpu_threads}"
else
test_threads="${small_instance_n_threads}"
doctest_threads="${num_cpu_threads}"
test_threads="${small_instance_n_threads}"
doctest_threads="${num_cpu_threads}"
fi
# Override test-threads number to avoid Out-of-memory issues on GPU instances
if [[ "${backend}" == "gpu" ]]; then
if [[ "${BIG_TESTS_INSTANCE}" == TRUE ]]; then
test_threads=8
doctest_threads=8
else
test_threads=4
doctest_threads=4
fi
if [[ "${BIG_TESTS_INSTANCE}" == TRUE ]]; then
test_threads=8
doctest_threads=8
else
test_threads=4
doctest_threads=4
fi
fi
filter_expression=$(/usr/bin/python3 scripts/test_filtering.py --layer integer --backend "${backend}" ${fast_tests_argument:+$fast_tests_argument} ${long_tests_argument:+$long_tests_argument} ${nightly_tests_argument:+$nightly_tests_argument} ${no_big_params_argument_gpu:+$no_big_params_argument_gpu} ${multi_bit_argument:+$multi_bit_argument} ${sign_argument:+$sign_argument} ${no_big_params_argument:+$no_big_params_argument} ${prod_param_argument:+$prod_param_argument})
if [[ "${FAST_TESTS}" == "TRUE" ]]; then
echo "Running 'fast' test set"
echo "Running 'fast' test set"
elif [[ "${LONG_TESTS}" == "FALSE" ]]; then
echo "Running 'slow' test set"
echo "Running 'slow' test set"
fi
if [[ "${LONG_TESTS}" == "TRUE" ]]; then
echo "Running 'long run' test set"
echo "Running 'long run' test set"
fi
if [[ "${NIGHTLY_TESTS}" == "TRUE" ]]; then
echo "Running 'nightly' test set"
echo "Running 'nightly' test set"
fi
echo "${filter_expression}"
if $no_run then; then
# This is very close to the run command, but the `--profile ci`
# is not 'supported'
cargo ${RUST_TOOLCHAIN:+"$RUST_TOOLCHAIN"} nextest list \
--tests \
--cargo-profile "${cargo_profile}" \
--package "${tfhe_package}" \
--no-default-features \
--features=integer,internal-keycache,zk-pok,experimental,"${avx512_feature}","${gpu_feature}" \
-E "$filter_expression"
if $no_run; then
nextest_command="list"
nextest_extra_flags=""
else
cargo ${RUST_TOOLCHAIN:+"$RUST_TOOLCHAIN"} nextest run \
--tests \
--cargo-profile "${cargo_profile}" \
--package "${tfhe_package}" \
--profile ci \
--no-default-features \
--features=integer,internal-keycache,zk-pok,experimental,"${avx512_feature}","${gpu_feature}" \
--test-threads "${test_threads}" \
-E "$filter_expression"
# Unfortunately, we cannot skip running doctest with `--no-run`
if [[ -z ${multi_bit_argument} && -z ${long_tests_argument} ]]; then
cargo ${RUST_TOOLCHAIN:+"$RUST_TOOLCHAIN"} test \
--profile "${cargo_profile}" \
--package "${tfhe_package}" \
--no-default-features \
--features=integer,internal-keycache,experimental,"${avx512_feature}","${gpu_feature}" \
--doc \
-- --test-threads="${doctest_threads}" integer::"${gpu_feature}"
fi
nextest_command="run"
nextest_extra_flags="--profile ci --test-threads ${test_threads}"
fi
cargo ${RUST_TOOLCHAIN:+"$RUST_TOOLCHAIN"} nextest ${nextest_command} \
--tests \
--cargo-profile "${cargo_profile}" \
--package "${tfhe_package}" \
--no-default-features \
--features=integer,internal-keycache,zk-pok,experimental,"${avx512_feature}","${gpu_feature}" \
${nexttest_extra_flags} \
-E "$filter_expression"
if ! $no_run; then
# Unfortunately, we cannot skip running doctest with `--no-run`
if [[ -z ${multi_bit_argument} && -z ${long_tests_argument} ]]; then
cargo ${RUST_TOOLCHAIN:+"$RUST_TOOLCHAIN"} test \
--profile "${cargo_profile}" \
--package "${tfhe_package}" \
--no-default-features \
--features=integer,internal-keycache,experimental,"${avx512_feature}","${gpu_feature}" \
--doc \
-- --test-threads="${doctest_threads}" integer::"${gpu_feature}"
fi
fi
echo "Test ran in $SECONDS seconds"

View File

@@ -8,6 +8,7 @@ function usage() {
echo "--help Print this message"
echo "--rust-toolchain The toolchain to run the tests with default: stable"
echo "--multi-bit Run multi-bit tests only: default off"
echo "--run-prod-only Run only the tests using the prod parameters"
echo "--cargo-profile The cargo profile used to build tests"
echo "--tfhe-package The package spec like tfhe@0.4.2, default=tfhe"
echo
@@ -19,6 +20,7 @@ multi_bit_argument=
fast_tests_argument=
cargo_profile="release"
tfhe_package="tfhe"
prod_param_argument=
while [ -n "$1" ]
do
@@ -38,6 +40,9 @@ do
multi_bit_argument=--multi-bit
;;
"--run-prod-only")
prod_param_argument="--run-prod-only"
;;
"--cargo-profile" )
shift
cargo_profile="$1"
@@ -85,7 +90,7 @@ else
fi
if [[ "${BIG_TESTS_INSTANCE}" != TRUE ]]; then
filter_expression_small_params=$(/usr/bin/python3 scripts/test_filtering.py --layer shortint ${fast_tests_argument} ${multi_bit_argument})
filter_expression_small_params=$(/usr/bin/python3 scripts/test_filtering.py --layer shortint ${fast_tests_argument} ${multi_bit_argument} ${prod_param_argument})
# Run tests only no examples or benches with small params and more threads
cargo ${RUST_TOOLCHAIN:+"$RUST_TOOLCHAIN"} nextest run \
@@ -125,7 +130,7 @@ and not test(~smart_add_and_mul)"""
fi
fi
else
filter_expression=$(/usr/bin/python3 scripts/test_filtering.py --layer shortint --big-instance ${fast_tests_argument} ${multi_bit_argument})
filter_expression=$(/usr/bin/python3 scripts/test_filtering.py --layer shortint --big-instance ${fast_tests_argument} ${multi_bit_argument} ${prod_param_argument})
# Run tests only no examples or benches with small params and more threads
cargo ${RUST_TOOLCHAIN:+"$RUST_TOOLCHAIN"} nextest run \

View File

@@ -129,9 +129,12 @@ def filter_integer_tests(input_args):
multi_bit_filter = "_gpu_multi_bit"
if input_args.run_prod_only:
filter_expression = [f"test(/^integer::{backend_filter}.*_param_prod/)"]
filter_expression = [f"test(/^integer::{backend_filter}.*_param_prod.*/)"]
else:
filter_expression = [f"test(/^integer::{backend_filter}.*/)"]
filter_expression = [
f"test(/^integer::{backend_filter}.*/)",
"not test(/.*_param_prod.*/)",
]
if input_args.multi_bit:
filter_expression.append("test(~_multi_bit)")
@@ -174,9 +177,6 @@ def filter_integer_tests(input_args):
for pattern in excluded_tests:
filter_expression.append(f"not test({pattern})")
if not input_args.run_prod_only:
filter_expression.append("not test(/.*_param_prod_.*/)")
else:
if input_args.backend == "gpu":
filter_expression = [
@@ -226,6 +226,11 @@ def shortint_normal_filter(input_args):
filter_expression.append("test(/^shortint::.*meta_param_cpu_2_2_ks32_pbs/)")
filter_expression.append("test(/^shortint::.*_ci_run_filter/)")
if input_args.run_prod_only:
filter_expression.append("test(/^shortint::.*_param_prod.*")
else:
filter_expression.append("not test(shortint::.*_param_prod.*/)")
return filter_expression