Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actionlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ self-hosted-runner:
- pqcp-arm64
- pqcp-ppc64
- pqcp-x64
- self-hosted-nucleo-n657x0
253 changes: 132 additions & 121 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,62 +28,73 @@ jobs:
fail-fast: true
matrix:
target:
- system: rpi4
name: Arm Cortex-A72 (Raspberry Pi 4) benchmarks
bench_pmu: PMU
archflags: -mcpu=cortex-a72 -DMLK_SYS_AARCH64_SLOW_BARREL_SHIFTER
cflags: "-flto -DMLK_FORCE_AARCH64"
ldflags: "-flto"
bench_extra_args: ""
nix_shell: bench
- system: rpi5
name: Arm Cortex-A76 (Raspberry Pi 5) benchmarks
bench_pmu: PERF
archflags: "-mcpu=cortex-a76 -march=armv8.2-a"
cflags: "-flto -DMLK_FORCE_AARCH64"
ldflags: "-flto"
bench_extra_args: ""
nix_shell: bench
cross_prefix: ""
- system: a55
name: Arm Cortex-A55 (Snapdragon 888) benchmarks
bench_pmu: PERF
archflags: "-mcpu=cortex-a55 -march=armv8.2-a"
cflags: "-flto -DMLK_FORCE_AARCH64 -DMLK_CONFIG_FIPS202_BACKEND_FILE=\\\\\\\"fips202/native/aarch64/x1_scalar.h\\\\\\\""
ldflags: "-flto -static"
bench_extra_args: -w exec-on-a55
nix_shell: bench
- system: bpi
name: SpacemiT K1 8 (Banana Pi F3) benchmarks
bench_pmu: PERF
archflags: "-march=rv64imafdcv_zicsr_zifencei"
# - system: rpi4
# name: Arm Cortex-A72 (Raspberry Pi 4) benchmarks
# bench_pmu: PMU
# archflags: -mcpu=cortex-a72 -DMLK_SYS_AARCH64_SLOW_BARREL_SHIFTER
# cflags: "-flto -DMLK_FORCE_AARCH64"
# ldflags: "-flto"
# bench_extra_args: ""
# nix_shell: bench
# - system: rpi5
# name: Arm Cortex-A76 (Raspberry Pi 5) benchmarks
# bench_pmu: PERF
# archflags: "-mcpu=cortex-a76 -march=armv8.2-a"
# cflags: "-flto -DMLK_FORCE_AARCH64"
# ldflags: "-flto"
# bench_extra_args: ""
# nix_shell: bench
# cross_prefix: ""
# - system: a55
# name: Arm Cortex-A55 (Snapdragon 888) benchmarks
# bench_pmu: PERF
# archflags: "-mcpu=cortex-a55 -march=armv8.2-a"
# cflags: "-flto -DMLK_FORCE_AARCH64 -DMLK_CONFIG_FIPS202_BACKEND_FILE=\\\\\\\"fips202/native/aarch64/x1_scalar.h\\\\\\\""
# ldflags: "-flto -static"
# bench_extra_args: -w exec-on-a55
# nix_shell: bench
# - system: bpi
# name: SpacemiT K1 8 (Banana Pi F3) benchmarks
# bench_pmu: PERF
# archflags: "-march=rv64imafdcv_zicsr_zifencei"
# cflags: ""
# ldflags: "-static"
# bench_extra_args: -w exec-on-bpi
# cross_prefix: riscv64-unknown-linux-gnu-
# nix_shell: cross-riscv64
# - system: m1-mac-mini
# name: Mac Mini (M1, 2020) benchmarks
# bench_pmu: MAC
# archflags: "-mcpu=apple-m1 -march=armv8.4-a+sha3"
# cflags: "-flto"
# ldflags: "-flto"
# bench_extra_args: "-r"
# nix_shell: bench
# - system: pqcp-ppc64
# name: ppc64le (POWER10) benchmarks
# bench_pmu: PERF
# archflags: "-mcpu=native"
# cflags: "-flto -DMLK_FORCE_PPC64LE"
# ldflags: "-flto"
# bench_extra_args: "-r"
# nix_shell: ''
# cross_prefix: ""
- system: nucleo-n657x0
name: Arm Cortex-M55 (NUCLEO-N657X0-Q) benchmarks
bench_pmu: CYCCNT
archflags: ""
cflags: ""
ldflags: "-static"
bench_extra_args: -w exec-on-bpi
cross_prefix: riscv64-unknown-linux-gnu-
nix_shell: cross-riscv64
- system: m1-mac-mini
name: Mac Mini (M1, 2020) benchmarks
bench_pmu: MAC
archflags: "-mcpu=apple-m1 -march=armv8.4-a+sha3"
cflags: "-flto"
ldflags: "-flto"
bench_extra_args: "-r"
nix_shell: bench
- system: pqcp-ppc64
name: ppc64le (POWER10) benchmarks
bench_pmu: PERF
archflags: "-mcpu=native"
cflags: "-flto -DMLK_FORCE_PPC64LE"
ldflags: "-flto"
bench_extra_args: "-r"
nix_shell: ''
ldflags: ""
bench_extra_args: ""
nix_shell: nucleo-n657x0-q
cross_prefix: ""
if: github.repository_owner == 'pq-code-package' && (github.event.label.name == 'benchmark' || github.ref == 'refs/heads/main')
runs-on: self-hosted-${{ matrix.target.system }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/bench
env:
EXTRA_MAKEFILE: ${{ matrix.target.system == 'nucleo-n657x0' && 'test/baremetal/platform/nucleo-n657x0-q/platform.mk' || '' }}
with:
name: ${{ matrix.target.name }}
cflags: ${{ matrix.target.cflags }}
Expand All @@ -96,75 +107,75 @@ jobs:
nix-shell: ${{ matrix.target.nix_shell }}
cross_prefix: ${{ matrix.target.cross_prefix }}

ec2_all:
name: ${{ matrix.target.name }}
permissions:
contents: write
pull-requests: write
id-token: write
strategy:
fail-fast: false
matrix:
target:
- name: Graviton2
ec2_instance_type: t4g.small
ec2_ami: ubuntu-latest (aarch64)
archflags: -mcpu=cortex-a76 -march=armv8.2-a
cflags: "-flto -DMLK_FORCE_AARCH64"
ldflags: "-flto"
perf: PERF
- name: Graviton3
ec2_instance_type: c7g.medium
ec2_ami: ubuntu-latest (aarch64)
archflags: -march=armv8.4-a+sha3
cflags: "-flto -DMLK_FORCE_AARCH64"
ldflags: "-flto"
perf: PERF
- name: Graviton4
ec2_instance_type: c8g.medium
ec2_ami: ubuntu-latest (aarch64)
archflags: -march=armv9-a+sha3
cflags: "-flto -DMLK_FORCE_AARCH64"
ldflags: "-flto"
perf: PERF
- name: AMD EPYC 4th gen (c7a)
ec2_instance_type: c7a.medium
ec2_ami: ubuntu-latest (x86_64)
archflags: -mavx2 -mbmi2 -mpopcnt -march=znver4
cflags: "-flto -DMLK_FORCE_X86_64"
ldflags: "-flto"
perf: PMU
- name: Intel Xeon 4th gen (c7i)
ec2_instance_type: c7i.metal-24xl
ec2_ami: ubuntu-latest (x86_64)
archflags: -mavx2 -mbmi2 -mpopcnt -march=sapphirerapids
cflags: "-flto -DMLK_FORCE_X86_64"
ldflags: "-flto"
perf: PMU
- name: AMD EPYC 3rd gen (c6a)
ec2_instance_type: c6a.large
ec2_ami: ubuntu-latest (x86_64)
archflags: -mavx2 -mbmi2 -mpopcnt -march=znver3
cflags: "-flto -DMLK_FORCE_X86_64"
ldflags: "-flto"
perf: PMU
- name: Intel Xeon 3rd gen (c6i)
ec2_instance_type: c6i.large
ec2_ami: ubuntu-latest (x86_64)
archflags: -mavx2 -mbmi2 -mpopcnt -march=icelake-server
cflags: "-flto -DMLK_FORCE_X86_64"
ldflags: "-flto"
perf: PMU
uses: ./.github/workflows/bench_ec2_reusable.yml
if: github.repository_owner == 'pq-code-package' && (github.event.label.name == 'benchmark' || github.ref == 'refs/heads/main')
with:
ec2_instance_type: ${{ matrix.target.ec2_instance_type }}
ec2_ami: ${{ matrix.target.ec2_ami }}
archflags: ${{ matrix.target.archflags }}
cflags: ${{ matrix.target.cflags }}
ldflags: ${{ matrix.target.ldflags }}
opt: "all"
store_results: ${{ github.repository_owner == 'pq-code-package' && github.ref == 'refs/heads/main' }} # Only store optimized results
name: ${{ matrix.target.name }}
perf: ${{ matrix.target.perf }}
secrets: inherit
# ec2_all:
# name: ${{ matrix.target.name }}
# permissions:
# contents: write
# pull-requests: write
# id-token: write
# strategy:
# fail-fast: false
# matrix:
# target:
# - name: Graviton2
# ec2_instance_type: t4g.small
# ec2_ami: ubuntu-latest (aarch64)
# archflags: -mcpu=cortex-a76 -march=armv8.2-a
# cflags: "-flto -DMLK_FORCE_AARCH64"
# ldflags: "-flto"
# perf: PERF
# - name: Graviton3
# ec2_instance_type: c7g.medium
# ec2_ami: ubuntu-latest (aarch64)
# archflags: -march=armv8.4-a+sha3
# cflags: "-flto -DMLK_FORCE_AARCH64"
# ldflags: "-flto"
# perf: PERF
# - name: Graviton4
# ec2_instance_type: c8g.medium
# ec2_ami: ubuntu-latest (aarch64)
# archflags: -march=armv9-a+sha3
# cflags: "-flto -DMLK_FORCE_AARCH64"
# ldflags: "-flto"
# perf: PERF
# - name: AMD EPYC 4th gen (c7a)
# ec2_instance_type: c7a.medium
# ec2_ami: ubuntu-latest (x86_64)
# archflags: -mavx2 -mbmi2 -mpopcnt -march=znver4
# cflags: "-flto -DMLK_FORCE_X86_64"
# ldflags: "-flto"
# perf: PMU
# - name: Intel Xeon 4th gen (c7i)
# ec2_instance_type: c7i.metal-24xl
# ec2_ami: ubuntu-latest (x86_64)
# archflags: -mavx2 -mbmi2 -mpopcnt -march=sapphirerapids
# cflags: "-flto -DMLK_FORCE_X86_64"
# ldflags: "-flto"
# perf: PMU
# - name: AMD EPYC 3rd gen (c6a)
# ec2_instance_type: c6a.large
# ec2_ami: ubuntu-latest (x86_64)
# archflags: -mavx2 -mbmi2 -mpopcnt -march=znver3
# cflags: "-flto -DMLK_FORCE_X86_64"
# ldflags: "-flto"
# perf: PMU
# - name: Intel Xeon 3rd gen (c6i)
# ec2_instance_type: c6i.large
# ec2_ami: ubuntu-latest (x86_64)
# archflags: -mavx2 -mbmi2 -mpopcnt -march=icelake-server
# cflags: "-flto -DMLK_FORCE_X86_64"
# ldflags: "-flto"
# perf: PMU
# uses: ./.github/workflows/bench_ec2_reusable.yml
# if: github.repository_owner == 'pq-code-package' && (github.event.label.name == 'benchmark' || github.ref == 'refs/heads/main')
# with:
# ec2_instance_type: ${{ matrix.target.ec2_instance_type }}
# ec2_ami: ${{ matrix.target.ec2_ami }}
# archflags: ${{ matrix.target.archflags }}
# cflags: ${{ matrix.target.cflags }}
# ldflags: ${{ matrix.target.ldflags }}
# opt: "all"
# store_results: ${{ github.repository_owner == 'pq-code-package' && github.ref == 'refs/heads/main' }} # Only store optimized results
# name: ${{ matrix.target.name }}
# perf: ${{ matrix.target.perf }}
# secrets: inherit
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,29 @@ jobs:
nix-shell: ''
gh_token: ${{ secrets.GITHUB_TOKEN }}
cflags: "-DMLKEM_DEBUG -DMLK_FORCE_PPC64LE"
nucleo_n657x0_q_tests:
if: github.repository_owner == 'pq-code-package' && !github.event.pull_request.head.repo.fork
name: Functional tests (NUCLEO-N657X0-Q)
runs-on: self-hosted-nucleo-n657x0
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: baremetal build + test
uses: ./.github/actions/functest
env:
EXTRA_MAKEFILE: test/baremetal/platform/nucleo-n657x0-q/platform.mk
with:
nix-shell: nucleo-n657x0-q
gh_token: ${{ secrets.GITHUB_TOKEN }}
opt: no_opt
func: true
kat: false
acvp: false
wycheproof: false
examples: false
stack: false
unit: false
alloc: false
rng_fail: false
backend_tests:
name: AArch64 FIPS202 backends (${{ matrix.backend }})
strategy:
Expand Down
22 changes: 22 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
ln -sfn "$S2N_BIGNUM_DIR" "$IMPORTS_DIR/s2n_bignum"
ln -sfn "$PROOF_DIR" "$IMPORTS_DIR/mlkem_native"
'';

in
{
_module.args.pkgs = import inputs.nixpkgs {
Expand Down Expand Up @@ -104,6 +105,27 @@
} ++ pkgs.lib.optionals (!pkgs.stdenv.isDarwin) [ config.packages.valgrind_varlat ];
}).overrideAttrs (old: { shellHook = holLightShellHook; });

# arm-none-eabi-gcc + platform files from pqmx
packages.m55-an547 = util.m55-an547;
packages.avr-toolchain = util.avr-toolchain;
packages.st-openocd = util.st-openocd;
devShells.arm-embedded = util.mkShell {
packages = builtins.attrValues
{
inherit (config.packages) m55-an547;
inherit (pkgs) gcc-arm-embedded qemu coreutils python3 git;
};
};
packages.nucleo-n657x0-q = util.nucleo-n657x0-q;
devShells.nucleo-n657x0-q = util.mkShell {
packages = builtins.attrValues ({
inherit (config.packages) linters nucleo-n657x0-q st-openocd;
inherit (pkgs) gcc-arm-embedded coreutils git libffi pkg-config;
});
};


devShells.avr = util.mkShell (import ./nix/avr { inherit pkgs; });
packages.hol_server = util.hol_server.hol_server_start;
devShells.hol_light = (util.mkShell {
packages = builtins.attrValues { inherit (config.packages) linters hol_light s2n_bignum hol_server; };
Expand Down
Loading
Loading