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

feat(prover): parallelized memory queues simulation in BWG #2652

Merged
merged 10 commits into from
Aug 16, 2024

Conversation

0xVolosnikov
Copy link
Contributor

@0xVolosnikov 0xVolosnikov commented Aug 14, 2024

What ❔

The updated logic of memory queue simulation in the test_harness requires changing the structure of the BWG artifacts. When processing memory queues for ram permutation circuit, part of the witness is sent to storage separately. For this reason, a new type of circuit wrapper has been added - partial base circuit. Also added logic required to transform a partial base layer circuit into a full one (merging structures) for WVG and proving.

These changes can significantly reduce peak RAM usage in BWG, while speeding up the slowest part of the witness generation process.

Checklist

  • PR title corresponds to the body of PR (we generate changelog entries from PRs).
  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • Code has been formatted via zk fmt and zk lint.

@0xVolosnikov
Copy link
Contributor Author

@0xVolosnikov
Copy link
Contributor Author

Also requires an update in shivini

@0xVolosnikov 0xVolosnikov requested a review from EmilLuta August 14, 2024 10:57
Copy link
Contributor

@EmilLuta EmilLuta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I spent some time going through this. Uh, so overall, I get the main idea. That said, a lot of complexity is moved from harness to BWG and that I don't like. I understand the split that's happening now, but I don't feel very comfortable maintaining/changing/troubleshooting the circuit recombining part. Do you envision any other method where less harness magic is spilled into prover subsystem?

@0xVolosnikov
Copy link
Contributor Author

0xVolosnikov commented Aug 15, 2024

  1. We need to simulate sorted and unsorted queues to the end to be able to calculate closed form input for the first ram permutation circuit (and for the following too)
  2. We need to keep subarrays of queues states for every ram permutation circuit
  3. These subarrays are huge, they are more than anything else in terms of RAM

So I do not see now any other way to deal with it other then split monolithic ram permutaion circuit artifacts

@0xVolosnikov
Copy link
Contributor Author

Maybe we can come up with a more elegant way to store/recombine data?

@0xVolosnikov 0xVolosnikov marked this pull request as ready for review August 16, 2024 11:18
Copy link
Contributor

@EmilLuta EmilLuta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed in particular and we haven't found a better solution. Will stick to current implementation for the time being and reasses when we encounter issues.

@EmilLuta EmilLuta added this pull request to the merge queue Aug 16, 2024
Merged via the queue into main with commit b4ffcd2 Aug 16, 2024
55 checks passed
@EmilLuta EmilLuta deleted the vv-parallelized-bwg branch August 16, 2024 12:11
github-merge-queue bot pushed a commit that referenced this pull request Aug 21, 2024
🤖 I have created a release *beep* *boop*
---


##
[24.19.0](core-v24.18.0...core-v24.19.0)
(2024-08-21)


### Features

* **db:** Allow creating owned Postgres connections
([#2654](#2654))
([47a082b](47a082b))
* **eth-sender:** add option to pause aggregator for gateway migration
([#2644](#2644))
([56d8ee8](56d8ee8))
* **eth-sender:** added chain_id column to eth_txs + support for gateway
in tx_aggregator
([#2685](#2685))
([97aa6fb](97aa6fb))
* **eth-sender:** gateway support for eth tx manager
([#2593](#2593))
([25aff59](25aff59))
* **prover_cli:** Add test for status, l1 and config commands.
([#2263](#2263))
([6a2e3b0](6a2e3b0))
* **prover_cli:** Stuck status
([#2441](#2441))
([232a817](232a817))
* **prover:** Add ProverJobMonitor
([#2666](#2666))
([e22cfb6](e22cfb6))
* **prover:** parallelized memory queues simulation in BWG
([#2652](#2652))
([b4ffcd2](b4ffcd2))
* update base token rate on L1
([#2589](#2589))
([f84aaaf](f84aaaf))
* **zk_toolbox:** Add zk_supervisor run unit tests command
([#2610](#2610))
([fa866cd](fa866cd))
* **zk_toolbox:** Run formatters and linterrs
([#2675](#2675))
([caedd1c](caedd1c))


### Bug Fixes

* **contract-verifier:** Check for 0x in zkvyper output
([#2693](#2693))
([0d77588](0d77588))
* make set token multiplier optional
([#2696](#2696))
([16dff4f](16dff4f))
* **prover:** change bucket for RAM permutation witnesses
([#2672](#2672))
([8b4cbf4](8b4cbf4))
* use lower fair l2 gas price for cbt
([#2690](#2690))
([e1146fc](e1146fc))


### Performance Improvements

* **logs-bloom:** do not run heavy query if migration was completed
([#2680](#2680))
([f9ef00e](f9ef00e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: zksync-era-bot <zksync-era-bot@users.noreply.github.com>
github-merge-queue bot pushed a commit that referenced this pull request Aug 28, 2024
🤖 I have created a release *beep* *boop*
---


##
[16.5.0](prover-v16.4.0...prover-v16.5.0)
(2024-08-28)


### Features

* **prover_cli:** Add test for status, l1 and config commands.
([#2263](#2263))
([6a2e3b0](6a2e3b0))
* **prover_cli:** Stuck status
([#2441](#2441))
([232a817](232a817))
* **prover:** Add ProverJobMonitor
([#2666](#2666))
([e22cfb6](e22cfb6))
* **prover:** parallelized memory queues simulation in BWG
([#2652](#2652))
([b4ffcd2](b4ffcd2))
* Provide easy prover setup
([#2683](#2683))
([30edda4](30edda4))


### Bug Fixes

* **prover_cli:** Remove congif file check
([#2695](#2695))
([2f456f0](2f456f0))
* **prover_cli:** Update prover cli README
([#2700](#2700))
([5a9bbb3](5a9bbb3))
* **prover:** change bucket for RAM permutation witnesses
([#2672](#2672))
([8b4cbf4](8b4cbf4))
* **prover:** fail when fri prover job is not found
([#2711](#2711))
([8776875](8776875))
* **prover:** Revert use of spawn_blocking in LWG/NWG
([#2682](#2682))
([edfcc7d](edfcc7d))
* **prover:** speed up LWG and NWG
([#2661](#2661))
([6243399](6243399))
* **vm:** Fix used bytecodes divergence
([#2741](#2741))
([923e33e](923e33e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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

Successfully merging this pull request may close these issues.

2 participants