Skip to content

Commit

Permalink
Merge branch 'main' into franziskus/ml-dsa-boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
franziskuskiefer authored Aug 30, 2024
2 parents af54f50 + 84c5d87 commit f3e2120
Show file tree
Hide file tree
Showing 96 changed files with 2,497 additions and 1,556 deletions.
12 changes: 6 additions & 6 deletions .docker/c/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,24 @@ unzip hacl-star.zip
rm -rf hacl-star.zip
mv hacl-star-2a8b61343a1a7232611cb763b0dc3e4dff84d656/ hacl-star

curl -L https://github.com/AeneasVerif/charon/archive/962f26311ccdf09a6a3cfeacbccafba22bf3d405.zip \
curl -L https://github.com/AeneasVerif/charon/archive/6b5e110342a771a3e1c739b10294b1778e4be8b4.zip \
--output charon.zip
unzip charon.zip
rm -rf charon.zip
mv charon-962f26311ccdf09a6a3cfeacbccafba22bf3d405/ charon
mv charon-6b5e110342a771a3e1c739b10294b1778e4be8b4/ charon


curl -L https://github.com/FStarLang/karamel/archive/7862fdc3899b718d39ec98568f78ec40592a622a.zip \
curl -L https://github.com/FStarLang/karamel/archive/3205d3365ea2790b02368f79fcee38e38d0b5908.zip \
--output karamel.zip
unzip karamel.zip
rm -rf karamel.zip
mv karamel-7862fdc3899b718d39ec98568f78ec40592a622a/ karamel
mv karamel-3205d3365ea2790b02368f79fcee38e38d0b5908/ karamel

curl -L https://github.com/AeneasVerif/eurydice/archive/e66abbc2119485abfafa17c1911bdbdada5b04f3.zip \
curl -L https://github.com/AeneasVerif/eurydice/archive/31be7d65ca5d6acdacfb33652e478d24dd85c1cb.zip \
--output eurydice.zip
unzip eurydice.zip
rm -rf eurydice.zip
mv eurydice-e66abbc2119485abfafa17c1911bdbdada5b04f3/ eurydice
mv eurydice-31be7d65ca5d6acdacfb33652e478d24dd85c1cb/ eurydice

echo "export FSTAR_HOME=$HOME/fstar" >>$HOME/.profile
echo "export HACL_HOME=$HOME/hacl-star" >>$HOME/.profile
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/c-bench.yml.disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Benchmark C

on:
workflow_dispatch:
merge_group:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
benchmark:
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
# - windows-latest # currently runs forever, needs to be investigated before adding again!

runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash

steps:
- uses: actions/checkout@v4

- name: πŸ”¨ Build libcrux-ml-kem/c
working-directory: libcrux-ml-kem/c
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release

# FIXME: Benchmarks on Windows CI are not working right now.
# - name: πŸƒπŸ»β€β™€οΈ Benchmark
# working-directory: libcrux-ml-kem/c
# run: ./build/Release/ml_kem_bench
# if: ${{ matrix.os == 'windows-latest' }}

- name: πŸƒπŸ»β€β™€οΈ Benchmark (libcrux-ml-kem/c)
working-directory: libcrux-ml-kem/c
run: ./build/ml_kem_bench
if: ${{ matrix.os != 'windows-latest' && (github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch') }}

- name: πŸ”¨ Build libcrux-ml-kem/cg
working-directory: libcrux-ml-kem/cg
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release

- name: πŸƒπŸ»β€β™€οΈ Benchmark libcrux-ml-kem/cg
working-directory: libcrux-ml-kem/cg
run: ./build/ml_kem_bench
if: ${{ matrix.os != 'windows-latest' && (github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch') }}
53 changes: 0 additions & 53 deletions .github/workflows/c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ concurrency:

jobs:
extract:
if: ${{ github.event_name != 'merge_group' }}
runs-on: ubuntu-latest
container: franziskus/libcrux-c:latest
defaults:
Expand All @@ -36,7 +35,6 @@ jobs:
if-no-files-found: error

extract-header-only:
if: ${{ github.event_name != 'merge_group' }}
runs-on: ubuntu-latest
container: franziskus/libcrux-c:latest
defaults:
Expand All @@ -59,7 +57,6 @@ jobs:

diff:
needs: [extract]
if: ${{ github.event_name != 'merge_group' }}
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -80,7 +77,6 @@ jobs:
diff-header-only:
needs: [extract-header-only]
if: ${{ github.event_name != 'merge_group' }}
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -101,7 +97,6 @@ jobs:
build:
needs: [extract]
if: ${{ github.event_name != 'merge_group' }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -141,7 +136,6 @@ jobs:

build-header-only:
needs: [extract-header-only]
if: ${{ github.event_name != 'merge_group' }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -174,50 +168,3 @@ jobs:
- name: πŸƒπŸ»β€β™€οΈ Test
run: ./build/ml_kem_test
if: ${{ matrix.os != 'windows-latest' }}

benchmark:
if: ${{ github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' }}
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest

runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
working-directory: libcrux-ml-kem/c

steps:
- uses: actions/checkout@v4

- name: πŸ”¨ Build Release
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
# FIXME: Benchmarks on Windows CI are not working right now.
# - name: πŸƒπŸ»β€β™€οΈ Benchmark
# run: ./build/Release/ml_kem_bench
# if: ${{ matrix.os == 'windows-latest' }}

- name: πŸƒπŸ»β€β™€οΈ Benchmark (c)
run: ./build/ml_kem_bench
if: ${{ matrix.os != 'windows-latest' && (github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch') }}

- name: πŸƒπŸ»β€β™€οΈ Benchmark (cg)
working-directory: libcrux-ml-kem/cg
run: ./build/ml_kem_bench
if: ${{ matrix.os != 'windows-latest' && (github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch') }}

mq_status:
if: |
always() &&
(github.event_name == 'workflow_dispatch' || github.event_name == 'merge_group')
needs: [benchmark]
uses: cryspen/actions/.github/workflows/merge-queue-status.yml@jonas/merge-queue-status
with:
needs_json: "${{toJSON(needs)}}"
1 change: 1 addition & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
pull_request:
branches: ["main", "dev"]
workflow_dispatch:
merge_group:

env:
CARGO_TERM_COLOR: always
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ecdh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
pull_request:
branches: ["main", "dev", "*"]
workflow_dispatch:
merge_group:

env:
CARGO_TERM_COLOR: always
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/hax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- cron: "0 0 * * *"

workflow_dispatch:
merge_group:

env:
CARGO_TERM_COLOR: always
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/kem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
pull_request:
branches: ["main", "dev", "*"]
workflow_dispatch:
merge_group:

env:
CARGO_TERM_COLOR: always
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/mldsa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
pull_request:
branches: ["main", "dev", "*"]
workflow_dispatch:
merge_group:

env:
CARGO_TERM_COLOR: always
Expand Down
105 changes: 105 additions & 0 deletions .github/workflows/mlkem-bench.yml.disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Benchmark ML-KEM

on:
workflow_dispatch:
merge_group:

env:
CARGO_TERM_COLOR: always

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
benchmark:
strategy:
fail-fast: true
matrix:
bits: [32, 64]
os:
- macos-13
- macos-latest
- ubuntu-latest
- windows-latest
exclude:
# There's no such thing as 32-bit macOS
- bits: 32
os: "macos-latest"
- bits: 32
os: "macos-13"

runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
working-directory: libcrux-ml-kem

steps:
- uses: actions/checkout@v4

- name: Update dependencies
run: cargo update

- run: echo "RUST_TARGET_FLAG=" > $GITHUB_ENV
if: ${{ matrix.bits == 64 }}

- name: πŸ› οΈ Setup Ubuntu x86
if: ${{ matrix.bits == 32 && matrix.os == 'ubuntu-latest' }}
run: |
rustup target add i686-unknown-linux-gnu
sudo apt-get update
sudo apt-get install -y gcc-multilib g++-multilib

- name: πŸ› οΈ Setup Ubuntu x64
if: ${{ matrix.bits == 64 && matrix.os == 'ubuntu-latest' }}
run: |
rustup target add aarch64-unknown-linux-gnu

- name: πŸ› οΈ Setup macOS
if: ${{ matrix.os == 'macos-latest' }}
run: |
rustup target add aarch64-apple-darwin

# Set up 32 bit systems

- name: πŸ› οΈ Config Windows x86
run: echo "RUST_TARGET_FLAG=--target=i686-pc-windows-msvc" > $GITHUB_ENV
if: ${{ matrix.bits == 32 && matrix.os == 'windows-latest' }}

- name: πŸ› οΈ Config Linux x86
run: |
echo "RUST_TARGET_FLAG=--target=i686-unknown-linux-gnu" > $GITHUB_ENV
if: ${{ matrix.bits == 32 && matrix.os == 'ubuntu-latest' }}

# - name: πŸ”¨ Build
# run: cargo build --benches

# - name: ⬆ Upload build
# uses: ./.github/actions/upload_artifacts
# with:
# name: benchmarks_${{ matrix.os }}_${{ matrix.bits }}

# Benchmarks ...

- name: πŸƒπŸ»β€β™€οΈ Benchmarks
run: cargo bench --verbose $RUST_TARGET_FLAG -- --output-format bencher | tee bench.txt

- name: πŸƒπŸ»β€β™€οΈ Benchmarks Portable
run: |
cargo clean
LIBCRUX_DISABLE_SIMD128=1 LIBCRUX_DISABLE_SIMD256=1 cargo bench --verbose $RUST_TARGET_FLAG -- --output-format bencher | sed 's/^test \(.*\) \.\.\. bench/test portable \1 ... bench/' | tee -a bench.txt
- name: Clear Cargo.lock so it doesn't interfere with git
run: git checkout Cargo.lock
- name: Store benchmarks
uses: benchmark-action/github-action-benchmark@v1
with:
name: ML-KEM Benchmark
tool: 'cargo'
output-file-path: libcrux-ml-kem/bench.txt
benchmark-data-dir-path: dev/bench/mlkem
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true



Loading

0 comments on commit f3e2120

Please sign in to comment.