You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, one of possible Operation's in the IR is exponentiation (Exp(NodeIndex, usize)). I think this needlessly complicates the algebraic graph - especially, since it should be pretty simple to reduce all exponentiations to a sequence of multiplications.
We still should have the ability to do exponentiation in the language, but the parser should reduce exponentiation to an optimal expression using only multiplications.
The text was updated successfully, but these errors were encountered:
We still should have the ability to do exponentiation in the language, but the parser should reduce exponentiation to an optimal expression using only multiplications.
Wouldn't it be best to leave that decision to each backend? For the Masm backend it does make sense to replace exponentiation with multiplication for quadratic elements (i mean, we have to do that because the VM doesn't support the operation).
But for the Winterfell backend that would make the generated code more complicated, since it can use a native exponentiation API, and the lowering would lose this information.
Edit: Well, from #130 it seems that is the plan? It seems I don't understand what are the benefits there.
The issue with using generic exponentiation is that we'd end up using a generic algorithm which includes while loops, if statements etc. In our case, exponents are pretty small (9 or smaller in Miden VM case) - so, unrolling should always produce better code, and it would make the overall structure simpler.
Currently, one of possible
Operation
's in the IR is exponentiation (Exp(NodeIndex, usize)
). I think this needlessly complicates the algebraic graph - especially, since it should be pretty simple to reduce all exponentiations to a sequence of multiplications.We still should have the ability to do exponentiation in the language, but the parser should reduce exponentiation to an optimal expression using only multiplications.
The text was updated successfully, but these errors were encountered: