Skip to content

perf(akita): optimize native chunk decomposition - #55

Closed
RadNi wants to merge 6 commits into
amir/akita-batchfrom
codex/akita-native-chunk-optimization
Closed

RadNi wants to merge 6 commits into
amir/akita-batchfrom
codex/akita-native-chunk-optimization

Conversation

@RadNi

@RadNi RadNi commented Oct 6, 2026

Copy link
Copy Markdown

Summary

Optimize native trace decomposition across 1, 2, 4, and 8 chunks while preserving the cycle ranges shared by every polynomial. All chunk counts use the same accumulation kernel; there is no single-chunk fast path.

Stacked on #51, with amir/akita-batch as the base branch.

Changes

  • Give each task a contiguous chunk destination and traverse its canonical block range across all columns, eliminating per-contribution chunk routing.
  • Batch row contributions with bounded i16 accumulation, reuse rotation tables, and schedule only chunk ranges intersecting each table batch. Reuse coefficient buffers for one-digit output and parallelize later digit expansion.
  • Extend the materialized witness oracle and fused traversal checks for native chunk geometry, signed coefficient limits, and accumulator flushing.
  • Add a documented lazy-source benchmark example and record comparisons against the saved pre-codex/akita-multi-chunk-on-1948 measurements.

Across 464 configurations covering log2 trace lengths 12–28 and all four chunk counts, all 116 one-chunk timings measured below their saved baselines. The three original D64 regression cases measured 31.4%, 21.2%, and 19.1% faster. At log2 length 28, D128, and 48 columns, the spread across chunk counts was 0.9% for K16 and 0.3% for K256. These are isolated kernel measurements from separate runs; short traces still incur additional witness-output and aggregation costs, and the largest cases use one sample.

Testing

  • Final 15 native kernel/traversal tests passed against the materialized oracle.
  • 22 ordinary Akita prover integration tests and 2 field-inline acceptance cases passed.
  • cargo clippy passed for the workspace with host and host,zk, for all jolt-akita targets, and for jolt-prover with akita, all with warnings denied.
  • cargo fmt --check and git diff --check passed.

Security Considerations

The change preserves native chunk ownership and decomposition outputs. Conservative coefficient bounds flush narrow accumulators before overflow; materialized witness checks cover signed limits, negacyclic wrap, digit expansion, and chunk counts. No protocol relations or proof serialization change.

Breaking Changes

None

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

📏 PR diff

Note

Actual code changed: 1,223 lines

🟢 +817 added    🔴 −406 removed

Tests, docs, fixtures, and helper scripts excluded.

Category 🟢 Added 🔴 Removed
⌨️ Actual code +817 −406
🧪 Tests +80 −60
📚 Docs +76 0
📦 Fixtures 0 0
🔧 Helper scripts 0 0
Total diff +973 −466

Every changed line is classified once.

@github-actions github-actions Bot added spec PR contains a spec implementation PR contains implementation of a spec labels Oct 6, 2026
@RadNi
RadNi force-pushed the amir/akita-batch branch 2 times, most recently from 1ef80d5 to 2e3ed2f Compare October 6, 2026 20:54
0xAndoroid and others added 6 commits October 7, 2026 10:04
…#2008)

* chore(verifier): remove unused openings rand dependency

* refactor(verifier): drop unused audit scope spelling

* docs(lean-gen): remove stale expansion output

* refactor(openings): drop the never-constructed CommitmentMismatch error

No scheme has returned OpeningsError::CommitmentMismatch since the mock opening scheme that produced it was removed in a16z#1654; nothing in the workspace constructs or matches it.

* chore(dory): drop the stale cargo-machete ignore

rand_core and rand_chacha are imported by the dory bench and commit_open_verify test, so cargo machete --with-metadata sees them as used without the exception.
)

* refactor(tracer): remove dead emulator internals and commented code

* chore(tracer): remove unused inline test support

* refactor(tracer): remove uncalled tracer APIs

* refactor(tracer): delete the never-read Cpu::_dump_flag field

* refactor(tracer): inline the identity normalize_u64 helper

* chore(tracer): drop the stale dead-code allowance on get_register_name

* docs(tracer): fix stale emulator doc references

* docs(jolt-riscv): name jolt_instruction! as the Flags impl generator
…2009)

* refactor(kernels): delete unused fixed-array Lagrange helpers

LagrangeHelper, LagrangePolynomial, and the three centered_* forwarding
wrappers over them had no callers anywhere in the workspace.

* refactor(kernels): remove test-only Lagrange convenience APIs

centered_lagrange_evals_array and symmetric_power_sums were only called
from their own unit tests; production uses centered_lagrange_evals and
centered_power_sums, which keep their coverage.

* refactor(kernels): delete unused committed-bytecode helper exports

committed_total_lanes and bytecode_chunk_ids were defined but never
called; the lane layout and chunk claims are built elsewhere.

* refactor(kernels): delete unused drop_in_background_thread

The background-drop wrapper had no callers; jolt-utils' thread module now
documents only the parallel collectors it still provides.

* refactor(kernels): delete definition-only Limbs and Polynomial accessors

Limbs::zero_extend_from and Polynomial::evaluations_mut had no callers in
the workspace, including tests, fuzz targets, and benches.

* chore(kernels): drop duplicate jolt-riscv dev-dependency

The normal dependency already declares jolt-riscv with the same
serialization feature, and tests inherit it.

* refactor(kernels): delete unused EqPolynomial::zero_selector

No caller remains in the workspace; its only test restated the product
formula as its own oracle.

* refactor(kernels): delete unused UnivariatePoly::from_linear_times_quadratic_with_hint

No workspace code has called it since jolt-poly was created;
jolt-prover-legacy carried a separate UniPoly copy. The split-eq
evaluator builds the same cubic through
GruenSplitEqPolynomial::gruen_poly_deg_3, so the "used by the split-eq
evaluator" doc was stale.

* refactor(kernels): delete unused UnivariatePoly long division

divide_with_remainder, and leading_coefficient (called only by it), have
never had a workspace caller outside their own unit tests;
jolt-prover-legacy carried a separate UniPoly copy.

* refactor(kernels): delete unused NUM_PREFIXES and NUM_SUFFIXES

Neither constant is referenced anywhere in the workspace; checkpoint
tables are sized from ALL_PREFIXES.

* docs(kernels): fix the lagrange module's field bound link

The functions are generic over Field; the JoltField intra-doc link did
not resolve in that module.
…#2005)

Replace the reduce-once Ext2 forms, which summed three products per c0,
with forms that reduce each coefficient's two products once:
c0 = a0 b0 + (2 a1) b1, c1 = a0 b1 + a1 b0. In a paired A/B on an M5 Max
the reduce-once forms were 7.5-9.2% slower on both chains and the square;
the two-product square beats the generic one by 8.2%.

Drop the spec's A/B numbers from the unmerged fp64-ext2-ab branch and the
development history in the test section; size SPELLING_CAPACITY to the
longest real spelling.
…cality (a16z#2012)

* chore(akita): bump dependency to e2c49ed

* Replace packed Akita trace with fused native column batching

* Restrict Akita catalogs to production shapes and explicit fixtures

* chore(akita): pin merged native batching revision

* fix(ci): test generated projects against checked-out SDK

* refactor(akita): pass the fixed fold chunk directly

* fix(akita): preserve K16 batch coverage through 2^30 cycles

* fix(akita): enforce trace mask capacity and prune K256 catalogs

* docs: specify native Akita trace batching and cycle chunk locality

* fix(akita): clarify batching scope and K256 support policy

* fix(akita): address native batching review follow-ups

* fix(akita): close remaining review gaps

* docs(akita): measure native batching PR performance

* fix(akita): preserve merged planner coverage and fork CI after rebase

* test(verifier): refresh inventory for rebased Spartan and HyperKZG sources

* refactor(akita): make streamed trace openings batch-only

* refactor(akita): finish naming and comment cleanup

* docs(akita): clarify digit zero and measured regressions

* test(akita): reject swapped streamed trace evaluations

* ci(akita): bound chunked field-inline provisioning coverage

* feat(profiling): select Akita chunk profiles through the CLI

* fix(profiling): distinguish Akita chunk profile results

* refactor(akita): split trace read contract tests

* chore(akita): bump pin to d98400c and regenerate schedules (a16z#2016)

* refactor(akita): remove unused trace opening fold

* ci(profiling): run chunk profile regression tests

---------

Co-authored-by: RadNi <khajepour.amirhossein@gmail.com>
@RadNi
RadNi force-pushed the codex/akita-native-chunk-optimization branch from e461893 to 635bace Compare October 7, 2026 21:41
@RadNi RadNi closed this Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

implementation PR contains implementation of a spec spec PR contains a spec

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants