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

pilopt: equal-constrained witness columns removal #2086

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

Conversation

gzanitti
Copy link
Collaborator

Resolves #2081

@chriseth
Copy link
Member

Nice! Did you try what the result on test_data/std/poseidon_gl_test.asm is?

pilopt/src/lib.rs Outdated Show resolved Hide resolved
@gzanitti
Copy link
Collaborator Author

Nice! Did you try what the result on test_data/std/poseidon_gl_test.asm is?

Yes, it went from Removed 164 witness and 154 fixed columns. Total count now: 99 witness and 50 fixed columns. to Removed 175 witness and 154 fixed columns. Total count now: 88 witness and 50 fixed columns.

pilopt/src/lib.rs Outdated Show resolved Hide resolved
pilopt/src/lib.rs Outdated Show resolved Hide resolved
pilopt/src/lib.rs Outdated Show resolved Hide resolved
pilopt/src/lib.rs Outdated Show resolved Hide resolved
pilopt/src/lib.rs Outdated Show resolved Hide resolved
pilopt/src/lib.rs Outdated Show resolved Hide resolved
riscv-executor/src/lib.rs Outdated Show resolved Hide resolved
@chriseth
Copy link
Member

This looks great now! One last annoying thing to test: Array elements. The issue is that we cannot remove them (because we would need to shorten the array by one element and update the indices, etc - it's very tricky).

Can you add a test of the form let w: col[20]; w[4] = w[7]; and see what happens? Please also include some references to the (potentially) removed witness column both in other identities and in hints / prover functions.

@chriseth
Copy link
Member

I think remove_constant_witness_columns already avoids removing arrays, but I think it does not correctly avoid removing array elements (.is_array() only returns true on the first element of the array or on the array itself). The function build_poly_id_to_definition_name_lookup already creates a lookup table that could be extended to also supply the information if the PolyID is an array element or not.

pilopt/src/lib.rs Outdated Show resolved Hide resolved
ast/src/analyzed/mod.rs Outdated Show resolved Hide resolved
@gzanitti gzanitti changed the title Opt: equal-constrained witness columns removal pilopt: equal-constrained witness columns removal Nov 29, 2024
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.

Optimizer should remove equal-constrained witness columns.
3 participants