Commit Graph

87 Commits

Author SHA1 Message Date
Thibaut Schaeffer
b0d4178477 Update openvm dep to forked synced with v1.3.0 (#3267) 2025-09-09 21:07:37 +00:00
Leo
c5b35ea4b0 remove podwr vm from main repo (#3231)
- Remove all crates that are not linked with `autoprecompiles`,
`openvm`, `constraint-solver`
- Remove tests and artifacts linked with removed crates
- Adjust CI
2025-08-28 10:03:36 +00:00
Leo
fe3b3550d6 update openvm (#3163)
If this works we can merge the openvm PR
2025-08-12 10:10:01 +00:00
Leandro Pacheco
4be51aa95a Powdr openvm extension with new hints (#3100)
Extend our openvm guest/host with support for new hints.
Includes hints for `k256` affine coordinate inverse and sqrt.
2025-07-30 15:50:23 +00:00
Thibaut Schaeffer
9f36102a16 Keep openvm program intact (#3075)
Since #3055, we don't need to change the program anymore.
This PR keeps the program intact in openvm, passing the apc opcodes to
openvm through a new API in openvm.
See https://github.com/powdr-labs/openvm/pull/36
Related: https://github.com/powdr-labs/openvm-reth-benchmark/pull/26
2025-07-28 14:48:10 +00:00
Thibaut Schaeffer
3ab2dba41f Update openvm (#3062) 2025-07-19 22:41:42 +00:00
Steve Wang
5ae915d7fd Calculate non-APC LogUp columns for PGO (#2960)
Need to first merge https://github.com/powdr-labs/stark-backend/pull/11.
And then merge https://github.com/powdr-labs/openvm/pull/32.

Original comment by @Schaeff:
```
so here's my suspicion:

to get the number of columns of an air, we use executor.air().width(), in fully qualified syntax openvm_stark_backend::p3_air::BaseAir::width(&executor.air())
this is the number of main trace columns, which does not include interaction columns
in order to get the full number of columns, we need to do what we already do for get_constraints but additionally call InteractionPhaseAirBuilder::finalize_interactions on the symbolic builder to materialize the interactions. Sadly InteractionPhaseAirBuilder is pub(crate) so it seems we need to change stark-backend
```

This PR follows the comment above, but has additional changes:
1. Instead of using `finalize_interactions`, call lower level functions
for greater efficiency.
2. Refactored `AirMetrics` related functions, so we always show the
number of main constraint vs bus interaction columns.

Next step:
1. We should calculate log up columns for APCs as well during PGO.

---------

Co-authored-by: Thibaut Schaeffer <schaeffer.thibaut@gmail.com>
2025-07-04 07:33:31 +00:00
Steve Wang
33979e5583 Update patch (#2961)
Simple one. Update patch so that it matches up exactly to the git
dependencies.

Before this PR, I had many compilation errors (cuz we are missing a
couple local crates) when syncing up patches during local development,
so might as well push to main so others don't need to fix up in the
future ;)
2025-06-30 09:06:30 +00:00
Leandro Pacheco
c839b15a04 bump openvm and stark-backend (#2958)
fixes metric collection for PowdrAir
depends on: https://github.com/powdr-labs/openvm/pull/31
2025-06-27 17:44:13 +00:00
Leandro Pacheco
52caecd2a0 add --metrics to prove command (#2925)
allows exporting metrics to a json file
2025-06-23 08:55:21 +00:00
Thibaut Schaeffer
97e878082d Sync openvm and stark-backend (#2926)
Related:
https://github.com/powdr-labs/openvm-reth-benchmark/pull/11
https://github.com/powdr-labs/openvm/pull/30
https://github.com/powdr-labs/stark-backend/pull/9
2025-06-20 09:07:51 +00:00
Thibaut Schaeffer
3454b41d88 Share dummy periphery across all APCs (#2870)
All APCs need access to periphery chips such as the range checker or the
xor chip.
These chips are expensive to create in memory, but they are not needed
in the end and just get thrown away.
Before this PR, each APC creates one instance of them.
After this PR, a single instance is created and then shared across all
APCs.
2025-06-16 10:00:11 +00:00
Thibaut Schaeffer
233278b6f7 Move deps to workspace (#2875)
Fewer places to change the rev
2025-06-10 18:58:03 +00:00
Georg Wiese
0e04662254 New expression type (#2831)
This PR adds a new `powdr_expression` crate, containing a simplified
version of `powdr_ast::analyzed::AlgebraicExpression`. The idea here is
that this decouples our Autoprecompiles code from the PowdrVM & PIL
codebase. This will allow us to gradually change the expression type
according to our needs. See #2832 and #2833 as work-in-progress
examples.

Differences to previous `AlgebraicExpression`:
- Generic over the reference type (but
`powdr_autoprecompiles::legacy_expression` adds `AlgebraicReference` and
defines `type AlgebraicExpression<T> = ActualAlgebraicExpression<T,
AlgebraicReference>`, for now)
- Removed `AlgebraicExpression::{PublicReference,Challenge}` variants
- Removed `AlgebraicBinaryOperator::Pow` variant
- `degree_with_cache()` -> `degree()`, as we don't have intermediate
polynomials anymore

I included a `powdr_ast::analyzed::AlgebraicExpression <-->
powdr_autoprecompiles::legacy_expression::AlgebraicExpression`
conversion, which is only used to interact with the `powdr_pilopt`
crate, which still is used by the APC codebase and the PowdrVM / PIL
codebase.
2025-06-06 12:59:15 +00:00
Leo
7647c67482 split riscv modules in crates so other crates can have minimal deps (#2747) 2025-05-21 15:37:42 +00:00
Thibaut Schaeffer
3ae17c7fcb Remove halo2 (#2740)
Remove halo2 from the backends, as well as the tutorials which heavily
reference it.
2025-05-21 12:08:50 +00:00
Thibaut Schaeffer
76bbebb53c Move patch to workspace cargo toml (#2726) 2025-05-18 08:46:48 +00:00
Thibaut Schaeffer
2d6708bbc5 Add openvm crates (#2714)
Based on commit 1dbe4db
- Split into two crates, lib and cli
- upgrade stwo, marked one stwo test `should_panic` @ShuangWu121 
- various clippy and fmt fixes linked to the rust version update
- bring all rust versions to 2025-05-14. CI still installs other
versions for openvm which uses them internally. The stable rust version
we test on is bumped to 1.85
- remove `examples` and related tests, which test the powdr crate on the
previous version of powdr (since it uses another nightly). Happy to
discuss this if it's important @leonardoalt
2025-05-16 14:30:09 +00:00
chriseth
fa5566891a Autoprecompiles clean v1 (#2686)
Co-authored-by: Leo Alt <leo@powdrlabs.com>
Co-authored-by: Georg Wiese <georgwiese@gmail.com>
2025-05-07 07:35:02 +00:00
chriseth
8a925cf204 Move constraint analysis (#2642) 2025-04-22 14:44:50 +00:00
Lucas Clemente Vella
ddc3510fff Renaming powdr-riscv-syscalls to powdr-syscalls. (#2583)
To reflect it is useful to other frontends, as well.
2025-03-24 18:37:06 +00:00
Leo
2ad6c4fbf8 update dev version to 0.1.4 (#2290) 2024-12-30 11:56:11 +00:00
Thibaut Schaeffer
576bdd714d Disallow iteration over hash types (#2167)
Iterating over hash types introduces non-determinism.
Ban generally and require turning off the lint locally when it's fine to
do so.
This
[lint](https://rust-lang.github.io/rust-clippy/master/index.html#/iter_over_hash_type)
only applies to loops.
2024-12-09 15:47:54 +00:00
Gastón Zanitti
127dec572b powdr-asmopt: remove unused submachines, instructions, registers (#2143)
Solves #682
2024-12-09 10:03:41 +00:00
Thibaut Schaeffer
c0fefae3e7 Introduce workspace-level lints (#2166)
Reduce the cost of adding a lint from O(#workspace_crates) to 1.
2024-11-29 14:02:53 +00:00
Leo
51cff4c758 remove powdr-executor dependency from backend-utils and plonky3 (#2124)
To make the plonky3 verifier module simpler for recursion
2024-11-21 13:57:13 +00:00
Leo
5e91971efb update dev version to 0.1.3 (#2106) 2024-11-18 13:28:04 +00:00
Lucas Clemente Vella
ecccb48684 Calling poseidon2-gl from Rust (#2061) 2024-11-08 13:38:49 +00:00
Leo
49d943f69f update main to 0.1.2 (#2059)
forgot after the release
2024-11-07 16:43:14 +00:00
Leo
84be2382a0 next version is 0.1.1 (#2005) 2024-10-31 17:08:04 +00:00
Leo
15f7b6bcc4 change version to 0.1.0 (#1977)
Next release will be 0.1.0
2024-10-29 20:17:00 +00:00
Leo
8acfa6ba2c cargo powdr (#1969)
cargo CLI tool to generate powdr host/guest templates, install tooling,
etc. Currently only does the former.

The template was copied from the latest version of
https://github.com/powdr-labs/powdr-template . Should we also copy
README?

It can be installed via the cmd below, and it's quite quick:
```console
cargo install --git https://github.com/powdr-labs/powdr --branch cargo-powdr cargo-powdr
```
(without the branch after it's merged)

It can be used via any of these options:
```console
$ cargo-powdr new # creates project 'my-powdr-host' with guest dir 'guest' and guest name 'my-powdr-guest'
$ cargo-powdr new host # creates project 'host' with guest dir 'guest' and guest name 'my-powdr-guest'
$ cargo-powdr new host111 --guest-name guest222 # creates project 'host111' with guest dir 'guest' and guest name 'guest222'
```
2024-10-29 12:21:38 +00:00
Thibaut Schaeffer
0f66c6a755 Integrated plonky3 prover (#1857)
This is a major change to the plonky3 prover to support proving many
machines.

# Sharing costs across tables
- at setup phase, fixed columns for each machine are committed to for
each possible size. This happens in separate commitments, so that the
prover and verifier can pick the relevant ones for a given execution
- for each phase of the proving, the corresponding traces across all
machines are committed to jointly
- the quotient chunks are committed to jointly across all tables

# Multi-stage publics
The implementation supports public values for each stage of each table.
This is tested internally in the plonky3 crate but not end-to-end in
pipeline tests.

---------

Co-authored-by: Leo Alt <leo@powdrlabs.com>
2024-10-17 11:49:09 +00:00
Lucas Clemente Vella
a68d0b7100 Remove RISC-V assembler (#1852)
Removal of a quite important feature.

Better get many approvals.
2024-10-02 10:50:23 +00:00
chriseth
1746d8cbc4 PIL -> rust compiler (#1416)
This is a (yet unused) component that takes an `Analyzed` and a list of
names and turns these names into `fn(u64) -> u64` to be called directly.

Not all syntax is supported yet (and no built-in functions).

The first goal is not be able to compile all constant functions.

The benchmarks show that `sqrt` is roughly 10 times faster than the
evaluator.

---------

Co-authored-by: Gastón Zanitti <gzanitti@gmail.com>
Co-authored-by: Georg Wiese <georgwiese@gmail.com>
2024-09-27 06:56:16 +00:00
Thibaut Schaeffer
01acfd736e Add plonky3 support (#1158)
plonky3 backend integration for witness columns only
2024-06-26 20:05:05 +00:00
Leo
266d737089 bump version (#1381)
version bump after release
2024-05-15 17:44:46 +00:00
Leo
34d04ed873 move internal dependencies to shared version (#1379)
Trying this out which will make releases much easier
2024-05-15 10:46:34 +00:00
Leo
101829b230 Split Rust compilation into its own CLI bin (#1348)
As suggested by @lvella .
I'm not too sure about this actually. I agree that compiling Rust ->
powdr-asm should have a separate pipeline somewhere, but before we could
do Rust -> proof in a single command, and with this we can't anymore.

- Do we expose the `prove` command and everything else here as well?
That'd be a lot of duplicated code.
- Do we force the user to first run `powdr-rs compile <rust_proj>` then
`powdr pil/prove ...`? That's potentially worse UX than right now.
- Do we keep all the Rust stuff in the `cli` crate?
2024-05-13 08:33:15 +00:00
chriseth
62c3eadc4c Re-enable non-inlined format args (#1362)
Fixes https://github.com/powdr-labs/powdr/issues/1360
2024-05-08 16:27:22 +00:00
Leo
141053c026 Move halo2 crate to a backend module (#1347)
Fixes https://github.com/powdr-labs/powdr/issues/1323
2024-05-06 09:37:21 +00:00
chriseth
d48c479d30 Non-recursive evaluator (#1282)
Co-authored-by: Leo <leo@powdrlabs.com>
Co-authored-by: Leandro Pacheco <contact@leandropacheco.com>
2024-04-24 11:05:18 +00:00
Leandro Pacheco
50eaab464e Coprocessors refactor (#1224)
- Refactor `CoProcessors` into a `Runtime` with submachines and syscalls
- Calls into prover functionality and submachines done via `ecall`
instead of "call symbol replacement"
- Call `poseidon_gl` machine with riscv registers by using the stack
(~50% speedup in many_chunks benchmark)
- New `riscv-syscalls` crate keeps the list of syscalls and related
constants
2024-04-03 18:37:32 +00:00
Leo Alt
a19a5443ca point halo2 to our forks so powdr lib uses do not need to patch it themselves 2024-03-19 12:19:37 +01:00
Georg Wiese
e40d5013f9 Don't panic on Halo2 Mock errors 2024-03-05 11:30:04 +01:00
Champii1
0cf2b977dc Add versioning for the analyzed types and schema validation
Remove dangling function in  macro

Fix variable name in schema_update.rs

Read the version number at runtime instread of compile time

Fix version_number parsing and write new schema after it

Add schemars feature `preserve_order`

Change unwrap for expect in schema_update.rs

Moved schema binary in its own crate

Graceful error management in powdr-schema instead of panic

Better graceful error handling in the pipeline and the cli

Fix clippy

Put the magic number at the start of the serialized data

Revert magic at the start of the file

Moved the SerializedAnalyzed to the schemas crate

Changed serialized.rs to analyzed.rs

Changed the magic number to be the ASCII `powdr`
2024-02-15 13:48:16 +01:00
Leo Alt
4be3d9d2bc docs about powdr as library 2024-02-13 20:20:24 +01:00
Leo Alt
fbc7921026 upgrade halo2 2024-02-09 09:35:49 +01:00
Leo Alt
3daf9d90be add package info 2024-01-29 18:35:32 +01:00
Leo Alt
bb2972c70f rename riscv-rt to riscv-runtime 2024-01-23 20:35:56 +01:00