Skip to content
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

uptream regression: support aliasing in towers of extension fields #147

Closed
mratsim opened this issue Feb 2, 2021 · 0 comments
Closed

uptream regression: support aliasing in towers of extension fields #147

mratsim opened this issue Feb 2, 2021 · 0 comments
Labels
bug 🪲 Something isn't working upstream 🐉

Comments

@mratsim
Copy link
Owner

mratsim commented Feb 2, 2021

Nim upstream fixed #146 by making big concept instantiation use normal Nim parameter passing (i.e. over 24 bytes = pass-by-reference) nim-lang/Nim#16897

However, now there is a bug in Fp12 towering due to aliasing output and input here:

Workaround is easy, just copy v3 in a temp before calling the function.
However this is likely to also contribute to extra MOV like here #145

In general, all tower functions need to be refactored so that the callee handles aliasing instead of the caller requiring temporaries as in that case that requires the caller to copy a whole 6x384 bits = 288 bytes before a function call.

This would likely also significantly extra overhead on G2 https://github.com/mratsim/constantine/blob/83dcd98/constantine/tower_field_extensions/quadratic_extensions.nim#L341-L365.

Constantine is currently runner up on BLS12-381 G1 in https://hackmd.io/@zkteam/eccbench, faster than BLST and MCL
image

but somehow falters on G2
image

and the gap is compounded in pairings/Fp12
image

@mratsim mratsim closed this as completed in 2c5e12d Feb 2, 2021
@mratsim mratsim added bug 🪲 Something isn't working upstream 🐉 labels Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working upstream 🐉
Projects
None yet
Development

No branches or pull requests

1 participant