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

Dynamic platform #608

Merged
merged 18 commits into from
Nov 21, 2024
Merged

Dynamic platform #608

merged 18 commits into from
Nov 21, 2024

Conversation

mcalancea
Copy link
Collaborator

@mcalancea mcalancea commented Nov 20, 2024

Makes the platform dynamic:

  • Extracts some of the more fixed behaviors of Platform into static methods, which replace some calls to CENO_PLATFORM.
  • Introduces a ProgramParams struct which stores the platform, the program size (no longer present in the type) and other useful params.
  • ProgramPrams flow from ZKVMConstraintSystem, through the CircuitBuilder, through some of the TableConfigs and into the relevant table trait methods which implement the behavior we wanted to make dynamic.

Observations:

  • Could instate some safeguards to use the same platform throughout the pipeline. One example: presently it's technically possible to use one platform for building the VM and another for the constraint system.
  • There is a default ProgramParams which is implicitly used in some constructors. This was done so as not to edit a lot of tests prematurely. While the default values should generally be compatible with the original intention of these test cases, it may be wise to remove the implicit defaults and force ourselves to choose params everywhere. This can be done in a subsequent PR.

ceno_zkvm/src/instructions/riscv/rv32im/mmu.rs Outdated Show resolved Hide resolved
ceno_zkvm/src/circuit_builder.rs Outdated Show resolved Hide resolved
ceno_zkvm/src/tables/ram/ram_circuit.rs Outdated Show resolved Hide resolved
ceno_zkvm/src/tables/ram/ram_circuit.rs Outdated Show resolved Hide resolved
ceno_zkvm/src/tables/ram/ram_circuit.rs Outdated Show resolved Hide resolved
ceno_zkvm/src/tables/ram.rs Outdated Show resolved Hide resolved
ceno_zkvm/src/tables/ram.rs Outdated Show resolved Hide resolved
@naure
Copy link
Collaborator

naure commented Nov 20, 2024

This approach is simple and a neat improvement.

@naure naure marked this pull request as ready for review November 20, 2024 15:37
@naure naure requested a review from kunxian-xia November 20, 2024 15:39
@naure naure changed the title [exp] Dynamic platform attempt Dynamic platform Nov 20, 2024
Copy link
Collaborator

@kunxian-xia kunxian-xia left a comment

Choose a reason for hiding this comment

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

Nice job!

@kunxian-xia kunxian-xia merged commit a1e7462 into master Nov 21, 2024
6 checks passed
@kunxian-xia kunxian-xia deleted the exp/dynamic-platform-variants branch November 21, 2024 12:38
naure added a commit that referenced this pull request Nov 21, 2024
Fix an invisible merge conflict between #611 and #608.

Co-authored-by: Aurélien Nicolas <[email protected]>
naure added a commit that referenced this pull request Nov 21, 2024
_Issues #614 and #607_

Initialize memory with unconstrained prover hints.

- It is practically identical to the zero-init circuit; just without the
zero-init part.
- The address range must be contiguous, but its size is dynamic.
- The `u32` range check is already done by the LOAD and STORE circuits.

e2e integration will be done in another PR. Need #608 to configure the
address space.

---------

Co-authored-by: Aurélien Nicolas <[email protected]>
@naure naure linked an issue Nov 21, 2024 that may be closed by this pull request
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.

Make the platform dynamic
3 participants