add `bench.cfg` files

This commit is contained in:
Balazs Komuves 2023-11-06 15:33:09 +01:00
parent 296baf3ccb
commit 6ebadf41c9
No known key found for this signature in database
GPG Key ID: 52130F4FE3E2C2BE
10 changed files with 114 additions and 9 deletions

View File

@ -0,0 +1,7 @@
name: "Blake3 CPU benchmark; official Rust implementation"
timeout: 60
params:
[ MEGABYTES: [ 1,4,16,64,256 ]
, NTHREADS: [ 1,2,4,8 ]
]
tags: CPU, Blake3, Rust

View File

@ -0,0 +1,8 @@
name: "Poseidon2 CPU benchmark; Zikkurat/C implementation"
author: Balazs Komuves
timeout: 60
params:
[ TREE_DEPTH: [ 8,10,12,14,16 ]
, NTHREADS: [ 1,2,4,8 ]
]
tags: CPU, Poseidon2, Zikkurat, C

View File

@ -0,0 +1,8 @@
name: "SHA256 CPU benchmark; Aaron D. Gifford's C implementation"
timeout: 60
params:
[ WHICH: [ LINEAR, MERKLE ]
, MEGABYTES: [ 1,4,16,64,256 ]
, NTHREADS: [ 1,2,4,8 ]
]
tags: CPU, SHA256, C

View File

@ -0,0 +1,6 @@
name: "SHA256 CPU benchmark; Unix tool included in the OS"
timeout: 60
params:
[ MEGABYTES: [ 1,4,16,64,256 ]
]
tags: CPU, SHA256, Unix

View File

@ -6,4 +6,21 @@ fi
echo "MEGABYTES = $ZKBENCH_MEGABYTES"
OSTYPE=`uname -s`
case $OSTYPE in
Darwin)
./build/fakedata $ZKBENCH_MEGABYTES | shasum -a256 -b -
;;
Linux)
./build/fakedata $ZKBENCH_MEGABYTES | sha256sum -b -
;;
FreeBSD)
./build/fakedata $ZKBENCH_MEGABYTES | sha256sum -b -
;;
*)
echo "unknown operating system \`$OSTYPE\`"
exit 99
;;
esac

View File

@ -0,0 +1,11 @@
name: "Poseidon2 Groth16 benchmarks"
author: Balazs Komuves
timeout: 300
rerun_from: build
params:
[ PROVER: [ snarkjs, rapidsnark ]
, INPUT_SIZE: [ 256, 512, 1024, 2048 ]
, WHICH: [ hash_sponge_rate1, hash_sponge_rate2, hash_merkle ]
]
tags: Groth16, Poseidon2, $PROVER

View File

@ -14,8 +14,12 @@ mkdir -p build
gcc -O3 generate_input.c -o build/generate_input || { echo "gcc failed"; exit 101; }
NAME=${ZKBENCH_WHICH}
sed "s/ZKBENCH_INPUT_SIZE/${ZKBENCH_INPUT_SIZE}/g" ${NAME}.circom.template >build/${NAME}.circom
#NAME=${ZKBENCH_WHICH}
NAME="hash"
echo ${NAME}.circom.template \
| sed "s/ZKBENCH_INPUT_SIZE/${ZKBENCH_INPUT_SIZE}/g" \
| sed "s/ZKBENCH_WHICH/${ZKBENCH_WHICH}/g" \
>build/${NAME}.circom
cd build

View File

@ -0,0 +1,49 @@
pragma circom 2.0.0;
include "../../../external/hash-circuits/circuits/poseidon2/poseidon2_hash.circom";
include "../../../external/hash-circuits/circuits/poseidon2/poseidon2_merkle.circom";
//------------------------------------------------------------------------------
// sponge with rate=1 (capacity=2)
template Bench_hash_sponge_rate1(n) {
signal input inp[n];
signal output out;
component sponge = PoseidonSponge(3,2,n,1);
sponge.inp <== inp;
sponge.out[0] ==> out;
}
// sponge with rate=2 (capacity=1)
template Bench_hash_sponge_rate2(n) {
signal input inp[n];
signal output out;
component sponge = PoseidonSponge(3,1,n,1);
sponge.inp <== inp;
sponge.out[0] ==> out;
}
//------------------------------------------------------------------------------
function FloorLog2(n) {
return (n==0) ? -1 : (1 + FloorLog2(n>>1));
}
function CeilLog2(n) {
return (n==0) ? 0 : (1 + FloorLog2(n-1));
}
template Bench_hash_merkle2(n) {
var log2n = CeilLog2(n);
assert( (1<<log2n) == n ); // for now this only works for power-of-two sized inputs
signal input inp[n];
signal output out;
component merkle = PoseidonMerkle(log2n);
merkle.inp <== inp;
merkle.out_root ==> out;
}
//------------------------------------------------------------------------------
component main {public [inp]} = Bench_ZKBENCH_WHICH( ZKBENCH_INPUT_SIZE );

View File

@ -1,5 +0,0 @@
pragma circom 2.0.0;
include "../../../external/hash-circuits/circuits/poseidon2/poseidon2_hash.circom";
component main {public [inp]} = Poseidon2_hash( ZKBENCH_INPUT_SIZE );

@ -1 +1 @@
Subproject commit bf6cca380547ca905ca0615cfdb6c49660e441a2
Subproject commit e6b99b20f038f27390f590313ce7de227d6dd42a