Commit 0c86bbf
authored
Add CUDA tracegen (#1379)
## Problem
Stacked on #1378.
Recursion v2 had CPU-side trace generation and proof wiring, but the
CUDA path was not usable end to end for inner recursion proving. That
left GPU proving unable to exercise the verifier, PCS, transcript,
proof-shape, and public-value traces in the same path used by
aggregation.
## Design Rationale
The main design is to keep recursion proving backend selection behind
the existing generic engine/backend type and enable the CUDA
specialization under the `cuda` feature. CUDA tracegen receives
explicit, typed inputs for proof shape, public values, PCS, transcript,
and verifier data instead of duplicating host-side layout assumptions.
For the OpenVM CUDA prover path, `PcsJaggedAssistQAir` is kept within
degree 4 by materializing the high-degree factor in the trace. This
avoids the logup zerocheck round0 5-coset CUDA limit while preserving
the AIR relation through explicit constraints.
## Change Highlights
- `ceno_recursion_v2`: add CUDA tracegen ABI, build wiring, fixtures,
and test harness.
- `ceno_recursion_v2`: wire CUDA inner tracegen/proving into
`e2e_aggregate`.
- `ceno_recursion_v2`: add CUDA layouts for proof shape, public values,
transcript, verifier, PCS, and main recursion traces.
- `ceno_recursion_v2`: reduce `PcsJaggedAssistQAir` max constraint
degree for CUDA proving compatibility.
## Benchmark / Performance Impact
This PR enables GPU recursion proving. There is no direct `master`
baseline for the CUDA recursion path because the path was not functional
before this PR.
### Operation
| Operation | master (s) | this PR (s) | Improve (master -> this PR) |
|-----------|------------|-------------|-----------------------------|
| recursion aggregation prove, fibonacci | N/A | 0.235 | enables CUDA
path |
| recursion aggregation verify, fibonacci | N/A | 0.037 | enables CUDA
path |
| recursion aggregation prove, keccak_syscall | N/A | 0.185 | enables
CUDA path |
| recursion aggregation verify, keccak_syscall | N/A | 0.033 | enables
CUDA path |
### Layer
| Layer | master (s) | this PR (s) | Improve (master -> this PR) |
|-------|------------|-------------|-----------------------------|
| CUDA inner recursion proving | N/A | 0.185-0.235 | new working path |
Benchmark command(s):
```sh
RUST_LOG=openvm_cuda_backend::logup_zerocheck=debug,ceno_recursion_v2::continuation::prover::inner=info RUST_MIN_STACK=67108864 cargo run --release --features cuda --bin e2e_aggregate -- /home/zbx/blockchain/ceno/examples/target/riscv32im-ceno-zkvm-elf/release/examples/fibonacci --platform ceno --max-cycle-per-shard 16000 --hints 10 --public-io 4191
RUST_LOG=openvm_cuda_backend::logup_zerocheck=debug,ceno_recursion_v2::continuation::prover::inner=info RUST_MIN_STACK=67108864 cargo run --release --features cuda --bin e2e_aggregate -- /home/zbx/blockchain/ceno/examples/target/riscv32im-ceno-zkvm-elf/release/examples/keccak_syscall --platform ceno --max-cycle-per-shard 16000
```
Environment (CPU/GPU, core count, rust toolchain, commit hash):
- local CUDA dev machine
- commit: `25d8ec89`
raw data:
- master: CUDA recursion proving path not available
- this PR:
- fibonacci: proved recursion aggregation in 0.235s, verified in 0.037s;
final exit is the known internal aggregation tree-reduction gap for 4
leaf proofs
- keccak_syscall: proved recursion aggregation in 0.185s, verified in
0.033s; exit code 0
## Testing
```sh
cargo fmt --check
git diff --check -- src/pcs/mod.rs src/bin/e2e_aggregate.rs
RUST_MIN_STACK=67108864 cargo run --release --features cuda --bin e2e_aggregate -- /home/zbx/blockchain/ceno/examples/target/riscv32im-ceno-zkvm-elf/release/examples/keccak_syscall --platform ceno --max-cycle-per-shard 16000
RUST_MIN_STACK=67108864 cargo run --release --features cuda --bin e2e_aggregate -- /home/zbx/blockchain/ceno/examples/target/riscv32im-ceno-zkvm-elf/release/examples/fibonacci --platform ceno --max-cycle-per-shard 16000 --hints 10 --public-io 4191
```
## Risks and Rollout
The main risk is CUDA/host layout drift. The PR mitigates this with
typed ABI structs, generated fixtures, and CUDA tracegen tests. Rollout
is feature-gated behind `cuda`, so CPU proving remains the fallback
path.
## Follow-ups (optional)
- Implement internal aggregation tree reduction for multiple leaf
proofs.
- Remove temporary CUDA diagnostic prints from the local OpenVM checkout
or rebuild clean CUDA objects before collecting final benchmark logs.
## Copilot Reviewer Directive (keep this section)
When Copilot reviews this PR, apply `.github/copilot-instructions.md`
strictly.1 parent 107577b commit 0c86bbf
28 files changed
Lines changed: 1604 additions & 218 deletions
File tree
- ceno_recursion_v2
- cuda
- include
- primitives
- src/proof_shape
- scripts
- src
- batch_constraint
- bin
- circuit/inner
- cuda
- main
- pcs
- proof_shape
- proof_shape
- pvs
- system
- tower
- transcript
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
59 | 62 | | |
60 | 63 | | |
| 64 | + | |
61 | 65 | | |
62 | 66 | | |
| 67 | + | |
63 | 68 | | |
64 | 69 | | |
65 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
0 commit comments