Leo 357894b539 fix apc register memory optimizer bug (#2717)
The bug that happened was that the last send of a register memory bus
interaction was removed due to having multiplicity zero. In the end the
bus was left unbalanced. Therefore, we need to run the solver optimizer
before the reg mem opt, so that these multiplicities are removed in
pairs before the apc optimizer runs and keeps only the first receive and
last send, because those multiplicities need to match. This is the main
solution implemented here in `build`. I also added some checks that the
reg mem interactions need to be even per address and in total.

A side effect of this fix is that we can no longer easily remove the
timestamp columns of removed mem int receives, the constraint that
decomposes it into bytes, the decomposing columns, and the range checks
on them. The pattern matching becomes too brittle and would be even
hackier if we wanted to keep supporting it that way. That's what causes
the regression in the test, and all the code that is removed in this PR,
since we won't do this anymore. The ultimate fix is to rely on the
optimizer to remove these columns, since:
- The reg mem int receive is removed
- Then the timestamp column becomes a free variable in its constraint
- The constraint can be removed
- The limb decomposition columns become unused in polynomial constraints
and only appear in range checks
- Therefore the range checks and columns can also be removed

At this point the result should be the same as the pattern matching
alternative removed by this PR.
I anticipate that we'll also need a fixpoint loop because it may be the
case that we need a few iterations to propagate everything possible when
this is implemented.
2025-05-16 10:11:43 +00:00
2025-03-25 18:46:26 +00:00
2025-03-25 18:46:26 +00:00
2025-04-29 14:58:57 +00:00
2025-04-28 11:19:41 +00:00
2025-03-27 01:21:00 +00:00
2025-03-25 18:46:26 +00:00
2025-04-28 12:26:25 +00:00
2025-04-16 07:56:28 +00:00
2025-03-25 18:46:26 +00:00
2025-05-07 07:35:02 +00:00
2025-04-16 07:56:28 +00:00
2025-04-16 07:56:28 +00:00
2024-09-13 17:03:37 +00:00
2025-05-07 07:35:02 +00:00
2024-05-14 16:29:23 +00:00
2024-05-14 16:29:23 +00:00
2024-11-18 13:14:38 +00:00

powdr

Matrix Chat Twitter Follow

WARNING: This codebase is experimental and has not been audited. DO NOT USE FOR PRODUCTION!

For detailed documentation please visit the powdr book.

If you have any questions or want to contribute, feel free to write us in our Matrix Chat.

powdr is a toolkit that helps build zkVMs and similar proof frameworks.

It has two main components:

  • powdr-asm: an extensible assembly IR language to perform dynamic executions.
  • powdr-PIL: a low level constraint language that allows you to define arithmetic constraints, lookups, etc. It includes a functional meta-constraint language to describe how constraints are generated.

Both frontend and backend are highly flexible.

The powdrVM is a zkVM implementation that builds on powdr. Users can write code in std Rust which is compiled to RISCV, then to powdr-asm and finally to powdr-PIL.

powdr-PIL can be used to generate proofs using multiple backends, such as:

All stages are fully automatic, which means you do not need to write any additional code for witness generation besides your Rust code. All witnesses are automatically inferred from the constraints. Since the witnesses are inferred, powdr can ensure that the system is not underconstrained, i.e., there are no additional unwanted witnesses.

All artifacts from the compilation pipeline are human-readable. You can inspect the powdr-asm IR, the compiled powdr-PIL file, and its final optimized version.

The assembly language is designed to be extensible and does not have a single native instruction. Instead, all instructions are user-defined and because of that, it is easy to adapt powdr assembly to any VM.

Notes on Efficiency

The current focus of the project is VM support and developer experience. The compiler generates many unnecessary columns. We will soon start writing optimizer steps that should bring performance closer to existing production systems.

Project structure

For an overview of the project structure, run:

cargo doc --workspace --no-deps --open

Contributing

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as below, without any additional terms or conditions.

License

This project is licensed under either of

at your option.

Description
No description provided
Readme 153 MiB
Languages
Rust 96.7%
Python 2.8%
Shell 0.5%