Skip to content

perf(mpcs): copy jagged q from committed column MLEs#62

Merged
hero78119 merged 4 commits into
mainfrom
feat/fix_jagged_padding
Jun 8, 2026
Merged

perf(mpcs): copy jagged q from committed column MLEs#62
hero78119 merged 4 commits into
mainfrom
feat/fix_jagged_padding

Conversation

@hero78119

@hero78119 hero78119 commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

Problem

Jagged q materialization transposes from the row-major RMM backing. For Ceno's current compact-q flow, the committed column MLEs are already available in the required order, so rebuilding q from the row-major layout does extra strided work.

Approach

  • Keep the existing compact q layout and reshape logic.
  • Fill each compact q column slice with copy_from_slice from the committed column MLE prefix.
  • No verifier changes and no protocol/layout change.

Performance

Reth CPU shard-0, block 23587691, CENO_MAX_CELL_PER_SHARD=805306368:

Version Result reth-block app.prove commit_traces batched_main pcs_opening
remote v1.0.0-alpha.31 pass 152s 151s 17.7s 35.1s 39.4s
this PR, q-copy only pass 134s 134s 16.5s 32.7s 36.3s

Testing

  • cargo fmt --check
  • cargo test -p mpcs jagged --lib (26 passed)
  • Reth CPU shard-0 benchmark above

Risk / Rollout

Low scope: only changes q materialization source in jagged commit. Rollback is reverting this PR.

Copilot Reviewer Directive (keep this section)

When Copilot reviews this PR, apply .github/copilot-instructions.md strictly.

  • Perform review only; do not commit/push/propose code changes.
  • Prefer inline comments on changed lines for each actionable finding.
  • If inline comments are unavailable, use [severity] path:line (symbol) format.
  • Prioritize soundness, performance, and architecture risks over style.
  • Output order: findings by severity, then open questions, then brief summary.
  • If PR description is empty or missing key context, report PR metadata: description as a finding.

@hero78119 hero78119 changed the title fix: align jagged q layout with committed rows fix: fix jagged q layout with compacted q Jun 8, 2026
Comment thread crates/mpcs/src/jagged/mod.rs Outdated
@hero78119 hero78119 changed the title fix: fix jagged q layout with compacted q perf(mpcs): copy jagged q from committed column MLEs Jun 8, 2026
@hero78119 hero78119 enabled auto-merge (squash) June 8, 2026 12:43
@hero78119 hero78119 merged commit 83cf5bb into main Jun 8, 2026
2 checks passed
@hero78119 hero78119 deleted the feat/fix_jagged_padding branch June 8, 2026 12:52
github-merge-queue Bot pushed a commit to scroll-tech/ceno that referenced this pull request Jun 8, 2026
## Problem

Dynamic RAM init could write non-zero values into committed witness
padding rows. That violates the expected zero-padding invariant for RMM
witness commitments and causes CPU shard verification to fail with
`InvalidPcsOpen`.

## Design Rationale

Keep the existing padded CPU proving flow and add the missing
dynamic-init guard so only real instances populate committed witness
rows. This preserves the RMM zero-padding contract without changing
verifier logic.

Related: scroll-tech/gkr-backend#62

## Change Highlights

- `ceno_zkvm`: guard dynamic RAM init witness writes with `i <
num_instances` so padded witness rows remain zero.
- No verifier changes.

## Benchmark / Performance Impact

### Operation

CPU benchmark: block `23587691`, shard `0`,
`CENO_MAX_CELL_PER_SHARD=805306368`.

| Operation | baseline | this PR (s) | Improve (before -> this PR) |

|-----------|-----------------------------------|-------------|-----------------------------|
| reth-block | 135 | 124 | 8.1% |
| app.prove | 134 | 123 | 8.2% |
| app.verify | 0.300 | 0.288 | 4.0% |

### Layer

| Layer | before: no guard + remote gkr (s) | this PR (s) | Improve
(before -> this PR) |

|-------|-----------------------------------|-------------|-----------------------------|
| create_proof_of_shard | 130 | 119 | 8.5% |
| commit_traces | 17.2 | 10.3 | 40.1% |
| prove_batched_main_constraints | 32.4 | 32.0 | 1.2% |
| pcs_opening | 36.8 | 33.9 | 7.9% |

Benchmark command(s):

```sh
CENO_MAX_CELL_PER_SHARD=805306368 \
OUTPUT_PATH=metrics_23587691_shard0_cpu_dynamic_guard_no_gkrzero_maxcell805306368_20260608.json \
RUST_LOG=info \
target/release/ceno-reth-benchmark-bin \
  --block-number 23587691 \
  --chain-id 1 \
  --cache-dir block_data \
  --mode prove-app \
  --app-proofs ./app_proof.bitcode \
  --shard-id 0
```

Baseline used the same benchmark with Ceno patched to `902b3e3c^`
(`7d8086c2`) and remote `gkr-backend` tag `v1.0.0-alpha.31`.

Environment (CPU/GPU, core count, rust toolchain, commit hash):

- CPU shard run, `rustc 1.93.0-nightly (07bdbaedc 2025-11-19)`
- before: Ceno `7d8086c2`, remote `gkr-backend v1.0.0-alpha.31`
- this PR: Ceno `902b3e3c`

raw data:

- before:
`sanity_23587691_shard0_cpu_fresh_baseline_remote_gkr_no_guard_maxcell805306368_20260608.log`,
failed verification with `InvalidPcsOpen`
- this PR:
`sanity_23587691_shard0_cpu_dynamic_guard_no_gkrzero_maxcell805306368_20260608.log`,
passed verification

## Testing

```sh
cargo check --package ceno_zkvm
CENO_MAX_CELL_PER_SHARD=805306368 target/release/ceno-reth-benchmark-bin --block-number 23587691 --chain-id 1 --cache-dir block_data --mode prove-app --app-proofs ./app_proof.bitcode --shard-id 0
```

## Risks and Rollout

Low risk: the change only skips dynamic RAM init writes for rows outside
`num_instances`. Rollback is reverting this guard.

## Follow-ups (optional)

None.

## Copilot Reviewer Directive (keep this section)

When Copilot reviews this PR, apply `.github/copilot-instructions.md`
strictly.
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