perf(aot): accelerate Pure and Full execution paths - #1394
Merged
Conversation
Train dynamic roots across the complete preflight workload and persist ABI-keyed native artifacts with checksum validation and atomic replacement. Track fallback reasons and recover safely through dynamic control flow and guarded memory accesses.
…t_aot_bb_workload # Conflicts: # ceno_emul/src/aot.rs # ceno_zkvm/src/e2e.rs
This reverts commit 14b2ad2.
This reverts commit 4f5dfed.
This reverts commit 5ebca74.
Admit only aligned LW/SW accesses sharing a base register and byte offset. Check the full affine interval for wrapping and region membership once, while retaining scalar guards for ungrouped or rejected accesses. Bump the cache identity because emitted code changes.
After block admission, keep the register base, dense-memory base, and memory ordinal base in their documented callee-saved registers. Emit memory events from the loaded cell metadata and defer next-PC/status stores until block exit. Scalar fallback, shard transitions, syscalls, and non-admitted entries continue to refresh context state.
Load generation, instance-count, and bucket-ceiling table bases once per admitted planner sequence. Preserve the existing generation and capacity checks, rollback path, and slow fallback for stale generations or bucket crossings.
Move public secp256k1 add/double normalization to halo2curves-axiom with Ceno-local variable-time field inversion. Preserve syscall witnesses, invalid inputs, infinity output, parity, and alias fallback; add deterministic differential and edge-case coverage.
Remove public cumulative preflight stages, tracking trainers, and generic compilation APIs. Production preflight now uses private scalar and admitted-block strategies, while tests exercise Pure value execution and FullTracer-compatible execution directly.
Provide a narrow production API that consumes the finalized preflight plan and replays every shard through FullTracer without assigning circuit witnesses. The replay preserves the exact preflight capacity and validates step, shard, exit-code, next-access, and boundary parity.
Gate AOT-only tracer, syscall, and benchmark support at their feature boundaries. Modernize deprecated secp byte conversions, make unsafe conversion types explicit, and document unavoidable transitive dependency-version lint exceptions so workspace all-target Clippy passes with warnings denied.
hero78119
added a commit
that referenced
this pull request
Aug 13, 2026
It was accidently included in previous PR #1394 Benchmark shows although It bring benefit to main sumcheck univariate evaluation, however a side effect is performance regressed due to the new resident column bring more overhead to GPU vram which reduce the multi-tower concurrency scheduling.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
PR #1393 moved Preflight accounting and FullTracer replay into native AOT artifacts, but the remaining production path still repeated expensive invariant guards, planner descriptor setup, state reloads, per-access MMIO extrema updates, and allocation-heavy public secp256k1 host arithmetic. The public API also exposed experimental cumulative tracking stages that were useful during profiling but were not intended to become supported execution modes.
This PR finishes that cleanup and leaves two explicit user-facing paths:
Design Rationale
The production path keeps accounting at the widest boundary that preserves exact shard, tape, witness, and fallback semantics. A block is admitted only after its complete instruction budget, planner descriptors, bucket ceilings, memory ranges, tape capacity, and transition are known to be safe. Failed admission, capacity proximity, bucket crossings, unsupported transitions, dynamic targets, syscalls, traps, and interior entry use the exact scalar path.
Three retained native optimizations reduce repeated work without changing those checks:
Full preflight reconstructs heap, stack, and hint extrema once from canonical initialization events instead of updating them on every memory access. The finalized shard plan carries its exact maximum shard size into
FullTracerConfig; replay validates boundary ordering, alignment, coverage, shard count, and capacity before allocating its one-record pending buffer.The LLVM
.llvm_bb_addr_mapfeature from #1393 remains part of the design.cargo ceno buildemits the map, the ELF loader validates it, and its workload-independent roots are always compiled as possible AOT entries. Coverage training is retained for dynamic targets, hot layout, event sizing, and planner identity. Static roots are included in cache identity.Public-data secp256k1 arithmetic uses the crates.io
halo2curves-axiombackend with Ceno-local variable-time normalization. AIR behavior, syscall witnesses, invalid-input behavior, infinity handling, parity, and aliasing remain unchanged. Variable-time arithmetic is restricted to public emulator data and is not used for secrets.Change Highlights
ceno_emul::aotceno_emul::tracer/ceno_zkvm::e2eceno_emul::syscallsdocsHow the Full Path Reached 4.95s
The reduction comes from moving repeated scalar work to safe block or execution boundaries while retaining the exact fallback path:
halo2curves-axiomaffine formulas plus Ceno-local variable-timeU256::inv_modreduce the final Full median from5.364432sto4.949843s(7.73%). The secp fallback portion alone falls from1.366264sto0.976211s(28.55%).Benchmark / Performance Impact
End-to-end result: 12.47s -> 4.95s
Pinned CPU-0 measurements on canonical block
25580200show the production Full path improving from the #1393/master baseline to the final candidate:The final number is the median of five alternating samples:
4.949843s,4.937121s,4.986585s,4.928285s, and4.969867s. All five samples meet the<5.0starget while preserving exact output and accounting parity.The secp comparison is a controlled five-pair measurement of the isolated final change. Earlier intermediate checkpoints were collected in separate frequency windows, so they are supporting diagnostic evidence rather than additive rows in the end-to-end table. Rejected compact-tape, planner-epoch, syscall-fusion, aggregate-region, and timestamp-cache experiments are not present in production code.
One paired Pure check improved from
2.130265sto1.770192s(16.90%). On secondary block25687400, Full improved from3.915112sto3.614206s(7.69%) with exact parity.Benchmark command:
Environment: AMD Ryzen 9 5900XT, CPU 0, Linux 6.8,
jemalloc,gpu,aot, rustc 1.93.0-nightly, frozen cached block input, and warm isolated AOT artifacts. Timings are observed measurements; isolated-candidate conclusions use alternating paired runs where stated.Testing
All commands pass locally. The current focused suites report 46 AOT tests and 7 LLVM basic-block-map parser tests passing. A real release guest built through
cargo cenocontains.llvm_bb_addr_map; cold production AOT preflight completed with zero dynamic-PC and memory-guard fallbacks and prepared the FullTracer replay artifact.Canonical differential checks preserve:
25580200: hash34439c597563024690ce3c91a082c34507569c7e18cc4d1b3b68550b791a2773, exit 0,994,896,527instructions, cycle3,979,586,112, 35 shards / 36 boundaries, and16,865,461ordered events;25687400: hashd9beb945e65579fa6d95d14012936cf8c7dcf7c52ed54d96f53aa3b0538ff899, exit 0,663,258,404instructions, cycle2,653,033,620, 25 shards / 26 boundaries, and14,472,131ordered events.Pure/Full guest state, planner output, tape order, syscall witnesses, and replay records match their generic reference paths in focused differential tests.
Risks and Rollout
Follow-ups (optional)
Copilot Reviewer Directive (keep this section)
When Copilot reviews this PR, apply
.github/copilot-instructions.mdstrictly.