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

[fix] modular setup macro padding #1252

Merged
merged 3 commits into from
Jan 23, 2025
Merged

[fix] modular setup macro padding #1252

merged 3 commits into from
Jan 23, 2025

Conversation

luffykai
Copy link
Contributor

Currently, if the modulus has 40 bytes, the blocksize is 8 and final number of limbs is still 40.
But we can't really do 40, as the adapter is either 32 or 48. Change the macro to match that logic

@luffykai luffykai changed the title [fix\ modular setup macro padding [fix] modular setup macro padding Jan 22, 2025
Copy link

group app.proof_time_ms app.cycles app.cells_used leaf.proof_time_ms leaf.cycles leaf.cells_used
verify_fibair (-63 [-2.7%]) 2,233 513,774 19,386,023 - - -
fibonacci_program (+35 [+0.6%]) 6,060 1,500,137 51,487,838 - - -
regex_program (-34 [-0.2%]) 17,829 4,190,904 165,010,909 - - -
ecrecover_program (+18 [+0.7%]) 2,613 285,401 15,075,033 - - -

Commit: f0502f0

Benchmark Workflow

}

// The largest power of two so that at most 10% of all space is wasted
let block_size = 1usize << ((limbs - 1) ^ (limbs + limbs / 9)).ilog2();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am not sure if i understand this correctly, but since the limbs is either 32 or 48, i just make the block 32 or 16 for them (like the memory read block). lmk if this doesn't work

Copy link
Contributor

@Golovanov399 Golovanov399 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems ok for now, but maybe at some point we need to do something to the adapters or at least to how many limbs we are using exactly in the operations

@jonathanpwang
Copy link
Contributor

Seems ok for now, but maybe at some point we need to do something to the adapters or at least to how many limbs we are using exactly in the operations

Yes will revisit. @manh9203 can help track this issue.

@jonathanpwang jonathanpwang merged commit 864d0a7 into main Jan 23, 2025
16 checks passed
@jonathanpwang jonathanpwang deleted the lunkai/mod-macro-pad branch January 23, 2025 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants