-
Notifications
You must be signed in to change notification settings - Fork 103
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
Experiment: backport ff_derive
x86_64 assembly from fff
crate
#58
base: main
Are you sure you want to change the base?
Conversation
(cherry picked from commit ffc03eb)
(cherry picked from commit 2561b7f)
(cherry picked from commit ba0fb17)
(cherry picked from commit b3cba18)
(cherry picked from commit 1cdee83) pick: Only the adx check.
(cherry picked from commit 6c65c33)
(cherry picked from commit 39cb448)
(cherry picked from commit 407cc1a)
(cherry picked from commit bbe3223)
This was definitely working at one point. Did something change? |
IDK. @dignifiedquire implemented that in January 2020 so it's "relatively" recent; they might have more information about what they were seeing that motivated the change. |
Here's a Godbolt example which shows Taken from the |
For |
This is an experimental backport of the changes from https://github.com/filecoin-project/ff (published as the
fff
crate). I've opened this as a draft PR for discussion. I see two main additions:ASM for modular multiplication. This is specific to BLS12-381, and is probably unlikely to be beneficial here. When the
fff
fork was created, the main BLS12-381 implementation was inpairing::bls12_381
, and it usedff_derive
for its field logic. That implementation has been removed frompairing
, and replaced with thebls12_381
crate which implements field logic directly. So we might want to consider potentially adding assembly optimisations there.ASM to use
_addcarry_u64
and_subborrow_u64
explicitly on x86_64. I'm surprised that Rust doesn't figure this out itself; it seems like we should be able to reworkff_derive
to encourage LLVM to lower to this directly.