-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Call ret #194
Conversation
The pull request is ready for review. |
.gitlab-ci.yml
Outdated
@@ -52,7 +52,8 @@ coq: | |||
EXTRA_NIX_ARGUMENTS: --arg coqDeps true | |||
extends: .common | |||
script: | |||
- nix-shell --arg inCI true $EXTRA_NIX_ARGUMENTS --run 'make -j$NIX_BUILD_CORES -C proofs' | |||
- nix-shell --arg inCI true $EXTRA_NIX_ARGUMENTS --run 'make -j$NIX_BUILD_CORES -C proofs Makefile.coq' | |||
- nix-shell --arg inCI true $EXTRA_NIX_ARGUMENTS --run 'make -j$NIX_BUILD_CORES -C proofs lang/extraction.vo' | |||
- nix-shell --arg inCI true $EXTRA_NIX_ARGUMENTS --run 'make -j$NIX_BUILD_CORES -C compiler CIL' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please drop these changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
If I remember well we discussed the possibility that the ci has an intermediate entry (i.e separating the proofs).
compiler/src/stackAlloc.ml
Outdated
@@ -209,10 +210,15 @@ let memory_analysis pp_err ~debug tbl up = | |||
let ra = V.mk "RA" (Stack Direct) (tu Arch.reg_size) L._dummy [] in | |||
let extra = | |||
let extra = to_save in | |||
let extra = if rastack then ra :: extra else extra in | |||
(* let extra = if rastack then ra :: extra else extra in *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
proofs/arch/asm_gen_proof.v
Outdated
@@ -308,7 +318,7 @@ Proof. | |||
case: h vt. | |||
+ move=> i {ty} ty /eq_exprP -> vt /=. | |||
case: i => /= [f | r]; first by apply: var_of_flagP eqm. | |||
by apply: var_of_regP eqm. | |||
apply: var_of_regP eqm. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is surprising.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
proofs/arch/asm_gen_proof.v
Outdated
@@ -1595,7 +1667,7 @@ Proof. | |||
eexists; first reflexivity. | |||
exists lc; first exact: omap_lc. | |||
by constructor => //; rewrite /setpc /= eqpc. | |||
Qed. | |||
Admitted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not look good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
proofs/compiler/linearization.v
Outdated
:: MkLI ii (Lgoto lcall) | ||
(* ++ MkLI ii (LstoreLabel ra lret) *) | ||
(* :: lstore ii rspi z Uptr glob_ra *) | ||
++ MkLI ii (Lcall lcall) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please clean the comments away.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
proofs/lang/memory_example.v
Outdated
@@ -90,8 +90,9 @@ Module MemoryI : MemoryT. | |||
- sizes are positive | |||
- stack does not overflow | |||
*) | |||
(* FIXME 0 <=? frame_size f not needed *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this be fixed before or after merging this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one was already fixed, I forgot to remove the comment
abebbe5
to
3fee871
Compare
I’m going to rebase… |
5ef7122
to
ab7e947
Compare
CI is happy. Let’s wait for feedback from Jasmin users. |
@vbgl @bgregoir, I did some experiments on libjade. I explain the procedure first, and then the results.
The benchmark settings (number of iterations, etc) are in libjade/bench/common. The remaining scripts that I used for this task are not. When I get some time to test and clean them, I can push them. The CPU is a Skylake. The results of scalarmult ref4 (~ amd64-64) and ref5 (~ amd64-51) are quite stable at a negative overhead. x25519 ref4 implementation usually runs at roughly 129500 cycles on said CPU. A -0.1% difference means ~ -130 cycles. This implementation does ~25 function calls (just for the inversion). For shake256, IIRC, only Keccakf is non-inline. The reported value for each run is the average of the overheads for: 32 bytes of output and 0, 32, 128, 1024, and 16384 bytes of input; There seems to be a bit of overhead for shake. Next, you can take a look at the number of cycles (for outlen=32 and inlen=16384) from libjade-jasmin-main and libjade-jasmin-call-ret, for a second entire run where I also registered individual results and not just the average (which means that the following values were not used to produce the previous plot).
For Kyber the results are the following (a little bit noisy at the moment; I think I would need to swap the random bytes implementation/shuffle the order of Kyber executions to get slightly stable results; I also cannot provide much insight about how many function calls are done given that I only know the implementation superficially). Overall I think this change in the compiler does not affect performance significantly so I would say that it would be nice to have it merged. |
eaf733d
to
4f3a8b5
Compare
331ac96
to
5741f1b
Compare
cee3390
to
3f9e17e
Compare
On my side, the PR is ready to merge. |
c4f93ad
to
f425eb5
Compare
Co-authored-by: Benjamin Grēgoire <[email protected]>
CI: https://gitlab.com/jasmin-lang/jasmin/-/pipelines/751942335 Do we want to run some benchmarks? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI is happy. I recommend to merge now and polish later.
Work in progress