Skip to content

Commit

Permalink
test: benchmarking pass
Browse files Browse the repository at this point in the history
  • Loading branch information
tfaoliveira-sb committed Jul 27, 2024
1 parent c7dea34 commit a9a1452
Show file tree
Hide file tree
Showing 11 changed files with 922 additions and 320 deletions.
11 changes: 3 additions & 8 deletions code/jasmin/mlkem_avx2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ TESTS := \

test: $(TESTS)

speed: test/speed_indcpa test/speed_mlkem
speed: test/speed_mlkem

# --

Expand Down Expand Up @@ -161,16 +161,12 @@ run-tests: compile-tests

# --

test/speed_indcpa: test/speed_indcpa.c $(HEADERS) $(C_SOURCES) $(S_INC) jspeed.s
test/speed_mlkem: test/speed_mlkem.c $(HEADERS) $(C_SOURCES) $(S_INC) $(RANDOMBYTES) jspeed.s
$(CC) $(CFLAGS) -o $@ $(C_SOURCES) $(RANDOMBYTES) jspeed.s $<

test/speed_mlkem: test/speed_mlkem.c $(HEADERS) $(C_SOURCES) $(S_INC) jspeed.s
$(CC) $(CFLAGS) -o $@ $(C_SOURCES) $(RANDOMBYTES) jspeed.s $<

compile-speed: test/speed_indcpa test/speed_mlkem
compile-speed: test/speed_mlkem

run-speed: compile-speed
./test/speed_indcpa
./test/speed_mlkem

# --
Expand All @@ -191,7 +187,6 @@ clean:
-rm -f test/test_fips202
-rm -f test/test_indcpa
-rm -f test/test_kem
-rm -f test/speed_indcpa
-rm -f test/speed_mlkem
ifeq ($(OS),Darwin)
-rm -r -f test/*.dSYM
Expand Down
23 changes: 23 additions & 0 deletions code/jasmin/mlkem_avx2/cycles.jinc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
inline fn tsc() -> stack u32[2]
{
reg u64 l h;
stack u32[2] t;

h, l = #RDTSC();

t[0] = (32u) l;
t[1] = (32u) h;

return t;
}

inline fn cycles(stack u32[2] start end) -> reg u64
{
reg u64 t;

t = end[u64 0];
t -= start[u64 0];

return t;
}

Loading

0 comments on commit a9a1452

Please sign in to comment.