1
1
mirror of https://github.com/henrydcase/pqc.git synced 2024-11-22 23:48:58 +00:00

basemul bench

This commit is contained in:
Henry Case 2021-05-06 12:09:01 +01:00
parent 977d449ce3
commit 395896dc92

View File

@ -11,6 +11,7 @@ extern "C" {
#include "kem/kyber/kyber512/avx2/indcpa.h" #include "kem/kyber/kyber512/avx2/indcpa.h"
#include "kem/kyber/kyber512/avx2/kem.h" #include "kem/kyber/kyber512/avx2/kem.h"
#include "kem/kyber/kyber512/avx2/rejsample.h" #include "kem/kyber/kyber512/avx2/rejsample.h"
#include "kem/kyber/kyber512/avx2/ntt.h"
} }
auto cpucycle = [](benchmark::State &st, int64_t cycles) { auto cpucycle = [](benchmark::State &st, int64_t cycles) {
@ -90,8 +91,23 @@ static void BenchKyberDecaps(benchmark::State &st) {
} }
cpucycle(st, total); cpucycle(st, total);
} }
static void BenchBaseMulAVX(benchmark::State &st) {
int64_t t, total = 0;
__m256i r[32],a[32],b[32],data[32];
for (auto _ : st) {
t = benchmark::cycleclock::Now();
PQCLEAN_KYBER512_AVX2_basemul_avx(r,a,b,data);
total += benchmark::cycleclock::Now() - t;
benchmark::DoNotOptimize(r);
}
cpucycle(st, total);
}
BENCHMARK(BenchKyberMatK2); BENCHMARK(BenchKyberMatK2);
BENCHMARK(BenchKyberRejSampling); BENCHMARK(BenchKyberRejSampling);
BENCHMARK(BenchKyberKeygen); BENCHMARK(BenchKyberKeygen);
BENCHMARK(BenchKyberEncaps); BENCHMARK(BenchKyberEncaps);
BENCHMARK(BenchKyberDecaps); BENCHMARK(BenchKyberDecaps);
BENCHMARK(BenchBaseMulAVX);