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

Plonky3 keccak memory #1832

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open

Plonky3 keccak memory #1832

wants to merge 25 commits into from

Conversation

qwang98
Copy link
Collaborator

@qwang98 qwang98 commented Sep 24, 2024

Now ready for review as tests all pass. Methodology documented as comments in the keccak16_memory.asm file.

I have only one optimization in mind, but I'm not sure if it'd speed things up, which will depend on more backend knowledge. Specifically, currently I'm using permutation links to add_sub submachine to calculate memory addresses for the input and output (basically adding 4 to the address for each read/write). The add_sub submachine itself is pretty compact and efficient in that it doesn't contain any wasted columns. However, I could instead create regular constraints in the main machine to enforce the add 4 logic. Because currently the address columns are only used in the first and last rows, I can put the carry bit in the second and the second to last rows of these address columns. I'll also need to create byte2 checks for all the calculated input/output addresses, which is currently done in the add_sub submachine.

The key question remains to be answered is whether it's cheaper to do many permutation links or to move everything to "native" constraint in the main machine. The actual number of constraints will be similar in either cases, it's just where we do them.

Either way we go, I think we should approve this PR as is first, because it's currently functioning and is ready for benchmarking. Any optimization mentioned I can do it in another PR.

@qwang98 qwang98 changed the title Plonky3 keccak memory new Plonky3 keccak memory Sep 24, 2024
@qwang98 qwang98 marked this pull request as draft September 24, 2024 13:21
@qwang98 qwang98 self-assigned this Oct 26, 2024
@qwang98 qwang98 marked this pull request as ready for review October 26, 2024 16:15
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.

1 participant