Compare commits
1 Commits
dt/ci/make
...
ts/bench/m
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47e75759c9 |
@@ -4,6 +4,9 @@ ignore = [
|
||||
"RUSTSEC-2024-0436",
|
||||
# Ignoring unmaintained 'bincode' crate. Getting rid of it would be too complex on the short term.
|
||||
"RUSTSEC-2025-0141",
|
||||
# Ignoring unsoundness in 'rand' with custom logger. Rand update is currently blocked by
|
||||
# arkworks and we do not use custom loggers.
|
||||
"RUSTSEC-2026-0097",
|
||||
]
|
||||
|
||||
[output]
|
||||
|
||||
@@ -79,11 +79,19 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Post/refresh backward-compat report
|
||||
- name: Find existing comment
|
||||
if: steps.report.outputs.has_report == 'true'
|
||||
uses: marocchino/sticky-pull-request-comment@0ea0beb66eb9baf113663a64ec522f60e49231c0
|
||||
id: find-comment
|
||||
uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad # v4.0.0
|
||||
with:
|
||||
header: backward-compat-snapshot
|
||||
hide_and_recreate: true
|
||||
hide_classify: OUTDATED
|
||||
path: report.md
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
body-includes: '**Backward-compat snapshot:'
|
||||
|
||||
- name: Comment on PR
|
||||
if: steps.report.outputs.has_report == 'true'
|
||||
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
|
||||
with:
|
||||
comment-id: ${{ steps.find-comment.outputs.comment-id }}
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
body-path: report.md
|
||||
edit-mode: replace
|
||||
|
||||
2
.github/workflows/benchmark_cpu_common.yml
vendored
@@ -223,7 +223,7 @@ jobs:
|
||||
results_type: ${{ inputs.additional_results_type }}
|
||||
|
||||
- name: Upload parsed results artifact
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
|
||||
with:
|
||||
name: ${{ github.sha }}_${{ matrix.command }}_${{ matrix.op_flavor }}_${{ matrix.bench_type }}_${{ matrix.params_type }}
|
||||
path: ${{ env.RESULTS_FILENAME }}
|
||||
|
||||
2
.github/workflows/benchmark_ct_key_sizes.yml
vendored
@@ -99,7 +99,7 @@ jobs:
|
||||
--append-results
|
||||
|
||||
- name: Upload parsed results artifact
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
|
||||
with:
|
||||
name: ${{ github.sha }}_ct_key_sizes
|
||||
path: ${{ env.RESULTS_FILENAME }}
|
||||
|
||||
57
.github/workflows/benchmark_gpu.yml
vendored
@@ -6,13 +6,6 @@ run-name: ${{ inputs.command }}::${{ inputs.bench_type}} (${{ inputs.profile }},
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
backend:
|
||||
description: "Backends to use"
|
||||
default: hyperstack
|
||||
type: choice
|
||||
options:
|
||||
- hyperstack
|
||||
- scaleway (terraform)
|
||||
profile:
|
||||
description: "Instance type"
|
||||
required: true
|
||||
@@ -93,42 +86,27 @@ jobs:
|
||||
name: benchmark_gpu/parse-inputs
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
backend: ${{ steps.parse_profile_and_hardware_name.outputs.backend }}
|
||||
profile: ${{ steps.parse_profile_and_hardware_name.outputs.profile }}
|
||||
hardware_name: ${{ steps.parse_profile_and_hardware_name.outputs.hardware }}
|
||||
profile: ${{ steps.parse_profile.outputs.profile }}
|
||||
hardware_name: ${{ steps.parse_hardware_name.outputs.name }}
|
||||
additional_file_to_parse: ${{ steps.set_file_to_parse.outputs.additional_file_to_parse }}
|
||||
env:
|
||||
INPUTS_PROFILE: ${{ inputs.profile }}
|
||||
steps:
|
||||
- name: Parse profile and hardware name
|
||||
id: parse_profile_and_hardware_name
|
||||
shell: python
|
||||
env:
|
||||
INPUTS_BACKEND: ${{ inputs.backend }}
|
||||
INPUTS_PROFILE: ${{ inputs.profile }}
|
||||
- name: Parse profile
|
||||
id: parse_profile
|
||||
run: |
|
||||
import os
|
||||
# Use Sed to extract a value from a string, this cannot be done with the ${variable//search/replace} pattern.
|
||||
# shellcheck disable=SC2001
|
||||
PROFILE=$(echo "${INPUTS_PROFILE}" | sed 's|\(.*\)[[:space:]](.*)|\1|')
|
||||
echo "profile=${PROFILE}" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
inputs_backend = os.environ["INPUTS_BACKEND"]
|
||||
inputs_profile = os.environ["INPUTS_PROFILE"]
|
||||
output_file = os.environ["GITHUB_OUTPUT"]
|
||||
|
||||
split_profile = inputs_profile.split()
|
||||
parsed_profile = split_profile[0]
|
||||
parsed_hardware = split_profile[1].strip("(").strip(")")
|
||||
|
||||
backend_name = inputs_backend
|
||||
|
||||
if "terraform" in inputs_backend:
|
||||
backend_name = "terraform"
|
||||
provider_name = inputs_backend.split()[0]
|
||||
parsed_profile = provider_name + "-" + parsed_profile
|
||||
|
||||
with open(output_file, "a") as f:
|
||||
for var_name, value in [
|
||||
("backend", backend_name),
|
||||
("profile", parsed_profile),
|
||||
("hardware", parsed_hardware),
|
||||
]:
|
||||
f.write(f"""{var_name}={value}\n""")
|
||||
- name: Parse hardware name
|
||||
id: parse_hardware_name
|
||||
run: |
|
||||
# Use Sed to extract a value from a string, this cannot be done with the ${variable//search/replace} pattern.
|
||||
# shellcheck disable=SC2001
|
||||
NAME=$(echo "${INPUTS_PROFILE}" | sed 's|.*[[:space:]](\(.*\))|\1|')
|
||||
echo "name=${NAME}" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
- name: Get additional file to parse
|
||||
id: set_file_to_parse
|
||||
@@ -165,7 +143,6 @@ jobs:
|
||||
needs: parse-inputs
|
||||
uses: ./.github/workflows/benchmark_gpu_common.yml
|
||||
with:
|
||||
backend: ${{ needs.parse-inputs.outputs.backend }}
|
||||
profile: ${{ needs.parse-inputs.outputs.profile }}
|
||||
hardware_name: ${{ needs.parse-inputs.outputs.hardware_name }}
|
||||
command: ${{ inputs.command }}
|
||||
|
||||
4
.github/workflows/benchmark_gpu_4090.yml
vendored
@@ -89,7 +89,7 @@ jobs:
|
||||
REF_NAME: ${{ github.ref_name }}
|
||||
|
||||
- name: Upload parsed results artifact
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
|
||||
with:
|
||||
name: ${{ github.sha }}_integer_multi_bit_gpu_default
|
||||
path: ${{ env.RESULTS_FILENAME }}
|
||||
@@ -173,7 +173,7 @@ jobs:
|
||||
REF_NAME: ${{ github.ref_name }}
|
||||
|
||||
- name: Upload parsed results artifact
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
|
||||
with:
|
||||
name: ${{ github.sha }}_core_crypto
|
||||
path: ${{ env.RESULTS_FILENAME }}
|
||||
|
||||
3
.github/workflows/benchmark_gpu_common.yml
vendored
@@ -143,7 +143,6 @@ jobs:
|
||||
install-dependencies:
|
||||
name: benchmark_gpu_common/install-dependencies
|
||||
needs: [ setup-instance ]
|
||||
if: inputs.backend != 'terraform'
|
||||
runs-on: ${{ needs.setup-instance.outputs.runner-name }}
|
||||
strategy:
|
||||
matrix:
|
||||
@@ -271,7 +270,7 @@ jobs:
|
||||
filenames: ${{ inputs.additional_file_to_parse }}
|
||||
|
||||
- name: Upload parsed results artifact
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
|
||||
with:
|
||||
name: ${{ github.sha }}_${{ matrix.command }}_${{ matrix.op_flavor }}_${{ inputs.profile }}_${{ matrix.bench_type }}_${{ matrix.params_type }}
|
||||
path: ${{ env.RESULTS_FILENAME }}
|
||||
|
||||
@@ -271,7 +271,7 @@ jobs:
|
||||
- name: Upload profile artifact
|
||||
env:
|
||||
REPORT_NAME: ${{ steps.nsys_profile_name.outputs.profile }}
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
|
||||
with:
|
||||
name: ${{ env.REPORT_NAME }}
|
||||
path: fhevm/coprocessor/fhevm-engine/tfhe-worker/${{ env.REPORT_NAME }}
|
||||
@@ -302,7 +302,7 @@ jobs:
|
||||
working-directory: fhevm/
|
||||
|
||||
- name: Upload parsed results artifact
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
|
||||
with:
|
||||
name: ${COMMIT_SHA}_${BENCHMARKS}_${{ needs.parse-inputs.outputs.profile }}
|
||||
path: fhevm/$${{ env.RESULTS_FILENAME }}
|
||||
|
||||
2
.github/workflows/benchmark_hpu_common.yml
vendored
@@ -185,7 +185,7 @@ jobs:
|
||||
BENCH_TYPE: ${{ matrix.bench_type }}
|
||||
|
||||
- name: Upload parsed results artifact
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
|
||||
with:
|
||||
name: ${{ github.sha }}_${{ matrix.bench_type }}_${{ matrix.command }}_benchmarks
|
||||
path: ${{ env.RESULTS_FILENAME }}
|
||||
|
||||
@@ -280,7 +280,7 @@ jobs:
|
||||
BENCH_TYPE: ${{ env.__TFHE_RS_BENCH_TYPE }}
|
||||
|
||||
- name: Upload parsed results artifact
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
|
||||
with:
|
||||
name: ${{ github.sha }}_regression_${{ env.RESULTS_FILE_SHA }} # RESULT_FILE_SHA is needed to avoid collision between matrix.command runs
|
||||
path: ${{ env.RESULTS_FILENAME }}
|
||||
|
||||
2
.github/workflows/benchmark_tfhe_fft.yml
vendored
@@ -99,7 +99,7 @@ jobs:
|
||||
REF_NAME: ${{ github.ref_name }}
|
||||
|
||||
- name: Upload parsed results artifact
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
|
||||
with:
|
||||
name: ${{ github.sha }}_fft
|
||||
path: ${{ env.RESULTS_FILENAME }}
|
||||
|
||||
2
.github/workflows/benchmark_tfhe_ntt.yml
vendored
@@ -99,7 +99,7 @@ jobs:
|
||||
REF_NAME: ${{ github.ref_name }}
|
||||
|
||||
- name: Upload parsed results artifact
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
|
||||
with:
|
||||
name: ${{ github.sha }}_ntt
|
||||
path: ${{ env.RESULTS_FILENAME }}
|
||||
|
||||
@@ -180,7 +180,7 @@ jobs:
|
||||
REF_NAME: ${{ github.ref_name }}
|
||||
|
||||
- name: Upload parsed results artifact
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
|
||||
with:
|
||||
name: ${{ github.sha }}_wasm_${{ matrix.browser }}
|
||||
path: ${{ env.RESULTS_FILENAME }}
|
||||
|
||||
4
.github/workflows/generate_svg_common.yml
vendored
@@ -87,7 +87,7 @@ jobs:
|
||||
|
||||
- name: Upload tables
|
||||
if: inputs.backend_comparison == false
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
|
||||
with:
|
||||
name: ${{ github.sha }}_${{ inputs.backend }}_${{ inputs.layer }}_subset_${{inputs.bench_subset}}_${{ inputs.pbs_kind }}_${{ inputs.bench_type }}_tables
|
||||
# This will upload all the file generated
|
||||
@@ -111,7 +111,7 @@ jobs:
|
||||
|
||||
- name: Upload comparison tables
|
||||
if: inputs.backend_comparison == true
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
|
||||
with:
|
||||
name: ${{ github.sha }}_backends_comparison_tables
|
||||
# This will upload all the file generated
|
||||
|
||||
10
.github/workflows/gpu_core_h100_tests.yml
vendored
@@ -23,7 +23,7 @@ on:
|
||||
# Allows you to run this workflow manually from the Actions tab as an alternative.
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
types: [ labeled, opened, synchronize ]
|
||||
types: [ labeled ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -38,7 +38,6 @@ jobs:
|
||||
pull-requests: read # Needed to check for file change
|
||||
outputs:
|
||||
gpu_test: ${{ env.IS_PULL_REQUEST == 'false' || steps.changed-files.outputs.gpu_any_changed }}
|
||||
core_crypto_changed: ${{ steps.changed-files.outputs.core_crypto_any_changed }}
|
||||
steps:
|
||||
- name: Checkout tfhe-rs
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||
@@ -63,16 +62,15 @@ jobs:
|
||||
- tfhe/src/integer/server_key/radix_parallel/tests_cases_unsigned.rs
|
||||
- tfhe/src/shortint/parameters/**
|
||||
- tfhe/src/c_api/**
|
||||
- 'tfhe/docs/**/**.md'
|
||||
- '.github/workflows/gpu_core_h100_tests.yml'
|
||||
core_crypto:
|
||||
- tfhe/src/core_crypto/gpu/**
|
||||
|
||||
setup-instance:
|
||||
name: gpu_core_h100_tests/setup-instance
|
||||
needs: should-run
|
||||
if: github.event_name != 'pull_request' ||
|
||||
(github.event.action == 'labeled' && github.event.label.name == 'approved' && needs.should-run.outputs.gpu_test == 'true') ||
|
||||
(github.event.action != 'labeled' && needs.should-run.outputs.core_crypto_changed == 'true')
|
||||
(github.event.action != 'labeled' && needs.should-run.outputs.gpu_test == 'true') ||
|
||||
(github.event.action == 'labeled' && github.event.label.name == 'approved' && needs.should-run.outputs.gpu_test == 'true')
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
runner-name: ${{ steps.start-remote-instance.outputs.label || steps.start-github-instance.outputs.runner_group }}
|
||||
|
||||
9
.github/workflows/gpu_hlapi_h100_tests.yml
vendored
@@ -23,7 +23,7 @@ on:
|
||||
# Allows you to run this workflow manually from the Actions tab as an alternative.
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
types: [ labeled, opened, synchronize ]
|
||||
types: [ labeled ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -38,7 +38,6 @@ jobs:
|
||||
pull-requests: read # Needed to check for file change
|
||||
outputs:
|
||||
gpu_test: ${{ env.IS_PULL_REQUEST == 'false' || steps.changed-files.outputs.gpu_any_changed }}
|
||||
core_crypto_changed: ${{ steps.changed-files.outputs.core_crypto_any_changed }}
|
||||
steps:
|
||||
- name: Checkout tfhe-rs
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||
@@ -66,15 +65,13 @@ jobs:
|
||||
- tfhe/src/c_api/**
|
||||
- 'tfhe/docs/**/**.md'
|
||||
- '.github/workflows/gpu_hlapi_h100_tests.yml'
|
||||
core_crypto:
|
||||
- tfhe/src/core_crypto/gpu/**
|
||||
|
||||
setup-instance:
|
||||
name: gpu_hlapi_h100_tests/setup-instance
|
||||
needs: should-run
|
||||
if: github.event_name != 'pull_request' ||
|
||||
(github.event.action == 'labeled' && github.event.label.name == 'approved' && needs.should-run.outputs.gpu_test == 'true') ||
|
||||
(github.event.action != 'labeled' && needs.should-run.outputs.core_crypto_changed == 'true')
|
||||
(github.event.action != 'labeled' && needs.should-run.outputs.gpu_test == 'true') ||
|
||||
(github.event.action == 'labeled' && github.event.label.name == 'approved' && needs.should-run.outputs.gpu_test == 'true')
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
runner-name: ${{ steps.start-remote-instance.outputs.label || steps.start-github-instance.outputs.runner_group }}
|
||||
|
||||
39
.github/workflows/gpu_integer_long_run_tests.yml
vendored
@@ -17,8 +17,8 @@ on:
|
||||
# Allows you to run this workflow manually from the Actions tab as an alternative.
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
# Weekly tests will be triggered every Monday at 8p.m.
|
||||
- cron: "0 20 * * 1"
|
||||
# Nightly tests will be triggered each evening 8p.m.
|
||||
- cron: "0 20 * * *"
|
||||
pull_request:
|
||||
|
||||
|
||||
@@ -28,41 +28,10 @@ permissions:
|
||||
# zizmor: ignore[concurrency-limits] concurrency is managed after instance setup to ensure safe provisioning
|
||||
|
||||
jobs:
|
||||
should-run:
|
||||
name: gpu_integer_long_run_tests/should-run
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: read # Needed to check for file change
|
||||
outputs:
|
||||
is_needed_in_gpu_ci: ${{ env.IS_PR == 'false' || steps.changed-files.outputs.gpu_any_changed }}
|
||||
steps:
|
||||
- name: Checkout tfhe-rs
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: 'false'
|
||||
token: ${{ env.CHECKOUT_TOKEN }}
|
||||
|
||||
- name: Check for file changes
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323 # v47.0.5
|
||||
with:
|
||||
files_yaml: |
|
||||
gpu:
|
||||
- tfhe/Cargo.toml
|
||||
- tfhe/build.rs
|
||||
- backends/tfhe-cuda-backend/**
|
||||
- tfhe/src/core_crypto/gpu/**
|
||||
- tfhe/src/integer/gpu/**
|
||||
- tfhe/src/shortint/parameters/**
|
||||
- '.github/workflows/gpu_integer_long_run_tests.yml'
|
||||
|
||||
setup-instance:
|
||||
name: gpu_integer_long_run_tests/setup-instance
|
||||
needs: [should-run]
|
||||
if: github.event_name == 'workflow_dispatch' ||
|
||||
(github.event_name == 'schedule' && github.repository == 'zama-ai/tfhe-rs') ||
|
||||
needs.should-run.outputs.is_needed_in_gpu_ci == 'true'
|
||||
if: github.event_name != 'schedule' ||
|
||||
(github.event_name == 'schedule' && github.repository == 'zama-ai/tfhe-rs')
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
runner-name: ${{ steps.start-instance.outputs.label }}
|
||||
|
||||
8
.github/workflows/gpu_pcc.yml
vendored
@@ -131,10 +131,6 @@ jobs:
|
||||
env:
|
||||
GCC_VERSION: ${{ matrix.gcc }}
|
||||
|
||||
- name: Run semgrep and lint checks on CUDA code
|
||||
run: |
|
||||
make semgrep_and_lint_gpu_code
|
||||
|
||||
- name: Run fmt checks
|
||||
run: |
|
||||
make check_fmt_gpu
|
||||
@@ -143,6 +139,10 @@ jobs:
|
||||
run: |
|
||||
make pcc_gpu
|
||||
|
||||
- name: Run semgrep and lint checks on CUDA code
|
||||
run: |
|
||||
make semgrep_and_lint_gpu_code
|
||||
|
||||
- name: Run semver checks on tfhe-cuda-backend
|
||||
run: |
|
||||
make semver_check_cuda_backend
|
||||
|
||||
@@ -63,6 +63,7 @@ jobs:
|
||||
- tfhe/src/shortint/parameters/**
|
||||
- tfhe/src/high_level_api/**
|
||||
- tfhe/src/c_api/**
|
||||
- 'tfhe/docs/**/**.md'
|
||||
- '.github/workflows/gpu_signed_integer_classic_tests.yml'
|
||||
- scripts/integer-tests.sh
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ on:
|
||||
# Allows you to run this workflow manually from the Actions tab as an alternative.
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
types: [ labeled, opened, synchronize ]
|
||||
types: [ labeled ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -38,7 +38,6 @@ jobs:
|
||||
pull-requests: read # Needed to check for file change
|
||||
outputs:
|
||||
gpu_test: ${{ env.IS_PULL_REQUEST == 'false' || steps.changed-files.outputs.gpu_any_changed }}
|
||||
core_crypto_changed: ${{ steps.changed-files.outputs.core_crypto_any_changed }}
|
||||
steps:
|
||||
- name: Checkout tfhe-rs
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||
@@ -64,17 +63,16 @@ jobs:
|
||||
- tfhe/src/shortint/parameters/**
|
||||
- tfhe/src/high_level_api/**
|
||||
- tfhe/src/c_api/**
|
||||
- 'tfhe/docs/**/**.md'
|
||||
- '.github/workflows/gpu_signed_integer_h100_tests.yml'
|
||||
- scripts/integer-tests.sh
|
||||
core_crypto:
|
||||
- tfhe/src/core_crypto/gpu/**
|
||||
|
||||
setup-instance:
|
||||
name: gpu_signed_integer_h100_tests/setup-instance
|
||||
needs: should-run
|
||||
if: github.event_name != 'pull_request' ||
|
||||
(github.event.action == 'labeled' && github.event.label.name == 'approved' && needs.should-run.outputs.gpu_test == 'true') ||
|
||||
(github.event.action != 'labeled' && needs.should-run.outputs.core_crypto_changed == 'true')
|
||||
(github.event.action != 'labeled' && needs.should-run.outputs.gpu_test == 'true') ||
|
||||
(github.event.action == 'labeled' && github.event.label.name == 'approved' && needs.should-run.outputs.gpu_test == 'true')
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
runner-name: ${{ steps.start-remote-instance.outputs.label || steps.start-github-instance.outputs.runner_group }}
|
||||
|
||||
@@ -64,6 +64,7 @@ jobs:
|
||||
- tfhe/src/shortint/parameters/**
|
||||
- tfhe/src/high_level_api/**
|
||||
- tfhe/src/c_api/**
|
||||
- 'tfhe/docs/**/**.md'
|
||||
- '.github/workflows/gpu_signed_integer_tests.yml'
|
||||
- scripts/integer-tests.sh
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ jobs:
|
||||
- tfhe/src/shortint/parameters/**
|
||||
- tfhe/src/high_level_api/**
|
||||
- tfhe/src/c_api/**
|
||||
- 'tfhe/docs/**/**.md'
|
||||
- '.github/workflows/gpu_unsigned_integer_classic_tests.yml'
|
||||
- scripts/integer-tests.sh
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ on:
|
||||
# Allows you to run this workflow manually from the Actions tab as an alternative.
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
types: [ labeled, opened, synchronize ]
|
||||
types: [ labeled ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -38,7 +38,6 @@ jobs:
|
||||
pull-requests: read # Needed to check for file change
|
||||
outputs:
|
||||
gpu_test: ${{ env.IS_PULL_REQUEST == 'false' || steps.changed-files.outputs.gpu_any_changed }}
|
||||
core_crypto_changed: ${{ steps.changed-files.outputs.core_crypto_any_changed }}
|
||||
steps:
|
||||
- name: Checkout tfhe-rs
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||
@@ -64,17 +63,16 @@ jobs:
|
||||
- tfhe/src/shortint/parameters/**
|
||||
- tfhe/src/high_level_api/**
|
||||
- tfhe/src/c_api/**
|
||||
- 'tfhe/docs/**/**.md'
|
||||
- '.github/workflows/gpu_unsigned_integer_h100_tests.yml'
|
||||
- scripts/integer-tests.sh
|
||||
core_crypto:
|
||||
- tfhe/src/core_crypto/gpu/**
|
||||
|
||||
setup-instance:
|
||||
name: gpu_unsigned_integer_h100_tests/setup-instance
|
||||
needs: should-run
|
||||
if: github.event_name == 'workflow_dispatch' ||
|
||||
(github.event.action == 'labeled' && github.event.label.name == 'approved' && needs.should-run.outputs.gpu_test == 'true') ||
|
||||
(github.event.action != 'labeled' && needs.should-run.outputs.core_crypto_changed == 'true')
|
||||
(github.event.action != 'labeled' && needs.should-run.outputs.gpu_test == 'true') ||
|
||||
(github.event.action == 'labeled' && github.event.label.name == 'approved' && needs.should-run.outputs.gpu_test == 'true')
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
runner-name: ${{ steps.start-remote-instance.outputs.label || steps.start-github-instance.outputs.runner_group }}
|
||||
|
||||
@@ -64,6 +64,7 @@ jobs:
|
||||
- tfhe/src/shortint/parameters/**
|
||||
- tfhe/src/high_level_api/**
|
||||
- tfhe/src/c_api/**
|
||||
- 'tfhe/docs/**/**.md'
|
||||
- '.github/workflows/gpu_unsigned_integer_tests.yml'
|
||||
- scripts/integer-tests.sh
|
||||
|
||||
|
||||
3
.github/workflows/gpu_zk_tests.yml
vendored
@@ -55,9 +55,12 @@ jobs:
|
||||
- tfhe/build.rs
|
||||
- backends/tfhe-cuda-backend/**
|
||||
- backends/zk-cuda-backend/**
|
||||
- tfhe/src/core_crypto/gpu/**
|
||||
- tfhe/src/integer/gpu/**
|
||||
- tfhe/src/shortint/parameters/**
|
||||
- tfhe/src/zk/**
|
||||
- tfhe-zk-pok/**
|
||||
- 'tfhe/docs/**/**.md'
|
||||
- '.github/workflows/gpu_zk_tests.yml'
|
||||
- ci/slab.toml
|
||||
|
||||
|
||||
2
.github/workflows/make_release_common.yml
vendored
@@ -62,7 +62,7 @@ jobs:
|
||||
PACKAGE: ${{ inputs.package-name }}
|
||||
run: |
|
||||
cargo package -p "${PACKAGE}"
|
||||
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
||||
with:
|
||||
name: crate-${{ inputs.package-name }}
|
||||
path: target/package/*.crate
|
||||
|
||||
19
.github/workflows/make_release_common_cuda.yml
vendored
@@ -128,7 +128,7 @@ jobs:
|
||||
run: |
|
||||
cargo package -p "${PACKAGE}"
|
||||
|
||||
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
||||
with:
|
||||
name: crate-${{ inputs.package-name }}
|
||||
path: target/package/*.crate
|
||||
@@ -196,13 +196,6 @@ jobs:
|
||||
env:
|
||||
GCC_VERSION: ${{ matrix.gcc }}
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: "false"
|
||||
token: ${{ secrets.REPO_CHECKOUT_TOKEN }}
|
||||
|
||||
- name: Download artifact
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
@@ -217,12 +210,12 @@ jobs:
|
||||
env:
|
||||
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
|
||||
PACKAGE: ${{ inputs.package-name }}
|
||||
DRY_RUN: ${{ inputs.dry-run && '--dry-run' || '' }}
|
||||
DRY-RUN: ${{ inputs.dry-run && '--dry-run' || '' }}
|
||||
run: |
|
||||
# DRY_RUN expansion cannot be double quoted when variable contains empty string otherwise cargo publish
|
||||
# would fail. This is safe since DRY_RUN is handled in the env section above.
|
||||
# dry-run expansion cannot be double quoted when variable contains empty string otherwise cargo publish
|
||||
# would fail. This is safe since dry-run is handled in the env section above.
|
||||
# shellcheck disable=SC2086
|
||||
cargo publish -p "${PACKAGE}" ${DRY_RUN}
|
||||
cargo publish -p "${PACKAGE}" ${DRY-RUN}
|
||||
|
||||
- name: Generate hash
|
||||
id: published_hash
|
||||
@@ -262,7 +255,7 @@ jobs:
|
||||
|
||||
- name: Slack Notification
|
||||
if: ${{ failure() }}
|
||||
uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661 # v2.3.3
|
||||
uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661
|
||||
env:
|
||||
SLACK_COLOR: ${{ job.status }}
|
||||
SLACK_MESSAGE: "Instance teardown (${{ inputs.package-name }} release) finished with status: ${{ job.status }}. (${{ env.ACTION_RUN_URL }})"
|
||||
|
||||
16
Makefile
@@ -312,7 +312,7 @@ semgrep_and_lint_gpu_code: semgrep_lint_setup_venv
|
||||
find "$(TFHECUDA_SRC)" -name '*.h' -o -name '*.cuh' -o -name '*.cu' \
|
||||
| grep -v '/cmake-build-debug/' \
|
||||
| grep -v '/build/' \
|
||||
| xargs venv/bin/semgrep --error --config "$(TFHECUDA_SRC)/.semgrep/release-ordering.yaml" --scan-unknown-extensions
|
||||
| xargs venv/bin/semgrep --config "$(TFHECUDA_SRC)/.semgrep/release-ordering.yaml" --scan-unknown-extensions
|
||||
venv/bin/python3 "scripts/check_scratch_cleanup.py"
|
||||
|
||||
.PHONY: semver_check_cuda_backend # Run semver checks on tfhe-cuda-backend
|
||||
@@ -360,7 +360,7 @@ check_fmt_toml: install_taplo
|
||||
|
||||
.PHONY: check_typos # Check for typos in codebase
|
||||
check_typos: install_typos_checker
|
||||
@git ls-files ":!*.png" ":!*.cbor" ":!*.bcode" ":!*.ico" ":!*/twiddles.cu" ":!*.hpu" | typos --file-list - && echo "No typos found"
|
||||
@git ls-files ":!*.png" ":!*.cbor" ":!*.bcode" ":!*.ico" ":!*/twiddles.cu" | typos --file-list - && echo "No typos found"
|
||||
|
||||
.PHONY: clippy_gpu # Run clippy lints on tfhe with "gpu" enabled
|
||||
clippy_gpu: install_rs_check_toolchain
|
||||
@@ -587,17 +587,6 @@ clippy_backward_compat_data: install_rs_check_toolchain # the toolchain is selec
|
||||
echo "Cannot run clippy for backward compat crate on non x86 platform for now."; \
|
||||
fi
|
||||
|
||||
.PHONY: check_backward_compat_locks_did_not_change # Check backward compat Cargo.lock files are up to date
|
||||
check_backward_compat_locks_did_not_change: install_rs_check_toolchain
|
||||
@for crate in `ls -1 $(BACKWARD_COMPAT_DATA_DIR)/crates/ | grep generate_`; do \
|
||||
echo "checking Cargo.lock for $$crate"; \
|
||||
cargo "$(CARGO_RS_CHECK_TOOLCHAIN)" -Z unstable-options \
|
||||
-C $(BACKWARD_COMPAT_DATA_DIR)/crates/$$crate metadata --locked --format-version 1 > /dev/null || \
|
||||
( echo "Cargo.lock for $$crate is out of date. Update it with:" && \
|
||||
echo " cd $(BACKWARD_COMPAT_DATA_DIR)/crates/$$crate && cargo metadata --format-version 1 > /dev/null" && \
|
||||
echo "then commit the updated Cargo.lock." && exit 1 ); \
|
||||
done
|
||||
|
||||
.PHONY: clippy_test_vectors # Run clippy lints on the test vectors app
|
||||
clippy_test_vectors: install_rs_check_toolchain
|
||||
cd apps/test-vectors; RUSTFLAGS="$(RUSTFLAGS)" cargo "$(CARGO_RS_CHECK_TOOLCHAIN)" clippy --all-targets \
|
||||
@@ -2276,7 +2265,6 @@ pcc_batch_5:
|
||||
$(call run_recipe_with_details,clippy_tfhe_lints)
|
||||
$(call run_recipe_with_details,check_compile_tests)
|
||||
$(call run_recipe_with_details,clippy_backward_compat_data)
|
||||
$(call run_recipe_with_details,check_backward_compat_locks_did_not_change)
|
||||
|
||||
.PHONY: pcc_batch_6 # duration: 6'32''
|
||||
pcc_batch_6:
|
||||
|
||||
@@ -1,14 +1,5 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn get_linux_distribution_name() -> Option<String> {
|
||||
let content = std::fs::read_to_string("/etc/os-release").ok()?;
|
||||
for line in content.lines() {
|
||||
if let Some(value) = line.strip_prefix("NAME=") {
|
||||
return Some(value.trim_matches('"').to_string());
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
if let Ok(val) = std::env::var("DOCS_RS") {
|
||||
@@ -37,7 +28,9 @@ fn main() {
|
||||
println!("cargo::rerun-if-changed=src");
|
||||
|
||||
if std::env::consts::OS == "linux" {
|
||||
if get_linux_distribution_name().as_deref() != Some("Ubuntu") {
|
||||
let output = Command::new("./get_os_name.sh").output().unwrap();
|
||||
let distribution = String::from_utf8(output.stdout).unwrap();
|
||||
if distribution != "Ubuntu\n" {
|
||||
println!(
|
||||
"cargo:warning=This Linux distribution is not officially supported. \
|
||||
Only Ubuntu is supported by tfhe-cuda-backend at this time. Build may fail\n"
|
||||
|
||||
@@ -721,7 +721,7 @@ void cuda_integer_grouped_oprf_custom_range_64_async(
|
||||
uint32_t num_blocks_intermediate, const void *seeded_lwe_input,
|
||||
const uint64_t *decomposed_scalar, const uint64_t *has_at_least_one_set,
|
||||
uint32_t num_scalars, uint32_t shift, int8_t *mem, void *const *bsks,
|
||||
void *const *compute_bsks, void *const *ksks);
|
||||
void *const *ksks);
|
||||
|
||||
void cleanup_cuda_integer_grouped_oprf_custom_range_64(CudaStreamsFFI streams,
|
||||
int8_t **mem_ptr_void);
|
||||
|
||||
@@ -390,7 +390,7 @@ __host__ void vectorized_sbox_n_bytes(CudaStreams streams,
|
||||
XOR(&wires_a[6], &wires_a[15], &input_bits[7]);
|
||||
XOR(&wires_a[10], &wires_a[15], &wires_b[0]);
|
||||
XOR(&wires_a[11], &wires_a[20], &wires_a[9]);
|
||||
FLUSH(&wires_a[6], &wires_a[10], &wires_a[11]);
|
||||
FLUSH(&wires_a[6], &wires_a[10]);
|
||||
XOR(&wires_a[7], &input_bits[7], &wires_a[11]);
|
||||
FLUSH(&wires_a[7]);
|
||||
XOR(&wires_a[17], &wires_a[10], &wires_a[11]);
|
||||
@@ -426,7 +426,7 @@ __host__ void vectorized_sbox_n_bytes(CudaStreams streams,
|
||||
XOR(&wires_b[22], &wires_b[18], &wires_a[19]);
|
||||
XOR(&wires_b[23], &wires_b[19], &wires_a[21]);
|
||||
XOR(&wires_b[24], &wires_b[20], &wires_a[18]);
|
||||
FLUSH(&wires_b[21], &wires_b[22], &wires_b[23], &wires_b[24]);
|
||||
FLUSH(&wires_b[21], &wires_b[23], &wires_b[24]);
|
||||
XOR(&wires_b[25], &wires_b[21], &wires_b[22]);
|
||||
FLUSH(&wires_b[25]);
|
||||
|
||||
@@ -468,7 +468,7 @@ __host__ void vectorized_sbox_n_bytes(CudaStreams streams,
|
||||
|
||||
XOR(&wires_b[37], &wires_b[36], &wires_b[34]);
|
||||
XOR(&wires_b[38], &wires_b[27], &wires_b[36]);
|
||||
FLUSH(&wires_b[38], &wires_b[37]);
|
||||
FLUSH(&wires_b[38]);
|
||||
XOR(&wires_b[44], &wires_b[33], &wires_b[37]);
|
||||
|
||||
CudaRadixCiphertextFFI *and_outs_6[] = {&wires_b[39]};
|
||||
@@ -479,7 +479,7 @@ __host__ void vectorized_sbox_n_bytes(CudaStreams streams,
|
||||
XOR(&wires_b[40], &wires_b[25], &wires_b[39]);
|
||||
XOR(&wires_b[41], &wires_b[40], &wires_b[37]);
|
||||
XOR(&wires_b[43], &wires_b[29], &wires_b[40]);
|
||||
FLUSH(&wires_b[41], &wires_b[40], &wires_b[43], &wires_b[44]);
|
||||
FLUSH(&wires_b[41]);
|
||||
XOR(&wires_b[45], &wires_b[42], &wires_b[41]);
|
||||
FLUSH(&wires_b[45]);
|
||||
|
||||
@@ -514,7 +514,6 @@ __host__ void vectorized_sbox_n_bytes(CudaStreams streams,
|
||||
XOR(&wires_b[57], &wires_b[50], &wires_b[53]);
|
||||
XOR(&wires_b[58], &wires_c[4], &wires_b[46]);
|
||||
XOR(&wires_b[59], &wires_c[3], &wires_b[54]);
|
||||
FLUSH(&wires_b[57], &wires_b[58]);
|
||||
XOR(&wires_b[60], &wires_b[46], &wires_b[57]);
|
||||
XOR(&wires_b[61], &wires_c[14], &wires_b[57]);
|
||||
XOR(&wires_b[62], &wires_b[52], &wires_b[58]);
|
||||
@@ -590,7 +589,6 @@ __host__ void vectorized_sbox_n_bytes(CudaStreams streams,
|
||||
#undef FLUSH
|
||||
#undef AND
|
||||
#undef ADD_ONE_FLUSH
|
||||
#undef ADD_ONE
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -489,7 +489,7 @@ template <typename Torus>
|
||||
__host__ void host_modulus_switch_multi_bit(
|
||||
cudaStream_t stream, uint32_t gpu_index, Torus *array_out, Torus *array_in,
|
||||
int size, uint32_t log_modulus, uint32_t degree, uint32_t grouping_factor) {
|
||||
check_cuda_error(cudaSetDevice(gpu_index));
|
||||
cudaSetDevice(gpu_index);
|
||||
int multibit_size = size / grouping_factor;
|
||||
int num_threads = 0, num_blocks = 0;
|
||||
getNumBlocksAndThreads(multibit_size, 1024, num_blocks, num_threads);
|
||||
|
||||
@@ -72,13 +72,13 @@ void cuda_integer_grouped_oprf_custom_range_64_async(
|
||||
uint32_t num_blocks_intermediate, const void *seeded_lwe_input,
|
||||
const uint64_t *decomposed_scalar, const uint64_t *has_at_least_one_set,
|
||||
uint32_t num_scalars, uint32_t shift, int8_t *mem, void *const *bsks,
|
||||
void *const *compute_bsks, void *const *ksks) {
|
||||
void *const *ksks) {
|
||||
|
||||
host_integer_grouped_oprf_custom_range<uint64_t>(
|
||||
CudaStreams(streams), radix_lwe_out, num_blocks_intermediate,
|
||||
(const uint64_t *)seeded_lwe_input, decomposed_scalar,
|
||||
has_at_least_one_set, num_scalars, shift,
|
||||
(int_grouped_oprf_custom_range_memory<uint64_t> *)mem, bsks, compute_bsks,
|
||||
(int_grouped_oprf_custom_range_memory<uint64_t> *)mem, bsks,
|
||||
(uint64_t *const *)ksks);
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ void host_integer_grouped_oprf_custom_range(
|
||||
const Torus *decomposed_scalar, const Torus *has_at_least_one_set,
|
||||
uint32_t num_scalars, uint32_t shift,
|
||||
int_grouped_oprf_custom_range_memory<Torus> *mem_ptr, void *const *bsks,
|
||||
void *const *compute_bsks, Torus *const *ksks) {
|
||||
Torus *const *ksks) {
|
||||
|
||||
CudaRadixCiphertextFFI *computation_buffer = mem_ptr->tmp_oprf_output;
|
||||
set_zero_radix_ciphertext_slice_async<Torus>(
|
||||
@@ -127,12 +127,12 @@ void host_integer_grouped_oprf_custom_range(
|
||||
|
||||
host_integer_scalar_mul_radix<Torus>(
|
||||
streams, computation_buffer, decomposed_scalar, has_at_least_one_set,
|
||||
mem_ptr->scalar_mul_buffer, compute_bsks, ksks,
|
||||
mem_ptr->params.message_modulus, num_scalars);
|
||||
mem_ptr->scalar_mul_buffer, bsks, ksks, mem_ptr->params.message_modulus,
|
||||
num_scalars);
|
||||
|
||||
host_logical_scalar_shift_inplace<Torus>(
|
||||
streams, computation_buffer, shift, mem_ptr->logical_scalar_shift_buffer,
|
||||
compute_bsks, ksks, num_blocks_intermediate);
|
||||
host_logical_scalar_shift_inplace<Torus>(streams, computation_buffer, shift,
|
||||
mem_ptr->logical_scalar_shift_buffer,
|
||||
bsks, ksks, num_blocks_intermediate);
|
||||
|
||||
uint32_t num_blocks_output = radix_lwe_out->num_radix_blocks;
|
||||
uint32_t blocks_to_copy =
|
||||
|
||||
@@ -308,7 +308,6 @@ void cleanup_cuda_multi_bit_programmable_bootstrap_noise_tests_128(
|
||||
void *stream, uint32_t gpu_index, int8_t **pbs_buffer) {
|
||||
cleanup_cuda_multi_bit_programmable_bootstrap_128(stream, gpu_index,
|
||||
pbs_buffer);
|
||||
cuda_synchronize_stream(static_cast<cudaStream_t>(stream), gpu_index);
|
||||
}
|
||||
|
||||
// Noise tests variant of the 128-bit multi-bit PBS, restricted to
|
||||
|
||||
3
backends/tfhe-cuda-backend/get_os_name.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cat /etc/os-release | grep "\<NAME\>" | sed "s/NAME=\"//g" | sed "s/\"//g"
|
||||
@@ -1647,7 +1647,6 @@ unsafe extern "C" {
|
||||
shift: u32,
|
||||
mem: *mut i8,
|
||||
bsks: *const *mut ffi::c_void,
|
||||
compute_bsks: *const *mut ffi::c_void,
|
||||
ksks: *const *mut ffi::c_void,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tfhe-hpu-backend"
|
||||
version = "0.5.0"
|
||||
version = "0.4.0"
|
||||
edition = "2021"
|
||||
license = "BSD-3-Clause-Clear"
|
||||
description = "HPU implementation on FPGA of TFHE-rs primitives."
|
||||
@@ -36,7 +36,7 @@ thiserror = "1.0.61"
|
||||
bytemuck = { workspace = true }
|
||||
anyhow = "1.0.82"
|
||||
lazy_static = "1.4.0"
|
||||
rand = "0.10.1"
|
||||
rand = "0.8.5"
|
||||
regex = "1.10.4"
|
||||
bitflags = { version = "2.5.0", features = ["serde"] }
|
||||
itertools = "0.11.0"
|
||||
|
||||
@@ -24,7 +24,7 @@ use mem_alloc::{MemAlloc, MemChunk};
|
||||
|
||||
mod qdma;
|
||||
use qdma::QdmaDriver;
|
||||
use rand::RngExt;
|
||||
use rand::Rng;
|
||||
|
||||
const DMA_XFER_ALIGN: usize = 4096_usize;
|
||||
|
||||
@@ -148,8 +148,8 @@ impl HpuHw {
|
||||
tracing::debug!("Load stage1 through JTAG");
|
||||
let pdi_stg1_tmp = format!(
|
||||
"hpu_stg1_{}.pdi",
|
||||
rand::rng()
|
||||
.sample_iter(rand::distr::Alphanumeric)
|
||||
rand::thread_rng()
|
||||
.sample_iter(rand::distributions::Alphanumeric)
|
||||
.take(5)
|
||||
.map(char::from)
|
||||
.collect::<String>()
|
||||
|
||||
@@ -156,7 +156,7 @@ impl HpuVarWrapped {
|
||||
{
|
||||
let mut inner = var.inner.lock().unwrap();
|
||||
|
||||
for (slot, ct) in std::iter::zip(inner.bundle.iter_mut(), ct) {
|
||||
for (slot, ct) in std::iter::zip(inner.bundle.iter_mut(), ct.into_iter()) {
|
||||
#[cfg(feature = "io-dump")]
|
||||
let params = ct.params().clone();
|
||||
for (id, cut) in ct.into_container().iter().enumerate() {
|
||||
|
||||
@@ -1,14 +1,5 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn get_linux_distribution_name() -> Option<String> {
|
||||
let content = std::fs::read_to_string("/etc/os-release").ok()?;
|
||||
for line in content.lines() {
|
||||
if let Some(value) = line.strip_prefix("NAME=") {
|
||||
return Some(value.trim_matches('"').to_string());
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
// Handle docs.rs builds (no CUDA available)
|
||||
@@ -38,10 +29,16 @@ fn main() {
|
||||
println!("cargo:rustc-link-arg=-Wl,--allow-multiple-definition");
|
||||
println!("cargo:rustc-link-arg=-Wl,--no-as-needed");
|
||||
|
||||
// Check Linux distribution (reuse script from tfhe-cuda-backend)
|
||||
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR")
|
||||
.expect("CARGO_MANIFEST_DIR must be set by cargo during build");
|
||||
|
||||
if get_linux_distribution_name().as_deref() != Some("Ubuntu") {
|
||||
let script_path = PathBuf::from(&manifest_dir).join("../tfhe-cuda-backend/get_os_name.sh");
|
||||
let output = Command::new(&script_path)
|
||||
.output()
|
||||
.expect("Failed to run get_os_name.sh — is tfhe-cuda-backend present?");
|
||||
let distribution =
|
||||
String::from_utf8(output.stdout).expect("get_os_name.sh output must be valid UTF-8");
|
||||
if distribution != "Ubuntu\n" {
|
||||
println!(
|
||||
"cargo:warning=This Linux distribution is not officially supported. \
|
||||
Only Ubuntu is supported by zk-cuda-backend at this time. Build may fail\n"
|
||||
|
||||
@@ -71,6 +71,11 @@ set(CMAKE_CUDA_FLAGS_DEBUG "-g -O0 -G")
|
||||
# Additional CUDA flags (aligned with tfhe-cuda-backend)
|
||||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler -Wall -Xcompiler -Wextra --use_fast_math --expt-relaxed-constexpr")
|
||||
|
||||
# =============================================================================
|
||||
# Path to tfhe-cuda-backend for device utilities
|
||||
# =============================================================================
|
||||
set(TFHE_CUDA_BACKEND_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../tfhe-cuda-backend/cuda)
|
||||
|
||||
# Core source files (without device utilities) Device utilities come from tfhe-cuda-backend.
|
||||
set(FP_CORE_SOURCES src/primitives/fp.cu src/primitives/fp2.cu src/curve.cu src/msm/pippenger/msm_pippenger.cu
|
||||
src/msm/msm.cu)
|
||||
@@ -107,7 +112,7 @@ endif()
|
||||
target_link_libraries(zk_cuda_backend PUBLIC cudart)
|
||||
|
||||
# Include both local headers and tfhe-cuda-backend headers (for device.h)
|
||||
target_include_directories(zk_cuda_backend PUBLIC include ../src/include)
|
||||
target_include_directories(zk_cuda_backend PUBLIC include ../src/include ${TFHE_CUDA_BACKEND_DIR}/include)
|
||||
|
||||
# =============================================================================
|
||||
# Tests and Benchmarks (optional, controlled by ZK_CUDA_BACKEND_BUILD_TESTS/BENCHMARKS)
|
||||
@@ -130,3 +135,4 @@ message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
||||
message(STATUS "CUDA architectures: ${CMAKE_CUDA_ARCHITECTURES}")
|
||||
message(STATUS "C++ standard: ${CMAKE_CXX_STANDARD}")
|
||||
message(STATUS "CUDA standard: ${CMAKE_CUDA_STANDARD}")
|
||||
message(STATUS "tfhe-cuda-backend path: ${TFHE_CUDA_BACKEND_DIR}")
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
|
||||
#include "device.h"
|
||||
|
||||
// Variadic checked multiplication of size_t values.
|
||||
// Folds left-to-right using __builtin_mul_overflow, returning true on overflow.
|
||||
// On overflow the value written to *out is unspecified.
|
||||
template <typename... Args>
|
||||
inline bool checked_mul(size_t *out, size_t first, Args... rest) {
|
||||
size_t result = first;
|
||||
for (size_t value : {static_cast<size_t>(rest)...}) {
|
||||
if (__builtin_mul_overflow(result, value, &result))
|
||||
return true;
|
||||
}
|
||||
*out = result;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Variadic safe multiplication: computes the product and panics on overflow.
|
||||
template <typename... Args> inline size_t safe_mul(size_t first, Args... rest) {
|
||||
size_t result;
|
||||
bool overflow = checked_mul(&result, first, rest...);
|
||||
PANIC_IF_FALSE(!overflow, "multiplication overflow wraps size_t");
|
||||
return result;
|
||||
}
|
||||
|
||||
// Variadic safe multiplication with an appended sizeof(T) factor.
|
||||
// Computes (args... * sizeof(T)) with overflow checking.
|
||||
template <typename T, typename... Args>
|
||||
inline size_t safe_mul_sizeof(Args... args) {
|
||||
return safe_mul(args..., sizeof(T));
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
#ifndef DEVICE_H
|
||||
#define DEVICE_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cuda_runtime.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
#define check_cuda_error(ans) \
|
||||
{ cuda_error((ans), __FILE__, __LINE__); }
|
||||
inline void cuda_error(cudaError_t code, const char *file, int line) {
|
||||
if (code != cudaSuccess) {
|
||||
std::fprintf(stderr, "Cuda error: %s %s %d\n", cudaGetErrorString(code),
|
||||
file, line);
|
||||
std::abort();
|
||||
}
|
||||
}
|
||||
|
||||
// The PANIC macro should be used to validate user-inputs to GPU functions
|
||||
// it will execute in all targets, including production settings
|
||||
// e.g., cudaMemCopy to the device should check that the destination pointer is
|
||||
// a device pointer
|
||||
#define PANIC(format, ...) \
|
||||
{ \
|
||||
std::fprintf(stderr, "%s::%d::%s: panic.\n" format "\n", __FILE__, \
|
||||
__LINE__, __func__, ##__VA_ARGS__); \
|
||||
std::abort(); \
|
||||
}
|
||||
|
||||
// This is a generic assertion checking macro with user defined printf-style
|
||||
// message
|
||||
#define PANIC_IF_FALSE(cond, format, ...) \
|
||||
do { \
|
||||
if (!(cond)) { \
|
||||
PANIC(format "\n\n %s\n", ##__VA_ARGS__, #cond); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#ifndef GPU_ASSERTS_DISABLE
|
||||
// The GPU assert should be used to validate assumptions in algorithms,
|
||||
// for example, checking that two user-provided quantities have a certain
|
||||
// relationship or that the size of the buffer provided to a function is
|
||||
// sufficient when it is filled with some algorithm that depends on
|
||||
// user-provided inputs e.g., OPRF corrections buffer should not have a size
|
||||
// higher than the number of blocks in the datatype that is generated
|
||||
#define GPU_ASSERT(cond, format, ...) \
|
||||
PANIC_IF_FALSE(cond, format, ##__VA_ARGS__)
|
||||
#else
|
||||
#define GPU_ASSERT(cond) \
|
||||
do { \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
uint32_t cuda_get_device();
|
||||
void cuda_set_device(uint32_t gpu_index);
|
||||
|
||||
cudaEvent_t cuda_create_event(uint32_t gpu_index);
|
||||
|
||||
void cuda_event_record(cudaEvent_t event, cudaStream_t stream,
|
||||
uint32_t gpu_index);
|
||||
void cuda_stream_wait_event(cudaStream_t stream, cudaEvent_t event,
|
||||
uint32_t gpu_index);
|
||||
|
||||
void cuda_event_destroy(cudaEvent_t event, uint32_t gpu_index);
|
||||
|
||||
cudaStream_t cuda_create_stream(uint32_t gpu_index);
|
||||
|
||||
void cuda_destroy_stream(cudaStream_t stream, uint32_t gpu_index);
|
||||
|
||||
void cuda_synchronize_stream(cudaStream_t stream, uint32_t gpu_index);
|
||||
|
||||
uint32_t cuda_is_available();
|
||||
|
||||
void *cuda_malloc(uint64_t size, uint32_t gpu_index);
|
||||
|
||||
void *cuda_malloc_with_size_tracking_async(uint64_t size, cudaStream_t stream,
|
||||
uint32_t gpu_index,
|
||||
uint64_t &size_tracker,
|
||||
bool allocate_gpu_memory);
|
||||
|
||||
void *cuda_malloc_async(uint64_t size, cudaStream_t stream, uint32_t gpu_index);
|
||||
|
||||
bool cuda_check_valid_malloc(uint64_t size, uint32_t gpu_index);
|
||||
uint64_t cuda_device_total_memory(uint32_t gpu_index);
|
||||
|
||||
void cuda_memcpy_with_size_tracking_async_to_gpu(void *dest, const void *src,
|
||||
uint64_t size,
|
||||
cudaStream_t stream,
|
||||
uint32_t gpu_index,
|
||||
bool gpu_memory_allocated);
|
||||
|
||||
void cuda_memcpy_async_to_gpu(void *dest, const void *src, uint64_t size,
|
||||
cudaStream_t stream, uint32_t gpu_index);
|
||||
|
||||
void cuda_memcpy_with_size_tracking_async_gpu_to_gpu(
|
||||
void *dest, void const *src, uint64_t size, cudaStream_t stream,
|
||||
uint32_t gpu_index, bool gpu_memory_allocated);
|
||||
|
||||
void cuda_memcpy_async_gpu_to_gpu(void *dest, void const *src, uint64_t size,
|
||||
cudaStream_t stream, uint32_t gpu_index);
|
||||
|
||||
void cuda_memcpy_gpu_to_gpu(void *dest, void const *src, uint64_t size,
|
||||
uint32_t gpu_index);
|
||||
|
||||
void cuda_memcpy_async_to_cpu(void *dest, const void *src, uint64_t size,
|
||||
cudaStream_t stream, uint32_t gpu_index);
|
||||
|
||||
void cuda_memset_with_size_tracking_async(void *dest, uint64_t val,
|
||||
uint64_t size, cudaStream_t stream,
|
||||
uint32_t gpu_index,
|
||||
bool gpu_memory_allocated);
|
||||
|
||||
void cuda_memset_async(void *dest, uint64_t val, uint64_t size,
|
||||
cudaStream_t stream, uint32_t gpu_index);
|
||||
|
||||
int cuda_get_number_of_gpus();
|
||||
|
||||
int cuda_get_number_of_sms();
|
||||
|
||||
void cuda_synchronize_device(uint32_t gpu_index);
|
||||
|
||||
void cuda_drop(void *ptr, uint32_t gpu_index);
|
||||
|
||||
void cuda_drop_with_size_tracking_async(void *ptr, cudaStream_t stream,
|
||||
uint32_t gpu_index,
|
||||
bool gpu_memory_allocated);
|
||||
|
||||
void cuda_drop_async(void *ptr, cudaStream_t stream, uint32_t gpu_index);
|
||||
}
|
||||
|
||||
uint32_t cuda_get_max_shared_memory(uint32_t gpu_index);
|
||||
|
||||
uint32_t cuda_get_max_shared_memory_per_block(uint32_t gpu_index);
|
||||
|
||||
bool cuda_check_support_cooperative_groups();
|
||||
|
||||
bool cuda_check_support_thread_block_clusters();
|
||||
|
||||
template <typename Torus>
|
||||
void cuda_set_value_async(cudaStream_t stream, uint32_t gpu_index,
|
||||
Torus *d_array, Torus value, Torus n);
|
||||
|
||||
#endif
|
||||
@@ -1,16 +0,0 @@
|
||||
#ifndef HELPER_PROFILE
|
||||
#define HELPER_PROFILE
|
||||
|
||||
#ifdef USE_NVTOOLS
|
||||
#include <nvtx3/nvToolsExt.h>
|
||||
#endif
|
||||
|
||||
void cuda_nvtx_label_with_color(const char *name);
|
||||
void cuda_nvtx_pop();
|
||||
|
||||
#define PUSH_RANGE(name) \
|
||||
{ cuda_nvtx_label_with_color(name); }
|
||||
#define POP_RANGE() \
|
||||
{ cuda_nvtx_pop(); }
|
||||
|
||||
#endif
|
||||
@@ -1,43 +0,0 @@
|
||||
#include "helper_profile.cuh"
|
||||
#include <stdint.h>
|
||||
|
||||
uint32_t adler32(const unsigned char *data) {
|
||||
const uint32_t MOD_ADLER = 65521;
|
||||
uint32_t a = 1, b = 0;
|
||||
size_t index;
|
||||
for (index = 0; data[index] != 0; ++index) {
|
||||
a = (a + data[index] * 2) % MOD_ADLER;
|
||||
b = (b + a) % MOD_ADLER;
|
||||
}
|
||||
return (b << 16) | a;
|
||||
}
|
||||
|
||||
void cuda_nvtx_label_with_color(const char *name) {
|
||||
#ifdef USE_NVTOOLS
|
||||
int color_id = adler32((const unsigned char *)name);
|
||||
int r, g, b;
|
||||
r = color_id & 0x000000ff;
|
||||
g = (color_id & 0x000ff000) >> 12;
|
||||
b = (color_id & 0x0ff00000) >> 20;
|
||||
if (r < 64 & g < 64 & b < 64) {
|
||||
r = r * 3;
|
||||
g = g * 3 + 64;
|
||||
b = b * 4;
|
||||
}
|
||||
|
||||
color_id = 0xff000000 | (r << 16) | (g << 8) | (b);
|
||||
nvtxEventAttributes_t eventAttrib = {0};
|
||||
eventAttrib.version = NVTX_VERSION;
|
||||
eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
|
||||
eventAttrib.colorType = NVTX_COLOR_ARGB;
|
||||
eventAttrib.color = color_id;
|
||||
eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII;
|
||||
eventAttrib.message.ascii = name;
|
||||
nvtxRangePushEx(&eventAttrib);
|
||||
#endif
|
||||
}
|
||||
void cuda_nvtx_pop() {
|
||||
#ifdef USE_NVTOOLS
|
||||
nvtxRangePop();
|
||||
#endif
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <stddef.h>
|
||||
#include <cstring>
|
||||
|
||||
#include "helper_profile.cuh"
|
||||
#include "../../tfhe-cuda-backend/cuda/src/utils/helper_profile.cuh"
|
||||
|
||||
// C++ helper functions (not exported, used internally)
|
||||
// These can call template functions since they have C++ linkage
|
||||
|
||||
@@ -112,8 +112,3 @@ environment_name = "canada"
|
||||
image_name = "Ubuntu Server 22.04 LTS R570 CUDA 12.8"
|
||||
flavor_name = "n3-L40x8"
|
||||
user = "ubuntu"
|
||||
|
||||
[backend.terraform.scaleway-multi-h100-sxm5]
|
||||
script_path = "ci/terraform_scripts/scaleway/multi-h100-sxm5/terraform.tf"
|
||||
instance_type = "H100-SXM-8-80G"
|
||||
user ="ubuntu"
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
scaleway = {
|
||||
source = "scaleway/scaleway"
|
||||
version = "~> 2.73"
|
||||
}
|
||||
}
|
||||
required_version = ">= 0.13"
|
||||
}
|
||||
provider "scaleway" {
|
||||
zone = "fr-par-2"
|
||||
region = "fr-par"
|
||||
}
|
||||
|
||||
variable "instance_type" {
|
||||
type = string
|
||||
description = "Scaleway instance type to be used"
|
||||
}
|
||||
|
||||
variable "instance_label" {
|
||||
type = string
|
||||
description = "Instance name to display in console"
|
||||
}
|
||||
|
||||
variable "user_data" {
|
||||
type = string
|
||||
description = "Script that will be run at instance startup"
|
||||
}
|
||||
|
||||
locals {
|
||||
project_id = "7af36573-4180-41de-8c27-890ed9d919fa"
|
||||
}
|
||||
|
||||
resource "scaleway_instance_ip" "github_runner" {
|
||||
project_id = local.project_id
|
||||
}
|
||||
|
||||
resource "scaleway_instance_security_group" "github_runner" {
|
||||
project_id = local.project_id
|
||||
inbound_default_policy = "drop"
|
||||
outbound_default_policy = "accept"
|
||||
}
|
||||
|
||||
resource "scaleway_instance_server" "multi-h100-sxm5" {
|
||||
project_id = local.project_id
|
||||
image = "ba7d8136-7ec3-4efb-8e36-b891a4685a36" // Local image: tfhe-rs-ubuntu-noble-cuda
|
||||
type = var.instance_type
|
||||
name = var.instance_label
|
||||
|
||||
ip_id = scaleway_instance_ip.github_runner.id
|
||||
|
||||
user_data = {
|
||||
"cloud-init" = var.user_data
|
||||
}
|
||||
|
||||
security_group_id = scaleway_instance_security_group.github_runner.id
|
||||
}
|
||||
|
||||
output "instance_id" {
|
||||
value = scaleway_instance_server.multi-h100-sxm5.id
|
||||
description = "Unique ID of the Scaleway instance"
|
||||
}
|
||||
@@ -16,14 +16,19 @@ tfhe = { path = "../../tfhe", features = ["hpu", "hpu-debug"] }
|
||||
|
||||
ipc-channel = "0.18.3"
|
||||
|
||||
strum = { version = "0.26.2", features = ["derive"] }
|
||||
strum_macros = "0.26.2"
|
||||
bytemuck = { workspace = true }
|
||||
|
||||
clap = { version = "4.4.4", features = ["derive"] }
|
||||
clap-num = "*"
|
||||
anyhow = "1.0.82"
|
||||
tracing = "0.1.40"
|
||||
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json"] }
|
||||
serde_json = "1.0"
|
||||
rand = "0.8.5"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
bitflags = "2.6.0"
|
||||
|
||||
[[bin]]
|
||||
name = "hpu_mockup"
|
||||
|
||||
@@ -1 +1 @@
|
||||
nightly-2026-04-22
|
||||
nightly-2026-01-14
|
||||
|
||||
@@ -25,7 +25,7 @@ use tfhe::{
|
||||
CompressedKVStore, CompressedPublicKey, CompressedServerKey,
|
||||
CompressedSquashedNoiseCiphertextList, CompressedSquashedNoiseCiphertextListBuilder, FheBool,
|
||||
FheInt8, FheUint32, FheUint64, FheUint8, ReRandomizationContext, ReRandomizationMode,
|
||||
ReRandomizationSupport, Seed, ServerKey, SquashedNoiseFheBool, SquashedNoiseFheInt,
|
||||
ReRandomizationSupport, ServerKey, SquashedNoiseFheBool, SquashedNoiseFheInt,
|
||||
SquashedNoiseFheUint,
|
||||
};
|
||||
use tfhe_backward_compat_data::load::{
|
||||
@@ -748,22 +748,6 @@ fn test_hl_key_features(
|
||||
}
|
||||
}
|
||||
|
||||
// OPRF: check that oblivious pseudo-random generation works with the dedicated key.
|
||||
// The decrypted values only need to be within range; the seed is deterministic but we
|
||||
// don't compare to specific bit values (those are validated in the unit tests).
|
||||
if server_key.supports_oprf() {
|
||||
let seed = Seed(42u128);
|
||||
|
||||
let rand_bool = FheBool::generate_oblivious_pseudo_random(seed);
|
||||
let _: bool = rand_bool.decrypt(client_key);
|
||||
|
||||
let rand_uint = FheUint8::generate_oblivious_pseudo_random(seed);
|
||||
let _: u8 = rand_uint.decrypt(client_key);
|
||||
|
||||
let rand_int = FheInt8::generate_oblivious_pseudo_random(seed);
|
||||
let _: i8 = rand_int.decrypt(client_key);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -36,12 +36,12 @@ pub fn bench_fhe_type_op<FheType, Op>(
|
||||
let inputs = op.setup_inputs(client_key, &mut rng);
|
||||
|
||||
let bench_type = get_bench_type();
|
||||
let benchmark_spec = BenchmarkSpec::new_hlapi(
|
||||
let benchmark_spec = BenchmarkSpec::new_hlapi_ops(
|
||||
hlapi_op,
|
||||
¶m_name,
|
||||
&operand_type,
|
||||
Some(type_name),
|
||||
bench_type,
|
||||
*bench_type,
|
||||
bench_backend_from_cfg(),
|
||||
);
|
||||
let bench_id = benchmark_spec.to_string();
|
||||
|
||||
@@ -5,12 +5,12 @@ 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,
|
||||
};
|
||||
use benchmark::utilities::{bench_backend_from_cfg, write_to_json, OperatorType};
|
||||
#[cfg(feature = "gpu")]
|
||||
use benchmark::utilities::{configure_gpu, get_param_type, ParamType};
|
||||
use benchmark::utilities::{write_to_json_unchecked, OperatorType};
|
||||
use benchmark_spec::{get_bench_type, BenchmarkType};
|
||||
use criterion::measurement::WallTime;
|
||||
use criterion::{BenchmarkGroup, Criterion, Throughput};
|
||||
use benchmark_spec::tfhe::hlapi::dex::{Dex, DexFlavor};
|
||||
use benchmark_spec::{get_bench_type, BenchmarkMetric, BenchmarkSpec, BenchmarkType, OperandType};
|
||||
use criterion::{Criterion, Throughput};
|
||||
use rand::prelude::*;
|
||||
use rand::thread_rng;
|
||||
use rayon::prelude::*;
|
||||
@@ -220,21 +220,15 @@ where
|
||||
|
||||
#[cfg(feature = "pbs-stats")]
|
||||
mod pbs_stats {
|
||||
use super::*;
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
|
||||
fn write_result(file: &mut File, name: &str, value: usize) {
|
||||
let line = format!("{name},{value}\n");
|
||||
let error_message = format!("cannot write {name} result into file");
|
||||
file.write_all(line.as_bytes()).expect(&error_message);
|
||||
}
|
||||
use benchmark_spec::TestResult;
|
||||
|
||||
use super::*;
|
||||
|
||||
pub fn print_swap_request_update_dex_balance_pbs_counts<FheType, F>(
|
||||
client_key: &ClientKey,
|
||||
type_name: &str,
|
||||
fn_name: &str,
|
||||
fn_name: Dex,
|
||||
swap_request_update_dex_balance_func: F,
|
||||
) where
|
||||
FheType: FheEncrypt<u64, ClientKey>,
|
||||
@@ -258,29 +252,24 @@ mod pbs_stats {
|
||||
let params = client_key.computation_parameters();
|
||||
let params_name = params.name();
|
||||
|
||||
let test_name = if cfg!(feature = "gpu") {
|
||||
format!("hlapi::cuda::dex::pbs_count::swap_request_update_dex_balance::{fn_name}::{params_name}::{type_name}")
|
||||
} else {
|
||||
format!(
|
||||
"hlapi::dex::pbs_count::swap_request_update_dex_balance::{fn_name}::{params_name}::{type_name}"
|
||||
)
|
||||
};
|
||||
let test_name = BenchmarkSpec::new_hlapi_dex(
|
||||
fn_name,
|
||||
¶ms_name,
|
||||
&OperandType::CipherText,
|
||||
Some(type_name),
|
||||
BenchmarkMetric::PbsCount,
|
||||
bench_backend_from_cfg(),
|
||||
None,
|
||||
);
|
||||
|
||||
let results_file = Path::new("dex_swap_request_update_dex_balance_pbs_count.csv");
|
||||
if !results_file.exists() {
|
||||
File::create(results_file).expect("create results file failed");
|
||||
}
|
||||
let mut file = OpenOptions::new()
|
||||
.append(true)
|
||||
.open(results_file)
|
||||
.expect("cannot open results file");
|
||||
let mut benchmark_test_result =
|
||||
TestResult::new("dex_swap_request_update_dex_balance_pbs_count.csv");
|
||||
|
||||
write_result(&mut file, &test_name, count as usize);
|
||||
benchmark_test_result.write_result(&test_name.to_string(), count as usize);
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
write_to_json::<u64, _>(
|
||||
&test_name,
|
||||
params,
|
||||
params_name,
|
||||
"pbs-count",
|
||||
&OperatorType::Atomic,
|
||||
0,
|
||||
@@ -290,6 +279,7 @@ mod pbs_stats {
|
||||
pub fn print_swap_request_finalize_pbs_counts<FheType, F>(
|
||||
client_key: &ClientKey,
|
||||
type_name: &str,
|
||||
fn_name: Dex,
|
||||
swap_request_finalize_func: F,
|
||||
) where
|
||||
FheType: FheEncrypt<u64, ClientKey>,
|
||||
@@ -313,29 +303,23 @@ mod pbs_stats {
|
||||
let params = client_key.computation_parameters();
|
||||
let params_name = params.name();
|
||||
|
||||
let test_name = if cfg!(feature = "gpu") {
|
||||
format!(
|
||||
"hlapi::cuda::dex::pbs_count::swap_request_finalize::{params_name}::{type_name}"
|
||||
)
|
||||
} else {
|
||||
format!("hlapi::dex::pbs_count::swap_request_finalize::{params_name}::{type_name}")
|
||||
};
|
||||
let test_name = BenchmarkSpec::new_hlapi_dex(
|
||||
fn_name,
|
||||
¶ms_name,
|
||||
&OperandType::CipherText,
|
||||
Some(type_name),
|
||||
BenchmarkMetric::PbsCount,
|
||||
bench_backend_from_cfg(),
|
||||
None,
|
||||
);
|
||||
|
||||
let results_file = Path::new("dex_swap_request_finalize_pbs_count.csv");
|
||||
if !results_file.exists() {
|
||||
File::create(results_file).expect("create results file failed");
|
||||
}
|
||||
let mut file = OpenOptions::new()
|
||||
.append(true)
|
||||
.open(results_file)
|
||||
.expect("cannot open results file");
|
||||
let mut benchmark_test_result = TestResult::new("dex_swap_request_finalize_pbs_count.csv");
|
||||
|
||||
write_result(&mut file, &test_name, count as usize);
|
||||
benchmark_test_result.write_result(&test_name.to_string(), count as usize);
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
write_to_json::<u64, _>(
|
||||
&test_name,
|
||||
params,
|
||||
params_name,
|
||||
"pbs-count",
|
||||
&OperatorType::Atomic,
|
||||
0,
|
||||
@@ -345,6 +329,7 @@ mod pbs_stats {
|
||||
pub fn print_swap_claim_prepare_pbs_counts<FheType, F>(
|
||||
client_key: &ClientKey,
|
||||
type_name: &str,
|
||||
fn_name: Dex,
|
||||
swap_claim_prepare_func: F,
|
||||
) where
|
||||
FheType: FheEncrypt<u64, ClientKey>,
|
||||
@@ -378,27 +363,23 @@ mod pbs_stats {
|
||||
let params = client_key.computation_parameters();
|
||||
let params_name = params.name();
|
||||
|
||||
let test_name = if cfg!(feature = "gpu") {
|
||||
format!("hlapi::cuda::pbs_count::dex::swap_claim_prepare::{params_name}::{type_name}")
|
||||
} else {
|
||||
format!("hlapi::dex::pbs_count::swap_claim_prepare::{params_name}::{type_name}")
|
||||
};
|
||||
let test_name = BenchmarkSpec::new_hlapi_dex(
|
||||
fn_name,
|
||||
¶ms_name,
|
||||
&OperandType::CipherText,
|
||||
Some(type_name),
|
||||
BenchmarkMetric::PbsCount,
|
||||
bench_backend_from_cfg(),
|
||||
None,
|
||||
);
|
||||
|
||||
let results_file = Path::new("dex_swap_claim_prepare_pbs_count.csv");
|
||||
if !results_file.exists() {
|
||||
File::create(results_file).expect("create results file failed");
|
||||
}
|
||||
let mut file = OpenOptions::new()
|
||||
.append(true)
|
||||
.open(results_file)
|
||||
.expect("cannot open results file");
|
||||
let mut benchmark_test_result = TestResult::new("dex_swap_claim_prepare_pbs_count.csv");
|
||||
|
||||
write_result(&mut file, &test_name, count as usize);
|
||||
benchmark_test_result.write_result(&test_name.to_string(), count as usize);
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
write_to_json::<u64, _>(
|
||||
&test_name,
|
||||
params,
|
||||
params_name,
|
||||
"pbs-count",
|
||||
&OperatorType::Atomic,
|
||||
0,
|
||||
@@ -408,7 +389,7 @@ mod pbs_stats {
|
||||
pub fn print_swap_claim_update_dex_balance_pbs_counts<FheType, F>(
|
||||
client_key: &ClientKey,
|
||||
type_name: &str,
|
||||
fn_name: &str,
|
||||
fn_name: Dex,
|
||||
swap_claim_update_dex_balance_func: F,
|
||||
) where
|
||||
FheType: FheEncrypt<u64, ClientKey>,
|
||||
@@ -438,27 +419,24 @@ mod pbs_stats {
|
||||
let params = client_key.computation_parameters();
|
||||
let params_name = params.name();
|
||||
|
||||
let test_name = if cfg!(feature = "gpu") {
|
||||
format!("hlapi::cuda::pbs_count::dex::swap_claim_update_dex_balance::{fn_name}::{params_name}::{type_name}")
|
||||
} else {
|
||||
format!("hlapi::dex::pbs_count::swap_claim_update_dex_balance::{fn_name}::{params_name}::{type_name}")
|
||||
};
|
||||
let test_name = BenchmarkSpec::new_hlapi_dex(
|
||||
fn_name,
|
||||
¶ms_name,
|
||||
&OperandType::CipherText,
|
||||
Some(type_name),
|
||||
BenchmarkMetric::PbsCount,
|
||||
bench_backend_from_cfg(),
|
||||
None,
|
||||
);
|
||||
|
||||
let results_file = Path::new("dex_swap_claim_update_dex_balance_pbs_count.csv");
|
||||
if !results_file.exists() {
|
||||
File::create(results_file).expect("create results file failed");
|
||||
}
|
||||
let mut file = OpenOptions::new()
|
||||
.append(true)
|
||||
.open(results_file)
|
||||
.expect("cannot open results file");
|
||||
let mut benchmark_test_result =
|
||||
TestResult::new("dex_swap_claim_update_dex_balance_pbs_count.csv");
|
||||
|
||||
write_result(&mut file, &test_name, count as usize);
|
||||
benchmark_test_result.write_result(&test_name.to_string(), count as usize);
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
write_to_json::<u64, _>(
|
||||
&test_name,
|
||||
params,
|
||||
params_name,
|
||||
"pbs-count",
|
||||
&OperatorType::Atomic,
|
||||
0,
|
||||
@@ -468,11 +446,10 @@ mod pbs_stats {
|
||||
}
|
||||
|
||||
fn bench_swap_request_latency<FheType, F1, F2>(
|
||||
c: &mut BenchmarkGroup<'_, WallTime>,
|
||||
c: &mut Criterion,
|
||||
client_key: &ClientKey,
|
||||
bench_name: &str,
|
||||
type_name: &str,
|
||||
fn_name: &str,
|
||||
fn_name: Dex,
|
||||
swap_request_update_dex_balance_func: F1,
|
||||
swap_request_finalize_func: F2,
|
||||
) where
|
||||
@@ -486,8 +463,19 @@ fn bench_swap_request_latency<FheType, F1, F2>(
|
||||
let params = client_key.computation_parameters();
|
||||
let params_name = params.name();
|
||||
|
||||
let bench_id = format!("{bench_name}::{fn_name}::{type_name}");
|
||||
c.bench_function(&bench_id, |b| {
|
||||
let mut c = c.benchmark_group(type_name);
|
||||
|
||||
let bench_spec = BenchmarkSpec::new_hlapi_dex(
|
||||
fn_name,
|
||||
¶ms_name,
|
||||
&OperandType::CipherText,
|
||||
Some(type_name),
|
||||
BenchmarkMetric::Latency,
|
||||
bench_backend_from_cfg(),
|
||||
None,
|
||||
);
|
||||
|
||||
c.bench_function(bench_spec.to_string(), |b| {
|
||||
let mut rng = thread_rng();
|
||||
|
||||
let from_balance_0 = FheType::encrypt(rng.gen::<u64>(), client_key);
|
||||
@@ -525,10 +513,9 @@ fn bench_swap_request_latency<FheType, F1, F2>(
|
||||
})
|
||||
});
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&bench_id,
|
||||
write_to_json::<u64, _>(
|
||||
&bench_spec,
|
||||
params,
|
||||
params_name,
|
||||
"dex-swap-request",
|
||||
&OperatorType::Atomic,
|
||||
64,
|
||||
@@ -538,11 +525,10 @@ fn bench_swap_request_latency<FheType, F1, F2>(
|
||||
|
||||
#[cfg(not(feature = "gpu"))]
|
||||
fn bench_swap_request_throughput<FheType, F1, F2>(
|
||||
group: &mut BenchmarkGroup<'_, WallTime>,
|
||||
c: &mut Criterion,
|
||||
client_key: &ClientKey,
|
||||
bench_name: &str,
|
||||
type_name: &str,
|
||||
fn_name: &str,
|
||||
fn_name: Dex,
|
||||
swap_request_update_dex_balance_func: F1,
|
||||
swap_request_finalize_func: F2,
|
||||
) where
|
||||
@@ -555,12 +541,22 @@ fn bench_swap_request_throughput<FheType, F1, F2>(
|
||||
let params = client_key.computation_parameters();
|
||||
let params_name = params.name();
|
||||
|
||||
let mut group = c.benchmark_group(type_name);
|
||||
|
||||
for num_elems in [10, 50, 100] {
|
||||
group.throughput(Throughput::Elements(num_elems));
|
||||
let bench_id = format!(
|
||||
"{bench_name}::throughput::{fn_name}::{params_name}::{type_name}::{num_elems}_elems"
|
||||
|
||||
let bench_spec = BenchmarkSpec::new_hlapi_dex(
|
||||
fn_name,
|
||||
¶ms_name,
|
||||
&OperandType::CipherText,
|
||||
Some(type_name),
|
||||
BenchmarkMetric::Throughput,
|
||||
bench_backend_from_cfg(),
|
||||
Some(num_elems.try_into().unwrap()),
|
||||
);
|
||||
group.bench_with_input(&bench_id, &num_elems, |b, &num_elems| {
|
||||
|
||||
group.bench_with_input(bench_spec.to_string(), &num_elems, |b, &num_elems| {
|
||||
let from_balances_0 = (0..num_elems)
|
||||
.map(|_| FheType::encrypt(rng.gen::<u64>(), client_key))
|
||||
.collect::<Vec<_>>();
|
||||
@@ -641,10 +637,9 @@ fn bench_swap_request_throughput<FheType, F1, F2>(
|
||||
})
|
||||
});
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&bench_id,
|
||||
write_to_json::<u64, _>(
|
||||
&bench_spec,
|
||||
params,
|
||||
¶ms_name,
|
||||
"dex-swap-request",
|
||||
&OperatorType::Atomic,
|
||||
64,
|
||||
@@ -654,11 +649,10 @@ fn bench_swap_request_throughput<FheType, F1, F2>(
|
||||
}
|
||||
#[cfg(feature = "gpu")]
|
||||
fn cuda_bench_swap_request_throughput<FheType, F1, F2>(
|
||||
group: &mut BenchmarkGroup<'_, WallTime>,
|
||||
c: &mut Criterion,
|
||||
client_key: &ClientKey,
|
||||
bench_name: &str,
|
||||
type_name: &str,
|
||||
fn_name: &str,
|
||||
fn_name: Dex,
|
||||
swap_request_update_dex_balance_func: F1,
|
||||
swap_request_finalize_func: F2,
|
||||
) where
|
||||
@@ -678,12 +672,20 @@ fn cuda_bench_swap_request_throughput<FheType, F1, F2>(
|
||||
let params = client_key.computation_parameters();
|
||||
let params_name = params.name();
|
||||
|
||||
let mut group = c.benchmark_group(type_name);
|
||||
|
||||
for num_elems in [5 * num_gpus, 10 * num_gpus, 20 * num_gpus] {
|
||||
group.throughput(Throughput::Elements(num_elems));
|
||||
let bench_id = format!(
|
||||
"{bench_name}::throughput::{fn_name}::{params_name}::{type_name}::{num_elems}_elems"
|
||||
let bench_spec = BenchmarkSpec::new_hlapi_dex(
|
||||
fn_name,
|
||||
¶ms_name,
|
||||
&OperandType::CipherText,
|
||||
Some(type_name),
|
||||
BenchmarkMetric::Throughput,
|
||||
bench_backend_from_cfg(),
|
||||
Some(num_elems.try_into().unwrap()),
|
||||
);
|
||||
group.bench_with_input(&bench_id, &num_elems, |b, &num_elems| {
|
||||
group.bench_with_input(bench_spec.to_string(), &num_elems, |b, &num_elems| {
|
||||
let from_balances_0 = (0..num_elems)
|
||||
.map(|_| FheType::encrypt(rng.gen::<u64>(), client_key))
|
||||
.collect::<Vec<_>>();
|
||||
@@ -853,10 +855,9 @@ fn cuda_bench_swap_request_throughput<FheType, F1, F2>(
|
||||
})
|
||||
});
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&bench_id,
|
||||
write_to_json::<u64, _>(
|
||||
&bench_spec,
|
||||
params,
|
||||
¶ms_name,
|
||||
"dex-swap-request",
|
||||
&OperatorType::Atomic,
|
||||
64,
|
||||
@@ -866,11 +867,10 @@ fn cuda_bench_swap_request_throughput<FheType, F1, F2>(
|
||||
}
|
||||
|
||||
fn bench_swap_claim_latency<FheType, F1, F2>(
|
||||
c: &mut BenchmarkGroup<'_, WallTime>,
|
||||
c: &mut Criterion,
|
||||
client_key: &ClientKey,
|
||||
bench_name: &str,
|
||||
type_name: &str,
|
||||
fn_name: &str,
|
||||
fn_name: Dex,
|
||||
swap_claim_prepare_func: F1,
|
||||
swap_claim_update_dex_balance_func: F2,
|
||||
) where
|
||||
@@ -884,8 +884,19 @@ fn bench_swap_claim_latency<FheType, F1, F2>(
|
||||
let params = client_key.computation_parameters();
|
||||
let params_name = params.name();
|
||||
|
||||
let bench_id = format!("{bench_name}::{fn_name}::{params_name}::{type_name}");
|
||||
c.bench_function(&bench_id, |b| {
|
||||
let mut c = c.benchmark_group(type_name);
|
||||
|
||||
let bench_spec = BenchmarkSpec::new_hlapi_dex(
|
||||
fn_name,
|
||||
¶ms_name,
|
||||
&OperandType::CipherText,
|
||||
Some(type_name),
|
||||
BenchmarkMetric::Latency,
|
||||
bench_backend_from_cfg(),
|
||||
None,
|
||||
);
|
||||
|
||||
c.bench_function(bench_spec.to_string(), |b| {
|
||||
let mut rng = thread_rng();
|
||||
|
||||
let pending_0_in = FheType::encrypt(rng.gen::<u64>(), client_key);
|
||||
@@ -929,10 +940,9 @@ fn bench_swap_claim_latency<FheType, F1, F2>(
|
||||
});
|
||||
});
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&bench_id,
|
||||
write_to_json::<u64, _>(
|
||||
&bench_spec,
|
||||
params,
|
||||
¶ms_name,
|
||||
"dex-swap-claim",
|
||||
&OperatorType::Atomic,
|
||||
64,
|
||||
@@ -942,11 +952,10 @@ fn bench_swap_claim_latency<FheType, F1, F2>(
|
||||
|
||||
#[cfg(not(feature = "gpu"))]
|
||||
fn bench_swap_claim_throughput<FheType, F1, F2>(
|
||||
group: &mut BenchmarkGroup<'_, WallTime>,
|
||||
c: &mut Criterion,
|
||||
client_key: &ClientKey,
|
||||
bench_name: &str,
|
||||
type_name: &str,
|
||||
fn_name: &str,
|
||||
fn_name: Dex,
|
||||
swap_claim_prepare_func: F1,
|
||||
swap_claim_update_dex_balance_func: F2,
|
||||
) where
|
||||
@@ -959,12 +968,22 @@ fn bench_swap_claim_throughput<FheType, F1, F2>(
|
||||
let params = client_key.computation_parameters();
|
||||
let params_name = params.name();
|
||||
|
||||
let mut group = c.benchmark_group(type_name);
|
||||
|
||||
for num_elems in [2, 6, 10] {
|
||||
group.throughput(Throughput::Elements(num_elems));
|
||||
let bench_id = format!(
|
||||
"{bench_name}::throughput::{fn_name}::{params_name}::{type_name}::{num_elems}_elems"
|
||||
|
||||
let bench_spec = BenchmarkSpec::new_hlapi_dex(
|
||||
fn_name,
|
||||
¶ms_name,
|
||||
&OperandType::CipherText,
|
||||
Some(type_name),
|
||||
BenchmarkMetric::Throughput,
|
||||
bench_backend_from_cfg(),
|
||||
Some(num_elems.try_into().unwrap()),
|
||||
);
|
||||
group.bench_with_input(&bench_id, &num_elems, |b, &num_elems| {
|
||||
|
||||
group.bench_with_input(bench_spec.to_string(), &num_elems, |b, &num_elems| {
|
||||
let pending_0_in = (0..num_elems)
|
||||
.map(|_| FheType::encrypt(rng.gen::<u64>(), client_key))
|
||||
.collect::<Vec<_>>();
|
||||
@@ -1063,10 +1082,9 @@ fn bench_swap_claim_throughput<FheType, F1, F2>(
|
||||
});
|
||||
});
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&bench_id,
|
||||
write_to_json::<u64, _>(
|
||||
&bench_spec,
|
||||
params,
|
||||
¶ms_name,
|
||||
"dex-swap-claim",
|
||||
&OperatorType::Atomic,
|
||||
64,
|
||||
@@ -1076,11 +1094,10 @@ fn bench_swap_claim_throughput<FheType, F1, F2>(
|
||||
}
|
||||
#[cfg(feature = "gpu")]
|
||||
fn cuda_bench_swap_claim_throughput<FheType, F1, F2>(
|
||||
group: &mut BenchmarkGroup<'_, WallTime>,
|
||||
c: &mut Criterion,
|
||||
client_key: &ClientKey,
|
||||
bench_name: &str,
|
||||
type_name: &str,
|
||||
fn_name: &str,
|
||||
fn_name: Dex,
|
||||
swap_claim_prepare_func: F1,
|
||||
swap_claim_update_dex_balance_func: F2,
|
||||
) where
|
||||
@@ -1100,12 +1117,20 @@ fn cuda_bench_swap_claim_throughput<FheType, F1, F2>(
|
||||
let params = client_key.computation_parameters();
|
||||
let params_name = params.name();
|
||||
|
||||
let mut group = c.benchmark_group(type_name);
|
||||
|
||||
for num_elems in [num_gpus, 2 * num_gpus] {
|
||||
group.throughput(Throughput::Elements(num_elems));
|
||||
let bench_id = format!(
|
||||
"{bench_name}::throughput::{fn_name}::{params_name}::{type_name}::{num_elems}_elems"
|
||||
let bench_spec = BenchmarkSpec::new_hlapi_dex(
|
||||
fn_name,
|
||||
¶ms_name,
|
||||
&OperandType::CipherText,
|
||||
Some(type_name),
|
||||
BenchmarkMetric::Throughput,
|
||||
bench_backend_from_cfg(),
|
||||
Some(num_elems.try_into().unwrap()),
|
||||
);
|
||||
group.bench_with_input(&bench_id, &num_elems, |b, &num_elems| {
|
||||
group.bench_with_input(bench_spec.to_string(), &num_elems, |b, &num_elems| {
|
||||
let pending_0_in = (0..num_elems)
|
||||
.map(|_| FheType::encrypt(rng.gen::<u64>(), client_key))
|
||||
.collect::<Vec<_>>();
|
||||
@@ -1270,10 +1295,9 @@ fn cuda_bench_swap_claim_throughput<FheType, F1, F2>(
|
||||
});
|
||||
});
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&bench_id,
|
||||
write_to_json::<u64, _>(
|
||||
&bench_spec,
|
||||
params,
|
||||
¶ms_name,
|
||||
"dex-swap-claim",
|
||||
&OperatorType::Atomic,
|
||||
64,
|
||||
@@ -1306,8 +1330,6 @@ fn main() {
|
||||
|
||||
let mut c = Criterion::default().sample_size(10).configure_from_args();
|
||||
|
||||
let bench_name = "hlapi::dex";
|
||||
|
||||
// FheUint64 PBS counts
|
||||
// We don't run multiple times since every input is encrypted
|
||||
// PBS count is always the same
|
||||
@@ -1316,120 +1338,109 @@ fn main() {
|
||||
print_swap_request_update_dex_balance_pbs_counts(
|
||||
&cks,
|
||||
"FheUint64",
|
||||
"whitepaper",
|
||||
Dex::SwapRequest(DexFlavor::Whitepaper),
|
||||
swap_request_update_dex_balance_whitepaper::<FheUint64>,
|
||||
);
|
||||
print_swap_request_update_dex_balance_pbs_counts(
|
||||
&cks,
|
||||
"FheUint64",
|
||||
"no_cmux",
|
||||
Dex::SwapRequest(DexFlavor::NoCmux),
|
||||
swap_request_update_dex_balance_no_cmux::<FheUint64>,
|
||||
);
|
||||
print_swap_request_finalize_pbs_counts(
|
||||
&cks,
|
||||
"FheUint64",
|
||||
Dex::SwapRequest(DexFlavor::Finalize),
|
||||
swap_request_finalize::<FheUint64>,
|
||||
);
|
||||
print_swap_claim_prepare_pbs_counts(
|
||||
&cks,
|
||||
"FheUint64",
|
||||
Dex::SwapClaim(DexFlavor::Prepare),
|
||||
swap_claim_prepare::<FheUint64, FheUint128>,
|
||||
);
|
||||
print_swap_claim_update_dex_balance_pbs_counts(
|
||||
&cks,
|
||||
"FheUint64",
|
||||
"whitepaper",
|
||||
Dex::SwapClaim(DexFlavor::Whitepaper),
|
||||
swap_claim_update_dex_balance_whitepaper::<FheUint64>,
|
||||
);
|
||||
print_swap_claim_update_dex_balance_pbs_counts(
|
||||
&cks,
|
||||
"FheUint64",
|
||||
"no_cmux",
|
||||
Dex::SwapClaim(DexFlavor::NoCmux),
|
||||
swap_claim_update_dex_balance_no_cmux::<FheUint64>,
|
||||
);
|
||||
}
|
||||
|
||||
match get_bench_type() {
|
||||
BenchmarkType::Latency => {
|
||||
let mut group = c.benchmark_group(bench_name);
|
||||
bench_swap_request_latency(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"swap_request::whitepaper",
|
||||
Dex::SwapRequest(DexFlavor::Whitepaper),
|
||||
swap_request_update_dex_balance_whitepaper::<FheUint64>,
|
||||
swap_request_finalize::<FheUint64>,
|
||||
);
|
||||
bench_swap_request_latency(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"swap_request::no_cmux",
|
||||
Dex::SwapRequest(DexFlavor::NoCmux),
|
||||
swap_request_update_dex_balance_no_cmux::<FheUint64>,
|
||||
swap_request_finalize::<FheUint64>,
|
||||
);
|
||||
bench_swap_claim_latency(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"swap_claim::whitepaper",
|
||||
Dex::SwapClaim(DexFlavor::Whitepaper),
|
||||
swap_claim_prepare::<FheUint64, FheUint128>,
|
||||
swap_claim_update_dex_balance_whitepaper::<FheUint64>,
|
||||
);
|
||||
bench_swap_claim_latency(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"swap_claim::no_cmux",
|
||||
Dex::SwapClaim(DexFlavor::NoCmux),
|
||||
swap_claim_prepare::<FheUint64, FheUint128>,
|
||||
swap_claim_update_dex_balance_no_cmux::<FheUint64>,
|
||||
);
|
||||
|
||||
group.finish();
|
||||
}
|
||||
BenchmarkType::Throughput => {
|
||||
let mut group = c.benchmark_group(bench_name);
|
||||
bench_swap_request_throughput(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"swap_request::whitepaper",
|
||||
Dex::SwapRequest(DexFlavor::Whitepaper),
|
||||
swap_request_update_dex_balance_whitepaper::<FheUint64>,
|
||||
swap_request_finalize::<FheUint64>,
|
||||
);
|
||||
bench_swap_request_throughput(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"swap_request::no_cmux",
|
||||
Dex::SwapRequest(DexFlavor::NoCmux),
|
||||
swap_request_update_dex_balance_no_cmux::<FheUint64>,
|
||||
swap_request_finalize::<FheUint64>,
|
||||
);
|
||||
bench_swap_claim_throughput(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"swap_claim::whitepaper",
|
||||
Dex::SwapClaim(DexFlavor::Whitepaper),
|
||||
swap_claim_prepare::<FheUint64, FheUint128>,
|
||||
swap_claim_update_dex_balance_whitepaper::<FheUint64>,
|
||||
);
|
||||
bench_swap_claim_throughput(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"swap_claim::no_cmux",
|
||||
Dex::SwapClaim(DexFlavor::NoCmux),
|
||||
swap_claim_prepare::<FheUint64, FheUint128>,
|
||||
swap_claim_update_dex_balance_no_cmux::<FheUint64>,
|
||||
);
|
||||
group.finish();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1449,8 +1460,6 @@ fn main() {
|
||||
|
||||
let mut c = Criterion::default().sample_size(10).configure_from_args();
|
||||
|
||||
let bench_name = "hlapi::cuda::dex";
|
||||
|
||||
// FheUint64 PBS counts
|
||||
// We don't run multiple times since every input is encrypted
|
||||
// PBS count is always the same
|
||||
@@ -1459,121 +1468,110 @@ fn main() {
|
||||
print_swap_request_update_dex_balance_pbs_counts(
|
||||
&cks,
|
||||
"FheUint64",
|
||||
"whitepaper",
|
||||
Dex::SwapRequest(DexFlavor::Whitepaper),
|
||||
swap_request_update_dex_balance_whitepaper::<FheUint64>,
|
||||
);
|
||||
print_swap_request_update_dex_balance_pbs_counts(
|
||||
&cks,
|
||||
"FheUint64",
|
||||
"no_cmux",
|
||||
Dex::SwapRequest(DexFlavor::NoCmux),
|
||||
swap_request_update_dex_balance_no_cmux::<FheUint64>,
|
||||
);
|
||||
print_swap_request_finalize_pbs_counts(
|
||||
&cks,
|
||||
"FheUint64",
|
||||
Dex::SwapRequest(DexFlavor::Finalize),
|
||||
swap_request_finalize::<FheUint64>,
|
||||
);
|
||||
print_swap_claim_prepare_pbs_counts(
|
||||
&cks,
|
||||
"FheUint64",
|
||||
Dex::SwapClaim(DexFlavor::Prepare),
|
||||
swap_claim_prepare::<FheUint64, FheUint128>,
|
||||
);
|
||||
print_swap_claim_update_dex_balance_pbs_counts(
|
||||
&cks,
|
||||
"FheUint64",
|
||||
"whitepaper",
|
||||
Dex::SwapClaim(DexFlavor::Whitepaper),
|
||||
swap_claim_update_dex_balance_whitepaper::<FheUint64>,
|
||||
);
|
||||
print_swap_claim_update_dex_balance_pbs_counts(
|
||||
&cks,
|
||||
"FheUint64",
|
||||
"no_cmux",
|
||||
Dex::SwapClaim(DexFlavor::NoCmux),
|
||||
swap_claim_update_dex_balance_no_cmux::<FheUint64>,
|
||||
);
|
||||
}
|
||||
|
||||
match get_bench_type() {
|
||||
BenchmarkType::Latency => {
|
||||
let mut group = c.benchmark_group(bench_name);
|
||||
bench_swap_request_latency(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"swap_request::whitepaper",
|
||||
Dex::SwapRequest(DexFlavor::Whitepaper),
|
||||
swap_request_update_dex_balance_whitepaper::<FheUint64>,
|
||||
swap_request_finalize::<FheUint64>,
|
||||
);
|
||||
bench_swap_request_latency(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"swap_request::no_cmux",
|
||||
Dex::SwapRequest(DexFlavor::NoCmux),
|
||||
swap_request_update_dex_balance_no_cmux::<FheUint64>,
|
||||
swap_request_finalize::<FheUint64>,
|
||||
);
|
||||
bench_swap_claim_latency(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"swap_claim::whitepaper",
|
||||
Dex::SwapClaim(DexFlavor::Whitepaper),
|
||||
swap_claim_prepare::<FheUint64, FheUint128>,
|
||||
swap_claim_update_dex_balance_whitepaper::<FheUint64>,
|
||||
);
|
||||
bench_swap_claim_latency(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"swap_claim::no_cmux",
|
||||
Dex::SwapClaim(DexFlavor::NoCmux),
|
||||
swap_claim_prepare::<FheUint64, FheUint128>,
|
||||
swap_claim_update_dex_balance_no_cmux::<FheUint64>,
|
||||
);
|
||||
|
||||
group.finish();
|
||||
}
|
||||
|
||||
BenchmarkType::Throughput => {
|
||||
let mut group = c.benchmark_group(bench_name);
|
||||
cuda_bench_swap_request_throughput(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"swap_request::whitepaper",
|
||||
Dex::SwapRequest(DexFlavor::Whitepaper),
|
||||
swap_request_update_dex_balance_whitepaper::<FheUint64>,
|
||||
swap_request_finalize::<FheUint64>,
|
||||
);
|
||||
cuda_bench_swap_request_throughput(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"swap_request::no_cmux",
|
||||
Dex::SwapRequest(DexFlavor::NoCmux),
|
||||
swap_request_update_dex_balance_no_cmux::<FheUint64>,
|
||||
swap_request_finalize::<FheUint64>,
|
||||
);
|
||||
cuda_bench_swap_claim_throughput(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"swap_claim::whitepaper",
|
||||
Dex::SwapClaim(DexFlavor::Whitepaper),
|
||||
swap_claim_prepare::<FheUint64, FheUint128>,
|
||||
swap_claim_update_dex_balance_whitepaper::<FheUint64>,
|
||||
);
|
||||
cuda_bench_swap_claim_throughput(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"swap_claim::no_cmux",
|
||||
Dex::SwapClaim(DexFlavor::NoCmux),
|
||||
swap_claim_prepare::<FheUint64, FheUint128>,
|
||||
swap_claim_update_dex_balance_no_cmux::<FheUint64>,
|
||||
);
|
||||
group.finish();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use benchmark::utilities::{bench_backend_from_cfg, write_to_json, OperatorType};
|
||||
#[cfg(feature = "gpu")]
|
||||
use benchmark::utilities::{configure_gpu, get_param_type, ParamType};
|
||||
use benchmark::utilities::{write_to_json_unchecked, OperatorType};
|
||||
use benchmark_spec::{get_bench_type, BenchmarkType};
|
||||
use criterion::measurement::WallTime;
|
||||
use criterion::{BenchmarkGroup, Criterion, Throughput};
|
||||
use benchmark_spec::tfhe::hlapi::erc7984::{Erc7984, TransferFlavor};
|
||||
use benchmark_spec::{get_bench_type, BenchmarkMetric, BenchmarkSpec, BenchmarkType, OperandType};
|
||||
use criterion::{Criterion, Throughput};
|
||||
use rand::prelude::*;
|
||||
use rand::thread_rng;
|
||||
#[cfg(not(feature = "hpu"))]
|
||||
@@ -286,21 +286,14 @@ where
|
||||
|
||||
#[cfg(all(feature = "pbs-stats", not(feature = "hpu")))]
|
||||
mod pbs_stats {
|
||||
use super::*;
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
use benchmark_spec::TestResult;
|
||||
|
||||
fn write_result(file: &mut File, name: &str, value: usize) {
|
||||
let line = format!("{name},{value}\n");
|
||||
let error_message = format!("cannot write {name} result into file");
|
||||
file.write_all(line.as_bytes()).expect(&error_message);
|
||||
}
|
||||
use super::*;
|
||||
|
||||
pub fn print_transfer_pbs_counts<FheType, F>(
|
||||
client_key: &ClientKey,
|
||||
type_name: &str,
|
||||
fn_name: &str,
|
||||
fn_name: Erc7984,
|
||||
transfer_func: F,
|
||||
) where
|
||||
FheType: FheEncrypt<u64, ClientKey>,
|
||||
@@ -324,27 +317,23 @@ mod pbs_stats {
|
||||
let params = client_key.computation_parameters();
|
||||
let params_name = params.name();
|
||||
|
||||
let test_name = if cfg!(feature = "gpu") {
|
||||
format!("hlapi::cuda::erc7984::pbs_count::{fn_name}::{params_name}::{type_name}")
|
||||
} else {
|
||||
format!("hlapi::erc7984::pbs_count::{fn_name}::{params_name}::{type_name}")
|
||||
};
|
||||
let test_name = BenchmarkSpec::new_hlapi_erc7984(
|
||||
fn_name,
|
||||
¶ms_name,
|
||||
&OperandType::CipherText,
|
||||
Some(type_name),
|
||||
BenchmarkMetric::PbsCount,
|
||||
bench_backend_from_cfg(),
|
||||
None,
|
||||
);
|
||||
|
||||
let results_file = Path::new("erc7984_pbs_count.csv");
|
||||
if !results_file.exists() {
|
||||
File::create(results_file).expect("create results file failed");
|
||||
}
|
||||
let mut file = OpenOptions::new()
|
||||
.append(true)
|
||||
.open(results_file)
|
||||
.expect("cannot open results file");
|
||||
let mut benchmark_test_result = TestResult::new("erc7984_pbs_count.csv");
|
||||
|
||||
write_result(&mut file, &test_name, count as usize);
|
||||
benchmark_test_result.write_result(&test_name.to_string(), count as usize);
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
write_to_json::<u64, _>(
|
||||
&test_name,
|
||||
params,
|
||||
params_name,
|
||||
"pbs-count",
|
||||
&OperatorType::Atomic,
|
||||
0,
|
||||
@@ -354,11 +343,10 @@ mod pbs_stats {
|
||||
}
|
||||
|
||||
fn bench_transfer_latency<FheType, F>(
|
||||
c: &mut BenchmarkGroup<'_, WallTime>,
|
||||
c: &mut Criterion,
|
||||
client_key: &ClientKey,
|
||||
bench_name: &str,
|
||||
type_name: &str,
|
||||
fn_name: &str,
|
||||
fn_name: Erc7984,
|
||||
transfer_func: F,
|
||||
) where
|
||||
FheType: FheEncrypt<u64, ClientKey>,
|
||||
@@ -371,7 +359,18 @@ fn bench_transfer_latency<FheType, F>(
|
||||
let params = client_key.computation_parameters();
|
||||
let params_name = params.name();
|
||||
|
||||
let bench_id = format!("{bench_name}::{fn_name}::{params_name}::{type_name}");
|
||||
let mut c = c.benchmark_group(type_name);
|
||||
|
||||
let bench_spec = BenchmarkSpec::new_hlapi_erc7984(
|
||||
fn_name,
|
||||
¶ms_name,
|
||||
&OperandType::CipherText,
|
||||
Some(type_name),
|
||||
BenchmarkMetric::Latency,
|
||||
bench_backend_from_cfg(),
|
||||
None,
|
||||
);
|
||||
let bench_id = bench_spec.to_string();
|
||||
c.bench_function(&bench_id, |b| {
|
||||
let mut rng = thread_rng();
|
||||
|
||||
@@ -388,10 +387,9 @@ fn bench_transfer_latency<FheType, F>(
|
||||
})
|
||||
});
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&bench_id,
|
||||
write_to_json::<u64, _>(
|
||||
&bench_spec,
|
||||
params,
|
||||
params_name,
|
||||
"erc7984-transfer",
|
||||
&OperatorType::Atomic,
|
||||
64,
|
||||
@@ -401,11 +399,10 @@ fn bench_transfer_latency<FheType, F>(
|
||||
|
||||
#[cfg(feature = "hpu")]
|
||||
fn bench_transfer_latency_simd<FheType, F>(
|
||||
c: &mut BenchmarkGroup<'_, WallTime>,
|
||||
c: &mut Criterion,
|
||||
client_key: &ClientKey,
|
||||
bench_name: &str,
|
||||
type_name: &str,
|
||||
fn_name: &str,
|
||||
fn_name: Erc7984,
|
||||
transfer_func: F,
|
||||
) where
|
||||
FheType: FheEncrypt<u64, ClientKey>,
|
||||
@@ -423,9 +420,18 @@ fn bench_transfer_latency_simd<FheType, F>(
|
||||
|
||||
let params = client_key.computation_parameters();
|
||||
let params_name = params.name();
|
||||
let mut c = c.benchmark_group(type_name);
|
||||
|
||||
let bench_id = format!("{bench_name}::{fn_name}::{params_name}::{type_name}");
|
||||
c.bench_function(&bench_id, |b| {
|
||||
let bench_spec = BenchmarkSpec::new_hlapi_erc7984(
|
||||
fn_name,
|
||||
¶ms_name,
|
||||
&OperandType::CipherText,
|
||||
Some(type_name),
|
||||
BenchmarkMetric::Throughput,
|
||||
bench_backend_from_cfg(),
|
||||
None,
|
||||
);
|
||||
c.bench_function(bench_spec.to_string(), |b| {
|
||||
let mut rng = thread_rng();
|
||||
|
||||
let mut from_amounts: Vec<FheType> = vec![];
|
||||
@@ -449,10 +455,9 @@ fn bench_transfer_latency_simd<FheType, F>(
|
||||
})
|
||||
});
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&bench_id,
|
||||
write_to_json::<u64, _>(
|
||||
&bench_spec,
|
||||
params,
|
||||
params_name,
|
||||
"erc7984-simd-transfer",
|
||||
&OperatorType::Atomic,
|
||||
64,
|
||||
@@ -462,11 +467,10 @@ fn bench_transfer_latency_simd<FheType, F>(
|
||||
|
||||
#[cfg(not(any(feature = "gpu", feature = "hpu")))]
|
||||
fn bench_transfer_throughput<FheType, F>(
|
||||
group: &mut BenchmarkGroup<'_, WallTime>,
|
||||
c: &mut Criterion,
|
||||
client_key: &ClientKey,
|
||||
bench_name: &str,
|
||||
type_name: &str,
|
||||
fn_name: &str,
|
||||
fn_name: Erc7984,
|
||||
transfer_func: F,
|
||||
) where
|
||||
FheType: FheEncrypt<u64, ClientKey> + Send + Sync,
|
||||
@@ -477,11 +481,20 @@ fn bench_transfer_throughput<FheType, F>(
|
||||
let params = client_key.computation_parameters();
|
||||
let params_name = params.name();
|
||||
|
||||
let mut group = c.benchmark_group(type_name);
|
||||
|
||||
for num_elems in [10, 100, 500] {
|
||||
group.throughput(Throughput::Elements(num_elems));
|
||||
let bench_id = format!(
|
||||
"{bench_name}::throughput::{fn_name}::{params_name}::{type_name}::{num_elems}_elems"
|
||||
let bench_spec = BenchmarkSpec::new_hlapi_erc7984(
|
||||
fn_name,
|
||||
¶ms_name,
|
||||
&OperandType::CipherText,
|
||||
Some(type_name),
|
||||
BenchmarkMetric::Throughput,
|
||||
bench_backend_from_cfg(),
|
||||
Some(num_elems.try_into().unwrap()),
|
||||
);
|
||||
let bench_id = bench_spec.to_string();
|
||||
group.bench_with_input(&bench_id, &num_elems, |b, &num_elems| {
|
||||
let from_amounts = (0..num_elems)
|
||||
.map(|_| FheType::encrypt(rng.gen::<u64>(), client_key))
|
||||
@@ -503,10 +516,9 @@ fn bench_transfer_throughput<FheType, F>(
|
||||
})
|
||||
});
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&bench_id,
|
||||
write_to_json::<u64, _>(
|
||||
&bench_spec,
|
||||
params,
|
||||
¶ms_name,
|
||||
"erc7984-transfer",
|
||||
&OperatorType::Atomic,
|
||||
64,
|
||||
@@ -517,11 +529,10 @@ fn bench_transfer_throughput<FheType, F>(
|
||||
|
||||
#[cfg(feature = "gpu")]
|
||||
fn cuda_bench_transfer_throughput<FheType, F>(
|
||||
group: &mut BenchmarkGroup<'_, WallTime>,
|
||||
c: &mut Criterion,
|
||||
client_key: &ClientKey,
|
||||
bench_name: &str,
|
||||
type_name: &str,
|
||||
fn_name: &str,
|
||||
fn_name: Erc7984,
|
||||
transfer_func: F,
|
||||
) where
|
||||
FheType: FheEncrypt<u64, ClientKey> + Send + Sync,
|
||||
@@ -542,11 +553,19 @@ fn cuda_bench_transfer_throughput<FheType, F>(
|
||||
// and is a multiple of the number of streams per GPU to avoid a bigger batch on one stream
|
||||
let num_elems = 300 * num_gpus;
|
||||
|
||||
let mut group = c.benchmark_group(type_name);
|
||||
group.throughput(Throughput::Elements(num_elems));
|
||||
let bench_id = format!(
|
||||
"{bench_name}::throughput::{fn_name}::{params_name}::{type_name}::{num_elems}_elems"
|
||||
|
||||
let bench_spec = BenchmarkSpec::new_hlapi_erc7984(
|
||||
fn_name,
|
||||
¶ms_name,
|
||||
&OperandType::CipherText,
|
||||
Some(type_name),
|
||||
BenchmarkMetric::Throughput,
|
||||
bench_backend_from_cfg(),
|
||||
Some(num_elems.try_into().unwrap()),
|
||||
);
|
||||
group.bench_with_input(&bench_id, &num_elems, |b, &num_elems| {
|
||||
group.bench_with_input(bench_spec.to_string(), &num_elems, |b, &num_elems| {
|
||||
let from_amounts = (0..num_elems)
|
||||
.map(|_| FheType::encrypt(rng.gen::<u64>(), client_key))
|
||||
.collect::<Vec<_>>();
|
||||
@@ -593,10 +612,9 @@ fn cuda_bench_transfer_throughput<FheType, F>(
|
||||
});
|
||||
});
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&bench_id,
|
||||
write_to_json::<u64, _>(
|
||||
&bench_spec,
|
||||
params,
|
||||
¶ms_name,
|
||||
"erc7984-transfer",
|
||||
&OperatorType::Atomic,
|
||||
64,
|
||||
@@ -606,11 +624,10 @@ fn cuda_bench_transfer_throughput<FheType, F>(
|
||||
|
||||
#[cfg(feature = "hpu")]
|
||||
fn hpu_bench_transfer_throughput<FheType, F>(
|
||||
group: &mut BenchmarkGroup<'_, WallTime>,
|
||||
group: &mut Criterion,
|
||||
client_key: &ClientKey,
|
||||
bench_name: &str,
|
||||
type_name: &str,
|
||||
fn_name: &str,
|
||||
fn_name: Erc7984,
|
||||
transfer_func: F,
|
||||
) where
|
||||
FheType: FheEncrypt<u64, ClientKey> + Send + Sync,
|
||||
@@ -622,12 +639,19 @@ fn hpu_bench_transfer_throughput<FheType, F>(
|
||||
let params = client_key.computation_parameters();
|
||||
let params_name = params.name();
|
||||
|
||||
let mut group = group.benchmark_group(type_name);
|
||||
for num_elems in [10, 100] {
|
||||
group.throughput(Throughput::Elements(num_elems));
|
||||
let bench_id = format!(
|
||||
"{bench_name}::throughput::{fn_name}::{params_name}::{type_name}::{num_elems}_elems"
|
||||
let bench_spec = BenchmarkSpec::new_hlapi_erc7984(
|
||||
fn_name,
|
||||
¶ms_name,
|
||||
&OperandType::CipherText,
|
||||
Some(type_name),
|
||||
BenchmarkMetric::Throughput,
|
||||
bench_backend_from_cfg(),
|
||||
Some(num_elems.try_into().unwrap()),
|
||||
);
|
||||
group.bench_with_input(&bench_id, &num_elems, |b, &num_elems| {
|
||||
group.bench_with_input(bench_spec.to_string(), &num_elems, |b, &num_elems| {
|
||||
let from_amounts = (0..num_elems)
|
||||
.map(|_| FheType::encrypt(rng.gen::<u64>(), client_key))
|
||||
.collect::<Vec<_>>();
|
||||
@@ -657,10 +681,9 @@ fn hpu_bench_transfer_throughput<FheType, F>(
|
||||
});
|
||||
});
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&bench_id,
|
||||
write_to_json::<u64, _>(
|
||||
&bench_spec,
|
||||
params,
|
||||
¶ms_name,
|
||||
"erc7984-transfer",
|
||||
&OperatorType::Atomic,
|
||||
64,
|
||||
@@ -671,11 +694,10 @@ fn hpu_bench_transfer_throughput<FheType, F>(
|
||||
|
||||
#[cfg(feature = "hpu")]
|
||||
fn hpu_bench_transfer_throughput_simd<FheType, F>(
|
||||
group: &mut BenchmarkGroup<'_, WallTime>,
|
||||
group: &mut Criterion,
|
||||
client_key: &ClientKey,
|
||||
bench_name: &str,
|
||||
type_name: &str,
|
||||
fn_name: &str,
|
||||
fn_name: Erc7984,
|
||||
transfer_func: F,
|
||||
) where
|
||||
FheType: FheEncrypt<u64, ClientKey> + Send + Sync,
|
||||
@@ -698,9 +720,16 @@ fn hpu_bench_transfer_throughput_simd<FheType, F>(
|
||||
for num_elems in [2, 8] {
|
||||
let real_num_elems = num_elems * (hpu_simd_n as u64);
|
||||
group.throughput(Throughput::Elements(real_num_elems));
|
||||
let bench_id =
|
||||
format!("{bench_name}::throughput::{fn_name}::{params_name}::{type_name}::{real_num_elems}_elems");
|
||||
group.bench_with_input(&bench_id, &num_elems, |b, &num_elems| {
|
||||
let bench_spec = BenchmarkSpec::new_hlapi_erc7984(
|
||||
fn_name,
|
||||
¶ms_name,
|
||||
&OperandType::CipherText,
|
||||
Some(type_name),
|
||||
BenchmarkMetric::Throughput,
|
||||
bench_backend_from_cfg(),
|
||||
Some(real_num_elems.try_into().unwrap()),
|
||||
);
|
||||
group.bench_with_input(bench_spec.to_string(), &num_elems, |b, &num_elems| {
|
||||
let from_amounts = (0..num_elems)
|
||||
.map(|_| {
|
||||
(0..hpu_simd_n)
|
||||
@@ -742,11 +771,10 @@ fn hpu_bench_transfer_throughput_simd<FheType, F>(
|
||||
});
|
||||
});
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&bench_id,
|
||||
write_to_json::<u64, _>(
|
||||
&bench_spec,
|
||||
params,
|
||||
¶ms_name,
|
||||
"erc7984-simd-ransfer",
|
||||
"erc7984-simd-transfer",
|
||||
&OperatorType::Atomic,
|
||||
64,
|
||||
vec![],
|
||||
@@ -769,8 +797,6 @@ fn main() {
|
||||
|
||||
let mut c = Criterion::default().sample_size(10).configure_from_args();
|
||||
|
||||
let bench_name = "hlapi::erc7984";
|
||||
|
||||
// FheUint64 PBS counts
|
||||
// We don't run multiple times since every input is encrypted
|
||||
// PBS count is always the same
|
||||
@@ -780,99 +806,90 @@ fn main() {
|
||||
print_transfer_pbs_counts(
|
||||
&cks,
|
||||
"FheUint64",
|
||||
"transfer::whitepaper",
|
||||
Erc7984::Transfer(TransferFlavor::Whitepaper),
|
||||
par_transfer_whitepaper::<FheUint64>,
|
||||
);
|
||||
print_transfer_pbs_counts(
|
||||
&cks,
|
||||
"FheUint64",
|
||||
"no_cmux",
|
||||
Erc7984::Transfer(TransferFlavor::NoCmux),
|
||||
par_transfer_no_cmux::<FheUint64>,
|
||||
);
|
||||
print_transfer_pbs_counts(
|
||||
&cks,
|
||||
"FheUint64",
|
||||
"transfer::overflow",
|
||||
Erc7984::Transfer(TransferFlavor::Overflow),
|
||||
par_transfer_overflow::<FheUint64>,
|
||||
);
|
||||
print_transfer_pbs_counts(&cks, "FheUint64", "safe", par_transfer_safe::<FheUint64>);
|
||||
print_transfer_pbs_counts(
|
||||
&cks,
|
||||
"FheUint64",
|
||||
Erc7984::Transfer(TransferFlavor::Safe),
|
||||
par_transfer_safe::<FheUint64>,
|
||||
);
|
||||
}
|
||||
|
||||
match get_bench_type() {
|
||||
BenchmarkType::Latency => {
|
||||
let mut group = c.benchmark_group(bench_name);
|
||||
bench_transfer_latency(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"transfer::whitepaper",
|
||||
Erc7984::Transfer(TransferFlavor::Whitepaper),
|
||||
par_transfer_whitepaper::<FheUint64>,
|
||||
);
|
||||
bench_transfer_latency(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"transfer::no_cmux",
|
||||
Erc7984::Transfer(TransferFlavor::NoCmux),
|
||||
par_transfer_no_cmux::<FheUint64>,
|
||||
);
|
||||
bench_transfer_latency(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"transfer::overflow",
|
||||
Erc7984::Transfer(TransferFlavor::Overflow),
|
||||
par_transfer_overflow::<FheUint64>,
|
||||
);
|
||||
bench_transfer_latency(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"transfer::safe",
|
||||
Erc7984::Transfer(TransferFlavor::Safe),
|
||||
par_transfer_safe::<FheUint64>,
|
||||
);
|
||||
|
||||
group.finish();
|
||||
}
|
||||
|
||||
BenchmarkType::Throughput => {
|
||||
let mut group = c.benchmark_group(bench_name);
|
||||
bench_transfer_throughput(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"transfer::whitepaper",
|
||||
Erc7984::Transfer(TransferFlavor::Whitepaper),
|
||||
par_transfer_whitepaper::<FheUint64>,
|
||||
);
|
||||
bench_transfer_throughput(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"transfer::no_cmux",
|
||||
Erc7984::Transfer(TransferFlavor::NoCmux),
|
||||
par_transfer_no_cmux::<FheUint64>,
|
||||
);
|
||||
bench_transfer_throughput(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"transfer::overflow",
|
||||
Erc7984::Transfer(TransferFlavor::Overflow),
|
||||
par_transfer_overflow::<FheUint64>,
|
||||
);
|
||||
bench_transfer_throughput(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"transfer::safe",
|
||||
Erc7984::Transfer(TransferFlavor::Safe),
|
||||
par_transfer_safe::<FheUint64>,
|
||||
);
|
||||
|
||||
group.finish();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -896,8 +913,6 @@ fn main() {
|
||||
|
||||
let mut c = Criterion::default().sample_size(10).configure_from_args();
|
||||
|
||||
let bench_name = "hlapi::cuda::erc7984";
|
||||
|
||||
// FheUint64 PBS counts
|
||||
// We don't run multiple times since every input is encrypted
|
||||
// PBS count is always the same
|
||||
@@ -907,98 +922,90 @@ fn main() {
|
||||
print_transfer_pbs_counts(
|
||||
&cks,
|
||||
"FheUint64",
|
||||
"transfer::whitepaper",
|
||||
Erc7984::Transfer(TransferFlavor::Whitepaper),
|
||||
par_transfer_whitepaper::<FheUint64>,
|
||||
);
|
||||
print_transfer_pbs_counts(
|
||||
&cks,
|
||||
"FheUint64",
|
||||
"no_cmux",
|
||||
Erc7984::Transfer(TransferFlavor::NoCmux),
|
||||
par_transfer_no_cmux::<FheUint64>,
|
||||
);
|
||||
print_transfer_pbs_counts(
|
||||
&cks,
|
||||
"FheUint64",
|
||||
"transfer::overflow",
|
||||
Erc7984::Transfer(TransferFlavor::Overflow),
|
||||
par_transfer_overflow::<FheUint64>,
|
||||
);
|
||||
print_transfer_pbs_counts(&cks, "FheUint64", "safe", par_transfer_safe::<FheUint64>);
|
||||
print_transfer_pbs_counts(
|
||||
&cks,
|
||||
"FheUint64",
|
||||
Erc7984::Transfer(TransferFlavor::Safe),
|
||||
par_transfer_safe::<FheUint64>,
|
||||
);
|
||||
}
|
||||
|
||||
match get_bench_type() {
|
||||
BenchmarkType::Latency => {
|
||||
let mut group = c.benchmark_group(bench_name);
|
||||
bench_transfer_latency(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"transfer::whitepaper",
|
||||
Erc7984::Transfer(TransferFlavor::Whitepaper),
|
||||
par_transfer_whitepaper::<FheUint64>,
|
||||
);
|
||||
bench_transfer_latency(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"transfer::no_cmux",
|
||||
Erc7984::Transfer(TransferFlavor::NoCmux),
|
||||
par_transfer_no_cmux::<FheUint64>,
|
||||
);
|
||||
bench_transfer_latency(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"transfer::overflow",
|
||||
Erc7984::Transfer(TransferFlavor::Overflow),
|
||||
par_transfer_overflow::<FheUint64>,
|
||||
);
|
||||
bench_transfer_latency(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"transfer::safe",
|
||||
Erc7984::Transfer(TransferFlavor::Safe),
|
||||
par_transfer_safe::<FheUint64>,
|
||||
);
|
||||
|
||||
group.finish();
|
||||
}
|
||||
|
||||
BenchmarkType::Throughput => {
|
||||
let mut group = c.benchmark_group(bench_name);
|
||||
cuda_bench_transfer_throughput(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"transfer::whitepaper",
|
||||
Erc7984::Transfer(TransferFlavor::Whitepaper),
|
||||
transfer_whitepaper::<FheUint64>,
|
||||
);
|
||||
cuda_bench_transfer_throughput(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"transfer::no_cmux",
|
||||
Erc7984::Transfer(TransferFlavor::NoCmux),
|
||||
transfer_no_cmux::<FheUint64>,
|
||||
);
|
||||
cuda_bench_transfer_throughput(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"transfer::overflow",
|
||||
Erc7984::Transfer(TransferFlavor::Overflow),
|
||||
transfer_overflow::<FheUint64>,
|
||||
);
|
||||
cuda_bench_transfer_throughput(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"transfer::safe",
|
||||
Erc7984::Transfer(TransferFlavor::Safe),
|
||||
transfer_safe::<FheUint64>,
|
||||
);
|
||||
group.finish();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1027,69 +1034,57 @@ fn main() {
|
||||
|
||||
let mut c = Criterion::default().sample_size(10).configure_from_args();
|
||||
|
||||
let bench_name = "hlapi::hpu::erc7984";
|
||||
|
||||
match get_bench_type() {
|
||||
BenchmarkType::Latency => {
|
||||
let mut group = c.benchmark_group(bench_name);
|
||||
bench_transfer_latency(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"transfer::whitepaper",
|
||||
Erc7984::Transfer(TransferFlavor::Whitepaper),
|
||||
transfer_whitepaper::<FheUint64>,
|
||||
);
|
||||
// Erc7984 optimized instruction only available on Hpu
|
||||
bench_transfer_latency(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"transfer::hpu_optim",
|
||||
Erc7984::Transfer(TransferFlavor::HpuOptim),
|
||||
transfer_hpu::<FheUint64>,
|
||||
);
|
||||
// Erc7984 SIMD instruction only available on Hpu
|
||||
bench_transfer_latency_simd(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"transfer::hpu_simd",
|
||||
Erc7984::Transfer(TransferFlavor::HpuSimd),
|
||||
transfer_hpu_simd::<FheUint64>,
|
||||
);
|
||||
group.finish();
|
||||
}
|
||||
|
||||
BenchmarkType::Throughput => {
|
||||
let mut group = c.benchmark_group(bench_name);
|
||||
hpu_bench_transfer_throughput(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"transfer::whitepaper",
|
||||
Erc7984::Transfer(TransferFlavor::Whitepaper),
|
||||
transfer_whitepaper::<FheUint64>,
|
||||
);
|
||||
// Erc7984 optimized instruction only available on Hpu
|
||||
hpu_bench_transfer_throughput(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"transfer::hpu_optim",
|
||||
Erc7984::Transfer(TransferFlavor::HpuOptim),
|
||||
transfer_hpu::<FheUint64>,
|
||||
);
|
||||
// Erc7984 SIMD instruction only available on Hpu
|
||||
hpu_bench_transfer_throughput_simd(
|
||||
&mut group,
|
||||
&mut c,
|
||||
&cks,
|
||||
bench_name,
|
||||
"FheUint64",
|
||||
"transfer::hpu_simd",
|
||||
Erc7984::Transfer(TransferFlavor::HpuSimd),
|
||||
transfer_hpu_simd::<FheUint64>,
|
||||
);
|
||||
group.finish();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ use rayon::prelude::*;
|
||||
#[cfg(any(feature = "gpu", feature = "hpu"))]
|
||||
use std::cmp::max;
|
||||
use tfhe::integer::keycache::KEY_CACHE;
|
||||
use tfhe::integer::oprf::{OprfPrivateKey, OprfServerKey};
|
||||
use tfhe::integer::IntegerKeyKind;
|
||||
use tfhe::keycache::NamedParam;
|
||||
#[cfg(any(feature = "gpu", feature = "hpu"))]
|
||||
@@ -36,42 +35,32 @@ pub fn unsigned_oprf(c: &mut Criterion) {
|
||||
format!("{bench_name}_bounded::{param_name}::{bit_size}_bits");
|
||||
|
||||
bench_group.bench_function(&bench_id_oprf, |b| {
|
||||
let (cks, sks) = KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix);
|
||||
let oprf_pk = OprfPrivateKey::new(&cks);
|
||||
let oprf_sk = OprfServerKey::new(&oprf_pk, &cks).unwrap();
|
||||
let (_, sk) = KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix);
|
||||
|
||||
b.iter(|| {
|
||||
_ = black_box(
|
||||
oprf_sk.par_generate_oblivious_pseudo_random_unsigned_integer(
|
||||
Seed(0),
|
||||
num_block as u64,
|
||||
&sks,
|
||||
),
|
||||
);
|
||||
_ = black_box(sk.par_generate_oblivious_pseudo_random_unsigned_integer(
|
||||
Seed(0),
|
||||
num_block as u64,
|
||||
));
|
||||
})
|
||||
});
|
||||
|
||||
bench_group.bench_function(&bench_id_oprf_bounded, |b| {
|
||||
let (cks, sks) = KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix);
|
||||
let oprf_pk = OprfPrivateKey::new(&cks);
|
||||
let oprf_sk = OprfServerKey::new(&oprf_pk, &cks).unwrap();
|
||||
let (_, sk) = KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix);
|
||||
|
||||
b.iter(|| {
|
||||
_ = black_box(
|
||||
oprf_sk.par_generate_oblivious_pseudo_random_unsigned_integer_bounded(
|
||||
sk.par_generate_oblivious_pseudo_random_unsigned_integer_bounded(
|
||||
Seed(0),
|
||||
bit_size as u64,
|
||||
num_block as u64,
|
||||
&sks,
|
||||
),
|
||||
);
|
||||
})
|
||||
});
|
||||
}
|
||||
BenchmarkType::Throughput => {
|
||||
let (cks, sks) = KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix);
|
||||
let oprf_pk = OprfPrivateKey::new(&cks);
|
||||
let oprf_sk = OprfServerKey::new(&oprf_pk, &cks).unwrap();
|
||||
let (_, sk) = KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix);
|
||||
|
||||
bench_id_oprf = format!("{bench_name}::throughput::{param_name}::{bit_size}_bits");
|
||||
bench_id_oprf_bounded =
|
||||
@@ -82,11 +71,10 @@ pub fn unsigned_oprf(c: &mut Criterion) {
|
||||
{
|
||||
// Execute the operation once to know its cost.
|
||||
reset_pbs_count();
|
||||
oprf_sk.par_generate_oblivious_pseudo_random_unsigned_integer_bounded(
|
||||
sk.par_generate_oblivious_pseudo_random_unsigned_integer_bounded(
|
||||
Seed(0),
|
||||
bit_size as u64,
|
||||
num_block as u64,
|
||||
&sks,
|
||||
);
|
||||
let pbs_count = max(get_pbs_count(), 1);
|
||||
throughput_num_threads(num_block, pbs_count)
|
||||
@@ -97,13 +85,11 @@ pub fn unsigned_oprf(c: &mut Criterion) {
|
||||
let setup = |_batch_size: usize| ();
|
||||
let run = |_: &mut (), batch_size: usize| {
|
||||
(0..batch_size).into_par_iter().for_each(|_| {
|
||||
oprf_sk
|
||||
.par_generate_oblivious_pseudo_random_unsigned_integer_bounded(
|
||||
Seed(0),
|
||||
bit_size as u64,
|
||||
num_block as u64,
|
||||
&sks,
|
||||
);
|
||||
sk.par_generate_oblivious_pseudo_random_unsigned_integer_bounded(
|
||||
Seed(0),
|
||||
bit_size as u64,
|
||||
num_block as u64,
|
||||
);
|
||||
});
|
||||
};
|
||||
find_optimal_batch(run, setup) as u64
|
||||
@@ -114,10 +100,9 @@ pub fn unsigned_oprf(c: &mut Criterion) {
|
||||
bench_group.bench_function(&bench_id_oprf, |b| {
|
||||
b.iter(|| {
|
||||
(0..elements).into_par_iter().for_each(|_| {
|
||||
oprf_sk.par_generate_oblivious_pseudo_random_unsigned_integer(
|
||||
sk.par_generate_oblivious_pseudo_random_unsigned_integer(
|
||||
Seed(0),
|
||||
num_block as u64,
|
||||
&sks,
|
||||
);
|
||||
})
|
||||
})
|
||||
@@ -126,11 +111,10 @@ pub fn unsigned_oprf(c: &mut Criterion) {
|
||||
bench_group.bench_function(&bench_id_oprf_bounded, |b| {
|
||||
b.iter(|| {
|
||||
(0..elements).into_par_iter().for_each(|_| {
|
||||
oprf_sk.par_generate_oblivious_pseudo_random_unsigned_integer_bounded(
|
||||
sk.par_generate_oblivious_pseudo_random_unsigned_integer_bounded(
|
||||
Seed(0),
|
||||
bit_size as u64,
|
||||
num_block as u64,
|
||||
&sks,
|
||||
);
|
||||
})
|
||||
})
|
||||
@@ -164,8 +148,6 @@ pub mod cuda {
|
||||
use criterion::black_box;
|
||||
use tfhe::core_crypto::gpu::{get_number_of_gpus, CudaStreams};
|
||||
use tfhe::integer::gpu::server_key::CudaServerKey;
|
||||
use tfhe::integer::gpu::CudaOprfServerKey;
|
||||
use tfhe::integer::oprf::{CompressedOprfServerKey, OprfPrivateKey};
|
||||
use tfhe::GpuIndex;
|
||||
use tfhe_csprng::seeders::Seed;
|
||||
|
||||
@@ -195,18 +177,12 @@ pub mod cuda {
|
||||
let (cks, _cpu_sks) =
|
||||
KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix);
|
||||
let gpu_sks = CudaServerKey::new(&cks, &streams);
|
||||
let oprf_pk = OprfPrivateKey::new(&cks);
|
||||
let compressed_oprf_sk =
|
||||
CompressedOprfServerKey::new(&oprf_pk, &cks).unwrap();
|
||||
let cuda_oprf_sk =
|
||||
CudaOprfServerKey::decompress_from_cpu(&compressed_oprf_sk, &streams);
|
||||
|
||||
b.iter(|| {
|
||||
_ = black_box(
|
||||
cuda_oprf_sk.par_generate_oblivious_pseudo_random_unsigned_integer(
|
||||
gpu_sks.par_generate_oblivious_pseudo_random_unsigned_integer(
|
||||
Seed(0),
|
||||
num_block as u64,
|
||||
&gpu_sks,
|
||||
&streams,
|
||||
),
|
||||
);
|
||||
@@ -217,20 +193,14 @@ pub mod cuda {
|
||||
let (cks, _cpu_sks) =
|
||||
KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix);
|
||||
let gpu_sks = CudaServerKey::new(&cks, &streams);
|
||||
let oprf_pk = OprfPrivateKey::new(&cks);
|
||||
let compressed_oprf_sk =
|
||||
CompressedOprfServerKey::new(&oprf_pk, &cks).unwrap();
|
||||
let cuda_oprf_sk =
|
||||
CudaOprfServerKey::decompress_from_cpu(&compressed_oprf_sk, &streams);
|
||||
|
||||
b.iter(|| {
|
||||
_ = black_box(
|
||||
cuda_oprf_sk
|
||||
gpu_sks
|
||||
.par_generate_oblivious_pseudo_random_unsigned_integer_bounded(
|
||||
Seed(0),
|
||||
bit_size as u64,
|
||||
num_block as u64,
|
||||
&gpu_sks,
|
||||
&streams,
|
||||
),
|
||||
);
|
||||
@@ -240,25 +210,13 @@ pub mod cuda {
|
||||
BenchmarkType::Throughput => {
|
||||
let (cks, cpu_sks) = KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix);
|
||||
let gpu_sks_vec = cuda_local_keys(&cks);
|
||||
let cpu_oprf_pk = OprfPrivateKey::new(&cks);
|
||||
let cpu_oprf_sk = OprfServerKey::new(&cpu_oprf_pk, &cks).unwrap();
|
||||
let compressed_oprf_sk =
|
||||
CompressedOprfServerKey::new(&cpu_oprf_pk, &cks).unwrap();
|
||||
// One CudaOprfServerKey per GPU, matching `gpu_sks_vec`.
|
||||
let cuda_oprf_sks_vec: Vec<CudaOprfServerKey> = (0..get_number_of_gpus())
|
||||
.map(|gpu_index| {
|
||||
let stream = CudaStreams::new_single_gpu(GpuIndex::new(gpu_index));
|
||||
CudaOprfServerKey::decompress_from_cpu(&compressed_oprf_sk, &stream)
|
||||
})
|
||||
.collect();
|
||||
|
||||
// Execute the operation once to know its cost.
|
||||
reset_pbs_count();
|
||||
cpu_oprf_sk.par_generate_oblivious_pseudo_random_unsigned_integer_bounded(
|
||||
cpu_sks.par_generate_oblivious_pseudo_random_unsigned_integer_bounded(
|
||||
Seed(0),
|
||||
bit_size as u64,
|
||||
num_block as u64,
|
||||
&cpu_sks,
|
||||
);
|
||||
let pbs_count = max(get_pbs_count(), 1); // Operation might not perform any PBS, so we take 1 as default
|
||||
|
||||
@@ -274,11 +232,10 @@ pub mod cuda {
|
||||
(0..elements).into_par_iter().for_each(|i| {
|
||||
let gpu_index: u32 = i as u32 % get_number_of_gpus();
|
||||
let stream = CudaStreams::new_single_gpu(GpuIndex::new(gpu_index));
|
||||
cuda_oprf_sks_vec[gpu_index as usize]
|
||||
gpu_sks_vec[gpu_index as usize]
|
||||
.par_generate_oblivious_pseudo_random_unsigned_integer(
|
||||
Seed(0),
|
||||
num_block as u64,
|
||||
&gpu_sks_vec[gpu_index as usize],
|
||||
&stream,
|
||||
);
|
||||
})
|
||||
@@ -290,12 +247,11 @@ pub mod cuda {
|
||||
(0..elements).into_par_iter().for_each(|i| {
|
||||
let gpu_index: u32 = i as u32 % get_number_of_gpus();
|
||||
let stream = CudaStreams::new_single_gpu(GpuIndex::new(gpu_index));
|
||||
cuda_oprf_sks_vec[gpu_index as usize]
|
||||
gpu_sks_vec[gpu_index as usize]
|
||||
.par_generate_oblivious_pseudo_random_unsigned_integer_bounded(
|
||||
Seed(0),
|
||||
bit_size as u64,
|
||||
num_block as u64,
|
||||
&gpu_sks_vec[gpu_index as usize],
|
||||
&stream,
|
||||
);
|
||||
})
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
use benchmark::params_aliases::*;
|
||||
use benchmark::utilities::{throughput_num_threads, write_to_json_unchecked, OperatorType};
|
||||
use benchmark_spec::{get_bench_type, BenchmarkType};
|
||||
use benchmark_spec::{get_bench_type, BenchmarkType, TestResult};
|
||||
use criterion::{criterion_group, Criterion, Throughput};
|
||||
use rand::prelude::*;
|
||||
use rayon::prelude::*;
|
||||
use std::env;
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
use tfhe::core_crypto::prelude::LweCiphertextCount;
|
||||
use tfhe::integer::key_switching_key::KeySwitchingKey;
|
||||
@@ -61,12 +59,6 @@ fn compute_load_config() -> Vec<ZkComputeLoad> {
|
||||
conf
|
||||
}
|
||||
|
||||
fn write_result(file: &mut File, name: &str, value: usize) {
|
||||
let line = format!("{name},{value}\n");
|
||||
let error_message = format!("cannot write {name} result into file");
|
||||
file.write_all(line.as_bytes()).expect(&error_message);
|
||||
}
|
||||
|
||||
fn zk_throughput_num_elements() -> u64 {
|
||||
// Zk verify uses pools of 32 threads for a single verification
|
||||
let pool_size = 32;
|
||||
@@ -217,11 +209,7 @@ fn cpu_pke_zk_verify(c: &mut Criterion, results_file: &Path) {
|
||||
.sample_size(15)
|
||||
.measurement_time(std::time::Duration::from_secs(60));
|
||||
|
||||
File::create(results_file).expect("create results file failed");
|
||||
let mut file = OpenOptions::new()
|
||||
.append(true)
|
||||
.open(results_file)
|
||||
.expect("cannot open results file");
|
||||
let mut benchmark_test_result = TestResult::from_path(results_file);
|
||||
|
||||
for (param_pke, param_casting, param_fhe) in [(
|
||||
BENCH_PARAM_PKE_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M128,
|
||||
@@ -271,7 +259,8 @@ fn cpu_pke_zk_verify(c: &mut Criterion, results_file: &Path) {
|
||||
let test_name =
|
||||
format!("zk::crs_sizes::{param_name}::{bits}_bits_packed_ZK{zk_vers:?}");
|
||||
|
||||
write_result(&mut file, &test_name, crs_data.len());
|
||||
benchmark_test_result.write_result(&test_name, crs_data.len());
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&test_name,
|
||||
shortint_params,
|
||||
@@ -321,11 +310,9 @@ fn cpu_pke_zk_verify(c: &mut Criterion, results_file: &Path) {
|
||||
"zk::proven_list_size::{param_name}::{bits}_bits_packed_{crs_size}_bits_crs_{zk_load}_ZK{zk_vers:?}"
|
||||
);
|
||||
|
||||
write_result(
|
||||
&mut file,
|
||||
&test_name,
|
||||
proven_ciphertext_list_serialized.len(),
|
||||
);
|
||||
benchmark_test_result
|
||||
.write_result(&test_name, proven_ciphertext_list_serialized.len());
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&test_name,
|
||||
shortint_params,
|
||||
@@ -342,7 +329,8 @@ fn cpu_pke_zk_verify(c: &mut Criterion, results_file: &Path) {
|
||||
let test_name =
|
||||
format!("zk::proof_sizes::{param_name}::{bits}_bits_packed_{crs_size}_bits_crs_{zk_load}_ZK{zk_vers:?}");
|
||||
|
||||
write_result(&mut file, &test_name, proof_size);
|
||||
benchmark_test_result.write_result(&test_name, proof_size);
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&test_name,
|
||||
shortint_params,
|
||||
@@ -522,11 +510,7 @@ mod cuda {
|
||||
.sample_size(15)
|
||||
.measurement_time(std::time::Duration::from_secs(60));
|
||||
|
||||
File::create(results_file).expect("create results file failed");
|
||||
let mut file = OpenOptions::new()
|
||||
.append(true)
|
||||
.open(results_file)
|
||||
.expect("cannot open results file");
|
||||
let mut benchmark_test_result = TestResult::from_path(results_file);
|
||||
|
||||
let (param_pke, param_ksk, param_fhe): (
|
||||
CompactPublicKeyEncryptionParameters,
|
||||
@@ -590,7 +574,7 @@ mod cuda {
|
||||
let test_name =
|
||||
format!("zk::crs_sizes::{param_name}::{bits}_bits_packed_ZK{zk_vers:?}");
|
||||
|
||||
write_result(&mut file, &test_name, crs_data.len());
|
||||
benchmark_test_result.write_result(&test_name, crs_data.len());
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&test_name,
|
||||
param_fhe,
|
||||
@@ -660,11 +644,8 @@ mod cuda {
|
||||
"zk::proven_list_size::{param_name}::{bits}_bits_packed_{crs_size}_bits_crs_{zk_load}_ZK{zk_vers:?}"
|
||||
);
|
||||
|
||||
write_result(
|
||||
&mut file,
|
||||
&test_name,
|
||||
proven_ciphertext_list_serialized.len(),
|
||||
);
|
||||
benchmark_test_result
|
||||
.write_result(&test_name, proven_ciphertext_list_serialized.len());
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&test_name,
|
||||
param_fhe,
|
||||
@@ -681,7 +662,7 @@ mod cuda {
|
||||
let test_name =
|
||||
format!("zk::proof_sizes::{param_name}::{bits}_bits_packed_{crs_size}_bits_crs_{zk_load}_ZK{zk_vers:?}");
|
||||
|
||||
write_result(&mut file, &test_name, proof_size);
|
||||
benchmark_test_result.write_result(&test_name, proof_size);
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&test_name,
|
||||
param_fhe,
|
||||
|
||||
@@ -2,7 +2,6 @@ use benchmark::params_aliases::*;
|
||||
use criterion::{black_box, criterion_group, Criterion};
|
||||
use tfhe::keycache::NamedParam;
|
||||
use tfhe::shortint::keycache::KEY_CACHE;
|
||||
use tfhe::shortint::oprf::{OprfPrivateKey, OprfServerKey};
|
||||
use tfhe_csprng::seeders::Seed;
|
||||
|
||||
fn oprf(c: &mut Criterion) {
|
||||
@@ -13,15 +12,11 @@ fn oprf(c: &mut Criterion) {
|
||||
let param = BENCH_PARAM_MESSAGE_2_CARRY_2_KS_PBS;
|
||||
|
||||
let keys = KEY_CACHE.get_from_param(param);
|
||||
let cks = keys.client_key();
|
||||
let sks = keys.server_key();
|
||||
|
||||
let oprf_pk = OprfPrivateKey::new(cks);
|
||||
let oprf_sk = OprfServerKey::new(&oprf_pk, cks).unwrap();
|
||||
|
||||
bench_group.bench_function(format!("2-bits-oprf::{}", param.name()), |b| {
|
||||
b.iter(|| {
|
||||
_ = black_box(oprf_sk.generate_oblivious_pseudo_random(Seed(0), 2, sks));
|
||||
_ = black_box(sks.generate_oblivious_pseudo_random(Seed(0), 2));
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,26 +1,16 @@
|
||||
use benchmark::utilities::{write_to_json_unchecked, OperatorType};
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io::Write;
|
||||
use benchmark_spec::TestResult;
|
||||
use std::path::Path;
|
||||
use tfhe::boolean::parameters::{DEFAULT_PARAMETERS, PARAMETERS_ERROR_PROB_2_POW_MINUS_165};
|
||||
use tfhe::boolean::{client_key, server_key};
|
||||
|
||||
fn write_result(file: &mut File, name: &str, value: usize) {
|
||||
let line = format!("{name},{value}\n");
|
||||
let error_message = format!("cannot write {name} result into file");
|
||||
file.write_all(line.as_bytes()).expect(&error_message);
|
||||
}
|
||||
|
||||
fn client_server_key_sizes(results_file: &Path) {
|
||||
let boolean_params_vec = [
|
||||
(DEFAULT_PARAMETERS, "DEFAULT_PARAMETERS"),
|
||||
(PARAMETERS_ERROR_PROB_2_POW_MINUS_165, "TFHE_LIB_PARAMETERS"),
|
||||
];
|
||||
File::create(results_file).expect("create results file failed");
|
||||
let mut file = OpenOptions::new()
|
||||
.append(true)
|
||||
.open(results_file)
|
||||
.expect("cannot open results file");
|
||||
|
||||
let mut benchmark_test_result = TestResult::from_path(results_file);
|
||||
|
||||
let operator = OperatorType::Atomic;
|
||||
|
||||
@@ -38,7 +28,7 @@ fn client_server_key_sizes(results_file: &Path) {
|
||||
let ksk_size = sks.key_switching_key_size_bytes();
|
||||
let test_name = format!("boolean_key_sizes_{params_name}_ksk");
|
||||
|
||||
write_result(&mut file, &test_name, ksk_size);
|
||||
benchmark_test_result.write_result(&test_name, ksk_size);
|
||||
write_to_json_unchecked::<u32, _>(
|
||||
&test_name,
|
||||
*params,
|
||||
@@ -58,7 +48,7 @@ fn client_server_key_sizes(results_file: &Path) {
|
||||
let bsk_size = sks.bootstrapping_key_size_bytes();
|
||||
let test_name = format!("boolean_key_sizes_{params_name}_bsk");
|
||||
|
||||
write_result(&mut file, &test_name, bsk_size);
|
||||
benchmark_test_result.write_result(&test_name, bsk_size);
|
||||
write_to_json_unchecked::<u32, _>(
|
||||
&test_name,
|
||||
*params,
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
use benchmark::params::{get_classical_tuniform_groups, get_multi_bit_tuniform_groups};
|
||||
use benchmark::params_aliases::*;
|
||||
use benchmark::utilities::{write_to_json_unchecked, OperatorType};
|
||||
use benchmark_spec::TestResult;
|
||||
use rand::Rng;
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
use tfhe::integer::U256;
|
||||
use tfhe::keycache::NamedParam;
|
||||
@@ -15,22 +14,10 @@ use tfhe::{
|
||||
CompressedSquashedNoiseCiphertextList, ConfigBuilder, FheUint64,
|
||||
};
|
||||
|
||||
fn write_result(file: &mut File, name: &str, value: usize) {
|
||||
let line = format!("{name},{value}\n");
|
||||
let error_message = format!("cannot write {name} result into file");
|
||||
file.write_all(line.as_bytes()).expect(&error_message);
|
||||
}
|
||||
|
||||
pub fn ct_sizes(results_file: &Path) {
|
||||
let mut rng = rand::thread_rng();
|
||||
|
||||
File::create(results_file).expect("create results file failed");
|
||||
let mut file = OpenOptions::new()
|
||||
.create(true)
|
||||
.truncate(true)
|
||||
.write(true)
|
||||
.open(results_file)
|
||||
.expect("cannot open results file");
|
||||
let mut benchmark_test_result = TestResult::from_path(results_file);
|
||||
|
||||
let operator = OperatorType::Atomic;
|
||||
|
||||
@@ -87,7 +74,7 @@ pub fn ct_sizes(results_file: &Path) {
|
||||
let params_record = param_fhe;
|
||||
|
||||
let mut write_and_record_result = |res: usize, test_name: &str, display_name: &str| {
|
||||
write_result(&mut file, test_name, res);
|
||||
benchmark_test_result.write_result(test_name, res);
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
test_name,
|
||||
params_record,
|
||||
@@ -174,13 +161,7 @@ pub fn cpk_and_cctl_sizes(results_file: &Path) {
|
||||
|
||||
let mut rng = rand::thread_rng();
|
||||
|
||||
File::create(results_file).expect("create results file failed");
|
||||
let mut file = OpenOptions::new()
|
||||
.create(true)
|
||||
.truncate(true)
|
||||
.write(true)
|
||||
.open(results_file)
|
||||
.expect("cannot open results file");
|
||||
let mut benchmark_test_result = TestResult::from_path(results_file);
|
||||
|
||||
let operator = OperatorType::Atomic;
|
||||
|
||||
@@ -205,7 +186,7 @@ pub fn cpk_and_cctl_sizes(results_file: &Path) {
|
||||
let cpk_size = bincode::serialize(&public_key).unwrap().len();
|
||||
|
||||
println!("PK size: {cpk_size} bytes");
|
||||
write_result(&mut file, &test_name, cpk_size);
|
||||
benchmark_test_result.write_result(&test_name, cpk_size);
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&test_name,
|
||||
params,
|
||||
@@ -227,7 +208,7 @@ pub fn cpk_and_cctl_sizes(results_file: &Path) {
|
||||
|
||||
println!("Compact CT list for {NB_CTXT} CTs: {cctl_size} bytes");
|
||||
|
||||
write_result(&mut file, &test_name, cctl_size);
|
||||
benchmark_test_result.write_result(&test_name, cctl_size);
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&test_name,
|
||||
params,
|
||||
@@ -273,7 +254,7 @@ pub fn cpk_and_cctl_sizes(results_file: &Path) {
|
||||
|
||||
println!("Compact CT list for {NB_CTXT} CTs: {cctl_size} bytes");
|
||||
|
||||
write_result(&mut file, &test_name, cctl_size);
|
||||
benchmark_test_result.write_result(&test_name, cctl_size);
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&test_name,
|
||||
params,
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
use benchmark::params::get_classical_tuniform_groups;
|
||||
use benchmark::params_aliases::*;
|
||||
use benchmark::utilities::{write_to_json_unchecked, CryptoParametersRecord, OperatorType};
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io::Write;
|
||||
use benchmark_spec::TestResult;
|
||||
use std::path::Path;
|
||||
use tfhe::keycache::NamedParam;
|
||||
use tfhe::shortint::atomic_pattern::compressed::CompressedAtomicPatternServerKey;
|
||||
@@ -18,12 +17,6 @@ use tfhe::shortint::{
|
||||
CompressedServerKey, PBSParameters, ServerKey,
|
||||
};
|
||||
|
||||
fn write_result(file: &mut File, name: &str, value: usize) {
|
||||
let line = format!("{name},{value}\n");
|
||||
let error_message = format!("cannot write {name} result into file");
|
||||
file.write_all(line.as_bytes()).expect(&error_message);
|
||||
}
|
||||
|
||||
fn client_server_key_sizes(results_file: &Path) {
|
||||
let shortint_params_vec: Vec<PBSParameters> = vec![
|
||||
BENCH_PARAM_MESSAGE_1_CARRY_1_KS_PBS_TUNIFORM_2M128.into(),
|
||||
@@ -59,11 +52,8 @@ fn client_server_key_sizes(results_file: &Path) {
|
||||
BENCH_PARAM_GPU_MULTI_BIT_GROUP_4_MESSAGE_3_CARRY_3_KS_PBS_TUNIFORM_2M128.into(),
|
||||
BENCH_PARAM_GPU_MULTI_BIT_GROUP_4_MESSAGE_4_CARRY_4_KS_PBS_TUNIFORM_2M128.into(),
|
||||
];
|
||||
File::create(results_file).expect("create results file failed");
|
||||
let mut file = OpenOptions::new()
|
||||
.append(true)
|
||||
.open(results_file)
|
||||
.expect("cannot open results file");
|
||||
|
||||
let mut benchmark_test_result = TestResult::from_path(results_file);
|
||||
|
||||
let operator = OperatorType::Atomic;
|
||||
|
||||
@@ -83,7 +73,8 @@ fn client_server_key_sizes(results_file: &Path) {
|
||||
let ksk_size = sks.key_switching_key_size_bytes();
|
||||
let test_name = format!("shortint_key_sizes_{}_ksk", params.name());
|
||||
|
||||
write_result(&mut file, &test_name, ksk_size);
|
||||
benchmark_test_result.write_result(&test_name, ksk_size);
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&test_name,
|
||||
params,
|
||||
@@ -103,7 +94,8 @@ fn client_server_key_sizes(results_file: &Path) {
|
||||
let bsk_size = sks.bootstrapping_key_size_bytes();
|
||||
let test_name = format!("shortint_key_sizes_{}_bsk", params.name());
|
||||
|
||||
write_result(&mut file, &test_name, bsk_size);
|
||||
benchmark_test_result.write_result(&test_name, bsk_size);
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&test_name,
|
||||
params,
|
||||
@@ -124,7 +116,8 @@ fn client_server_key_sizes(results_file: &Path) {
|
||||
let bsk_compressed_size = sks_compressed.bootstrapping_key_size_bytes();
|
||||
let test_name = format!("shortint_key_sizes_{}_bsk_compressed", params.name());
|
||||
|
||||
write_result(&mut file, &test_name, bsk_compressed_size);
|
||||
benchmark_test_result.write_result(&test_name, bsk_compressed_size);
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&test_name,
|
||||
params,
|
||||
@@ -152,12 +145,12 @@ fn measure_serialized_size<T: serde::Serialize, P: Into<CryptoParametersRecord<u
|
||||
param_name: &str,
|
||||
test_name_suffix: &str,
|
||||
display_name: &str,
|
||||
file: &mut File,
|
||||
file: &mut TestResult,
|
||||
) {
|
||||
let serialized = bincode::serialize(to_serialize).unwrap();
|
||||
let size = serialized.len();
|
||||
let test_name = format!("shortint_key_sizes_{param_name}_{test_name_suffix}");
|
||||
write_result(file, &test_name, size);
|
||||
file.write_result(&test_name, size);
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
&test_name,
|
||||
param.clone(),
|
||||
@@ -172,11 +165,7 @@ fn measure_serialized_size<T: serde::Serialize, P: Into<CryptoParametersRecord<u
|
||||
}
|
||||
|
||||
fn tuniform_key_set_sizes(results_file: &Path) {
|
||||
File::create(results_file).expect("create results file failed");
|
||||
let mut file = OpenOptions::new()
|
||||
.append(true)
|
||||
.open(results_file)
|
||||
.expect("cannot open results file");
|
||||
let mut benchmark_test_result = TestResult::from_path(results_file);
|
||||
|
||||
println!("Measuring shortint key sizes:");
|
||||
|
||||
@@ -200,7 +189,7 @@ fn tuniform_key_set_sizes(results_file: &Path) {
|
||||
¶m_fhe_name,
|
||||
"ksk",
|
||||
"KSK",
|
||||
&mut file,
|
||||
&mut benchmark_test_result,
|
||||
);
|
||||
measure_serialized_size(
|
||||
&ap.bootstrapping_key,
|
||||
@@ -208,7 +197,7 @@ fn tuniform_key_set_sizes(results_file: &Path) {
|
||||
¶m_fhe_name,
|
||||
"bsk",
|
||||
"BSK",
|
||||
&mut file,
|
||||
&mut benchmark_test_result,
|
||||
);
|
||||
}
|
||||
AtomicPatternServerKey::KeySwitch32(ap) => {
|
||||
@@ -218,7 +207,7 @@ fn tuniform_key_set_sizes(results_file: &Path) {
|
||||
¶m_fhe_name,
|
||||
"ksk",
|
||||
"KSK",
|
||||
&mut file,
|
||||
&mut benchmark_test_result,
|
||||
);
|
||||
measure_serialized_size(
|
||||
&ap.bootstrapping_key,
|
||||
@@ -226,7 +215,7 @@ fn tuniform_key_set_sizes(results_file: &Path) {
|
||||
¶m_fhe_name,
|
||||
"bsk",
|
||||
"BSK",
|
||||
&mut file,
|
||||
&mut benchmark_test_result,
|
||||
);
|
||||
}
|
||||
AtomicPatternServerKey::Dynamic(_) => panic!("Dynamic atomic pattern not supported"),
|
||||
@@ -240,7 +229,7 @@ fn tuniform_key_set_sizes(results_file: &Path) {
|
||||
¶m_fhe_name,
|
||||
"ksk_compressed",
|
||||
"KSK",
|
||||
&mut file,
|
||||
&mut benchmark_test_result,
|
||||
);
|
||||
measure_serialized_size(
|
||||
&comp_ap.bootstrapping_key(),
|
||||
@@ -248,7 +237,7 @@ fn tuniform_key_set_sizes(results_file: &Path) {
|
||||
¶m_fhe_name,
|
||||
"bsk_compressed",
|
||||
"BSK",
|
||||
&mut file,
|
||||
&mut benchmark_test_result,
|
||||
);
|
||||
}
|
||||
CompressedAtomicPatternServerKey::KeySwitch32(comp_ap) => {
|
||||
@@ -258,7 +247,7 @@ fn tuniform_key_set_sizes(results_file: &Path) {
|
||||
¶m_fhe_name,
|
||||
"ksk_compressed",
|
||||
"KSK",
|
||||
&mut file,
|
||||
&mut benchmark_test_result,
|
||||
);
|
||||
measure_serialized_size(
|
||||
&comp_ap.bootstrapping_key(),
|
||||
@@ -266,7 +255,7 @@ fn tuniform_key_set_sizes(results_file: &Path) {
|
||||
¶m_fhe_name,
|
||||
"bsk_compressed",
|
||||
"BSK",
|
||||
&mut file,
|
||||
&mut benchmark_test_result,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -278,14 +267,21 @@ fn tuniform_key_set_sizes(results_file: &Path) {
|
||||
let compressed_pk = CompressedCompactPublicKey::new(&compact_private_key);
|
||||
let pk = compressed_pk.decompress();
|
||||
|
||||
measure_serialized_size(&pk, pke_param, ¶m_pke_name, "cpk", "CPK", &mut file);
|
||||
measure_serialized_size(
|
||||
&pk,
|
||||
pke_param,
|
||||
¶m_pke_name,
|
||||
"cpk",
|
||||
"CPK",
|
||||
&mut benchmark_test_result,
|
||||
);
|
||||
measure_serialized_size(
|
||||
&compressed_pk,
|
||||
pke_param,
|
||||
¶m_pke_name,
|
||||
"cpk_compressed",
|
||||
"CPK",
|
||||
&mut file,
|
||||
&mut benchmark_test_result,
|
||||
);
|
||||
|
||||
let casting_param = dedicated_pke_params.ksk_params;
|
||||
@@ -303,7 +299,7 @@ fn tuniform_key_set_sizes(results_file: &Path) {
|
||||
¶m_casting_name,
|
||||
"casting_key",
|
||||
"CastKey",
|
||||
&mut file,
|
||||
&mut benchmark_test_result,
|
||||
);
|
||||
measure_serialized_size(
|
||||
&compressed_casting_key.into_raw_parts().0,
|
||||
@@ -311,7 +307,7 @@ fn tuniform_key_set_sizes(results_file: &Path) {
|
||||
¶m_casting_name,
|
||||
"casting_key_compressed",
|
||||
"CastKey",
|
||||
&mut file,
|
||||
&mut benchmark_test_result,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -329,7 +325,7 @@ fn tuniform_key_set_sizes(results_file: &Path) {
|
||||
¶m_compression_name,
|
||||
"compression_key",
|
||||
"CompressionKey",
|
||||
&mut file,
|
||||
&mut benchmark_test_result,
|
||||
);
|
||||
measure_serialized_size(
|
||||
&decompression_key,
|
||||
@@ -337,7 +333,7 @@ fn tuniform_key_set_sizes(results_file: &Path) {
|
||||
¶m_compression_name,
|
||||
"decompression_key",
|
||||
"CompressionKey",
|
||||
&mut file,
|
||||
&mut benchmark_test_result,
|
||||
);
|
||||
|
||||
let (compressed_compression_key, compressed_decompression_key) =
|
||||
@@ -349,7 +345,7 @@ fn tuniform_key_set_sizes(results_file: &Path) {
|
||||
¶m_compression_name,
|
||||
"compressed_compression_key",
|
||||
"CompressedCompressionKey",
|
||||
&mut file,
|
||||
&mut benchmark_test_result,
|
||||
);
|
||||
measure_serialized_size(
|
||||
&compressed_decompression_key,
|
||||
@@ -357,7 +353,7 @@ fn tuniform_key_set_sizes(results_file: &Path) {
|
||||
¶m_compression_name,
|
||||
"compressed_decompression_key",
|
||||
"CompressedCompressionKey",
|
||||
&mut file,
|
||||
&mut benchmark_test_result,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -373,7 +369,7 @@ fn tuniform_key_set_sizes(results_file: &Path) {
|
||||
&noise_squashing_param.name(),
|
||||
"noise_squashing_key",
|
||||
"NoiseSquashingKey",
|
||||
&mut file,
|
||||
&mut benchmark_test_result,
|
||||
);
|
||||
if let Some(noise_squashing_comp_param) =
|
||||
meta_noise_squashing_param.compression_parameters
|
||||
@@ -392,7 +388,7 @@ fn tuniform_key_set_sizes(results_file: &Path) {
|
||||
&noise_squashing_comp_param.name(),
|
||||
"noise_squashing_compression_key",
|
||||
"NoiseSquashingCompressionKey",
|
||||
&mut file,
|
||||
&mut benchmark_test_result,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
use benchmark::utilities::{write_to_json_unchecked, OperatorType};
|
||||
use benchmark_spec::TestResult;
|
||||
use clap::Parser;
|
||||
use std::collections::HashMap;
|
||||
use std::fs;
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
use tfhe::keycache::NamedParam;
|
||||
use tfhe::shortint::keycache::get_shortint_parameter_set_from_name;
|
||||
@@ -29,18 +28,8 @@ fn params_from_name(name: &str) -> ClassicPBSParameters {
|
||||
}
|
||||
}
|
||||
|
||||
fn write_result(file: &mut File, name: &str, value: usize) {
|
||||
let line = format!("{name},{value}\n");
|
||||
let error_message = format!("cannot write {name} result into file");
|
||||
file.write_all(line.as_bytes()).expect(&error_message);
|
||||
}
|
||||
|
||||
pub fn parse_wasm_benchmarks(results_file: &Path, raw_results_file: &Path) {
|
||||
File::create(results_file).expect("create results file failed");
|
||||
let mut file = OpenOptions::new()
|
||||
.append(true)
|
||||
.open(results_file)
|
||||
.expect("cannot open parsed results file");
|
||||
let mut benchmark_test_result = TestResult::from_path(results_file);
|
||||
|
||||
let operator = OperatorType::Atomic;
|
||||
|
||||
@@ -60,10 +49,10 @@ pub fn parse_wasm_benchmarks(results_file: &Path, raw_results_file: &Path) {
|
||||
let params: PBSParameters = params_from_name(name_parts[1]).into();
|
||||
println!("{name_parts:?}");
|
||||
if full_name.contains("_size") {
|
||||
write_result(&mut file, &prefixed_full_name, *val as usize);
|
||||
benchmark_test_result.write_result(&prefixed_full_name, *val as usize);
|
||||
} else {
|
||||
let value_in_ns = (val * 1_000_000_f32) as usize;
|
||||
write_result(&mut file, &prefixed_full_name, value_in_ns);
|
||||
benchmark_test_result.write_result(&prefixed_full_name, value_in_ns);
|
||||
}
|
||||
|
||||
write_to_json_unchecked::<u64, _>(
|
||||
|
||||
@@ -168,7 +168,7 @@ mod generic_tests {
|
||||
fn test_xof_seed_getters() {
|
||||
let seed_bytes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
|
||||
let bits = u128::from_le_bytes(seed_bytes);
|
||||
let dsep = *b"tfheksps";
|
||||
let dsep = [b't', b'f', b'h', b'e', b'k', b's', b'p', b's'];
|
||||
let seed = XofSeed::new_u128(bits, dsep);
|
||||
|
||||
let s = u128::from_le_bytes(seed.seed().try_into().unwrap());
|
||||
|
||||
@@ -342,28 +342,6 @@ impl<G: Curve> Proof<G> {
|
||||
None => ComputeLoad::Verify,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_le_bytes(&self) -> Vec<u8> {
|
||||
let mut bytes = Vec::new();
|
||||
|
||||
let Self {
|
||||
c_hat,
|
||||
c_y,
|
||||
pi,
|
||||
compute_load_proof_fields,
|
||||
} = self;
|
||||
|
||||
bytes.extend_from_slice(c_hat.to_le_bytes().as_ref());
|
||||
bytes.extend_from_slice(c_y.to_le_bytes().as_ref());
|
||||
bytes.extend_from_slice(pi.to_le_bytes().as_ref());
|
||||
let (c_hat_t_bytes, c_h_bytes, pi_kzg_bytes) =
|
||||
ComputeLoadProofFields::to_le_bytes(compute_load_proof_fields);
|
||||
bytes.extend_from_slice(&c_hat_t_bytes);
|
||||
bytes.extend_from_slice(&c_h_bytes);
|
||||
bytes.extend_from_slice(&pi_kzg_bytes);
|
||||
|
||||
bytes
|
||||
}
|
||||
}
|
||||
|
||||
impl<G: Curve> ParameterSetConformant for Proof<G> {
|
||||
@@ -426,26 +404,6 @@ pub(crate) struct ComputeLoadProofFields<G: Curve> {
|
||||
pub(crate) pi_kzg: G::G1,
|
||||
}
|
||||
|
||||
impl<G: Curve> ComputeLoadProofFields<G> {
|
||||
#[allow(clippy::type_complexity)]
|
||||
fn to_le_bytes(fields: &Option<Self>) -> (Box<[u8]>, Box<[u8]>, Box<[u8]>) {
|
||||
if let Some(ComputeLoadProofFields {
|
||||
c_hat_t,
|
||||
c_h,
|
||||
pi_kzg,
|
||||
}) = fields.as_ref()
|
||||
{
|
||||
(
|
||||
Box::from(G::G2::to_le_bytes(*c_hat_t).as_ref()),
|
||||
Box::from(G::G1::to_le_bytes(*c_h).as_ref()),
|
||||
Box::from(G::G1::to_le_bytes(*pi_kzg).as_ref()),
|
||||
)
|
||||
} else {
|
||||
(Box::from([]), Box::from([]), Box::from([]))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type CompressedG2<G> = <<G as Curve>::G2 as Compressible>::Compressed;
|
||||
type CompressedG1<G> = <<G as Curve>::G1 as Compressible>::Compressed;
|
||||
|
||||
|
||||
@@ -440,44 +440,6 @@ impl<G: Curve> Proof<G> {
|
||||
pub fn hash_config(&self) -> PkeV2SupportedHashConfig {
|
||||
self.hash_config
|
||||
}
|
||||
|
||||
pub fn to_le_bytes(&self) -> Vec<u8> {
|
||||
let mut bytes = Vec::new();
|
||||
|
||||
let Self {
|
||||
C_hat_e,
|
||||
C_e,
|
||||
C_r_tilde,
|
||||
C_R,
|
||||
C_hat_bin,
|
||||
C_y,
|
||||
C_h1,
|
||||
C_h2,
|
||||
C_hat_t,
|
||||
pi,
|
||||
pi_kzg,
|
||||
compute_load_proof_fields,
|
||||
hash_config: _,
|
||||
} = self;
|
||||
|
||||
bytes.extend_from_slice(C_hat_e.to_le_bytes().as_ref());
|
||||
bytes.extend_from_slice(C_e.to_le_bytes().as_ref());
|
||||
bytes.extend_from_slice(C_r_tilde.to_le_bytes().as_ref());
|
||||
bytes.extend_from_slice(C_R.to_le_bytes().as_ref());
|
||||
bytes.extend_from_slice(C_hat_bin.to_le_bytes().as_ref());
|
||||
bytes.extend_from_slice(C_y.to_le_bytes().as_ref());
|
||||
bytes.extend_from_slice(C_h1.to_le_bytes().as_ref());
|
||||
bytes.extend_from_slice(C_h2.to_le_bytes().as_ref());
|
||||
bytes.extend_from_slice(C_hat_t.to_le_bytes().as_ref());
|
||||
bytes.extend_from_slice(pi.to_le_bytes().as_ref());
|
||||
bytes.extend_from_slice(pi_kzg.to_le_bytes().as_ref());
|
||||
let (C_hat_h3_bytes, C_hat_w_bytes) =
|
||||
ComputeLoadProofFields::to_le_bytes(compute_load_proof_fields);
|
||||
bytes.extend_from_slice(&C_hat_h3_bytes);
|
||||
bytes.extend_from_slice(&C_hat_w_bytes);
|
||||
|
||||
bytes
|
||||
}
|
||||
}
|
||||
|
||||
/// These fields can be pre-computed on the prover side in the faster Verifier scheme. If that's the
|
||||
|
||||
@@ -99,7 +99,7 @@ serde-wasm-bindgen = { workspace = true, optional = true }
|
||||
getrandom = { workspace = true, optional = true }
|
||||
bytemuck = { workspace = true }
|
||||
|
||||
tfhe-hpu-backend = { version = "0.5", path = "../backends/tfhe-hpu-backend", optional = true }
|
||||
tfhe-hpu-backend = { version = "0.4", path = "../backends/tfhe-hpu-backend", optional = true }
|
||||
|
||||
[features]
|
||||
default = ["avx512"]
|
||||
|
||||
@@ -8,23 +8,23 @@
|
||||
<rect x="0" y="40" width="300" height="520" fill="#fbbc04"/>
|
||||
<rect x="300" y="40" width="420" height="520" fill="#f3f3f3"/>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="60.0">Negation (-)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="60.0">77.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="60.0">71.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="60.0">9.08 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="60.0">8.4 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="100.0">Add / Sub (+,-)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="100.0">91.7 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="100.0">93.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="100.0">9.07 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="100.0">8.35 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="140.0">Mul (x)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="140.0">357 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="140.0">352 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="140.0">32.8 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="140.0">122 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="180.0">Equal / Not Equal (eq, ne)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="180.0">72.0 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="180.0">70.1 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="180.0">7.03 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="180.0">6.77 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="220.0">Comparisons (ge, gt, le, lt)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="220.0">89.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="220.0">87.6 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="220.0">10.6 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="220.0">6.81 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="260.0">Max / Min (max, min)</text>
|
||||
@@ -32,31 +32,31 @@
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="260.0">15.0 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="260.0">11.7 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="300.0">Bitwise operations (&, |, ^)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="300.0">19.0 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="300.0">19.1 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="300.0">1.99 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="300.0">2.95 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="340.0">Div / Rem (/, %)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="340.0">4.88 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="340.0">5.04 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="340.0">514 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="340.0">912 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="380.0">Left / Right Shifts (<<, >>)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="380.0">121 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="380.0">119 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="380.0">18.0 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="380.0">25.8 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="420.0">Left / Right Rotations (left_rotate, right_rotate)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="420.0">121 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="420.0">119 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="420.0">18.0 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="420.0">27.9 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="460.0">Leading / Trailing zeros/ones</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="460.0">222 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="460.0">223 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="460.0">20.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="460.0">14.7 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="500.0">Log2</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="500.0">246 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="500.0">244 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="500.0">21.9 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="500.0">14.8 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="540.0">Select</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="540.0">40.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="540.0">39.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="540.0">4.7 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="540.0">5.53 ms</text>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="0" x2="720" y2="0"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
@@ -7,13 +7,13 @@
|
||||
<rect x="0" y="40" width="300" height="120" fill="#fbbc04"/>
|
||||
<rect x="300" y="40" width="420" height="120" fill="#f3f3f3"/>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="60.0">whitepaper</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="405.0" y="60.0">253 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="615.0" y="60.0">25.2 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="405.0" y="60.0">276 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="615.0" y="60.0">23.0 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="100.0">no_cmux</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="405.0" y="100.0">256 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="615.0" y="100.0">25.2 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="405.0" y="100.0">238 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="615.0" y="100.0">24.0 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="140.0">overflow</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="405.0" y="140.0">238 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="405.0" y="140.0">225 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="615.0" y="140.0">21.3 ops/s</text>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="0" x2="720" y2="0"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="40" x2="720" y2="40"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
@@ -15,83 +15,83 @@
|
||||
<rect x="0" y="40" width="300" height="520" fill="#fbbc04"/>
|
||||
<rect x="300" y="40" width="420" height="520" fill="#f3f3f3"/>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="60.0">Negation (-)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="60.0">50.8 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="60.0">55.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="60.0">57.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="60.0">77.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="60.0">96.4 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="60.0">52.7 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="60.0">55.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="60.0">54.6 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="60.0">76.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="60.0">96.0 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="100.0">Add / Sub (+,-)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="100.0">50.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="100.0">55.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="100.0">74.8 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="100.0">91.7 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="100.0">150 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="100.0">50.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="100.0">55.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="100.0">75.9 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="100.0">96.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="100.0">145 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="140.0">Mul (x)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="140.0">89.1 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="140.0">89.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="140.0">131 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="140.0">195 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="140.0">357 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="140.0">1.02 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="140.0">363 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="140.0">1.01 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="180.0">Equal / Not Equal (eq, ne)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="180.0">33.7 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="180.0">52.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="180.0">52.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="180.0">72.0 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="180.0">72.7 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="180.0">33.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="180.0">50.9 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="180.0">51.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="180.0">71.6 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="180.0">72.0 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="220.0">Comparisons (ge, gt, le, lt)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="220.0">32.9 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="220.0">52.1 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="220.0">70.7 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="220.0">89.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="220.0">34.4 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="220.0">50.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="220.0">70.4 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="220.0">88.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="220.0">128 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="260.0">Max / Min (max, min)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="260.0">69.6 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="260.0">88.9 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="260.0">70.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="260.0">88.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="260.0">109 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="260.0">128 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="260.0">173 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="260.0">131 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="260.0">168 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="300.0">Bitwise operations (&, |, ^)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="300.0">17.0 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="300.0">18.4 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="300.0">19.1 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="300.0">19.0 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="300.0">19.9 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="300.0">17.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="300.0">18.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="300.0">18.9 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="300.0">18.6 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="300.0">20.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="340.0">Div / Rem (/, %)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="340.0">460 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="340.0">1.01 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="340.0">2.22 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="340.0">4.88 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="340.0">12.6 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="340.0">457 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="340.0">1.0 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="340.0">2.2 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="340.0">4.99 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="340.0">12.5 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="380.0">Left / Right Shifts (<<, >>)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="380.0">53.8 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="380.0">74.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="380.0">97.4 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="380.0">121 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="380.0">158 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="380.0">54.7 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="380.0">75.6 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="380.0">97.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="380.0">122 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="380.0">150 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="420.0">Left / Right Rotations (left_rotate, right_rotate)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="420.0">54.7 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="420.0">75.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="420.0">94.4 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="420.0">121 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="420.0">165 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="420.0">53.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="420.0">75.4 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="420.0">96.9 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="420.0">116 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="420.0">164 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="460.0">Leading / Trailing zeros/ones</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="460.0">67.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="460.0">70.6 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="460.0">89.8 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="460.0">92.6 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="460.0">113 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="460.0">86.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="460.0">140 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="460.0">164 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="460.0">220 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="460.0">264 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="500.0">Log2</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="500.0">110 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="500.0">163 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="500.0">186 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="500.0">246 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="500.0">290 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="500.0">103 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="500.0">159 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="500.0">183 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="500.0">236 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="500.0">279 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="540.0">Select</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="540.0">36.6 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="540.0">36.9 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="540.0">38.7 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="540.0">40.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="540.0">43.1 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="540.0">35.6 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="540.0">37.4 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="540.0">36.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="540.0">39.7 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="540.0">42.0 ms</text>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="0" x2="720" y2="0"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="40" x2="720" y2="40"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="80" x2="720" y2="80"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
@@ -15,65 +15,65 @@
|
||||
<rect x="0" y="40" width="300" height="400" fill="#fbbc04"/>
|
||||
<rect x="300" y="40" width="420" height="400" fill="#f3f3f3"/>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="60.0">Add / Sub (+,-)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="60.0">53.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="60.0">55.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="60.0">57.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="60.0">78.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="60.0">99.7 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="60.0">50.6 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="60.0">54.1 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="60.0">54.8 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="60.0">76.8 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="60.0">95.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="100.0">Mul (x)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="100.0">71.1 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="100.0">70.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="100.0">115 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="100.0">155 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="100.0">207 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="100.0">422 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="100.0">156 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="100.0">208 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="100.0">412 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="140.0">Equal / Not Equal (eq, ne)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="140.0">34.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="140.0">33.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="140.0">52.1 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="140.0">52.0 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="140.0">72.4 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="140.0">33.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="140.0">33.7 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="140.0">52.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="140.0">53.6 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="140.0">71.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="180.0">Comparisons (ge, gt, le, lt)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="180.0">38.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="180.0">34.9 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="180.0">54.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="180.0">31.0 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="180.0">34.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="180.0">51.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="180.0">70.4 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="180.0">90.7 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="180.0">90.1 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="220.0">Max / Min (max, min)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="220.0">54.0 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="220.0">53.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="220.0">71.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="220.0">91.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="220.0">110 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="220.0">52.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="220.0">52.9 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="220.0">71.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="220.0">91.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="220.0">108 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="260.0">Bitwise operations (&, |, ^)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="260.0">17.8 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="260.0">17.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="260.0">18.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="260.0">19.1 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="260.0">19.8 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="260.0">19.9 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="260.0">19.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="260.0">20.7 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="300.0">Div (/)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="300.0">136 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="300.0">172 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="300.0">245 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="300.0">437 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="300.0">792 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="300.0">126 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="300.0">182 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="300.0">234 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="300.0">427 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="300.0">799 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="340.0">Rem (%)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="340.0">235 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="340.0">337 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="340.0">468 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="340.0">690 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="340.0">1.27 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="340.0">244 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="340.0">334 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="340.0">462 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="340.0">657 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="340.0">1.19 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="380.0">Left / Right Shifts (<<, >>)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="380.0">17.7 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="380.0">18.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="380.0">19.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="380.0">19.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="380.0">21.0 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="380.0">17.8 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="380.0">18.0 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="380.0">19.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="380.0">19.9 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="380.0">19.8 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="420.0">Left / Right Rotations (left_rotate, right_rotate)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="420.0">18.0 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="420.0">18.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="420.0">19.4 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="420.0">19.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="420.0">20.8 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="420.0">17.7 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="420.0">18.6 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="420.0">18.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="420.0">20.0 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="420.0">21.0 ms</text>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="0" x2="720" y2="0"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="40" x2="720" y2="40"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="80" x2="720" y2="80"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
@@ -15,83 +15,83 @@
|
||||
<rect x="0" y="40" width="300" height="520" fill="#fbbc04"/>
|
||||
<rect x="300" y="40" width="420" height="520" fill="#f3f3f3"/>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="60.0">Negation (-)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="60.0">804 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="60.0">372 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="60.0">181 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="60.0">86.3 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="60.0">42.1 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="60.0">824 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="60.0">388 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="60.0">184 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="60.0">88.7 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="60.0">42.8 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="100.0">Add / Sub (+,-)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="100.0">733 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="100.0">356 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="100.0">167 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="100.0">82.6 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="100.0">40.0 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="100.0">752 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="100.0">368 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="100.0">172 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="100.0">82.1 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="100.0">39.5 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="140.0">Mul (x)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="140.0">293 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="140.0">71.9 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="140.0">18.2 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="140.0">4.58 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="140.0">1.19 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="140.0">283 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="140.0">65.7 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="140.0">17.7 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="140.0">4.68 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="140.0">1.17 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="180.0">Equal / Not Equal (eq, ne)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="180.0">1.6 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="180.0">740 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="180.0">392 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="180.0">200 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="180.0">101 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="180.0">1.65 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="180.0">748 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="180.0">391 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="180.0">195 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="180.0">102 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="220.0">Comparisons (ge, gt, le, lt)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="220.0">1.58 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="220.0">733 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="220.0">354 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="220.0">171 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="220.0">64.7 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="220.0">1.62 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="220.0">745 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="220.0">355 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="220.0">170 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="220.0">65.2 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="260.0">Max / Min (max, min)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="260.0">493 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="260.0">236 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="260.0">116 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="260.0">58.3 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="260.0">25.7 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="260.0">488 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="260.0">239 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="260.0">117 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="260.0">57.3 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="260.0">25.2 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="300.0">Bitwise operations (&, |, ^)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="300.0">2.1 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="300.0">981 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="300.0">490 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="300.0">262 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="300.0">130 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="300.0">2.14 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="300.0">1.06 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="300.0">537 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="300.0">270 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="300.0">136 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="340.0">Div / Rem (/, %)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="340.0">45.2 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="340.0">12.9 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="340.0">3.56 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="340.0">0.893 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="340.0">0.223 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="340.0">42.2 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="340.0">12.7 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="340.0">3.51 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="340.0">0.914 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="340.0">0.143 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="380.0">Left / Right Shifts (<<, >>)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="380.0">464 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="380.0">183 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="380.0">76.1 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="380.0">32.4 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="380.0">14.3 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="380.0">469 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="380.0">182 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="380.0">74.5 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="380.0">32.3 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="380.0">14.1 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="420.0">Left / Right Rotations (left_rotate, right_rotate)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="420.0">391 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="420.0">397 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="420.0">170 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="420.0">74.0 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="420.0">32.5 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="420.0">72.2 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="420.0">32.1 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="420.0">14.0 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="460.0">Leading / Trailing zeros/ones</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="460.0">824 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="460.0">487 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="460.0">222 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="460.0">119 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="460.0">57.8 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="460.0">621 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="460.0">235 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="460.0">104 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="460.0">41.8 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="460.0">17.8 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="500.0">Log2</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="500.0">542 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="500.0">220 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="500.0">102 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="500.0">42.0 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="500.0">18.6 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="500.0">536 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="500.0">207 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="500.0">96.4 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="500.0">40.4 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="500.0">17.3 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="540.0">Select</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="540.0">676 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="540.0">350 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="540.0">176 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="540.0">84.2 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="540.0">42.6 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="540.0">699 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="540.0">351 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="540.0">175 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="540.0">87.3 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="540.0">43.4 ops/s</text>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="0" x2="720" y2="0"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="40" x2="720" y2="40"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="80" x2="720" y2="80"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
@@ -15,65 +15,65 @@
|
||||
<rect x="0" y="40" width="300" height="400" fill="#fbbc04"/>
|
||||
<rect x="300" y="40" width="420" height="400" fill="#f3f3f3"/>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="60.0">Add / Sub (+,-)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="60.0">810 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="60.0">379 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="60.0">178 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="60.0">86.0 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="60.0">41.7 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="60.0">836 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="60.0">383 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="60.0">184 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="60.0">87.9 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="60.0">42.5 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="100.0">Mul (x)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="100.0">658 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="100.0">185 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="100.0">57.2 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="100.0">17.6 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="100.0">4.83 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="100.0">659 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="100.0">182 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="100.0">52.8 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="100.0">16.5 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="100.0">4.79 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="140.0">Equal / Not Equal (eq, ne)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="140.0">2.69 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="140.0">1.57 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="140.0">723 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="140.0">378 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="140.0">192 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="140.0">2.73 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="140.0">1.68 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="140.0">757 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="140.0">399 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="140.0">198 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="180.0">Comparisons (ge, gt, le, lt)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="180.0">2.61 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="180.0">1.63 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="180.0">717 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="180.0">348 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="180.0">172 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="180.0">2.82 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="180.0">1.64 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="180.0">747 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="180.0">356 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="180.0">173 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="220.0">Max / Min (max, min)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="220.0">1.15 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="220.0">621 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="220.0">302 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="220.0">148 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="220.0">73.6 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="220.0">1.18 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="220.0">645 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="220.0">305 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="220.0">150 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="220.0">73.2 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="260.0">Bitwise operations (&, |, ^)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="260.0">2.11 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="260.0">1.04 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="260.0">516 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="260.0">260 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="260.0">128 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="260.0">2.31 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="260.0">1.12 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="260.0">555 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="260.0">276 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="260.0">139 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="300.0">Div (/)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="300.0">203 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="300.0">73.3 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="300.0">24.8 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="300.0">7.38 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="300.0">2.16 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="300.0">196 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="300.0">69.6 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="300.0">23.7 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="300.0">7.63 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="300.0">2.13 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="340.0">Rem (%)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="340.0">130 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="340.0">49.1 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="340.0">17.1 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="340.0">5.65 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="340.0">1.75 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="340.0">114 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="340.0">44.5 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="340.0">16.6 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="340.0">5.78 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="340.0">1.66 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="380.0">Left / Right Shifts (<<, >>)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="380.0">2.01 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="380.0">1.02 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="380.0">510 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="380.0">247 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="380.0">124 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="380.0">2.13 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="380.0">1.07 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="380.0">546 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="380.0">270 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="380.0">138 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="420.0">Left / Right Rotations (left_rotate, right_rotate)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="420.0">2.01 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="420.0">992 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="420.0">517 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="420.0">254 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="420.0">124 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="342.0" y="420.0">2.14 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="426.0" y="420.0">1.07 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="420.0">541 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="594.0" y="420.0">270 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="678.0" y="420.0">137 ops/s</text>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="0" x2="720" y2="0"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="40" x2="720" y2="40"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="80" x2="720" y2="80"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
@@ -9,25 +9,25 @@
|
||||
<rect x="0" y="40" width="300" height="160" fill="#fbbc04"/>
|
||||
<rect x="300" y="40" width="420" height="160" fill="#f3f3f3"/>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="60.0">PBS</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="352.5" y="60.0">9.57 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="457.5" y="60.0">12.7 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="562.5" y="60.0">112 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="667.5" y="60.0">1.58 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="352.5" y="60.0">9.54 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="457.5" y="60.0">12.4 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="562.5" y="60.0">111 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="667.5" y="60.0">1.39 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="100.0">MB-PBS</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="352.5" y="100.0">4.42 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="457.5" y="100.0">4.71 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="562.5" y="100.0">30.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="667.5" y="100.0">257 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="352.5" y="100.0">4.02 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="457.5" y="100.0">4.55 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="562.5" y="100.0">30.9 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="667.5" y="100.0">244 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="140.0">KS - PBS</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="352.5" y="140.0">11.1 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="457.5" y="140.0">15.6 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="562.5" y="140.0">126 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="667.5" y="140.0">1.58 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="352.5" y="140.0">10.9 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="457.5" y="140.0">15.1 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="562.5" y="140.0">125 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="667.5" y="140.0">1.51 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="180.0">KS - MB-PBS</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="352.5" y="180.0">6.67 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="457.5" y="180.0">8.49 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="562.5" y="180.0">46.8 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="667.5" y="180.0">388 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="352.5" y="180.0">5.56 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="457.5" y="180.0">7.29 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="562.5" y="180.0">61.9 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="667.5" y="180.0">418 ms</text>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="0" x2="720" y2="0"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="40" x2="720" y2="40"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="80" x2="720" y2="80"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
@@ -9,25 +9,25 @@
|
||||
<rect x="0" y="40" width="300" height="160" fill="#fbbc04"/>
|
||||
<rect x="300" y="40" width="420" height="160" fill="#f3f3f3"/>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="60.0">PBS</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="352.5" y="60.0">8.93 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="352.5" y="60.0">8.94 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="457.5" y="60.0">11.8 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="562.5" y="60.0">102 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="667.5" y="60.0">654 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="562.5" y="60.0">104 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="667.5" y="60.0">670 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="100.0">MB-PBS</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="352.5" y="100.0">4.9 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="457.5" y="100.0">4.58 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="562.5" y="100.0">28.6 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="667.5" y="100.0">214 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="352.5" y="100.0">4.87 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="457.5" y="100.0">4.53 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="562.5" y="100.0">30.6 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="667.5" y="100.0">185 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="140.0">KS - PBS</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="352.5" y="140.0">10.8 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="457.5" y="140.0">14.9 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="562.5" y="140.0">119 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="667.5" y="140.0">865 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="352.5" y="140.0">10.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="457.5" y="140.0">15.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="562.5" y="140.0">120 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="667.5" y="140.0">871 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="180.0">KS - MB-PBS</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="352.5" y="180.0">6.96 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="457.5" y="180.0">7.59 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="562.5" y="180.0">47.9 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="667.5" y="180.0">247 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="352.5" y="180.0">6.83 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="457.5" y="180.0">7.13 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="562.5" y="180.0">44.7 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="667.5" y="180.0">228 ms</text>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="0" x2="720" y2="0"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="40" x2="720" y2="40"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="80" x2="720" y2="80"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
@@ -6,11 +6,11 @@
|
||||
<rect x="0" y="40" width="300" height="120" fill="#fbbc04"/>
|
||||
<rect x="300" y="40" width="420" height="120" fill="#f3f3f3"/>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="60.0">1xFheUint64 (64 bits)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="60.0">1.53 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="60.0">1.66 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="100.0">4xFheUint64 (256 bits) </text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="100.0">1.55 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="100.0">1.66 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="140.0">32xFheUint64 (2048 bits)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="140.0">1.76 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="140.0">1.8 s</text>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="0" x2="720" y2="0"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="40" x2="720" y2="40"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="80" x2="720" y2="80"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
@@ -8,17 +8,17 @@
|
||||
<rect x="0" y="40" width="300" height="120" fill="#fbbc04"/>
|
||||
<rect x="300" y="40" width="420" height="120" fill="#f3f3f3"/>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="60.0">1xFheUint64 (64 bits)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="60.0">209 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="60.0">43.9 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="60.0">67.1 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="60.0">276 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="60.0">44.0 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="60.0">66.0 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="100.0">4xFheUint64 (256 bits) </text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="100.0">211 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="100.0">277 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="100.0">44.6 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="100.0">72.9 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="100.0">70.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="140.0">32xFheUint64 (2048 bits)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="140.0">219 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="140.0">293 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="140.0">49.1 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="140.0">185 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="140.0">184 ms</text>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="0" x2="720" y2="0"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="40" x2="720" y2="40"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="80" x2="720" y2="80"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
@@ -8,17 +8,17 @@
|
||||
<rect x="0" y="40" width="300" height="120" fill="#fbbc04"/>
|
||||
<rect x="300" y="40" width="420" height="120" fill="#f3f3f3"/>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="60.0">1xFheUint64 (64 bits)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="60.0">8.3 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="60.0">265 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="60.0">129 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="60.0">7.9 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="60.0">274 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="60.0">131 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="100.0">4xFheUint64 (256 bits) </text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="100.0">8.36 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="100.0">259 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="100.0">50.8 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="100.0">7.9 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="100.0">277 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="100.0">51.3 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="140.0">32xFheUint64 (2048 bits)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="140.0">8.3 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="140.0">236 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="140.0">8.38 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="140.0">7.73 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="140.0">242 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="140.0">8.62 ops/s</text>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="0" x2="720" y2="0"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="40" x2="720" y2="40"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="80" x2="720" y2="80"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
@@ -6,11 +6,11 @@
|
||||
<rect x="0" y="40" width="300" height="120" fill="#fbbc04"/>
|
||||
<rect x="300" y="40" width="420" height="120" fill="#f3f3f3"/>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="60.0">1xFheUint64 (64 bits)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="60.0">1.71 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="60.0">1.94 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="100.0">4xFheUint64 (256 bits) </text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="100.0">1.72 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="100.0">1.96 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="140.0">32xFheUint64 (2048 bits)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="140.0">1.93 s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="140.0">2.13 s</text>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="0" x2="720" y2="0"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="40" x2="720" y2="40"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="80" x2="720" y2="80"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
@@ -8,17 +8,17 @@
|
||||
<rect x="0" y="40" width="300" height="120" fill="#fbbc04"/>
|
||||
<rect x="300" y="40" width="420" height="120" fill="#f3f3f3"/>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="60.0">1xFheUint64 (64 bits)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="60.0">214 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="60.0">31.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="60.0">52.5 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="60.0">292 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="60.0">31.4 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="60.0">51.8 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="100.0">4xFheUint64 (256 bits) </text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="100.0">217 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="100.0">31.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="100.0">57.3 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="100.0">294 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="100.0">31.6 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="100.0">56.2 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="140.0">32xFheUint64 (2048 bits)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="140.0">225 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="140.0">33.6 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="140.0">170 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="140.0">317 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="140.0">33.8 ms</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="140.0">167 ms</text>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="0" x2="720" y2="0"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="40" x2="720" y2="40"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="80" x2="720" y2="80"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
@@ -8,17 +8,17 @@
|
||||
<rect x="0" y="40" width="300" height="120" fill="#fbbc04"/>
|
||||
<rect x="300" y="40" width="420" height="120" fill="#f3f3f3"/>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="60.0">1xFheUint64 (64 bits)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="60.0">7.78 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="60.0">877 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="60.0">200 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="60.0">7.3 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="60.0">988 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="60.0">201 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="100.0">4xFheUint64 (256 bits) </text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="100.0">7.79 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="100.0">931 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="100.0">58.9 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="100.0">7.23 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="100.0">987 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="100.0">59.5 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="start" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="6" y="140.0">32xFheUint64 (2048 bits)</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="140.0">7.77 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="140.0">993 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="140.0">8.59 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="370.0" y="140.0">7.1 ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="510.0" y="140.0">1.11 k.ops/s</text>
|
||||
<text dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="14" font-weight="normal" fill="black" x="650.0" y="140.0">8.85 ops/s</text>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="0" x2="720" y2="0"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="40" x2="720" y2="40"/>
|
||||
<line stroke="white" stroke-width="2" x1="0" y1="80" x2="720" y2="80"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
@@ -85,7 +85,7 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
let public_key = tfhe::CompactPublicKey::try_new(&client_key).unwrap();
|
||||
// This can be left empty, but if provided allows to tie the proof to arbitrary data
|
||||
let metadata = b"TFHE-rs";
|
||||
let metadata = [b'T', b'F', b'H', b'E', b'-', b'r', b's'];
|
||||
|
||||
let clear_a = random::<u64>();
|
||||
let clear_b = random::<u64>();
|
||||
@@ -93,7 +93,7 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let proven_compact_list = tfhe::ProvenCompactCiphertextList::builder(&public_key)
|
||||
.push(clear_a)
|
||||
.push(clear_b)
|
||||
.build_with_proof_packed(&crs, metadata, ZkComputeLoad::Verify)?;
|
||||
.build_with_proof_packed(&crs, &metadata, ZkComputeLoad::Verify)?;
|
||||
|
||||
// Server side
|
||||
let result = {
|
||||
@@ -101,7 +101,7 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
// Verify the proofs and expand the ciphertexts
|
||||
let expander =
|
||||
proven_compact_list.verify_and_expand(&crs, &public_key, metadata)?;
|
||||
proven_compact_list.verify_and_expand(&crs, &public_key, &metadata)?;
|
||||
let a: tfhe::FheUint64 = expander.get(0)?.unwrap();
|
||||
let b: tfhe::FheUint64 = expander.get(1)?.unwrap();
|
||||
|
||||
|
||||
@@ -97,76 +97,6 @@ pub fn main() {
|
||||
}
|
||||
```
|
||||
|
||||
## Example: Re-randomization of a `ProvenCompactCiphertextList`
|
||||
|
||||
Untrusted user inputs received in a `ProvenCompactCiphertextList` should also be re-randomized.
|
||||
Here is how to do it:
|
||||
|
||||
```rust
|
||||
use tfhe::prelude::*;
|
||||
use tfhe::shortint::parameters::v1_6::meta::cpu::V1_6_META_PARAM_CPU_2_2_KS_PBS_PKE_TO_SMALL_ZKV2_TUNIFORM_2M128;
|
||||
use tfhe::zk::{CompactPkeCrs, ZkComputeLoad};
|
||||
use tfhe::{
|
||||
CompactPublicKey, Config, FheBool, FheInt8, FheUint64, ProvenCompactCiphertextList,
|
||||
ReRandomizationContext, generate_keys, set_server_key,
|
||||
};
|
||||
|
||||
pub fn main() {
|
||||
let config = Config::from(V1_6_META_PARAM_CPU_2_2_KS_PBS_PKE_TO_SMALL_ZKV2_TUNIFORM_2M128);
|
||||
let (cks, sks) = generate_keys(config);
|
||||
let cpk = CompactPublicKey::new(&cks);
|
||||
|
||||
let compact_public_encryption_domain_separator = *b"TFHE_Enc";
|
||||
let rerand_domain_separator = *b"TFHE_Rrd";
|
||||
|
||||
let crs = CompactPkeCrs::from_config(config, 2048).unwrap();
|
||||
let metadata = b"rerand";
|
||||
|
||||
set_server_key(sks);
|
||||
|
||||
// Generate a list of ciphertexts
|
||||
let clear_a = rand::random::<u64>();
|
||||
let clear_b = rand::random::<i8>();
|
||||
|
||||
let compact_list = ProvenCompactCiphertextList::builder(&cpk)
|
||||
.push(clear_a)
|
||||
.push(clear_b)
|
||||
.push(false)
|
||||
.build_with_proof_packed(&crs, metadata, ZkComputeLoad::Proof)
|
||||
.unwrap();
|
||||
|
||||
// Simulate a 256 bits nonce
|
||||
let nonce: [u8; 256 / 8] = core::array::from_fn(|_| rand::random());
|
||||
|
||||
let mut re_rand_context = ReRandomizationContext::new(
|
||||
rerand_domain_separator,
|
||||
[b"expand".as_slice(), nonce.as_slice()],
|
||||
compact_public_encryption_domain_separator,
|
||||
);
|
||||
|
||||
// Add the compact list to the context
|
||||
re_rand_context.add_ciphertext(&compact_list);
|
||||
|
||||
let mut seed_gen = re_rand_context.finalize();
|
||||
|
||||
// Verify, re_randomize and expand
|
||||
let expander = compact_list
|
||||
.verify_re_randomize_and_expand(&crs, &cpk, metadata, seed_gen.next_seed().unwrap())
|
||||
.unwrap();
|
||||
|
||||
let a: FheUint64 = expander.get(0).unwrap().unwrap();
|
||||
let b: FheInt8 = expander.get(1).unwrap().unwrap();
|
||||
let c: FheBool = expander.get(2).unwrap().unwrap();
|
||||
|
||||
let dec_a: u64 = a.decrypt(&cks);
|
||||
assert_eq!(dec_a, clear_a);
|
||||
let dec_b: i8 = b.decrypt(&cks);
|
||||
assert_eq!(dec_b, clear_b);
|
||||
let dec_c: bool = c.decrypt(&cks);
|
||||
assert!(!dec_c);
|
||||
}
|
||||
```
|
||||
|
||||
## Managing legacy Re-Randomization API
|
||||
|
||||
Because of an API change in version 1.6 you may find yourself needing to manage older keys using the old API, the following example shows how it can be done:
|
||||
|
||||
@@ -46,7 +46,7 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let server_key = tfhe::ServerKey::new(&client_key);
|
||||
let public_key = tfhe::CompactPublicKey::try_new(&client_key).unwrap();
|
||||
// This can be left empty, but if provided allows to tie the proof to arbitrary data
|
||||
let metadata = b"TFHE-rs";
|
||||
let metadata = [b'T', b'F', b'H', b'E', b'-', b'r', b's'];
|
||||
|
||||
let clear_a = rng.gen::<u64>();
|
||||
let clear_b = rng.gen::<u64>();
|
||||
@@ -54,7 +54,7 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let proven_compact_list = tfhe::ProvenCompactCiphertextList::builder(&public_key)
|
||||
.push(clear_a)
|
||||
.push(clear_b)
|
||||
.build_with_proof_packed(&crs, metadata, ZkComputeLoad::Verify)?;
|
||||
.build_with_proof_packed(&crs, &metadata, ZkComputeLoad::Verify)?;
|
||||
|
||||
// Server side
|
||||
let result = {
|
||||
@@ -62,7 +62,7 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
// Verify the ciphertexts
|
||||
let expander =
|
||||
proven_compact_list.verify_and_expand(&crs, &public_key, metadata)?;
|
||||
proven_compact_list.verify_and_expand(&crs, &public_key, &metadata)?;
|
||||
let a: tfhe::FheUint64 = expander.get(0)?.unwrap();
|
||||
let b: tfhe::FheUint64 = expander.get(1)?.unwrap();
|
||||
|
||||
@@ -118,7 +118,7 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let server_key = tfhe::ServerKey::new(&client_key);
|
||||
let public_key = tfhe::CompactPublicKey::try_new(&client_key).unwrap();
|
||||
// This can be left empty, but if provided allows to tie the proof to arbitrary data
|
||||
let metadata = b"TFHE-rs";
|
||||
let metadata = [b'T', b'F', b'H', b'E', b'-', b'r', b's'];
|
||||
|
||||
let clear_a = rng.gen::<u64>();
|
||||
let clear_b = rng.gen::<u64>();
|
||||
@@ -126,7 +126,7 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let proven_compact_list = tfhe::ProvenCompactCiphertextList::builder(&public_key)
|
||||
.push(clear_a)
|
||||
.push(clear_b)
|
||||
.build_with_proof_packed(&crs, metadata, ZkComputeLoad::Verify)?;
|
||||
.build_with_proof_packed(&crs, &metadata, ZkComputeLoad::Verify)?;
|
||||
|
||||
// Server side
|
||||
let result = {
|
||||
@@ -134,7 +134,7 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
// Verify the ciphertexts
|
||||
let expander =
|
||||
proven_compact_list.verify_and_expand(&crs, &public_key, metadata)?;
|
||||
proven_compact_list.verify_and_expand(&crs, &public_key, &metadata)?;
|
||||
let a: tfhe::FheUint64 = expander.get(0)?.unwrap();
|
||||
let b: tfhe::FheUint64 = expander.get(1)?.unwrap();
|
||||
|
||||
|
||||
@@ -252,7 +252,9 @@ where
|
||||
))
|
||||
}
|
||||
|
||||
const NON_ESCAPABLE_SYMBOLS: [u8; 14] = *b"&;:,`~-_!@#%'\"";
|
||||
const NON_ESCAPABLE_SYMBOLS: [u8; 14] = [
|
||||
b'&', b';', b':', b',', b'`', b'~', b'-', b'_', b'!', b'@', b'#', b'%', b'\'', b'\"',
|
||||
];
|
||||
|
||||
fn atom<Input>() -> impl Parser<Input, Output = RegExpr>
|
||||
where
|
||||
|
||||
@@ -92,7 +92,6 @@ pub fn glwe_ciphertext_add_assign<Scalar, LhsCont, RhsCont>(
|
||||
lhs.ciphertext_modulus(),
|
||||
rhs.ciphertext_modulus()
|
||||
);
|
||||
assert!(lhs.ciphertext_modulus().is_power_of_two());
|
||||
|
||||
slice_wrapping_add_assign(lhs.as_mut(), rhs.as_ref());
|
||||
}
|
||||
@@ -197,7 +196,6 @@ pub fn glwe_ciphertext_add<Scalar, OutputCont, LhsCont, RhsCont>(
|
||||
output.ciphertext_modulus(),
|
||||
rhs.ciphertext_modulus()
|
||||
);
|
||||
assert!(lhs.ciphertext_modulus().is_power_of_two());
|
||||
|
||||
slice_wrapping_add(output.as_mut(), lhs.as_ref(), rhs.as_ref());
|
||||
}
|
||||
@@ -642,7 +640,6 @@ where
|
||||
Scalar: UnsignedInteger,
|
||||
InCont: ContainerMut<Element = Scalar>,
|
||||
{
|
||||
assert!(ct.ciphertext_modulus().is_power_of_two());
|
||||
slice_wrapping_opposite_assign(ct.as_mut());
|
||||
}
|
||||
|
||||
@@ -726,8 +723,6 @@ pub fn glwe_ciphertext_cleartext_mul_assign<Scalar, InCont>(
|
||||
Scalar: UnsignedInteger,
|
||||
InCont: ContainerMut<Element = Scalar>,
|
||||
{
|
||||
assert!(lhs.ciphertext_modulus().is_power_of_two());
|
||||
|
||||
slice_wrapping_scalar_mul_assign(lhs.as_mut(), rhs.0);
|
||||
}
|
||||
|
||||
@@ -913,7 +908,6 @@ pub fn glwe_ciphertext_sub_assign<Scalar, LhsCont, RhsCont>(
|
||||
lhs.ciphertext_modulus(),
|
||||
rhs.ciphertext_modulus()
|
||||
);
|
||||
assert!(lhs.ciphertext_modulus().is_power_of_two());
|
||||
|
||||
slice_wrapping_sub_assign(lhs.as_mut(), rhs.as_ref());
|
||||
}
|
||||
|
||||
@@ -1251,7 +1251,7 @@ pub fn encrypt_lwe_ciphertext_iterator_with_seeded_public_key<Scalar, KeyCont, O
|
||||
}
|
||||
}
|
||||
|
||||
for (output_ct, plaintext) in output.iter_mut().zip(encoded) {
|
||||
for (output_ct, plaintext) in output.iter_mut().zip(encoded.into_iter()) {
|
||||
lwe_ciphertext_plaintext_add_assign(output_ct, plaintext);
|
||||
}
|
||||
}
|
||||
@@ -2123,7 +2123,7 @@ pub fn encrypt_lwe_ciphertext_with_compact_public_key<
|
||||
///
|
||||
/// // We can add custom metadata that will be required for verification, allowing to tie the proof
|
||||
/// // to some arbitrary data.
|
||||
/// let metadata = b"TFHE-rs";
|
||||
/// let metadata = [b'T', b'F', b'H', b'E', b'-', b'r', b's'];
|
||||
///
|
||||
/// // Create the PRNG
|
||||
/// let mut seeder = new_seeder();
|
||||
@@ -2170,14 +2170,14 @@ pub fn encrypt_lwe_ciphertext_with_compact_public_key<
|
||||
/// glwe_noise_distribution,
|
||||
/// encryption_generator.noise_generator_mut(),
|
||||
/// &crs,
|
||||
/// metadata,
|
||||
/// &metadata,
|
||||
/// ZkComputeLoad::Proof,
|
||||
/// )
|
||||
/// .unwrap();
|
||||
///
|
||||
/// // verify the ciphertext list with the proof
|
||||
/// assert!(
|
||||
/// verify_lwe_ciphertext(&lwe, &lwe_compact_public_key, &proof, &crs, metadata).is_valid()
|
||||
/// verify_lwe_ciphertext(&lwe, &lwe_compact_public_key, &proof, &crs, &metadata).is_valid()
|
||||
/// );
|
||||
///
|
||||
/// let decrypted_plaintext = decrypt_lwe_ciphertext(&lwe_secret_key, &lwe);
|
||||
@@ -2572,7 +2572,7 @@ pub fn encrypt_lwe_compact_ciphertext_list_with_compact_public_key<
|
||||
///
|
||||
/// // We can add custom metadata that will be required for verification, allowing to tie the proof
|
||||
/// // to some arbitrary data.
|
||||
/// let metadata = b"TFHE-rs";
|
||||
/// let metadata = [b'T', b'F', b'H', b'E', b'-', b'r', b's'];
|
||||
///
|
||||
/// // Create the PRNG
|
||||
/// let mut seeder = new_seeder();
|
||||
@@ -2623,7 +2623,7 @@ pub fn encrypt_lwe_compact_ciphertext_list_with_compact_public_key<
|
||||
/// glwe_noise_distribution,
|
||||
/// encryption_generator.noise_generator_mut(),
|
||||
/// &crs,
|
||||
/// metadata,
|
||||
/// &metadata,
|
||||
/// ZkComputeLoad::Proof,
|
||||
/// )
|
||||
/// .unwrap();
|
||||
@@ -2634,7 +2634,7 @@ pub fn encrypt_lwe_compact_ciphertext_list_with_compact_public_key<
|
||||
/// &lwe_compact_public_key,
|
||||
/// &proof,
|
||||
/// &crs,
|
||||
/// metadata,
|
||||
/// &metadata,
|
||||
/// )
|
||||
/// .is_valid());
|
||||
///
|
||||
@@ -3045,7 +3045,7 @@ pub fn par_encrypt_lwe_compact_ciphertext_list_with_compact_public_key<
|
||||
///
|
||||
/// // We can add custom metadata that will be required for verification, allowing to tie the proof
|
||||
/// // to some arbitrary data.
|
||||
/// let metadata = b"TFHE-rs";
|
||||
/// let metadata = [b'T', b'F', b'H', b'E', b'-', b'r', b's'];
|
||||
///
|
||||
/// // Create the PRNG
|
||||
/// let mut seeder = new_seeder();
|
||||
@@ -3096,7 +3096,7 @@ pub fn par_encrypt_lwe_compact_ciphertext_list_with_compact_public_key<
|
||||
/// glwe_noise_distribution,
|
||||
/// encryption_generator.noise_generator_mut(),
|
||||
/// &crs,
|
||||
/// metadata,
|
||||
/// &metadata,
|
||||
/// ZkComputeLoad::Proof,
|
||||
/// )
|
||||
/// .unwrap();
|
||||
@@ -3107,7 +3107,7 @@ pub fn par_encrypt_lwe_compact_ciphertext_list_with_compact_public_key<
|
||||
/// &lwe_compact_public_key,
|
||||
/// &proof,
|
||||
/// &crs,
|
||||
/// metadata,
|
||||
/// &metadata,
|
||||
/// )
|
||||
/// .is_valid());
|
||||
///
|
||||
|
||||
@@ -816,111 +816,6 @@ pub fn lwe_ciphertext_sub<Scalar, OutputCont, LhsCont, RhsCont>(
|
||||
lwe_ciphertext_sub_assign(output, rhs);
|
||||
}
|
||||
|
||||
/// Add the right-hand side [`LWE compact ciphertext list`](`LweCompactCiphertextList`) to the
|
||||
/// left-hand side [`LWE compact ciphertext list`](`LweCompactCiphertextList`) updating it in-place.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use tfhe::core_crypto::prelude::*;
|
||||
///
|
||||
/// // DISCLAIMER: these toy example parameters are not guaranteed to be secure or yield correct
|
||||
/// // computations
|
||||
/// // Define parameters for LweCompactCiphertextList creation
|
||||
/// let lwe_dimension = LweDimension(2048);
|
||||
/// let lwe_ciphertext_count = LweCiphertextCount(3);
|
||||
/// let noise_distribution =
|
||||
/// Gaussian::from_dispersion_parameter(StandardDev(0.00000000000000029403601535432533), 0.0);
|
||||
/// let ciphertext_modulus = CiphertextModulus::new_native();
|
||||
///
|
||||
/// // Create the PRNG
|
||||
/// let mut seeder = new_seeder();
|
||||
/// let seeder = seeder.as_mut();
|
||||
/// let mut secret_generator = SecretRandomGenerator::<DefaultRandomGenerator>::new(seeder.seed());
|
||||
/// let mut encryption_generator =
|
||||
/// EncryptionRandomGenerator::<DefaultRandomGenerator>::new(seeder.seed(), seeder);
|
||||
///
|
||||
/// // Create the LweSecretKey
|
||||
/// let lwe_secret_key =
|
||||
/// allocate_and_generate_new_binary_lwe_secret_key(lwe_dimension, &mut secret_generator);
|
||||
///
|
||||
/// let lwe_compact_public_key = allocate_and_generate_new_lwe_compact_public_key(
|
||||
/// &lwe_secret_key,
|
||||
/// noise_distribution,
|
||||
/// ciphertext_modulus,
|
||||
/// &mut encryption_generator,
|
||||
/// );
|
||||
///
|
||||
/// // Create the plaintext
|
||||
/// let msg = 3u64;
|
||||
/// let encoded_msg = msg << 60;
|
||||
/// let input_plaintext_list =
|
||||
/// PlaintextList::new(encoded_msg, PlaintextCount(lwe_ciphertext_count.0));
|
||||
///
|
||||
/// // Create and encrypt a new LweCompactCiphertextList
|
||||
/// let mut lwe_compact_ct_list = LweCompactCiphertextList::new(
|
||||
/// 0u64,
|
||||
/// lwe_dimension.to_lwe_size(),
|
||||
/// lwe_ciphertext_count,
|
||||
/// ciphertext_modulus,
|
||||
/// );
|
||||
/// encrypt_lwe_compact_ciphertext_list_with_compact_public_key(
|
||||
/// &lwe_compact_public_key,
|
||||
/// &mut lwe_compact_ct_list,
|
||||
/// &input_plaintext_list,
|
||||
/// noise_distribution,
|
||||
/// noise_distribution,
|
||||
/// encryption_generator.noise_generator_mut(),
|
||||
/// );
|
||||
///
|
||||
/// let rhs = lwe_compact_ct_list.clone();
|
||||
///
|
||||
/// lwe_compact_ciphertext_list_add_assign(&mut lwe_compact_ct_list, &rhs);
|
||||
///
|
||||
/// // Expand and decrypt
|
||||
/// let lwe_ciphertext_list = lwe_compact_ct_list.expand_into_lwe_ciphertext_list();
|
||||
///
|
||||
/// let mut output_plaintext_list =
|
||||
/// PlaintextList::new(0u64, PlaintextCount(lwe_ciphertext_count.0));
|
||||
///
|
||||
/// decrypt_lwe_ciphertext_list(
|
||||
/// &lwe_secret_key,
|
||||
/// &lwe_ciphertext_list,
|
||||
/// &mut output_plaintext_list,
|
||||
/// );
|
||||
///
|
||||
/// // Round and remove encoding
|
||||
/// // First create a decomposer working on the high 4 bits corresponding to our encoding.
|
||||
/// let decomposer = SignedDecomposer::new(DecompositionBaseLog(4), DecompositionLevelCount(1));
|
||||
///
|
||||
/// // Round and remove encoding in the output plaintext list
|
||||
/// output_plaintext_list
|
||||
/// .iter_mut()
|
||||
/// .for_each(|x| *x.0 = decomposer.closest_representable(*x.0) >> 60);
|
||||
///
|
||||
/// // Check we recovered the expected result
|
||||
/// assert!(output_plaintext_list.iter().all(|x| *x.0 == msg + msg));
|
||||
/// ```
|
||||
pub fn lwe_compact_ciphertext_list_add_assign<Scalar, LhsCont, RhsCont>(
|
||||
lhs: &mut LweCompactCiphertextList<LhsCont>,
|
||||
rhs: &LweCompactCiphertextList<RhsCont>,
|
||||
) where
|
||||
Scalar: UnsignedInteger,
|
||||
LhsCont: ContainerMut<Element = Scalar>,
|
||||
RhsCont: Container<Element = Scalar>,
|
||||
{
|
||||
assert_eq!(
|
||||
lhs.ciphertext_modulus(),
|
||||
rhs.ciphertext_modulus(),
|
||||
"Mismatched moduli between lhs ({:?}) and rhs ({:?}) LweCompactCiphertextList",
|
||||
lhs.ciphertext_modulus(),
|
||||
rhs.ciphertext_modulus()
|
||||
);
|
||||
assert!(lhs.ciphertext_modulus().is_power_of_two());
|
||||
|
||||
slice_wrapping_add_assign(lhs.as_mut(), rhs.as_ref());
|
||||
}
|
||||
|
||||
// ============== Noise measurement trait implementations ============== //
|
||||
use crate::core_crypto::commons::noise_formulas::noise_simulation::traits::{
|
||||
LweUncorrelatedAdd, LweUncorrelatedSub, ScalarMul, ScalarMulAssign,
|
||||
|
||||
@@ -1010,7 +1010,7 @@ fn lwe_compact_public_encrypt_prove_verify_decrypt_custom_mod<Scalar>(
|
||||
let message_modulus_log = params.message_modulus_log;
|
||||
let encoding_with_padding = get_encoding_with_padding(ciphertext_modulus);
|
||||
|
||||
let metadata = b"core";
|
||||
let metadata = [b'c', b'o', b'r', b'e'];
|
||||
|
||||
let mut rsc = TestResources::new();
|
||||
let mut random_generator = RandomGenerator::<DefaultRandomGenerator>::new(rsc.seeder.seed());
|
||||
@@ -1073,7 +1073,7 @@ fn lwe_compact_public_encrypt_prove_verify_decrypt_custom_mod<Scalar>(
|
||||
glwe_noise_distribution,
|
||||
rsc.encryption_random_generator.noise_generator_mut(),
|
||||
crs,
|
||||
metadata,
|
||||
&metadata,
|
||||
ZkComputeLoad::Proof,
|
||||
)
|
||||
.unwrap();
|
||||
@@ -1090,13 +1090,13 @@ fn lwe_compact_public_encrypt_prove_verify_decrypt_custom_mod<Scalar>(
|
||||
assert_eq!(msg, decoded);
|
||||
|
||||
// Verify the proof
|
||||
assert!(verify_lwe_ciphertext(&ct, &pk, &proof, crs, metadata).is_valid());
|
||||
assert!(verify_lwe_ciphertext(&ct, &pk, &proof, crs, &metadata).is_valid());
|
||||
|
||||
// verify proof with invalid ciphertext
|
||||
let index = random_generator.gen::<usize>() % ct.as_ref().len();
|
||||
let value_to_add = random_generator.gen::<Scalar>();
|
||||
ct.as_mut()[index] = ct.as_mut()[index].wrapping_add(value_to_add);
|
||||
assert!(verify_lwe_ciphertext(&ct, &pk, &proof, crs, metadata).is_invalid());
|
||||
assert!(verify_lwe_ciphertext(&ct, &pk, &proof, crs, &metadata).is_invalid());
|
||||
}
|
||||
|
||||
// In coverage, we break after one while loop iteration, changing message values does
|
||||
@@ -1122,7 +1122,7 @@ fn test_par_compact_lwe_list_public_key_encryption_and_proof() {
|
||||
let glwe_noise_distribution = TUniform::new(9);
|
||||
let ciphertext_modulus = CiphertextModulus::new_native();
|
||||
|
||||
let metadata = b"core";
|
||||
let metadata = [b'c', b'o', b'r', b'e'];
|
||||
|
||||
let delta_log = 59;
|
||||
let delta = 1u64 << delta_log;
|
||||
@@ -1195,7 +1195,7 @@ fn test_par_compact_lwe_list_public_key_encryption_and_proof() {
|
||||
glwe_noise_distribution,
|
||||
encryption_random_generator.noise_generator_mut(),
|
||||
&crs,
|
||||
metadata,
|
||||
&metadata,
|
||||
ZkComputeLoad::Proof,
|
||||
)
|
||||
.unwrap();
|
||||
@@ -1205,7 +1205,7 @@ fn test_par_compact_lwe_list_public_key_encryption_and_proof() {
|
||||
&compact_lwe_pk,
|
||||
&proof,
|
||||
&crs,
|
||||
metadata
|
||||
&metadata
|
||||
)
|
||||
.is_valid());
|
||||
|
||||
@@ -1236,7 +1236,7 @@ fn test_par_compact_lwe_list_public_key_encryption_and_proof() {
|
||||
&compact_lwe_pk,
|
||||
&proof,
|
||||
&crs,
|
||||
metadata
|
||||
&metadata
|
||||
)
|
||||
.is_invalid());
|
||||
|
||||
@@ -1284,7 +1284,7 @@ fn test_par_compact_lwe_list_public_key_encryption_and_proof() {
|
||||
glwe_noise_distribution,
|
||||
encryption_random_generator.noise_generator_mut(),
|
||||
&crs,
|
||||
metadata,
|
||||
&metadata,
|
||||
ZkComputeLoad::Proof,
|
||||
)
|
||||
.unwrap();
|
||||
@@ -1294,7 +1294,7 @@ fn test_par_compact_lwe_list_public_key_encryption_and_proof() {
|
||||
&compact_lwe_pk,
|
||||
&proof,
|
||||
&crs,
|
||||
metadata
|
||||
&metadata
|
||||
)
|
||||
.is_valid());
|
||||
|
||||
@@ -1325,7 +1325,7 @@ fn test_par_compact_lwe_list_public_key_encryption_and_proof() {
|
||||
&compact_lwe_pk,
|
||||
&proof,
|
||||
&crs,
|
||||
metadata
|
||||
&metadata
|
||||
)
|
||||
.is_invalid());
|
||||
|
||||
|
||||
@@ -538,5 +538,4 @@ macro_rules! create_parameterized_test_with_non_native_parameters {
|
||||
};
|
||||
}
|
||||
|
||||
pub(crate) use create_parameterized_test;
|
||||
pub(crate) use create_parameterized_test_with_non_native_parameters;
|
||||
pub(crate) use {create_parameterized_test, create_parameterized_test_with_non_native_parameters};
|
||||
|
||||
@@ -19,7 +19,7 @@ pub fn pbs_variance_132_bits_security_gaussian(
|
||||
lwe_dimension.0 as f64,
|
||||
glwe_dimension.0 as f64,
|
||||
polynomial_size.0 as f64,
|
||||
var_min.0,
|
||||
var_min.0 as f64,
|
||||
decomposition_level_count.0 as f64,
|
||||
decomposition_base_log.0 as f64,
|
||||
ciphertext_modulus,
|
||||
@@ -45,7 +45,7 @@ pub fn pbs_variance_132_bits_security_tuniform(
|
||||
lwe_dimension.0 as f64,
|
||||
glwe_dimension.0 as f64,
|
||||
polynomial_size.0 as f64,
|
||||
var_min.0,
|
||||
var_min.0 as f64,
|
||||
decomposition_level_count.0 as f64,
|
||||
decomposition_base_log.0 as f64,
|
||||
ciphertext_modulus,
|
||||
|
||||
@@ -53,7 +53,7 @@ macro_rules! implement_gaussian {
|
||||
for a in uniform_rand_bytes_v.iter_mut() {
|
||||
*a = generator.generate_next();
|
||||
}
|
||||
let size = <$T as crate::core_crypto::commons::numeric::Numeric>::BITS as i32;
|
||||
let size = <$T>::BITS as i32;
|
||||
let mut u: $T = <$S>::from_le_bytes(uniform_rand_bytes_u).cast_into();
|
||||
u *= <$T>::TWO.powi(-size + 1);
|
||||
let mut v: $T = <$S>::from_le_bytes(uniform_rand_bytes_v).cast_into();
|
||||
|
||||
@@ -102,7 +102,7 @@ macro_rules! implement {
|
||||
self.floor()
|
||||
}
|
||||
fn to_bit_string(&self) -> String {
|
||||
if <Self as Numeric>::BITS == 32 {
|
||||
if Self::BITS == 32 {
|
||||
let mut bit_string = format!("{:032b}", self.to_bits());
|
||||
bit_string.insert(1, ' ');
|
||||
bit_string.insert(10, ' ');
|
||||
|
||||
@@ -99,6 +99,7 @@ macro_rules! create_gpu_multi_bit_ks32_parameterized_test{
|
||||
}
|
||||
use crate::core_crypto::gpu::algorithms::test::params::MultiBitTestKS32Params;
|
||||
use crate::core_crypto::gpu::lwe_packing_keyswitch_key::CudaLwePackingKeyswitchKey;
|
||||
use create_gpu_multi_bit_ks32_parameterized_test;
|
||||
use create_gpu_multi_bit_parameterized_test;
|
||||
use create_gpu_parameterized_test;
|
||||
use {
|
||||
create_gpu_multi_bit_ks32_parameterized_test, create_gpu_multi_bit_parameterized_test,
|
||||
create_gpu_parameterized_test,
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@ pub(in crate::high_level_api) mod traits;
|
||||
use crate::array::traits::TensorSlice;
|
||||
use crate::high_level_api::array::traits::HasClear;
|
||||
use crate::high_level_api::global_state;
|
||||
use crate::high_level_api::integers::{FheIntId, FheIntegerType, FheUintId};
|
||||
use crate::high_level_api::integers::{FheIntId, FheUintId};
|
||||
use crate::high_level_api::keys::InternalServerKey;
|
||||
use crate::high_level_api::re_randomization::ReRandomizationMetadata;
|
||||
use crate::{FheBool, FheId, FheInt, FheUint, Tag};
|
||||
@@ -24,8 +24,6 @@ pub use traits::{IOwnedArray, Slicing, SlicingMut};
|
||||
use crate::array::stride::DynDimensions;
|
||||
use crate::core_crypto::prelude::{Numeric, OverflowingAdd, SignedNumeric, UnsignedNumeric};
|
||||
use crate::integer::block_decomposition::DecomposableInto;
|
||||
#[cfg(feature = "gpu")]
|
||||
use crate::integer::gpu::ciphertext::CudaIntegerRadixCiphertext;
|
||||
use crate::integer::RadixCiphertext;
|
||||
use crate::prelude::{CastFrom, CastInto};
|
||||
pub use cpu::{
|
||||
@@ -452,55 +450,6 @@ pub fn fhe_uint_array_contains_sub_slice<Id: FheUintId>(
|
||||
})
|
||||
}
|
||||
|
||||
pub fn fhe_array_contains<T>(data: &[T], value: &T) -> FheBool
|
||||
where
|
||||
T: FheIntegerType,
|
||||
{
|
||||
global_state::with_internal_keys(|sks| match sks {
|
||||
InternalServerKey::Cpu(cpu_key) => {
|
||||
let tmp_data = data
|
||||
.iter()
|
||||
.map(|element| element.on_cpu().into_owned())
|
||||
.collect::<Vec<_>>();
|
||||
let tmp_value = value.on_cpu();
|
||||
|
||||
let result = cpu_key
|
||||
.pbs_key()
|
||||
.contains_parallelized(&tmp_data, &*tmp_value);
|
||||
FheBool::new(
|
||||
result,
|
||||
cpu_key.tag.clone(),
|
||||
ReRandomizationMetadata::default(),
|
||||
)
|
||||
}
|
||||
#[cfg(feature = "gpu")]
|
||||
InternalServerKey::Cuda(gpu_key) => {
|
||||
use crate::high_level_api::details::MaybeCloned;
|
||||
|
||||
let streams = &gpu_key.streams;
|
||||
let tmp_data = data
|
||||
.iter()
|
||||
.map(|element| match element.on_gpu(streams) {
|
||||
MaybeCloned::Borrowed(ct) => ct.duplicate(streams),
|
||||
MaybeCloned::Cloned(ct) => ct,
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
let tmp_value = value.on_gpu(streams);
|
||||
|
||||
let result = gpu_key.pbs_key().contains(&tmp_data, &*tmp_value, streams);
|
||||
FheBool::new(
|
||||
result,
|
||||
gpu_key.tag.clone(),
|
||||
ReRandomizationMetadata::default(),
|
||||
)
|
||||
}
|
||||
#[cfg(feature = "hpu")]
|
||||
InternalServerKey::Hpu(_) => {
|
||||
panic!("HPU does not support contains() on FheIntegerType yet")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Small helper to reduce code
|
||||
///
|
||||
/// * num_bits: num bits of the FheType
|
||||
|
||||
@@ -2,8 +2,6 @@ mod booleans;
|
||||
mod signed;
|
||||
mod unsigned;
|
||||
|
||||
use crate::high_level_api::array::fhe_array_contains;
|
||||
use crate::high_level_api::integers::FheIntegerType;
|
||||
use crate::{generate_keys, set_server_key, ClientKey, ConfigBuilder, FheId};
|
||||
use rand::distributions::{Distribution, Standard};
|
||||
use rand::random;
|
||||
@@ -12,7 +10,7 @@ use std::fmt::Debug;
|
||||
use crate::array::traits::IOwnedArray;
|
||||
use crate::array::ClearArray;
|
||||
use crate::high_level_api::array::{FheBackendArray, FheBackendArraySlice};
|
||||
use crate::prelude::{FheDecrypt, FheEncrypt, FheTryEncrypt};
|
||||
use crate::prelude::{FheDecrypt, FheTryEncrypt};
|
||||
use std::ops::{BitAnd, BitOr, BitXor};
|
||||
|
||||
fn draw_random_values<T>(num_values: usize) -> Vec<T>
|
||||
@@ -276,42 +274,3 @@ where
|
||||
assert_eq!(result, expected_result);
|
||||
}
|
||||
}
|
||||
|
||||
fn test_case_contains<T, Clear>(ck: &ClientKey)
|
||||
where
|
||||
T: FheIntegerType + FheEncrypt<Clear, ClientKey>,
|
||||
Standard: Distribution<Clear>,
|
||||
Clear: Copy + Eq,
|
||||
{
|
||||
let values = draw_random_values::<Clear>(5);
|
||||
|
||||
// Pick one element that is guaranteed to be in the slice
|
||||
let present_value = values[random::<usize>() % values.len()];
|
||||
|
||||
// Generate an absent value that is not in the slice
|
||||
let absent_value = loop {
|
||||
let candidate: Clear = random();
|
||||
if !values.contains(&candidate) {
|
||||
break candidate;
|
||||
}
|
||||
};
|
||||
|
||||
let data: Vec<T> = values.iter().map(|&v| T::encrypt(v, ck)).collect();
|
||||
|
||||
let present = T::encrypt(present_value, ck);
|
||||
let result: bool = fhe_array_contains(&data, &present).decrypt(ck);
|
||||
assert!(result);
|
||||
|
||||
let absent = T::encrypt(absent_value, ck);
|
||||
let result: bool = fhe_array_contains(&data, &absent).decrypt(ck);
|
||||
assert!(!result);
|
||||
|
||||
// Test with a duplicated value in the slice
|
||||
let mut values_with_dup = values.clone();
|
||||
values_with_dup.push(values[0]);
|
||||
let data_with_dup: Vec<T> = values_with_dup.iter().map(|&v| T::encrypt(v, ck)).collect();
|
||||
|
||||
let present_dup = T::encrypt(values[0], ck);
|
||||
let result: bool = fhe_array_contains(&data_with_dup, &present_dup).decrypt(ck);
|
||||
assert!(result);
|
||||
}
|
||||
|
||||
@@ -101,21 +101,6 @@ fn test_cpu_dyn_bitand_scalar_slice() {
|
||||
super::bitand_scalar_slice_test_case::<crate::FheUint32Array, u32>(&ck);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_contains() {
|
||||
let ck = super::setup_default_cpu();
|
||||
super::test_case_contains::<crate::FheUint8, u8>(&ck);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "gpu")]
|
||||
fn test_contains_gpu() {
|
||||
for setup_fn in crate::high_level_api::integers::unsigned::tests::gpu::GPU_SETUP_FN {
|
||||
let ck = setup_fn();
|
||||
super::test_case_contains::<crate::FheUint8, u8>(&ck);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_single_dimension() {
|
||||
let config = ConfigBuilder::default().build();
|
||||
|
||||
@@ -10,10 +10,8 @@ use crate::integer::compression_keys::{
|
||||
use crate::integer::noise_squashing::{
|
||||
CompressedNoiseSquashingKey, NoiseSquashingKey, NoiseSquashingPrivateKey,
|
||||
};
|
||||
use crate::shortint::parameters::list_compression::CompressionParameters;
|
||||
use crate::shortint::parameters::{
|
||||
CompactPublicKeyEncryptionParameters, EncryptionKeyChoice, NoiseSquashingCompressionParameters,
|
||||
NoiseSquashingParameters, ReRandomizationParameters, ShortintKeySwitchingParameters,
|
||||
EncryptionKeyChoice, ReRandomizationParameters, ShortintKeySwitchingParameters,
|
||||
};
|
||||
use crate::Tag;
|
||||
use std::convert::Infallible;
|
||||
@@ -77,9 +75,8 @@ impl Upgrade<PublicKey> for PublicKeyV0 {
|
||||
type Error = Infallible;
|
||||
|
||||
fn upgrade(self) -> Result<PublicKey, Self::Error> {
|
||||
let Self { key } = self;
|
||||
Ok(PublicKey {
|
||||
key,
|
||||
key: self.key,
|
||||
tag: Tag::default(),
|
||||
})
|
||||
}
|
||||
@@ -100,9 +97,8 @@ impl Upgrade<CompactPublicKey> for CompactPublicKeyV0 {
|
||||
type Error = Infallible;
|
||||
|
||||
fn upgrade(self) -> Result<CompactPublicKey, Self::Error> {
|
||||
let Self { key } = self;
|
||||
Ok(CompactPublicKey {
|
||||
key,
|
||||
key: self.key,
|
||||
tag: Tag::default(),
|
||||
})
|
||||
}
|
||||
@@ -123,9 +119,8 @@ impl Upgrade<CompressedPublicKey> for CompressedPublicKeyV0 {
|
||||
type Error = Infallible;
|
||||
|
||||
fn upgrade(self) -> Result<CompressedPublicKey, Self::Error> {
|
||||
let Self { key } = self;
|
||||
Ok(CompressedPublicKey {
|
||||
key,
|
||||
key: self.key,
|
||||
tag: Tag::default(),
|
||||
})
|
||||
}
|
||||
@@ -146,9 +141,8 @@ impl Upgrade<CompressedCompactPublicKey> for CompressedCompactPublicKeyV0 {
|
||||
type Error = Infallible;
|
||||
|
||||
fn upgrade(self) -> Result<CompressedCompactPublicKey, Self::Error> {
|
||||
let Self { key } = self;
|
||||
Ok(CompressedCompactPublicKey {
|
||||
key,
|
||||
key: self.key,
|
||||
tag: Tag::default(),
|
||||
})
|
||||
}
|
||||
@@ -160,48 +154,10 @@ pub enum CompressedCompactPublicKeyVersions {
|
||||
V1(CompressedCompactPublicKey),
|
||||
}
|
||||
|
||||
#[derive(Version)]
|
||||
pub(crate) struct IntegerConfigV0 {
|
||||
pub(crate) block_parameters: crate::shortint::atomic_pattern::AtomicPatternParameters,
|
||||
pub(crate) dedicated_compact_public_key_parameters: Option<(
|
||||
CompactPublicKeyEncryptionParameters,
|
||||
ShortintKeySwitchingParameters,
|
||||
)>,
|
||||
pub(crate) compression_parameters: Option<CompressionParameters>,
|
||||
pub(crate) noise_squashing_parameters: Option<NoiseSquashingParameters>,
|
||||
pub(crate) noise_squashing_compression_parameters: Option<NoiseSquashingCompressionParameters>,
|
||||
pub(crate) cpk_re_randomization_params: Option<ReRandomizationParameters>,
|
||||
}
|
||||
|
||||
impl Upgrade<IntegerConfig> for IntegerConfigV0 {
|
||||
type Error = Infallible;
|
||||
|
||||
fn upgrade(self) -> Result<IntegerConfig, Self::Error> {
|
||||
let Self {
|
||||
block_parameters,
|
||||
dedicated_compact_public_key_parameters,
|
||||
compression_parameters,
|
||||
noise_squashing_parameters,
|
||||
noise_squashing_compression_parameters,
|
||||
cpk_re_randomization_params,
|
||||
} = self;
|
||||
Ok(IntegerConfig {
|
||||
block_parameters,
|
||||
dedicated_compact_public_key_parameters,
|
||||
compression_parameters,
|
||||
noise_squashing_parameters,
|
||||
noise_squashing_compression_parameters,
|
||||
cpk_re_randomization_params,
|
||||
dedicated_oprf_key: false,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(VersionsDispatch)]
|
||||
#[allow(unused)]
|
||||
pub(crate) enum IntegerConfigVersions {
|
||||
V0(IntegerConfigV0),
|
||||
V1(IntegerConfig),
|
||||
V0(IntegerConfig),
|
||||
}
|
||||
|
||||
impl Deprecable for IntegerClientKey {
|
||||
@@ -220,15 +176,11 @@ impl Upgrade<IntegerClientKeyV3> for IntegerClientKeyV2 {
|
||||
type Error = Infallible;
|
||||
|
||||
fn upgrade(self) -> Result<IntegerClientKeyV3, Self::Error> {
|
||||
let Self {
|
||||
key,
|
||||
dedicated_compact_private_key,
|
||||
compression_key,
|
||||
} = self;
|
||||
Ok(IntegerClientKeyV3 {
|
||||
key,
|
||||
dedicated_compact_private_key,
|
||||
compression_key: compression_key
|
||||
key: self.key,
|
||||
dedicated_compact_private_key: self.dedicated_compact_private_key,
|
||||
compression_key: self
|
||||
.compression_key
|
||||
.map(|key| crate::integer::compression_keys::CompressionPrivateKeys { key }),
|
||||
})
|
||||
}
|
||||
@@ -334,10 +286,10 @@ pub(crate) struct IntegerClientKeyV6 {
|
||||
pub(crate) cpk_re_randomization_ksk_params: Option<ShortintKeySwitchingParameters>,
|
||||
}
|
||||
|
||||
impl Upgrade<IntegerClientKeyV7> for IntegerClientKeyV6 {
|
||||
impl Upgrade<IntegerClientKey> for IntegerClientKeyV6 {
|
||||
type Error = crate::Error;
|
||||
|
||||
fn upgrade(self) -> Result<IntegerClientKeyV7, Self::Error> {
|
||||
fn upgrade(self) -> Result<IntegerClientKey, Self::Error> {
|
||||
let Self {
|
||||
key,
|
||||
dedicated_compact_private_key,
|
||||
@@ -376,39 +328,6 @@ impl Upgrade<IntegerClientKeyV7> for IntegerClientKeyV6 {
|
||||
}
|
||||
};
|
||||
|
||||
Ok(IntegerClientKeyV7 {
|
||||
key,
|
||||
dedicated_compact_private_key,
|
||||
compression_key,
|
||||
noise_squashing_private_key,
|
||||
noise_squashing_compression_private_key,
|
||||
cpk_re_randomization_params,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Version)]
|
||||
pub(crate) struct IntegerClientKeyV7 {
|
||||
pub(crate) key: crate::integer::ClientKey,
|
||||
pub(crate) dedicated_compact_private_key: Option<CompactPrivateKey>,
|
||||
pub(crate) compression_key: Option<CompressionPrivateKeys>,
|
||||
pub(crate) noise_squashing_private_key: Option<NoiseSquashingPrivateKey>,
|
||||
pub(crate) noise_squashing_compression_private_key: Option<NoiseSquashingCompressionPrivateKey>,
|
||||
pub(crate) cpk_re_randomization_params: Option<ReRandomizationParameters>,
|
||||
}
|
||||
|
||||
impl Upgrade<IntegerClientKey> for IntegerClientKeyV7 {
|
||||
type Error = Infallible;
|
||||
|
||||
fn upgrade(self) -> Result<IntegerClientKey, Self::Error> {
|
||||
let Self {
|
||||
key,
|
||||
dedicated_compact_private_key,
|
||||
compression_key,
|
||||
noise_squashing_private_key,
|
||||
noise_squashing_compression_private_key,
|
||||
cpk_re_randomization_params,
|
||||
} = self;
|
||||
Ok(IntegerClientKey {
|
||||
key,
|
||||
dedicated_compact_private_key,
|
||||
@@ -416,7 +335,6 @@ impl Upgrade<IntegerClientKey> for IntegerClientKeyV7 {
|
||||
noise_squashing_private_key,
|
||||
noise_squashing_compression_private_key,
|
||||
cpk_re_randomization_params,
|
||||
dedicated_oprf_private_key: None,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -431,8 +349,7 @@ pub(crate) enum IntegerClientKeyVersions {
|
||||
V4(IntegerClientKeyV4),
|
||||
V5(IntegerClientKeyV5),
|
||||
V6(IntegerClientKeyV6),
|
||||
V7(IntegerClientKeyV7),
|
||||
V8(IntegerClientKey),
|
||||
V7(IntegerClientKey),
|
||||
}
|
||||
|
||||
impl Deprecable for IntegerServerKey {
|
||||
@@ -556,10 +473,10 @@ pub struct IntegerServerKeyV7 {
|
||||
Option<ReRandomizationKeySwitchingKey>,
|
||||
}
|
||||
|
||||
impl Upgrade<IntegerServerKeyV8> for IntegerServerKeyV7 {
|
||||
impl Upgrade<IntegerServerKey> for IntegerServerKeyV7 {
|
||||
type Error = Infallible;
|
||||
|
||||
fn upgrade(self) -> Result<IntegerServerKeyV8, Self::Error> {
|
||||
fn upgrade(self) -> Result<IntegerServerKey, Self::Error> {
|
||||
let Self {
|
||||
key,
|
||||
cpk_key_switching_key_material,
|
||||
@@ -570,7 +487,7 @@ impl Upgrade<IntegerServerKeyV8> for IntegerServerKeyV7 {
|
||||
cpk_re_randomization_key_switching_key_material,
|
||||
} = self;
|
||||
|
||||
Ok(IntegerServerKeyV8 {
|
||||
Ok(IntegerServerKey {
|
||||
key,
|
||||
cpk_key_switching_key_material,
|
||||
compression_key,
|
||||
@@ -586,44 +503,6 @@ impl Upgrade<IntegerServerKeyV8> for IntegerServerKeyV7 {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Version)]
|
||||
pub struct IntegerServerKeyV8 {
|
||||
pub(crate) key: crate::integer::ServerKey,
|
||||
pub(crate) cpk_key_switching_key_material:
|
||||
Option<crate::integer::key_switching_key::KeySwitchingKeyMaterial>,
|
||||
pub(crate) compression_key: Option<CompressionKey>,
|
||||
pub(crate) decompression_key: Option<DecompressionKey>,
|
||||
pub(crate) noise_squashing_key: Option<NoiseSquashingKey>,
|
||||
pub(crate) noise_squashing_compression_key: Option<NoiseSquashingCompressionKey>,
|
||||
pub(crate) cpk_re_randomization_key: Option<ReRandomizationKey>,
|
||||
}
|
||||
|
||||
impl Upgrade<IntegerServerKey> for IntegerServerKeyV8 {
|
||||
type Error = Infallible;
|
||||
|
||||
fn upgrade(self) -> Result<IntegerServerKey, Self::Error> {
|
||||
let Self {
|
||||
key,
|
||||
cpk_key_switching_key_material,
|
||||
compression_key,
|
||||
decompression_key,
|
||||
noise_squashing_key,
|
||||
noise_squashing_compression_key,
|
||||
cpk_re_randomization_key,
|
||||
} = self;
|
||||
Ok(IntegerServerKey {
|
||||
key,
|
||||
cpk_key_switching_key_material,
|
||||
compression_key,
|
||||
decompression_key,
|
||||
noise_squashing_key,
|
||||
noise_squashing_compression_key,
|
||||
cpk_re_randomization_key,
|
||||
oprf_key: None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(VersionsDispatch)]
|
||||
pub enum IntegerServerKeyVersions {
|
||||
V0(Deprecated<IntegerServerKey>),
|
||||
@@ -634,8 +513,7 @@ pub enum IntegerServerKeyVersions {
|
||||
V5(IntegerServerKeyV5),
|
||||
V6(IntegerServerKeyV6),
|
||||
V7(IntegerServerKeyV7),
|
||||
V8(IntegerServerKeyV8),
|
||||
V9(IntegerServerKey),
|
||||
V8(IntegerServerKey),
|
||||
}
|
||||
|
||||
impl Deprecable for IntegerCompressedServerKey {
|
||||
@@ -755,10 +633,10 @@ pub struct IntegerCompressedServerKeyV5 {
|
||||
Option<CompressedReRandomizationKeySwitchingKey>,
|
||||
}
|
||||
|
||||
impl Upgrade<IntegerCompressedServerKeyV6> for IntegerCompressedServerKeyV5 {
|
||||
impl Upgrade<IntegerCompressedServerKey> for IntegerCompressedServerKeyV5 {
|
||||
type Error = Infallible;
|
||||
|
||||
fn upgrade(self) -> Result<IntegerCompressedServerKeyV6, Self::Error> {
|
||||
fn upgrade(self) -> Result<IntegerCompressedServerKey, Self::Error> {
|
||||
let Self {
|
||||
key,
|
||||
cpk_key_switching_key_material,
|
||||
@@ -769,7 +647,7 @@ impl Upgrade<IntegerCompressedServerKeyV6> for IntegerCompressedServerKeyV5 {
|
||||
cpk_re_randomization_key_switching_key_material,
|
||||
} = self;
|
||||
|
||||
Ok(IntegerCompressedServerKeyV6 {
|
||||
Ok(IntegerCompressedServerKey {
|
||||
key,
|
||||
cpk_key_switching_key_material,
|
||||
compression_key,
|
||||
@@ -785,45 +663,6 @@ impl Upgrade<IntegerCompressedServerKeyV6> for IntegerCompressedServerKeyV5 {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Version)]
|
||||
pub struct IntegerCompressedServerKeyV6 {
|
||||
pub(crate) key: crate::integer::CompressedServerKey,
|
||||
pub(crate) cpk_key_switching_key_material:
|
||||
Option<crate::integer::key_switching_key::CompressedKeySwitchingKeyMaterial>,
|
||||
pub(crate) compression_key: Option<CompressedCompressionKey>,
|
||||
pub(crate) decompression_key: Option<CompressedDecompressionKey>,
|
||||
pub(crate) noise_squashing_key: Option<CompressedNoiseSquashingKey>,
|
||||
pub(crate) noise_squashing_compression_key: Option<CompressedNoiseSquashingCompressionKey>,
|
||||
pub(crate) cpk_re_randomization_key: Option<CompressedReRandomizationKey>,
|
||||
}
|
||||
|
||||
impl Upgrade<IntegerCompressedServerKey> for IntegerCompressedServerKeyV6 {
|
||||
type Error = Infallible;
|
||||
|
||||
fn upgrade(self) -> Result<IntegerCompressedServerKey, Self::Error> {
|
||||
let Self {
|
||||
key,
|
||||
cpk_key_switching_key_material,
|
||||
compression_key,
|
||||
decompression_key,
|
||||
noise_squashing_key,
|
||||
noise_squashing_compression_key,
|
||||
cpk_re_randomization_key,
|
||||
} = self;
|
||||
|
||||
Ok(IntegerCompressedServerKey {
|
||||
key,
|
||||
cpk_key_switching_key_material,
|
||||
compression_key,
|
||||
decompression_key,
|
||||
noise_squashing_key,
|
||||
noise_squashing_compression_key,
|
||||
cpk_re_randomization_key,
|
||||
oprf_key: None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(VersionsDispatch)]
|
||||
pub enum IntegerCompressedServerKeyVersions {
|
||||
V0(Deprecated<IntegerCompressedServerKey>),
|
||||
@@ -832,8 +671,7 @@ pub enum IntegerCompressedServerKeyVersions {
|
||||
V3(IntegerCompressedServerKeyV3),
|
||||
V4(IntegerCompressedServerKeyV4),
|
||||
V5(IntegerCompressedServerKeyV5),
|
||||
V6(IntegerCompressedServerKeyV6),
|
||||
V7(IntegerCompressedServerKey),
|
||||
V6(IntegerCompressedServerKey),
|
||||
}
|
||||
|
||||
#[derive(VersionsDispatch)]
|
||||
|
||||
@@ -7,7 +7,7 @@ use crate::integer::gpu::ciphertext::boolean_value::CudaBooleanBlock;
|
||||
#[cfg(feature = "gpu")]
|
||||
use crate::integer::gpu::ciphertext::CudaUnsignedRadixCiphertext;
|
||||
use crate::integer::BooleanBlock;
|
||||
use crate::shortint::OprfSeed;
|
||||
use tfhe_csprng::seeders::Seed;
|
||||
|
||||
impl FheBool {
|
||||
/// Generates an encrypted boolean
|
||||
@@ -28,15 +28,12 @@ impl FheBool {
|
||||
///
|
||||
/// let dec_result: bool = ct_res.decrypt(&client_key);
|
||||
/// ```
|
||||
pub fn generate_oblivious_pseudo_random(seed: impl OprfSeed) -> Self {
|
||||
pub fn generate_oblivious_pseudo_random(seed: Seed) -> Self {
|
||||
let (ciphertext, tag) = global_state::with_internal_keys(|key| match key {
|
||||
InternalServerKey::Cpu(key) => {
|
||||
let sk = &key.pbs_key().key;
|
||||
|
||||
let ct = key
|
||||
.oprf_key()
|
||||
.key
|
||||
.generate_oblivious_pseudo_random(seed, 1, sk);
|
||||
let ct = sk.generate_oblivious_pseudo_random(seed, 1);
|
||||
(
|
||||
InnerBoolean::Cpu(BooleanBlock::new_unchecked(ct)),
|
||||
key.tag.clone(),
|
||||
@@ -46,8 +43,9 @@ impl FheBool {
|
||||
InternalServerKey::Cuda(cuda_key) => {
|
||||
let streams = &cuda_key.streams;
|
||||
let d_ct: CudaUnsignedRadixCiphertext = cuda_key
|
||||
.oprf_key()
|
||||
.generate_oblivious_pseudo_random(seed, 1, cuda_key.pbs_key(), streams);
|
||||
.key
|
||||
.key
|
||||
.generate_oblivious_pseudo_random(seed, 1, streams);
|
||||
(
|
||||
InnerBoolean::Cuda(CudaBooleanBlock::from_cuda_radix_ciphertext(
|
||||
d_ct.ciphertext,
|
||||
@@ -68,18 +66,17 @@ impl FheBool {
|
||||
#[cfg(feature = "gpu")]
|
||||
mod test {
|
||||
use crate::prelude::FheDecrypt;
|
||||
use tfhe_csprng::seeders::Seed;
|
||||
|
||||
#[test]
|
||||
fn test_oprf_boolean() {
|
||||
let config = crate::ConfigBuilder::default()
|
||||
.use_dedicated_oprf_key(true)
|
||||
.build();
|
||||
let config = crate::ConfigBuilder::default().build();
|
||||
let client_key = crate::ClientKey::generate(config);
|
||||
let compressed_server_key = crate::CompressedServerKey::new(&client_key);
|
||||
let gpu_key = compressed_server_key.decompress_to_gpu();
|
||||
crate::set_server_key(gpu_key);
|
||||
|
||||
let rnd = crate::FheBool::generate_oblivious_pseudo_random(crate::Seed(123));
|
||||
let rnd = crate::FheBool::generate_oblivious_pseudo_random(Seed(123u128));
|
||||
let decrypted_result: bool = rnd.decrypt(&client_key);
|
||||
println!("Random bool: {decrypted_result}");
|
||||
}
|
||||
|
||||
@@ -462,10 +462,7 @@ mod zk {
|
||||
use crate::conformance::ParameterSetConformant;
|
||||
use crate::high_level_api::global_state::device_of_internal_keys;
|
||||
use crate::high_level_api::keys::InternalServerKey;
|
||||
use crate::high_level_api::re_randomization::ReRandContextAdd;
|
||||
use crate::integer::ciphertext::{
|
||||
IntegerProvenCompactCiphertextListConformanceParams, ReRandomizationSeed,
|
||||
};
|
||||
use crate::integer::ciphertext::IntegerProvenCompactCiphertextListConformanceParams;
|
||||
#[cfg(feature = "gpu")]
|
||||
use crate::integer::gpu::zk::CudaProvenCompactCiphertextList;
|
||||
use serde::Serializer;
|
||||
@@ -623,13 +620,6 @@ mod zk {
|
||||
const NAME: &'static str = "high_level_api::ProvenCompactCiphertextList";
|
||||
}
|
||||
|
||||
impl ReRandContextAdd for ProvenCompactCiphertextList {
|
||||
fn add_to_re_randomization_context(&self, context: &mut crate::ReRandomizationContext) {
|
||||
let on_cpu = self.inner.on_cpu();
|
||||
context.inner.add_proven_ciphertext_list(on_cpu)
|
||||
}
|
||||
}
|
||||
|
||||
impl ProvenCompactCiphertextList {
|
||||
pub fn builder(pk: &CompactPublicKey) -> CompactCiphertextListBuilder {
|
||||
CompactCiphertextListBuilder::new(pk)
|
||||
@@ -665,7 +655,7 @@ mod zk {
|
||||
pk: &CompactPublicKey,
|
||||
metadata: &[u8],
|
||||
) -> crate::Result<CompactCiphertextListExpander> {
|
||||
self.maybe_verify_maybe_re_randomize_and_expand(Some((crs, pk, metadata)), None)
|
||||
self.maybe_verify_and_expand(Some((crs, pk, metadata)))
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
@@ -673,68 +663,27 @@ mod zk {
|
||||
///
|
||||
/// If you are here you were probably looking for it: use at your own risks.
|
||||
pub fn expand_without_verification(&self) -> crate::Result<CompactCiphertextListExpander> {
|
||||
self.maybe_verify_maybe_re_randomize_and_expand(None, None)
|
||||
self.maybe_verify_and_expand(None)
|
||||
}
|
||||
|
||||
pub fn verify_re_randomize_and_expand(
|
||||
&self,
|
||||
crs: &CompactPkeCrs,
|
||||
pk: &CompactPublicKey,
|
||||
metadata: &[u8],
|
||||
seed: ReRandomizationSeed,
|
||||
) -> crate::Result<CompactCiphertextListExpander> {
|
||||
self.maybe_verify_maybe_re_randomize_and_expand(
|
||||
Some((crs, pk, metadata)),
|
||||
Some((pk, seed)),
|
||||
)
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
/// This function allows to re_randomize and expand a ciphertext without verifying the
|
||||
/// associated proof.
|
||||
///
|
||||
/// If you are here you were probably looking for it: use at your own risks.
|
||||
pub fn re_randomize_and_expand_without_verification(
|
||||
&self,
|
||||
pk: &CompactPublicKey,
|
||||
seed: ReRandomizationSeed,
|
||||
) -> crate::Result<CompactCiphertextListExpander> {
|
||||
self.maybe_verify_maybe_re_randomize_and_expand(None, Some((pk, seed)))
|
||||
}
|
||||
|
||||
/// Internal helper that does expansion, and optionally verification and re_randomization if
|
||||
/// the required materials are provided
|
||||
fn maybe_verify_maybe_re_randomize_and_expand(
|
||||
/// Internal helper that does expansion, and verification only if crs, public key and
|
||||
/// metadata are provided
|
||||
fn maybe_verify_and_expand(
|
||||
&self,
|
||||
verification_materials: Option<(&CompactPkeCrs, &CompactPublicKey, &[u8])>,
|
||||
re_randomization_materials: Option<(&CompactPublicKey, ReRandomizationSeed)>,
|
||||
) -> crate::Result<CompactCiphertextListExpander> {
|
||||
#[allow(irrefutable_let_patterns)]
|
||||
if let InnerProvenCompactCiphertextList::Cpu(inner) = &self.inner {
|
||||
// For WASM
|
||||
if !inner.is_packed() && !inner.needs_casting() {
|
||||
let expander = match (verification_materials, re_randomization_materials) {
|
||||
(Some((crs, pk, metadata)), Some((_, seed))) => inner
|
||||
.verify_re_randomize_and_expand(
|
||||
crs,
|
||||
&pk.key.key,
|
||||
metadata,
|
||||
IntegerCompactCiphertextListExpansionMode::NoCastingAndNoUnpacking,
|
||||
seed,
|
||||
),
|
||||
(None, Some((pk, seed))) => inner
|
||||
.re_randomize_and_expand_without_verification(
|
||||
IntegerCompactCiphertextListExpansionMode::NoCastingAndNoUnpacking,
|
||||
&pk.key.key,
|
||||
seed,
|
||||
),
|
||||
(Some((crs, pk, metadata)), None) => inner.verify_and_expand(
|
||||
let expander = match verification_materials {
|
||||
Some((crs, pk, metadata)) => inner.verify_and_expand(
|
||||
crs,
|
||||
&pk.key.key,
|
||||
metadata,
|
||||
IntegerCompactCiphertextListExpansionMode::NoCastingAndNoUnpacking,
|
||||
),
|
||||
(None, None) => inner.expand_without_verification(
|
||||
None => inner.expand_without_verification(
|
||||
IntegerCompactCiphertextListExpansionMode::NoCastingAndNoUnpacking,
|
||||
),
|
||||
}?;
|
||||
@@ -756,28 +705,14 @@ mod zk {
|
||||
InnerProvenCompactCiphertextList::Cuda(inner) => &inner.h_proved_lists,
|
||||
};
|
||||
|
||||
let expander = match (verification_materials, re_randomization_materials) {
|
||||
(Some((crs, pk, metadata)), Some((_, seed))) => proven_ct
|
||||
.verify_re_randomize_and_expand(
|
||||
crs,
|
||||
&pk.key.key,
|
||||
metadata,
|
||||
cpu_key.integer_compact_ciphertext_list_expansion_mode(),
|
||||
seed,
|
||||
),
|
||||
(Some((crs, pk, metadata)), None) => proven_ct.verify_and_expand(
|
||||
let expander = match verification_materials {
|
||||
Some((crs, pk, metadata)) => proven_ct.verify_and_expand(
|
||||
crs,
|
||||
&pk.key.key,
|
||||
metadata,
|
||||
cpu_key.integer_compact_ciphertext_list_expansion_mode(),
|
||||
),
|
||||
(None, Some((pk, seed))) => proven_ct
|
||||
.re_randomize_and_expand_without_verification(
|
||||
cpu_key.integer_compact_ciphertext_list_expansion_mode(),
|
||||
&pk.key.key,
|
||||
seed,
|
||||
),
|
||||
(None, None) => proven_ct.expand_without_verification(
|
||||
None => proven_ct.expand_without_verification(
|
||||
cpu_key.integer_compact_ciphertext_list_expansion_mode(),
|
||||
),
|
||||
}?;
|
||||
@@ -799,28 +734,11 @@ mod zk {
|
||||
};
|
||||
|
||||
let ksk = gpu_key.cpk_key_switching_key();
|
||||
let expander = match (verification_materials, re_randomization_materials) {
|
||||
(Some((crs, pk, metadata)), Some((_, seed))) => proven_ct
|
||||
.verify_re_randomize_and_expand(
|
||||
crs,
|
||||
&pk.key.key,
|
||||
metadata,
|
||||
&ksk,
|
||||
seed,
|
||||
streams,
|
||||
),
|
||||
(Some((crs, pk, metadata)), None) => {
|
||||
let expander = match verification_materials {
|
||||
Some((crs, pk, metadata)) => {
|
||||
proven_ct.verify_and_expand(crs, &pk.key.key, metadata, &ksk, streams)
|
||||
}
|
||||
|
||||
(None, Some((pk, seed))) => proven_ct
|
||||
.re_randomize_and_expand_without_verification(
|
||||
&ksk,
|
||||
&pk.key.key,
|
||||
seed,
|
||||
streams,
|
||||
),
|
||||
(None, None) => proven_ct.expand_without_verification(&ksk, streams),
|
||||
None => proven_ct.expand_without_verification(&ksk, streams),
|
||||
}?;
|
||||
|
||||
Ok(CompactCiphertextListExpander {
|
||||
@@ -870,7 +788,7 @@ mod zk {
|
||||
let crs = CompactPkeCrs::from_config(config.into(), 64).unwrap();
|
||||
let public_key = crate::CompactPublicKey::try_new(&client_key).unwrap();
|
||||
|
||||
let metadata = b"TFHE-rs";
|
||||
let metadata = [b'T', b'F', b'H', b'E', b'-', b'r', b's'];
|
||||
|
||||
let clear_a = rng.gen::<u64>();
|
||||
let clear_b = rng.gen::<bool>();
|
||||
@@ -878,7 +796,7 @@ mod zk {
|
||||
let proven_compact_list = crate::ProvenCompactCiphertextList::builder(&public_key)
|
||||
.push(clear_a)
|
||||
.push(clear_b)
|
||||
.build_with_proof_packed(&crs, metadata, ZkComputeLoad::Proof)
|
||||
.build_with_proof_packed(&crs, &metadata, ZkComputeLoad::Proof)
|
||||
.unwrap();
|
||||
|
||||
let params =
|
||||
@@ -1628,7 +1546,7 @@ mod tests {
|
||||
// Intentionally low so that we test when multiple lists and proofs are needed
|
||||
let crs = CompactPkeCrs::from_config(config, 32).unwrap();
|
||||
|
||||
let metadata = b"hlapi";
|
||||
let metadata = [b'h', b'l', b'a', b'p', b'i'];
|
||||
|
||||
let compact_list = ProvenCompactCiphertextList::builder(&pk)
|
||||
.push(17u32)
|
||||
@@ -1636,12 +1554,14 @@ mod tests {
|
||||
.push(false)
|
||||
.push_with_num_bits(3u32, 2)
|
||||
.unwrap()
|
||||
.build_with_proof_packed(&crs, metadata, ZkComputeLoad::Proof)
|
||||
.build_with_proof_packed(&crs, &metadata, ZkComputeLoad::Proof)
|
||||
.unwrap();
|
||||
|
||||
let serialized = bincode::serialize(&compact_list).unwrap();
|
||||
let compact_list: ProvenCompactCiphertextList = bincode::deserialize(&serialized).unwrap();
|
||||
let expander = compact_list.verify_and_expand(&crs, &pk, metadata).unwrap();
|
||||
let expander = compact_list
|
||||
.verify_and_expand(&crs, &pk, &metadata)
|
||||
.unwrap();
|
||||
|
||||
{
|
||||
let a: FheUint32 = expander.get(0).unwrap().unwrap();
|
||||
@@ -1707,7 +1627,7 @@ mod tests {
|
||||
set_server_key(sks);
|
||||
|
||||
let crs = CompactPkeCrs::from_config(config, 32).unwrap();
|
||||
let metadata = b"seed";
|
||||
let metadata = [b's', b'e', b'e', b'd'];
|
||||
|
||||
let mut rng = thread_rng();
|
||||
let seed_a: [u8; 16] = rng.gen();
|
||||
@@ -1719,7 +1639,7 @@ mod tests {
|
||||
.push(17u32)
|
||||
.push(-1i64)
|
||||
.push(false)
|
||||
.build_with_proof_packed_seeded(&crs, metadata, ZkComputeLoad::Proof, seed)
|
||||
.build_with_proof_packed_seeded(&crs, &metadata, ZkComputeLoad::Proof, seed)
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
@@ -1736,7 +1656,7 @@ mod tests {
|
||||
"different seeds must produce different output"
|
||||
);
|
||||
|
||||
let expander = list_a1.verify_and_expand(&crs, &pk, metadata).unwrap();
|
||||
let expander = list_a1.verify_and_expand(&crs, &pk, &metadata).unwrap();
|
||||
let a: FheUint32 = expander.get(0).unwrap().unwrap();
|
||||
let b: FheInt64 = expander.get(1).unwrap().unwrap();
|
||||
let c: FheBool = expander.get(2).unwrap().unwrap();
|
||||
@@ -1767,13 +1687,15 @@ mod tests {
|
||||
|
||||
let crs = CompactPkeCrs::from_config(config, 32).unwrap();
|
||||
|
||||
let metadata = b"hlapi";
|
||||
let metadata = [b'h', b'l', b'a', b'p', b'i'];
|
||||
|
||||
let compact_list = CompactCiphertextList::builder(&pk)
|
||||
.build_with_proof_packed(&crs, metadata, ZkComputeLoad::Proof)
|
||||
.build_with_proof_packed(&crs, &metadata, ZkComputeLoad::Proof)
|
||||
.unwrap();
|
||||
|
||||
let expander = compact_list.verify_and_expand(&crs, &pk, metadata).unwrap();
|
||||
let expander = compact_list
|
||||
.verify_and_expand(&crs, &pk, &metadata)
|
||||
.unwrap();
|
||||
|
||||
assert!(expander.get::<FheBool>(0).unwrap().is_none());
|
||||
}
|
||||
@@ -1814,7 +1736,7 @@ mod tests {
|
||||
// Intentionally low so that we test when multiple lists and proofs are needed
|
||||
let crs = CompactPkeCrs::from_config(config, 32).unwrap();
|
||||
|
||||
let metadata = b"hlapi";
|
||||
let metadata = [b'h', b'l', b'a', b'p', b'i'];
|
||||
|
||||
let compact_list = ProvenCompactCiphertextList::builder(&pk)
|
||||
.push(17u32)
|
||||
@@ -1822,13 +1744,15 @@ mod tests {
|
||||
.push(false)
|
||||
.push_with_num_bits(3u32, 2)
|
||||
.unwrap()
|
||||
.build_with_proof_packed(&crs, metadata, ZkComputeLoad::Proof)
|
||||
.build_with_proof_packed(&crs, &metadata, ZkComputeLoad::Proof)
|
||||
.unwrap();
|
||||
|
||||
let serialized = bincode::serialize(&compact_list).unwrap();
|
||||
let compact_list: ProvenCompactCiphertextList =
|
||||
bincode::deserialize(&serialized).unwrap();
|
||||
let expander = compact_list.verify_and_expand(&crs, &pk, metadata).unwrap();
|
||||
let expander = compact_list
|
||||
.verify_and_expand(&crs, &pk, &metadata)
|
||||
.unwrap();
|
||||
|
||||
{
|
||||
let a: FheUint32 = expander.get(0).unwrap().unwrap();
|
||||
|
||||
@@ -132,11 +132,6 @@ impl ConfigBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn use_dedicated_oprf_key(mut self, enabled: bool) -> Self {
|
||||
self.config.inner.use_dedicated_oprf_key(enabled);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn use_custom_parameters<P>(mut self, block_parameters: P) -> Self
|
||||
where
|
||||
P: Into<crate::shortint::atomic_pattern::AtomicPatternParameters>,
|
||||
@@ -172,7 +167,6 @@ impl From<MetaParameters> for Config {
|
||||
.noise_squashing_parameters
|
||||
.and_then(|ns_p| ns_p.compression_parameters),
|
||||
cpk_re_randomization_params: meta_params.rerandomization_parameters(),
|
||||
dedicated_oprf_key: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||