tracing profiling log (for Plonky3) (#1753)
With this change, we also print profiling logs for crates that are instrumented using the `tracing` crate (if we're at least in the `DEBUG` log level). For example, for: ```bash cargo run -r --bin powdr-rs compile riscv/tests/riscv_data/keccak -o output RUST_LOG=debug cargo run -r --features plonky3,halo2 pil output/keccak.asm -o output -f --field gl --prove-with plonky3-composite ``` This prints: ``` == Proving machine: main (size 131072), stage 0 INFO prove_with_key [ 1.84s | 0.23% / 100.00% ] INFO ┝━ infer log of constraint degree [ 141µs | 0.01% ] INFO ┝━ commit to trace data [ 458ms | 19.13% / 24.94% ] INFO │ ┕━ coset_lde_batch [ 107ms | 5.81% ] dims: 74x131072 INFO ┝━ compute quotient polynomial [ 1.16s | 62.90% ] INFO ┝━ commit to quotient poly chunks [ 58.7ms | 2.14% / 3.19% ] INFO │ ┝━ coset_lde_batch [ 10.6ms | 0.58% ] dims: 2x131072 INFO │ ┕━ coset_lde_batch [ 8.86ms | 0.48% ] dims: 2x131072 INFO ┝━ compute_inverse_denominators [ 26.3ms | 1.43% ] INFO ┝━ reduce matrix quotient [ 10.9ms | 0.00% / 0.59% ] dims: 4x262144 INFO │ ┝━ compute opened values with Lagrange interpolation [ 8.46ms | 0.46% ] INFO │ ┕━ reduce rows [ 2.42ms | 0.13% ] INFO ┝━ reduce matrix quotient [ 10.9ms | 0.00% / 0.59% ] dims: 4x262144 INFO │ ┝━ compute opened values with Lagrange interpolation [ 8.91ms | 0.48% ] INFO │ ┕━ reduce rows [ 2.01ms | 0.11% ] INFO ┝━ reduce matrix quotient [ 20.4ms | 0.00% / 1.11% ] dims: 74x262144 INFO │ ┝━ compute opened values with Lagrange interpolation [ 14.0ms | 0.76% ] INFO │ ┕━ reduce rows [ 6.35ms | 0.35% ] INFO ┝━ reduce matrix quotient [ 17.6ms | 0.00% / 0.96% ] dims: 74x262144 INFO │ ┝━ compute opened values with Lagrange interpolation [ 11.2ms | 0.61% ] INFO │ ┕━ reduce rows [ 6.44ms | 0.35% ] INFO ┝━ reduce matrix quotient [ 7.55ms | 0.00% / 0.41% ] dims: 2x262144 INFO │ ┝━ compute opened values with Lagrange interpolation [ 6.63ms | 0.36% ] INFO │ ┕━ reduce rows [ 913µs | 0.05% ] INFO ┝━ reduce matrix quotient [ 8.74ms | 0.00% / 0.48% ] dims: 2x262144 INFO │ ┝━ compute opened values with Lagrange interpolation [ 7.92ms | 0.43% ] INFO │ ┕━ reduce rows [ 817µs | 0.04% ] INFO ┕━ FRI prover [ 57.8ms | 0.00% / 3.15% ] INFO ┝━ commit phase [ 56.0ms | 3.05% ] INFO ┝━ grind for proof-of-work witness [ 654µs | 0.04% ] INFO ┕━ query phase [ 1.09ms | 0.06% ] INFO verify_with_key [ 42.6ms | 99.63% / 100.00% ] INFO ┕━ infer log of constraint degree [ 158µs | 0.37% ] ==> Proof stage computed in 1.934923926s ```
powdr
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.
As an example, powdr contains a frontend that enables you to write code in (no-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:
- Halo2, using PSE's
- eSTARK, using
- Plonky3 (ongoing work): https://github.com/powdr-labs/powdr/pull/1158
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 RISCV assembly files, the powdr-asm IR, and the compiled PIL file.
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.
