Skip to content

perf(gpu): overlap replay with shard proving - #1401

Merged
hero78119 merged 16 commits into
masterfrom
fix/pr1399-gpu-replay-owner
Aug 26, 2026
Merged

perf(gpu): overlap replay with shard proving#1401
hero78119 merged 16 commits into
masterfrom
fix/pr1399-gpu-replay-owner

Conversation

@hero78119

@hero78119 hero78119 commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Problem

GPU shard proving serialized compact CPU replay with the preceding shard proof. Replay ownership also crossed shard boundaries implicitly, and the packed producer priority could not represent the full supported producer domain.

Design Rationale

A capacity-one pipeline prepares shard N+1 on the CPU while shard N is proved. CUDA assignment remains on the proving thread and starts only after the preceding proof completes, preventing assignment kernels or transfers from overlapping sumchecks. Replay owners are retained and recycled explicitly so their storage remains valid across the boundary.

Producer base, count, and order remain separate on the host. The hot device domain contains only base and count; order is read only for terminal emission. A checked 64-bit priority preserves continuation class, instruction order, producer index, and slot through exactly 2^28 rows without changing transcript or witness order.

Change Highlights

  • ceno_emul: add compact replay ranges and checked producer-domain metadata.
  • ceno_zkvm: overlap CPU replay with the preceding proof, retain/recycle owners explicitly, and gate each GPU assignment before proving its shard.
  • GPU dispatch: publish initialized shard metadata across streams before dependent kernels run.

Benchmark / Performance Impact

Operation

Operation master (s) this PR (s) Improve (master -> this PR)
Block 23817600 total proof creation 52.095 48.604 3.491 s (6.70%)

Layer

Layer master (s) this PR (s) Improve (master -> this PR)
Application proving 46.144 42.752 3.392 s (7.35%)
Recursion proving 5.882 5.786 0.096 s (1.64%)

Benchmark command:

target/release/ceno-reth-benchmark-bin --mode prove-stark --block-number 23817600 --output-dir output --cache-dir rpc-cache --chain-id 1

Environment: NVIDIA RTX 4090 (CUDA_ARCH=89), GPU + jemalloc + AOT benchmark workflow. Baseline used Ceno 436a32e2; this PR used 6fddf6cb.

Raw data:

Testing

cargo fmt --all -- --check
cargo check -p ceno_zkvm --all-targets
RUST_MIN_STACK=33554432 cargo test --workspace --lib --bins --tests --examples --no-default-features --features goldilocks --no-run
RUSTFLAGS=-Dwarnings cargo check --workspace --all-targets

Both benchmark workflows completed successfully and verified block 23817600.

Risks and Rollout

The main risk is cross-shard lifetime or stream-ordering regression. Bounded channels, explicit owner recycling, checked domain bounds, and a publication barrier make these boundaries explicit. Reverting the PR restores serialized replay without data migration or protocol changes.

Copilot Reviewer Directive (keep this section)

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

@hero78119 hero78119 changed the title Fix/pr1399 gpu replay owner perf(gpu): overlap replay with shard proving Aug 26, 2026
@hero78119
hero78119 merged commit 32a12d5 into master Aug 26, 2026
4 of 5 checks passed
@hero78119
hero78119 deleted the fix/pr1399-gpu-replay-owner branch August 26, 2026 11:23
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.

1 participant