Skip to content

Commit 4d3a9ec

Browse files
authored
Merge pull request #462 from pq-code-package/armv8.1-m
Add initial support for Armv8.1-M targets
2 parents 2811406 + 4c8d0db commit 4d3a9ec

File tree

19 files changed

+278
-15
lines changed

19 files changed

+278
-15
lines changed

.github/actions/bench/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ inputs:
1919
archflags:
2020
description: ARCHFLAGS to pass to compilation
2121
default: ""
22+
ldflags:
23+
description: LDFLAGS to pass to compilation
24+
default: ""
2225
opt:
2326
description: opt flag to set for tests script
2427
default: "true"
@@ -77,11 +80,13 @@ runs:
7780
run: |
7881
./scripts/tests bench -c ${{ inputs.perf }} --cross-prefix="${{ inputs.cross_prefix }}" \
7982
--cflags="${{ inputs.cflags }} ${{ inputs.archflags }}" \
83+
--ldflags="${{ inputs.ldflags }}" \
8084
--opt=$([[ ${{ inputs.opt }} == "false" ]] && echo "no_opt" || echo "opt") \
8185
-v --output=output.json ${{ inputs.bench_extra_args }}
8286
8387
./scripts/tests bench --components -c ${{ inputs.perf }} --cross-prefix="${{ inputs.cross_prefix }}" \
8488
--cflags="${{ inputs.cflags }} ${{ inputs.archflags }}" \
89+
--ldflags="${{ inputs.ldflags }}" \
8590
--opt=$([[ ${{ inputs.opt }} == "false" ]] && echo "no_opt" || echo "opt") \
8691
-v ${{ inputs.bench_extra_args }}
8792
- name: Store benchmark result

.github/actions/config-variations/action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ runs:
2424
gh_token: ${{ inputs.gh_token }}
2525
compile_mode: native
2626
cflags: "-DMLD_CONFIG_KEYGEN_PCT -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all"
27+
ldflags: "-fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all"
2728
func: true
2829
kat: true
2930
acvp: true
@@ -51,6 +52,7 @@ runs:
5152
gh_token: ${{ inputs.gh_token }}
5253
compile_mode: native
5354
cflags: "-std=c11 -D_GNU_SOURCE -DMLD_CONFIG_FILE=\\\\\\\"../test/custom_zeroize_config.h\\\\\\\" -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all"
55+
ldflags: "-fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all"
5456
func: true
5557
kat: true
5658
acvp: true
@@ -63,6 +65,7 @@ runs:
6365
gh_token: ${{ inputs.gh_token }}
6466
compile_mode: native
6567
cflags: "-std=c11 -D_GNU_SOURCE -DMLD_CONFIG_FILE=\\\\\\\"../test/no_asm_config.h\\\\\\\" -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all"
68+
ldflags: "-fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all"
6669
func: true
6770
kat: true
6871
acvp: true
@@ -75,6 +78,7 @@ runs:
7578
gh_token: ${{ inputs.gh_token }}
7679
compile_mode: native
7780
cflags: "-std=c11 -D_GNU_SOURCE -DMLD_CONFIG_FILE=\\\\\\\"../test/custom_randombytes_config.h\\\\\\\" -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all"
81+
ldflags: "-fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all"
7882
func: true
7983
kat: true
8084
acvp: true
@@ -87,6 +91,7 @@ runs:
8791
gh_token: ${{ inputs.gh_token }}
8892
compile_mode: native
8993
cflags: "-std=c11 -D_GNU_SOURCE -DMLD_CONFIG_FILE=\\\\\\\"../test/custom_memcpy_config.h\\\\\\\" -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all"
94+
ldflags: "-fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all"
9095
func: true
9196
kat: true
9297
acvp: true
@@ -99,6 +104,7 @@ runs:
99104
gh_token: ${{ inputs.gh_token }}
100105
compile_mode: native
101106
cflags: "-std=c11 -D_GNU_SOURCE -DMLD_CONFIG_FILE=\\\\\\\"../test/custom_memset_config.h\\\\\\\" -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all"
107+
ldflags: "-fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all"
102108
func: true
103109
kat: true
104110
acvp: true
@@ -111,6 +117,7 @@ runs:
111117
gh_token: ${{ inputs.gh_token }}
112118
compile_mode: native
113119
cflags: "-std=c11 -D_GNU_SOURCE -DMLD_CONFIG_FILE=\\\\\\\"../test/custom_stdlib_config.h\\\\\\\" -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all"
120+
ldflags: "-fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all"
114121
func: true
115122
kat: true
116123
acvp: true

.github/actions/functest/action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ inputs:
2424
cflags:
2525
description: CFLAGS to pass to compilation
2626
default: ""
27+
ldflags:
28+
description: LDFLAGS to pass to linking
29+
default: ""
2730
cross_prefix:
2831
description: Binary prefix for cross compilation
2932
default: ""
@@ -95,7 +98,7 @@ runs:
9598
shell: ${{ env.SHELL }}
9699
run: |
97100
make clean
98-
./scripts/tests all --exec-wrapper="${{ inputs.exec_wrapper }}" --cross-prefix="${{ inputs.cross_prefix }}" --cflags="${{ inputs.cflags }}" --opt=${{ inputs.opt }} --${{ env.FUNC }} --${{ env.KAT }} --${{ env.ACVP }} --${{ env.EXAMPLES }} --${{ env.STACK }} -v
101+
./scripts/tests all --exec-wrapper="${{ inputs.exec_wrapper }}" --cross-prefix="${{ inputs.cross_prefix }}" --cflags="${{ inputs.cflags }}" --ldflags="${{ inputs.ldflags }}" --opt=${{ inputs.opt }} --${{ env.FUNC }} --${{ env.KAT }} --${{ env.ACVP }} --${{ env.EXAMPLES }} --${{ env.STACK }} -v
99102
- name: Post ${{ env.MODE }} Tests
100103
shell: ${{ env.SHELL }}
101104
if: success() || failure()

.github/actions/multi-functest/action.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ inputs:
2424
cflags:
2525
description: CFLAGS to pass to compilation
2626
default: ""
27+
ldflags:
28+
description: LDFLAGS to pass to linking
29+
default: ""
2730
compile_mode:
2831
description: all | native | cross-x86_64 | cross-aarch64 | cross-riscv64
2932
default: "native"
@@ -58,6 +61,7 @@ runs:
5861
gh_token: ${{ inputs.gh_token }}
5962
custom_shell: ${{ inputs.custom_shell }}
6063
cflags: ${{ inputs.cflags }}
64+
ldflags: ${{ inputs.ldflags }}
6165
opt: ${{ inputs.opt }}
6266
func: ${{ inputs.func }}
6367
kat: ${{ inputs.kat }}
@@ -74,6 +78,7 @@ runs:
7478
gh_token: ${{ inputs.gh_token }}
7579
custom_shell: ${{ inputs.custom_shell }}
7680
cflags: "${{ inputs.cflags }} -DMLD_FORCE_X86_64"
81+
ldflags: ${{ inputs.ldflags }}
7782
cross_prefix: x86_64-unknown-linux-gnu-
7883
exec_wrapper: qemu-x86_64
7984
opt: ${{ inputs.opt }}
@@ -92,6 +97,7 @@ runs:
9297
gh_token: ${{ inputs.gh_token }}
9398
custom_shell: ${{ inputs.custom_shell }}
9499
cflags: "${{ inputs.cflags }} -DMLD_FORCE_AARCH64"
100+
ldflags: ${{ inputs.ldflags }}
95101
cross_prefix: aarch64-unknown-linux-gnu-
96102
exec_wrapper: qemu-aarch64
97103
opt: ${{ inputs.opt }}
@@ -110,6 +116,7 @@ runs:
110116
gh_token: ${{ inputs.gh_token }}
111117
custom_shell: ${{ inputs.custom_shell }}
112118
cflags: "${{ inputs.cflags }} -DMLD_FORCE_PPC64LE"
119+
ldflags: ${{ inputs.ldflags }}
113120
cross_prefix: powerpc64le-unknown-linux-gnu-
114121
exec_wrapper: qemu-ppc64le
115122
opt: ${{ inputs.opt }}
@@ -127,7 +134,8 @@ runs:
127134
nix-verbose: ${{ inputs.nix-verbose }}
128135
gh_token: ${{ inputs.gh_token }}
129136
custom_shell: ${{ inputs.custom_shell }}
130-
cflags: "${{ inputs.cflags }} -static -DMLD_FORCE_AARCH64_EB"
137+
cflags: "${{ inputs.cflags }} -DMLD_FORCE_AARCH64_EB"
138+
ldflags: "${{ inputs.ldflags }} -static"
131139
cross_prefix: aarch64_be-none-linux-gnu-
132140
exec_wrapper: qemu-aarch64_be
133141
opt: ${{ inputs.opt }}
@@ -146,6 +154,7 @@ runs:
146154
gh_token: ${{ inputs.gh_token }}
147155
custom_shell: ${{ inputs.custom_shell }}
148156
cflags: "${{ inputs.cflags }} -DMLD_FORCE_RISCV64"
157+
ldflags: ${{ inputs.ldflags }}
149158
cross_prefix: riscv64-unknown-linux-gnu-
150159
exec_wrapper: qemu-riscv64
151160
opt: ${{ inputs.opt }}

.github/workflows/all.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,11 @@ jobs:
5959
needs: [ base, nix ]
6060
uses: ./.github/workflows/ct-tests.yml
6161
secrets: inherit
62+
baremetal:
63+
name: Baremetal
64+
permissions:
65+
contents: 'read'
66+
id-token: 'write'
67+
needs: [ base ]
68+
uses: ./.github/workflows/baremetal.yml
69+
secrets: inherit

.github/workflows/baremetal.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Copyright (c) The mldsa-native project authors
2+
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
3+
4+
name: Baremetal
5+
permissions:
6+
contents: read
7+
on:
8+
workflow_call:
9+
workflow_dispatch:
10+
11+
jobs:
12+
baremetal_tests:
13+
name: Baremetal tests (${{ matrix.target.name }})
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
target:
18+
- runner: ubuntu-latest
19+
name: 'M55-AN547'
20+
makefile: test/baremetal/platform/m55-an547/platform.mk
21+
nix-shell: arm-embedded
22+
runs-on: ${{ matrix.target.runner }}
23+
steps:
24+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
25+
- name: baremetal build + test
26+
uses: ./.github/actions/functest
27+
env:
28+
EXTRA_MAKEFILE: ${{ matrix.target.makefile }}
29+
with:
30+
nix-shell: ${{ matrix.target.nix-shell }}
31+
gh_token: ${{ secrets.GITHUB_TOKEN }}
32+
opt: no_opt
33+
func: true
34+
kat: true
35+
acvp: true
36+
examples: false
37+
stack: false

.github/workflows/bench.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
bench_pmu: PMU
3535
archflags: -mcpu=cortex-a72 -DMLD_SYS_AARCH64_SLOW_BARREL_SHIFTER
3636
cflags: "-flto -DMLD_FORCE_AARCH64"
37+
ldflags: "-flto"
3738
bench_extra_args: ""
3839
nix_shell: ci-bench
3940
only_no_opt: false
@@ -42,22 +43,25 @@ jobs:
4243
bench_pmu: PERF
4344
archflags: "-mcpu=cortex-a76 -march=armv8.2-a"
4445
cflags: "-flto -DMLD_FORCE_AARCH64"
46+
ldflags: "-flto"
4547
bench_extra_args: ""
4648
nix_shell: ci-bench
4749
only_no_opt: false
4850
- system: a55
4951
name: Arm Cortex-A55 (Snapdragon 888) benchmarks
5052
bench_pmu: PERF
5153
archflags: "-mcpu=cortex-a55 -march=armv8.2-a"
52-
cflags: "-flto -static -DMLD_FORCE_AARCH64"
54+
cflags: "-flto -DMLD_FORCE_AARCH64"
55+
ldflags: "-flto -static"
5356
bench_extra_args: -w exec-on-a55
5457
nix_shell: ci-bench
5558
only_no_opt: false
5659
- system: bpi
5760
name: SpacemiT K1 8 (Banana Pi F3) benchmarks
5861
bench_pmu: PERF
5962
archflags: "-march=rv64imafdcv_zicsr_zifencei"
60-
cflags: "-static"
63+
cflags: ""
64+
ldflags: "-static"
6165
bench_extra_args: -w exec-on-bpi
6266
cross_prefix: riscv64-unknown-linux-gnu-
6367
nix_shell: ci-cross-riscv64
@@ -67,6 +71,7 @@ jobs:
6771
bench_pmu: MAC
6872
archflags: "-mcpu=apple-m1 -march=armv8.4-a+sha3"
6973
cflags: "-flto"
74+
ldflags: "-flto"
7075
bench_extra_args: "-r"
7176
nix_shell: ci-bench
7277
only_no_opt: false
@@ -80,6 +85,7 @@ jobs:
8085
name: ${{ matrix.target.name }} (opt)
8186
cflags: ${{ matrix.target.cflags }}
8287
archflags: ${{ matrix.target.archflags }}
88+
ldflags: ${{ matrix.target.ldflags }}
8389
perf: ${{ matrix.target.bench_pmu }}
8490
store_results: ${{ github.repository_owner == 'pq-code-package' && github.ref == 'refs/heads/main' }}
8591
bench_extra_args: ${{ matrix.target.bench_extra_args }}
@@ -92,6 +98,7 @@ jobs:
9298
name: ${{ matrix.target.name }} (no-opt)
9399
cflags: ${{ matrix.target.cflags }}
94100
archflags: ${{ matrix.target.archflags }}
101+
ldflags: ${{ matrix.target.ldflags }}
95102
perf: ${{ matrix.target.bench_pmu }}
96103
store_results: ${{ github.repository_owner == 'pq-code-package' && github.ref == 'refs/heads/main' }}
97104
bench_extra_args: ${{ matrix.target.bench_extra_args }}
@@ -115,42 +122,49 @@ jobs:
115122
ec2_ami: ubuntu-latest (aarch64)
116123
archflags: -mcpu=cortex-a76 -march=armv8.2-a
117124
cflags: "-flto -DMLD_FORCE_AARCH64"
125+
ldflags: "-flto"
118126
perf: PERF
119127
- name: Graviton3
120128
ec2_instance_type: c7g.medium
121129
ec2_ami: ubuntu-latest (aarch64)
122130
archflags: -march=armv8.4-a+sha3
123131
cflags: "-flto -DMLD_FORCE_AARCH64"
132+
ldflags: "-flto"
124133
perf: PERF
125134
- name: Graviton4
126135
ec2_instance_type: c8g.medium
127136
ec2_ami: ubuntu-latest (aarch64)
128137
archflags: -march=armv9-a+sha3
129138
cflags: "-flto -DMLD_FORCE_AARCH64"
139+
ldflags: "-flto"
130140
perf: PERF
131141
- name: AMD EPYC 4th gen (c7a)
132142
ec2_instance_type: c7a.medium
133143
ec2_ami: ubuntu-latest (x86_64)
134144
archflags: -mavx2 -mbmi2 -mpopcnt -maes -march=znver4
135145
cflags: "-flto -DMLD_FORCE_X86_64"
146+
ldflags: "-flto"
136147
perf: PMU
137148
- name: Intel Xeon 4th gen (c7i)
138149
ec2_instance_type: c7i.metal-24xl
139150
ec2_ami: ubuntu-latest (x86_64)
140151
archflags: -mavx2 -mbmi2 -mpopcnt -maes -march=sapphirerapids
141152
cflags: "-flto -DMLD_FORCE_X86_64"
153+
ldflags: "-flto"
142154
perf: PMU
143155
- name: AMD EPYC 3rd gen (c6a)
144156
ec2_instance_type: c6a.large
145157
ec2_ami: ubuntu-latest (x86_64)
146158
archflags: -mavx2 -mbmi2 -mpopcnt -maes -march=znver3
147159
cflags: "-flto -DMLD_FORCE_X86_64"
160+
ldflags: "-flto"
148161
perf: PMU
149162
- name: Intel Xeon 3rd gen (c6i)
150163
ec2_instance_type: c6i.large
151164
ec2_ami: ubuntu-latest (x86_64)
152165
archflags: -mavx2 -mbmi2 -mpopcnt -maes -march=icelake-server
153166
cflags: "-flto -DMLD_FORCE_X86_64"
167+
ldflags: "-flto"
154168
perf: PMU
155169
uses: ./.github/workflows/bench_ec2_reusable.yml
156170
if: github.repository_owner == 'pq-code-package' && (github.event.label.name == 'benchmark' || github.ref == 'refs/heads/main')
@@ -159,6 +173,7 @@ jobs:
159173
ec2_ami: ${{ matrix.target.ec2_ami }}
160174
archflags: ${{ matrix.target.archflags }}
161175
cflags: ${{ matrix.target.cflags }}
176+
ldflags: ${{ matrix.target.ldflags }}
162177
opt: "all"
163178
store_results: ${{ github.repository_owner == 'pq-code-package' && github.ref == 'refs/heads/main' }} # Only store optimized results
164179
name: ${{ matrix.target.name }}

.github/workflows/bench_ec2_any.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ on:
3232
archflags:
3333
description: Custom ARCH flags for compilation
3434
default: ''
35+
ldflags:
36+
description: Custom LDFLAGS for linking
37+
default: ''
3538
opt:
3639
description: Benchmark optimized, non-optimized, or both
3740
type: choice
@@ -45,9 +48,6 @@ on:
4548
compiler:
4649
description: Compiler to use. When unset, default nix shell is used.
4750
default: ''
48-
additional_packages:
49-
description: Additional packages to install when custom compiler is used.
50-
default: ''
5151
jobs:
5252
bench-ec2-any:
5353
name: Ad-hoc benchmark on $${{ inputs.ec2_instance_type }}
@@ -61,10 +61,10 @@ jobs:
6161
ec2_ami_id: ${{ inputs.ec2_ami_id }}
6262
cflags: ${{ inputs.cflags }}
6363
archflags: ${{ inputs.archflags }}
64+
ldflags: ${{ inputs.ldflags }}
6465
opt: ${{ inputs.opt }}
6566
name: ${{ inputs.name }}
6667
store_results: false
6768
bench_extra_args: ${{ inputs.bench_extra_args }}
6869
compiler: ${{ inputs.compiler }}
69-
additional_packages: ${{ inputs.additional_packages }}
7070
secrets: inherit

0 commit comments

Comments
 (0)