Commit Graph

291 Commits

Author SHA1 Message Date
Thibaut Schaeffer
ef2409b008 Upgrade rust to 1.77 (#1253)
Required for #1158
2024-04-04 20:17:48 +00:00
chriseth
99d25fd74f Rename generic args. (#1230) 2024-04-03 13:05:23 +00:00
chriseth
f46d59dfe1 Basic version of patterns. (#1205)
Depends on #1187 

Implements part of https://github.com/powdr-labs/powdr/issues/982

Will document in https://github.com/powdr-labs/powdr/pull/1214
2024-04-03 09:30:42 +00:00
chriseth
28f0bb9c1d Statements in blocks and function annotations (#1187)
Adds statements at block level and introduces function kinds to be
either pure, constr or query.

closes https://github.com/powdr-labs/powdr/issues/960

---------

Co-authored-by: Leo <leo@powdrlabs.com>
2024-04-02 08:23:39 +00:00
Georg Wiese
96893cc143 Add Write-once memory to STD (#1202)
Fixes #844

This PR adds a new machine to the STD: `WriteOnceMemory`. This can be
used in our RISC-V machine for bootloader inputs (#1203).

Most of the issues mentioned in the issue were fixed in the meantime or
had a simple workaround (like defining `let LATCH = 1`). The only
remaining issues were in the machine detection, which I fixed here.

I also re-factor two existing tests.
2024-03-26 18:50:30 +00:00
Georg Wiese
c1bc7184ed Witgen: Remember which machine answers to which lookup / permutation (#1154)
With this PR, we remember the mapping from Lookup / Permutation Identity
to Machine. This is cleaner, lets us save some work when calling a
machine and allows us to fail earlier if no machine can answer the call
(at machine extraction time, rather than runtime.

Changes:
- `Machine::process_plookup()`: Instead of passing in `right` and
`kind`, machines now only receive an `IdentityId`. If the machine needs
to access any of the expressions, references to it have to be stored
with the machine.
- `Machine::identities()`: New function that lets us ask the machine for
which identities it feels respondible.
- The `Machines` struct now stores the mapping from `IdentityId` to
machine index, allowing us to replace the loop of trying all machines
with a simple call to `Machines::call()`.
- The identity kind is now also stored in `Identity::id`. Previously,
this only stored a `usize` which is not necessarily unique. As mentioned
above, this change could be merged as part of a separate PR.

#### Benchmark Results:

```
executor-benchmark/keccak
                        time:   [8.7242 s 8.9755 s 9.3876 s]
                        change: [-4.7814% +0.8652% +7.4252%] (p = 0.79 > 0.05)
                        No change in performance detected.

executor-benchmark/many_chunks_chunk_0
                        time:   [38.731 s 39.313 s 40.081 s]
                        change: [-5.6906% -3.9986% -1.8421%] (p = 0.00 < 0.05)
                        Performance has improved.
```
2024-03-25 19:27:09 +00:00
Georg Wiese
795eb51900 Make sure Identity IDs are unique (#1196)
This PR changes that `Identity` IDs are now globally unique, by doing to
things:
1. When dispensing IDs, we now have only one ID counter, instead of one
per type.
2. Fixed a bug in the condenser, where it would previously assign the
same ID when evaluating a `|| -> constr[]`.
2024-03-25 16:29:47 +00:00
Georg Wiese
f9318ba5a8 Implement multi-phase witgen 2024-03-25 10:27:15 +01:00
chriseth
f7d7649e87 Fix cache issue. 2024-03-22 17:22:13 +01:00
chriseth
a9412a4883 Test for generic cache. 2024-03-22 16:35:27 +01:00
Georg Wiese
80fafbe19c Spell-check 2024-03-20 16:12:55 +01:00
chriseth
e1753fd88e Challenges and stages. 2024-03-20 12:40:51 +01:00
Georg Wiese
a04e3f1360 Merge pull request #1157 from powdr-labs/witgen-fix-latch-on-first-row
Fix Witgen for machines connected by permutation with latch on first row
2024-03-19 23:05:41 +00:00
Georg Wiese
be7a48cb84 Witgen: Don't derive non-unique witness when there might be overflow 2024-03-19 14:13:17 +01:00
Leo Alt
efe11f40fc enum declarations 2024-03-18 22:09:44 +01:00
Georg Wiese
6281554a45 Fix Witgen for machines connected by permutation with latch on first row 2024-03-13 13:57:54 +01:00
Georg Wiese
d7afe3d6d8 Merge pull request #1134 from powdr-labs/memory-machine-separate-selectors
Memory machine: Don't use selectors to distinguish operations
2024-03-12 11:54:20 +00:00
Georg Wiese
d4477779a2 Memory machine: Don't use selectors to distinguish operations 2024-03-12 12:13:36 +01:00
chriseth
dc05b9c56e Use only one type type. 2024-03-11 18:01:40 +01:00
chriseth
349f9aa461 Parse numbers as integers. 2024-03-08 15:48:49 +01:00
chriseth
f0c9f0c41b Delay evaluation. 2024-03-08 10:49:05 +01:00
chriseth
4024698b2a Use ibig crate. 2024-03-08 07:31:27 +01:00
chriseth
2015953698 Use evaluation cache for symbols. 2024-03-07 13:14:03 +01:00
chriseth
cb548153a6 Remove Custom. 2024-03-05 20:36:52 +01:00
Georg Wiese
ce015328ec Merge pull request #1121 from powdr-labs/handle-incomplete
Witgen Sequence Iterator: Allow for empty steps
2024-03-05 16:22:37 +00:00
chriseth
9f4f4776e8 Use powder_number::BigInt / BigUint everywhere instead of num_bigint. 2024-03-05 15:32:39 +01:00
chriseth
57df2918d0 Rename number::BigInt to LargeInt. 2024-03-05 15:11:49 +01:00
Georg Wiese
0b750da16a Rename CacheEntry variant 2024-03-05 14:36:39 +01:00
Georg Wiese
195a8c5127 Panic if the cache already has an entry 2024-03-05 14:35:13 +01:00
Georg Wiese
f82b48cfe2 Witgen Sequence Iterator: Allow for empty steps 2024-03-05 12:51:23 +01:00
chriseth
dc96509070 Make expressions and constraints native values. 2024-03-05 11:22:12 +01:00
chriseth
97ed14c48b Type checking. 2024-03-01 17:36:54 +01:00
Georg Wiese
4eb8644e79 Witness generation for block machines connected via permutations 2024-02-29 16:04:58 +01:00
Leandro Pacheco
28c63ed2d9 AffineExpression as enum
- change AffineExpression to an enum of Constant|OneVar|ManyVars
- remove "cleaning" logic and keep coefficients ordered and clean
- rewrite of ExpressionEvaluator::evaluate_binary_operation to shortcut on Err when possible
2024-02-29 08:02:16 -03:00
Leo
41d856c698 Merge pull request #1068 from powdr-labs/poseidon-latch-first-row
Poseidon Machines: Change latch to be on first row
2024-02-27 12:49:28 +00:00
Leandro Pacheco
9f554793c6 use Cow for returning affine coefficients 2024-02-26 09:07:09 -03:00
Georg Wiese
f2c6caa991 Poseidon Machines: Change latch to be on first row 2024-02-26 11:59:36 +01:00
Leandro Pacheco
861e576da7 inlining 2024-02-24 23:06:44 -03:00
Leandro Pacheco
87c4d10370 make PolynomialTypeTrait::ptype() an associated constant 2024-02-23 10:02:15 -03:00
chriseth
1bcdb54587 Merge pull request #1086 from powdr-labs/opt_fixes
Small fixes for witgen performance
2024-02-23 12:30:35 +00:00
Leandro Pacheco
d45f9c7a8d small changes for witgen performance 2024-02-23 08:06:59 -03:00
Georg Wiese
eb67bc5a2e Witgen: Don't log errors if they can be recovered from 2024-02-22 18:37:27 +01:00
chriseth
daffb65c0c Add type schemes. 2024-02-22 13:39:39 +01:00
chriseth
daa4dc9e07 Merge pull request #1081 from powdr-labs/small_fixes
typo & minor fixes
2024-02-21 13:56:20 +00:00
Leandro Pacheco
599f1635c3 typo & minor fixes 2024-02-21 10:23:06 -03:00
Georg Wiese
fdfdc7984d Get rid of dummy blocks in BlockMachines 2024-02-21 10:58:18 +01:00
Georg Wiese
668d881057 On (N-1, 0) row pair, only execute identities with next reference 2024-02-19 10:27:50 +01:00
Georg Wiese
4d5df90e4c Handle publics in gen_halo2_proof() 2024-02-13 17:57:31 +01:00
Lucas Clemente Vella
07835e0fec Updating rust version from 1.72 to 1.74. 2024-02-08 19:17:40 +00:00
Georg Wiese
78e328f605 QueryProcessor: Give access to functions 2024-02-07 18:23:54 +01:00