Skip to content

[Plonky3 Codegen] Expression de-duplication in generated constraints #534

@Leo-Besancon

Description

@Leo-Besancon

When compiling the MidenVM constraints currently done towards the Plonky3 backend, the generated constraints represent ~70 individual constraints.
However, the RPO constraints are written in a way that makes it hard to load (one constraint being represented with 1 line of 80k+ caracters).

We should maybe better optimize some expressions. For instance, we could improve the Common SubExpression Elimination: currently, it deduplicates nodes in the algebraic graph, but the codegen duplicates the generated Rust code back.

Using Rust let statements when a node is duplicated (maybe with some stricter conditions such as "this node should be referenced more than 10 times in the graph to have a dedicated let statement") would certainly improve readability.

The main issue I think would be that the variable names would probably not be made easily readable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions