Skip to content

perf(aot): reduce preflight latency with cached full-coverage artifacts - #1392

Merged
hero78119 merged 1 commit into
masterfrom
feat/extract_aot_bb_workload
Jul 27, 2026
Merged

perf(aot): reduce preflight latency with cached full-coverage artifacts#1392
hero78119 merged 1 commit into
masterfrom
feat/extract_aot_bb_workload

Conversation

@hero78119

@hero78119 hero78119 commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Problem

Preflight AOT coverage was derived from a bounded execution sample and a fixed set of hot roots. Late control-flow targets could therefore remain uncompiled, while each process repeated training and native compilation even when the program and AOT ABI were unchanged.

Design Rationale

A lightweight coverage tracer now follows the complete training workload and records only control-flow roots. This provides whole-workload basic-block coverage without constructing full preflight RAM and shard state during training.

Compiled artifacts are persisted because complete coverage and native compilation are cold-start costs. Cache identity includes the program digest, AOT ABI, trace style, architecture, and operating system. Metadata and artifact digests reject stale or corrupt entries, and temporary-file replacement prevents partial artifacts from becoming visible.

Coverage is not treated as a correctness assumption. Unseen indirect targets, memory guards, ecalls, and exceptional paths continue in the interpreter. Fallback reasons remain active until execution reaches a compiled block leader, preserving recovery semantics and producing actionable diagnostics.

Change Highlights

  • Replace bounded hot-root sampling with complete, low-overhead control-flow coverage.
  • Load or build persistent preflight AOT artifacts through a versioned cache.
  • Validate cache identity and artifact integrity before loading native code.
  • Classify dynamic-PC, memory-guard, ecall, and exceptional fallbacks.
  • Add tests for late targets, canonical block coverage, cache hits and corruption recovery, unseen indirect targets, and memory-guard recovery.

Benchmark / Performance Impact

Operation

Operation baseline (s) this PR (s) Improvement
End-to-end 67.100 65.800 1.02x faster

Layer

Layer baseline (s) this PR (s) Improvement
Preflight / emulator 6.500 5.510 1.18x faster (15.23% lower)
Application proving 50.700 50.100 1.01x faster
Recursion 9.160 9.420 0.97x
Root verification 0.028 0.028 1.00x

Benchmark command(s):

benchmark-dispatch: mainnet block 23817600

Environment: benchmark-dispatch runner and identical block input; branch-specific artifacts are linked below.

Raw data:

Testing

  • Default and Goldilocks test suites pass in CI.
  • Repository lint checks pass in CI.
  • AOT tests cover full-workload roots, cache reuse, corrupt artifact and metadata rebuilds, runtime ABI offsets, dynamic-target fallback, and memory-guard recovery.

Risks and Rollout

  • No circuit or protocol constraints change. A faulty AOT path can fail preflight or proving, but cannot relax proof constraints.
  • Cached native artifacts increase local disk use; ABI-, program-, trace-, and platform-scoped keys prevent incompatible reuse.
  • Interpreter fallback remains available for workload-dependent control flow. Per-reason fallback counters provide rollout diagnostics.
  • Rollback consists of reverting the AOT cache path and clearing generated cache artifacts if required.

Follow-ups (optional)

  • Add cache retention limits if artifact growth becomes operationally significant.

Copilot Reviewer Directive (keep this section)

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

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.
@hero78119 hero78119 changed the title feat(aot): cache full-coverage preflight artifacts perf(aot): reduce preflight latency with cached full-coverage artifacts Jul 27, 2026
@hero78119
hero78119 merged commit 8f7006e into master Jul 27, 2026
4 of 5 checks passed
@hero78119
hero78119 deleted the feat/extract_aot_bb_workload branch July 27, 2026 06:53
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