-
Notifications
You must be signed in to change notification settings - Fork 148
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
Eliminate addcarryx/subborrowx wrappers in Go #1006
Conversation
694b927
to
2d48c00
Compare
So it turns out that I missed testing "wrapper removal" in isolation from "cast removal" in our back and forth in the issue due just copy-pasting my optimized code for the (wrapper removed version), when it was something I really should have done. This commit removes the NOP wall due to the inliner, but the casts are the bulk of the perf penalty. For this snippet:
With casts:
Without casts (uint1 made to an alias of uint64):
I assume that unilaterally type-casting
That said, if defining a type that is only used for carries/borrows is easier than relaxing casts (ie: something like Sorry for the oversight when doing the initial round of benchmarks, when HACS goes back to being an in-person thing, remind me that I owe you a beverage of your choice. |
2d48c00
to
f19674e
Compare
This is a partial fix for item 1 of mit-plv#949 (comment) also mentioned at golang/go#40171 (comment) Unfortunately, we still cast the arguments to uint1 because we don't have enough information in the right places to relax the casts. We really want a fused absint/rewriting pass, where we get access to true bounds information rather than just casts.
f19674e
to
4b98c40
Compare
For performance reasons. Note that this is unsound, but having the carry type be 8 bits rather than 1 bit was already unsound, and this is no more unsound. The narrowness of the carry type is not used in practice in the code, though we should still someday include it in the proofs.
@Yawning I've updated the typedef to be to uint64. Does this code do better? |
A quick check of the generated assembly also looks sensible. |
This is a partial fix for item 1 of
#949 (comment) also
mentioned at golang/go#40171 (comment)
Unfortunately, we still cast the arguments to uint1 because we don't
have enough information in the right places to relax the casts. We
really want a fused absint/rewriting pass, where we get access to true
bounds information rather than just casts.
cc @Yawning, how does this do performance-wise?