Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade field lib to Plonky3 #806

Open
2 of 4 tasks
hero78119 opened this issue Jan 6, 2025 · 2 comments
Open
2 of 4 tasks

Upgrade field lib to Plonky3 #806

hero78119 opened this issue Jan 6, 2025 · 2 comments

Comments

@hero78119
Copy link
Collaborator

hero78119 commented Jan 6, 2025

With upgrade to plonky3 in unblock many benefits & optimisation possible.

  • we can remove in-house version of RowMajorMatrix and just import from plonky3 RowMajorMatrix, and
  • remove poseidon porting (code duplicated from plonky2) and use plonky3 poseidon(2)
  • Plonky3 support extension field pack/unpack + SIMD via AVX2 or AVX512

TODOs

@hero78119
Copy link
Collaborator Author

Some performance degrade after migrate Poseidon to plonky3 via command cargo bench --bench hashing --package poseidon -- --baseline baseline

Found 2 outliers among 100 measurements (2.00%)
  1 (1.00%) low mild
  1 (1.00%) high mild

ceno hash single        time:   [829.54 ps 830.45 ps 831.39 ps]
                        change: [-0.0836% +0.1065% +0.2809%] (p = 0.25 > 0.05)
                        No change in performance detected.
Found 5 outliers among 100 measurements (5.00%)
  2 (2.00%) high mild
  3 (3.00%) high severe

ceno hash 2 to 1        time:   [2.3006 ms 2.3010 ms 2.3014 ms]
                        change: [+41.410% +41.462% +41.509%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 7 outliers among 100 measurements (7.00%)
  4 (4.00%) high mild
  3 (3.00%) high severe

ceno hash 60 to 1       time:   [19.301 ms 19.306 ms 19.313 ms]
                        change: [+47.062% +47.137% +47.208%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 3 outliers among 100 measurements (3.00%)
  1 (1.00%) high mild
  2 (2.00%) high severe

I think it might be expected due to plonky3 already migrate to poseidon2. We should have sub-task to upgrade poseidon2

hero78119 added a commit that referenced this issue Feb 17, 2025
Related to #806

### Changes highlights
- compiles on base crates except for `mpcs`, `poseidon`. We will remove
crate `poseidon` in the future, as right now only `mpcs` depends on it.
- migrate `transcripts` to `p3::poseidon`. We can upgrade to `poseidon2`
later.
- use `p3::Field` instead of `ff:Field`, and adjust respective api:
`E::from` -> `from_canonical_u64`. `E::from -> from_base`

sumcheck/mle both all unittest passed.
hero78119 added a commit that referenced this issue Feb 18, 2025
### issues
#806 

### change log 
- [x] introduce `FieldFrom`/`FieldInto` to simulate `From/Into` of
plonky3 field, avoiding invasive modification. We can use
shortcut`3u64.into_f()` to convert a number into field
- [x] clippy & build pass 
- [x] clean up old dependency:
https://github.com/scroll-tech/ceno-Goldilocks &
https://github.com/zkcrypto/ff
github-merge-queue bot pushed a commit that referenced this issue Feb 20, 2025
### issue 
#806

### relevant PR
change highlights break down to several small PRs
- #805
- #811 
- #830 
- #831
@hero78119
Copy link
Collaborator Author

Some performance degrade after migrate Poseidon to plonky3 via command cargo bench --bench hashing --package poseidon -- --baseline baseline

Found 2 outliers among 100 measurements (2.00%)
1 (1.00%) low mild
1 (1.00%) high mild

ceno hash single time: [829.54 ps 830.45 ps 831.39 ps]
change: [-0.0836% +0.1065% +0.2809%] (p = 0.25 > 0.05)
No change in performance detected.
Found 5 outliers among 100 measurements (5.00%)
2 (2.00%) high mild
3 (3.00%) high severe

ceno hash 2 to 1 time: [2.3006 ms 2.3010 ms 2.3014 ms]
change: [+41.410% +41.462% +41.509%] (p = 0.00 < 0.05)
Performance has regressed.
Found 7 outliers among 100 measurements (7.00%)
4 (4.00%) high mild
3 (3.00%) high severe

ceno hash 60 to 1 time: [19.301 ms 19.306 ms 19.313 ms]
change: [+47.062% +47.137% +47.208%] (p = 0.00 < 0.05)
Performance has regressed.
Found 3 outliers among 100 measurements (3.00%)
1 (1.00%) high mild
2 (2.00%) high severe
I think it might be expected due to plonky3 already migrate to poseidon2. We should have sub-task to upgrade poseidon2

Was addressed after upgrade to poseidon2, benchmark #832 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant