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

Polynomials should be automatically broken to the maximum supported degree. #1971

Open
lvella opened this issue Oct 28, 2024 · 4 comments
Open

Comments

@lvella
Copy link
Member

lvella commented Oct 28, 2024

Users should not worry about the degree of the constraint as they write in Powdr/PIL. Especially now that we have functions that can be nested in multiple abstraction levels, which makes it hard to know what will be the final degree of a polynomial.

Which is related to making both snippets below equivalent:

let x;
x = something;
let x = something;

This is related because it is the compiler that should decide if it is necessary or not to introduce a new concrete column (or remove them, but I think the optimizer already does that).

@lvella lvella changed the title Polynomials should be break to the maximum supported degree. Polynomials should be automatically broken to the maximum supported degree. Oct 28, 2024
@georgwiese
Copy link
Collaborator

Yes, please! :)

I think the simplest implementation would be to always use intermediate polynomials (which are essentially an expressions, but one that is not inlined by the condenser), and give the backend the opportunity to turn intermediate columns into witness columns if needed.

I think the devil is in the details though:

  • Then, the backend needs to modify the PIL passed to witgen (because witgen needs to generate values for witness columns but not intermediate columns). So witness generation would be backend-specific.
  • At least currently, witgen treats intermediate columns and witness columns differently. So it could be the case that it is able to solve for one backend, but not for another.

@lvella
Copy link
Member Author

lvella commented Oct 31, 2024

Couldn't we make it so that there would be a simple adapter pass from a more general witgen output to an specific backend input?

@georgwiese
Copy link
Collaborator

I mean, only if we change witgen to output values for all intermediate columns, right? Because the backend needs these values if it decides to turn them into witness columns. It's one option, but I think it could also increase the cost of witgen.

@georgwiese
Copy link
Collaborator

Ah, but the adapter could also compute the values on demand from the provided witness columns. That's a good point, nice!

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

No branches or pull requests

2 participants