-
Notifications
You must be signed in to change notification settings - Fork 0
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
Opt const eval #17
base: main
Are you sure you want to change the base?
Opt const eval #17
Conversation
math/src/field/f64/mod.rs
Outdated
let mut b = self; | ||
|
||
if power == 0 { | ||
return Self::ONE; | ||
} else if b == Self::ZERO { | ||
return Self::ZERO; | ||
} | ||
|
||
let mut r = if power & 1 == 1 { b } else { Self::ONE }; | ||
for i in 1..64 - power.leading_zeros() { | ||
b = b.square(); | ||
if (power >> i) & 1 == 1 { | ||
r *= b; | ||
} |
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 is fine to have for testing purposes - but it probably shouldn't be a part of 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.
Sure, I will remove it before making the PR against Novi/Winterfell main.
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.
Actually, I will just change it back so that I don't forget it.
@@ -271,15 +278,12 @@ impl<E: FieldElement> TransitionConstraintGroup<E> { | |||
/// them by the divisor later on. The degree of the divisor for transition constraints is | |||
/// always $n - 1$. Thus, once we divide out the divisor, the evaluations will represent a | |||
/// polynomial of degree $D$. | |||
pub fn merge_evaluations<B, F>(&self, evaluations: &[F], x: B) -> E | |||
pub fn merge_evaluations<B, F>(&self, evaluations: &[F], xp: B) -> E |
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.
The comment above probably should be updated.
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, let me know what you think.
@@ -81,6 +100,19 @@ impl<B: StarkField> StarkDomain<B> { | |||
self.ce_to_lde_blowup | |||
} | |||
|
|||
/// Returns (offset * g^(step))^degree_adjustment. | |||
pub fn get_ce_x_power_at<A: Air<BaseField = B>>( |
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.
We could try adding #[inline(always)]
attribute to this function (and maybe some other functions). Sometimes, this improves performance.
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.
Sure, I did here and in the helper function on the same file.
prover/src/domain.rs
Outdated
let index = index % (self.ce_domain_size()); | ||
let xp = self.ce_domain()[index] * *self.degree_adj_map().get(°ree_adjustment).unwrap(); |
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.
I wonder if instead of %
we could use a shift here somehow (because we know that ce_domain_size
is a power of 2).
Also, we should change unwrap
to expect
(we shouldn't use unwrap
's in non-test code).
For some reason the previous PR says that it has been merged. I am creating this new PR which implements the improvements suggested in the old one.
Sorry for the mess.