aboutsummaryrefslogtreecommitdiff
path: root/content/posts
diff options
context:
space:
mode:
Diffstat (limited to 'content/posts')
-rw-r--r--content/posts/2024-05-15-c11-fips203ipd-v0.6.md216
1 files changed, 176 insertions, 40 deletions
diff --git a/content/posts/2024-05-15-c11-fips203ipd-v0.6.md b/content/posts/2024-05-15-c11-fips203ipd-v0.6.md
index c749850..01bfa7b 100644
--- a/content/posts/2024-05-15-c11-fips203ipd-v0.6.md
+++ b/content/posts/2024-05-15-c11-fips203ipd-v0.6.md
@@ -2,6 +2,28 @@
slug: c11-fips203ipd-v0.6
title: "C11 FIPS 203 IPD v0.6"
date: "2024-05-15T04:16:06-04:00"
+pics:
+ bench-x1-svg:
+ css: "image"
+ tip: "Median cycles by backend, Lenovo ThinkPad X1 Carbon, 6th Gen (i7-1185G7)."
+ sources:
+ - src: "/files/posts/c11-fips203ipd-v0.6/x1-results.svg"
+ width: 960
+ height: 480
+ bench-pi5-svg:
+ css: "image"
+ tip: "Median cycles by backend, Raspberry Pi 5 (Cortex-A76)."
+ sources:
+ - src: "/files/posts/c11-fips203ipd-v0.6/pi5-results.svg"
+ width: 960
+ height: 480
+ bench-n2l-svg:
+ css: "image"
+ tip: "Median cycles by backend, Odroid N2L (Cortex-A73)."
+ sources:
+ - src: "/files/posts/c11-fips203ipd-v0.6/n2l-results.svg"
+ width: 960
+ height: 480
tables:
bench-x1:
# table columns (required)
@@ -12,40 +34,66 @@ tables:
- id: "function"
name: "Function"
tip: "Function."
- - id: "cycles"
- name: "Cycles (median, 5k trials)"
- tip: "Median number of cycles from 5k trials."
+ - id: "scalar-gcc"
+ name: "Scalar (GCC)"
+ tip: "Median number of CPU cycles when using the scalar backend compiled with GCC."
+ align: "right"
+ - id: "scalar-clang"
+ name: "Scalar (Clang)"
+ tip: "Median number of CPU cycles when using the scalar backend compiled with Clang."
+ align: "right"
+ - id: "simd-gcc"
+ name: "AVX-512 (GCC)"
+ tip: "Median number of CPU cycles when using the AVX-512 backend compiled with GCC."
align: "right"
# table rows (required)
rows:
- set: "kem512"
function: "keygen"
- cycles: "17633"
+ scalar-gcc: "118733"
+ scalar-clang: "70770"
+ simd-gcc: "17448"
- set: "kem512"
function: "encaps"
- cycles: "21602"
+ scalar-gcc: "126159"
+ scalar-clang: "82713"
+ simd-gcc: "21474"
- set: "kem512"
function: "decaps"
- cycles: "25733"
+ scalar-gcc: "185426"
+ scalar-clang: "97722"
+ simd-gcc: "25685"
- set: "kem768"
function: "keygen"
- cycles: "29384"
+ scalar-gcc: "172446"
+ scalar-clang: "110192"
+ simd-gcc: "29334"
- set: "kem768"
function: "encaps"
- cycles: "32511"
+ scalar-gcc: "184614"
+ scalar-clang: "132385"
+ simd-gcc: "32528"
- set: "kem768"
function: "decaps"
- cycles: "38176"
+ scalar-gcc: "234564"
+ scalar-clang: "148425"
+ simd-gcc: "38184"
- set: "kem1024"
function: "keygen"
- cycles: "39829"
+ scalar-gcc: "268327"
+ scalar-clang: "176256"
+ simd-gcc: "39914"
- set: "kem1024"
function: "encaps"
- cycles: "45250"
+ scalar-gcc: "270793"
+ scalar-clang: "206497"
+ simd-gcc: "45268"
- set: "kem1024"
function: "decaps"
- cycles: "52425"
+ scalar-gcc: "370533"
+ scalar-clang: "224686"
+ simd-gcc: "52523"
bench-pi5:
# table columns (required)
@@ -56,40 +104,66 @@ tables:
- id: "function"
name: "Function"
tip: "Function."
- - id: "cycles"
- name: "Cycles (median, 5k trials)"
- tip: "Median number of cycles from 5k trials."
+ - id: "scalar-gcc"
+ name: "Scalar (GCC)"
+ tip: "Median number of CPU cycles when using the scalar backend compiled with GCC."
+ align: "right"
+ - id: "scalar-clang"
+ name: "Scalar (Clang)"
+ tip: "Median number of CPU cycles when using the scalar backend compiled with Clang."
+ align: "right"
+ - id: "simd-gcc"
+ name: "Neon (GCC)"
+ tip: "Median number of CPU cycles when using the Neon backend compiled with GCC."
align: "right"
# table rows (required)
rows:
- set: "kem512"
function: "keygen"
- cycles: "53711"
+ scalar-gcc: "127403"
+ scalar-clang: "77030"
+ simd-gcc: "53667"
- set: "kem512"
function: "encaps"
- cycles: "61366"
+ scalar-gcc: "132432"
+ scalar-clang: "90335"
+ simd-gcc: "61321"
- set: "kem512"
function: "decaps"
- cycles: "73559"
+ scalar-gcc: "176620"
+ scalar-clang: "107868"
+ simd-gcc: "73647"
- set: "kem768"
function: "keygen"
- cycles: "92560"
+ scalar-gcc: "197268"
+ scalar-clang: "114009"
+ simd-gcc: "92471"
- set: "kem768"
function: "encaps"
- cycles: "104842"
+ scalar-gcc: "205189"
+ scalar-clang: "140042"
+ simd-gcc: "104842"
- set: "kem768"
function: "decaps"
- cycles: "121485"
+ scalar-gcc: "265442"
+ scalar-clang: "162514"
+ simd-gcc: "121529"
- set: "kem1024"
function: "keygen"
- cycles: "140219"
+ scalar-gcc: "292543"
+ scalar-clang: "180492"
+ simd-gcc: "140220"
- set: "kem1024"
function: "encaps"
- cycles: "154949"
+ scalar-gcc: "298150"
+ scalar-clang: "212488"
+ simd-gcc: "155127"
- set: "kem1024"
function: "decaps"
- cycles: "176131"
+ scalar-gcc: "376114"
+ scalar-clang: "242303"
+ simd-gcc: "176042"
bench-n2l:
# table columns (required)
@@ -100,40 +174,66 @@ tables:
- id: "function"
name: "Function"
tip: "Function."
- - id: "cycles"
- name: "Cycles (median, 5k trials)"
- tip: "Median number of cycles from 5k trials."
+ - id: "scalar-gcc"
+ name: "Scalar (GCC)"
+ tip: "Median number of CPU cycles when using the scalar backend compiled with GCC."
+ align: "right"
+ - id: "scalar-clang"
+ name: "Scalar (Clang)"
+ tip: "Median number of CPU cycles when using the scalar backend compiled with Clang."
+ align: "right"
+ - id: "simd-gcc"
+ name: "Neon (GCC)"
+ tip: "Median number of CPU cycles when using the Neon backend compiled with GCC."
align: "right"
# table rows (required)
rows:
- set: "kem512"
function: "keygen"
- cycles: "96450"
+ scalar-gcc: "210900"
+ scalar-clang: "123675"
+ simd-gcc: "89625"
- set: "kem512"
function: "encaps"
- cycles: "107550"
+ scalar-gcc: "216750"
+ scalar-clang: "143325"
+ simd-gcc: "101550"
- set: "kem512"
function: "decaps"
- cycles: "126375"
+ scalar-gcc: "298050"
+ scalar-clang: "173550"
+ simd-gcc: "122475"
- set: "kem768"
function: "keygen"
- cycles: "168450"
+ scalar-gcc: "325050"
+ scalar-clang: "179025"
+ simd-gcc: "153525"
- set: "kem768"
function: "encaps"
- cycles: "186975"
+ scalar-gcc: "331725"
+ scalar-clang: "219900"
+ simd-gcc: "173325"
- set: "kem768"
function: "decaps"
- cycles: "212925"
+ scalar-gcc: "444600"
+ scalar-clang: "259350"
+ simd-gcc: "201900"
- set: "kem1024"
function: "keygen"
- cycles: "260325"
+ scalar-gcc: "482625"
+ scalar-clang: "285375"
+ simd-gcc: "234075"
- set: "kem1024"
function: "encaps"
- cycles: "281175"
+ scalar-gcc: "475500"
+ scalar-clang: "335025"
+ simd-gcc: "256650"
- set: "kem1024"
function: "decaps"
- cycles: "314250"
+ scalar-gcc: "619725"
+ scalar-clang: "384825"
+ simd-gcc: "293250"
---
@@ -161,25 +261,43 @@ mechanism (KEM)][kem].
### Benchmarks
Here are median cycle count as measured by the included `bench` tool for
-each parameter set and function from several of my systems.
+each parameter set, function, compiler, and backend from several of my
+systems.
For context, the results below are competitive with the [eBATS][]
results ([kyber512][], [kyber768][], [kyber1024][]), although the
comparison is inexact because the results were measured with different
tools and because [Kyber][] and ML-KEM differ slightly.
-#### Lenovo ThinkPad X1 Carbon, 6th Gen (x86-64 i7-1185G7, AVX-512 backend)
+#### Lenovo ThinkPad X1 Carbon, 6th Gen (x86-64 i7-1185G7)
+
+[{{< pe-figure "bench-x1-svg" >}}][bench-x1-svg]
{{< table "bench-x1" >}}
-#### Raspberry Pi 5 (ARM Cortex-A76, Neon backend)
+[Download CSV][bench-x1-csv]
+
+#### Raspberry Pi 5 (ARM Cortex-A76)
+
+[{{< pe-figure "bench-pi5-svg" >}}][bench-pi5-svg]
{{< table "bench-pi5" >}}
-#### Odroid N2L (ARM Cortex-A73, Neon backend)
+[Download CSV][bench-pi5-csv]
+
+#### Odroid N2L (ARM Cortex-A73)
+
+[{{< pe-figure "bench-n2l-svg" >}}][bench-n2l-svg]
{{< table "bench-n2l" >}}
+[Download CSV][bench-n2l-csv]
+
+**Update (2024-05-16):** Added cycle counts for scalar backend (clang
+and gcc), added bar charts, added downloadable [CSVs][csv]. The
+[CSVs][csv] and [SVGs][svg] generated by the [Python][] scripts in the
+[`scripts/bench-chart/` directory of the Git repository][bench-chart].
+
[fips203ipd-git]: https://github.com/pablotron/fips203ipd
"Embedable, dependency-free, MIT-0 licensed, C11 implemention of the FIPS 203 initial public draft (IPD)."
[fips203ipd-api-docs]: https://pmdn.org/api-docs/fips203ipd/
@@ -244,3 +362,21 @@ tools and because [Kyber][] and ML-KEM differ slightly.
"eBATS: kyber1024"
[kyber]: https://pq-crystals.org/kyber/
"Kyber"
+[bench-x1-svg]: /files/posts/c11-fips203ipd-v0.6/x1-results.svg
+ "View SVG of median CPU cycles by backend, Lenovo ThinkPad X1 Carbon, 6th Gen (x86-64 i7-1185G7)."
+[bench-x1-csv]: /files/posts/c11-fips203ipd-v0.6/x1-results.csv
+ "Download CSV of median CPU cycles by backend, Lenovo ThinkPad X1 Carbon, 6th Gen (x86-64 i7-1185G7)."
+[bench-pi5-svg]: /files/posts/c11-fips203ipd-v0.6/pi5-results.svg
+ "View SVG of median CPU cycles by backend, Raspberry Pi 5 (ARM Cortex-A76)."
+[bench-pi5-csv]: /files/posts/c11-fips203ipd-v0.6/pi5-results.csv
+ "Download CSV of median CPU cycles by backend, Raspberry Pi 5 (ARM Cortex-A76)."
+[bench-n2l-svg]: /files/posts/c11-fips203ipd-v0.6/n2l-results.svg
+ "View SVG of median CPU cycles by backend, Odroid N2L (ARM Cortex-A73)."
+[bench-n2l-csv]: /files/posts/c11-fips203ipd-v0.6/n2l-results.csv
+ "Download CSV of median CPU cycles by backend, Odroid N2L (ARM Cortex-A73)."
+[bench-chart]: https://github.com/pablotron/fips203ipd/tree/main/scripts/bench-chart
+ "Python scripts used to generate the bar charts in this post."
+[python]: https://www.python.org/
+ "Python programming language."
+[svg]: https://en.wikipedia.org/wiki/SVG
+ "Scalable Vector Graphics vector image format."