# Run all integer benchmarks on a permanent HPU instance and return parsed results to Slab CI bot. name: benchmark_hpu_integer on: workflow_dispatch: inputs: all_precisions: description: "Run all precisions" type: boolean bench_type: description: "Benchmarks type" type: choice default: both options: - latency - throughput - both env: CARGO_TERM_COLOR: always RESULTS_FILENAME: parsed_benchmark_results_${{ github.sha }}.json ACTION_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} RUST_BACKTRACE: "full" RUST_MIN_STACK: "8388608" FAST_BENCH: TRUE permissions: {} jobs: prepare-matrix: name: Prepare operations matrix runs-on: v80-marais outputs: bench_type: ${{ steps.set_bench_type.outputs.bench_type }} steps: - name: Set benchmark types if: github.event_name == 'workflow_dispatch' run: | if [[ -z $INPUTS_BENCH_TYPE || "${INPUTS_BENCH_TYPE}" == "both" ]]; then echo "BENCH_TYPE=[\"latency\", \"throughput\"]" >> "${GITHUB_ENV}" else echo "BENCH_TYPE=[\"${INPUTS_BENCH_TYPE}\"]" >> "${GITHUB_ENV}" fi env: INPUTS_BENCH_TYPE: ${{ inputs.bench_type }} - name: Default benchmark type if: github.event_name != 'workflow_dispatch' run: | echo "BENCH_TYPE=[\"latency\"]" >> "${GITHUB_ENV}" - name: Set benchmark types output id: set_bench_type run: | # zizmor: ignore[template-injection] this env variable is safe echo "bench_type=${{ toJSON(env.BENCH_TYPE) }}" >> "${GITHUB_OUTPUT}" integer-benchmarks-hpu: name: benchmark_hpu_integer/integer-benchmarks-hpu needs: prepare-matrix runs-on: v80-marais concurrency: group: ${{ github.workflow }}_${{ github.ref }} cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} timeout-minutes: 1440 # 24 hours strategy: max-parallel: 1 matrix: bench_type: ${{ fromJSON(needs.prepare-matrix.outputs.bench_type) }} steps: # Needed as long as hw_regmap repository is private - name: Configure SSH uses: webfactory/ssh-agent@a6f90b1f127823b31d4d4a8d96047790581349bd # v0.9.1 with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - name: Checkout tfhe-rs repo with tags uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: fetch-depth: 0 persist-credentials: 'false' lfs: true token: ${{ secrets.REPO_CHECKOUT_TOKEN }} - name: Get benchmark details run: | COMMIT_DATE=$(git --no-pager show -s --format=%cd --date=iso8601-strict "${SHA}"); { echo "BENCH_DATE=$(date --iso-8601=seconds)"; echo "COMMIT_DATE=${COMMIT_DATE}"; echo "COMMIT_HASH=$(git describe --tags --dirty)"; } >> "${GITHUB_ENV}" env: SHA: ${{ github.sha }} - name: Install rust uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # zizmor: ignore[stale-action-refs] this action doesn't create releases with: toolchain: nightly - name: Checkout Slab repo uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: repository: zama-ai/slab path: slab persist-credentials: 'false' token: ${{ secrets.REPO_CHECKOUT_TOKEN }} - name: Should run benchmarks with all precisions if: inputs.all_precisions run: | echo "FAST_BENCH=FALSE" >> "${GITHUB_ENV}" - name: Run benchmarks run: | make pull_hpu_files export V80_SERIAL_NUMBER=XFL12NWY3ZKG source /opt/amd/Vivado/2024.2/settings64.sh make BENCH_TYPE="${BENCH_TYPE}" bench_integer_hpu env: BENCH_TYPE: ${{ matrix.bench_type }} - name: Parse results run: | python3 ./ci/benchmark_parser.py target/criterion "${RESULTS_FILENAME}" \ --database tfhe_rs \ --hardware "hpu_x1" \ --backend hpu \ --project-version "${COMMIT_HASH}" \ --branch "${REF_NAME}" \ --commit-date "${COMMIT_DATE}" \ --bench-date "${BENCH_DATE}" \ --walk-subdirs \ --bench-type "${BENCH_TYPE}" env: REF_NAME: ${{ github.ref_name }} BENCH_TYPE: ${{ matrix.bench_type }} - name: Upload parsed results artifact uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 with: name: ${{ github.sha }}_${{ matrix.bench_type }}_integer_benchmarks path: ${{ env.RESULTS_FILENAME }} - name: Send data to Slab shell: bash run: | python3 slab/scripts/data_sender.py "${RESULTS_FILENAME}" "${JOB_SECRET}" \ --slab-url "${SLAB_URL}" env: JOB_SECRET: ${{ secrets.JOB_SECRET }} SLAB_URL: ${{ secrets.SLAB_URL }}