scroll-tech / scroll-tech/ceno

Optimise r_record/w_record/lk_record witness generation

Open
#193 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement protocol
Dominant language
Rust
Stars
153
Forks
43
Avg merge
3d 13h
Merged PRs (30d)
4

Description

A potiential enhancement initialized by @chaosma 👍

In ceno zkvm prover, to prepare tower prover leaf layers witness, it's break down into 2 steps

  1. inter witness in wit polys by expression
    https://github.com/scroll-tech/ceno/blob/41ceaaab0b329fa92ea18586bd860d2605e04a93/ceno_zkvm/src/scheme/prover.rs#L70-L79

  2. interleaving column oriented records to logup witness leaf layer
    https://github.com/scroll-tech/ceno/blob/41ceaaab0b329fa92ea18586bd860d2605e04a93/ceno_zkvm/src/scheme/prover.rs#L99-L100

If we have a close look on witnss layer in high level

first layer v = [
    // instances 1 
    eval(inst[0], expr[0]), eval(inst[0], expr[1]), eval(inst[0], expr[2]), ....,, padding...
    // instances 2 
    eval(inst[1], expr[0]), eval(inst[1], expr[1]), eval(inst[1], expr[2]), ....,, <padding> 
    // instances 3 
    eval(inst[2], expr[0]), eval(inst[2], expr[1]), eval(inst[2], expr[2]), ....,, <padding> 
    ...
]

Its like taking 1 instance and evaluate on all record expressions, and take next instance... to the last instance

possible enhancement

We can probably have it in just one step if we have a row oriented design such that we can take one instance and evaluate on all expression. Fortunatesly in witness assignments phase the witness data are arranged in row (or instance) oriented format

https://github.com/scroll-tech/ceno/blob/41ceaaab0b329fa92ea18586bd860d2605e04a93/ceno_zkvm/src/witness.rs#L33-L39

So we can explore a way to leverage the witness and population of leaf layer witness in one pass with high cpu cache hit rate, since the vector are bulk load into cache and next instance fetch should be w.h.p. hit

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the referenced sections of ceno_zkvm/src/scheme/prover.rs around lines 70-79 and 99-100, then inspect ceno_zkvm/src/witness.rs around lines 33-39 to understand the row-oriented witness layout. Explore whether leaf-layer witness generation can evaluate each instance and populate the output in one pass, while preserving the existing witness result and improving locality.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cryptography, performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.